1
0
Fork 0

Address comments

This commit is contained in:
Tiger Wang 2020-07-07 00:04:32 +01:00
parent 2c0fc395ba
commit 4f85931c42
9 changed files with 41 additions and 34 deletions

View File

@ -60,6 +60,11 @@ jobs:
before_install: *use-cmake before_install: *use-cmake
env: *Debug env: *Debug
# Do not let CMake find ccache wrappers
# we use CMAKE_CXX_COMPILER_LAUNCHER for ccache support
before_script:
- export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/lib\/ccache//')
# Run the build and tests # Run the build and tests
script: ./travisbuild.sh script: ./travisbuild.sh

View File

@ -1,4 +1,4 @@
function(build_dependencies TARGET) function(build_dependencies)
# Set options for SQLiteCpp, disable all their tests and lints: # Set options for SQLiteCpp, disable all their tests and lints:
set(SQLITECPP_RUN_CPPLINT OFF CACHE BOOL "Run cpplint.py tool for Google C++ StyleGuide.") set(SQLITECPP_RUN_CPPLINT OFF CACHE BOOL "Run cpplint.py tool for Google C++ StyleGuide.")
set(SQLITECPP_RUN_CPPCHECK OFF CACHE BOOL "Run cppcheck C++ static analysis tool.") set(SQLITECPP_RUN_CPPCHECK OFF CACHE BOOL "Run cppcheck C++ static analysis tool.")
@ -40,6 +40,12 @@ function(build_dependencies TARGET)
add_subdirectory("lib/${DEPENDENCY}" EXCLUDE_FROM_ALL) add_subdirectory("lib/${DEPENDENCY}" EXCLUDE_FROM_ALL)
endforeach() endforeach()
if (WIN32)
add_subdirectory(lib/luaproxy)
endif()
endfunction()
function(link_dependencies TARGET)
# Add required includes: # Add required includes:
target_include_directories( target_include_directories(
${TARGET} SYSTEM PRIVATE ${TARGET} SYSTEM PRIVATE
@ -76,8 +82,4 @@ function(build_dependencies TARGET)
# Prettify jsoncpp_lib name in VS solution explorer: # Prettify jsoncpp_lib name in VS solution explorer:
set_property(TARGET jsoncpp_lib PROPERTY PROJECT_LABEL "jsoncpp") set_property(TARGET jsoncpp_lib PROPERTY PROJECT_LABEL "jsoncpp")
if (WIN32)
add_subdirectory(lib/luaproxy)
endif()
endfunction() endfunction()

View File

@ -37,9 +37,6 @@ include("SetFlags.cmake")
# Add build timestamp and details: # Add build timestamp and details:
include("CMake/StampBuild.cmake") include("CMake/StampBuild.cmake")
# TODO: set_build_stamp()
set_global_flags()
# We need C++17 features: # We need C++17 features:
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -55,11 +52,15 @@ endif()
# Static CRT: # Static CRT:
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# TODO: set_build_stamp()
set_global_flags()
build_dependencies()
add_executable(${CMAKE_PROJECT_NAME}) add_executable(${CMAKE_PROJECT_NAME})
add_subdirectory(src) add_subdirectory(src)
enable_warnings(${CMAKE_PROJECT_NAME}) set_exe_flags(${CMAKE_PROJECT_NAME})
build_dependencies(${CMAKE_PROJECT_NAME}) link_dependencies(${CMAKE_PROJECT_NAME})
# Set the startup project to Cuberite, and the debugger dir: # Set the startup project to Cuberite, and the debugger dir:
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${CMAKE_PROJECT_NAME}) set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${CMAKE_PROJECT_NAME})

View File

@ -111,7 +111,7 @@ function(set_global_flags)
endif() endif()
endfunction() endfunction()
function(enable_warnings TARGET) function(set_exe_flags TARGET)
if (MSVC) if (MSVC)
# TODO: MSVC level 4, warnings as errors # TODO: MSVC level 4, warnings as errors
return () return ()
@ -129,14 +129,6 @@ function(enable_warnings TARGET)
# All warnings: # All warnings:
-Wall -Wextra -Wall -Wextra
# TODO: actually fix the warnings instead of disabling them
# or at least disable on a file-level basis:
-Wno-unused-parameter -Wno-missing-noreturn -Wno-padded -Wno-implicit-fallthrough
-Wno-double-promotion
# This is a pretty useless warning, we've already got -Wswitch which is what we need:
-Wno-switch-enum
) )
if(CMAKE_CXX_COMPILE_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILE_ID STREQUAL "Clang")
@ -146,6 +138,14 @@ function(enable_warnings TARGET)
# Warnings-as-errors only on Clang for now: # Warnings-as-errors only on Clang for now:
-Werror -Werror
# TODO: actually fix the warnings instead of disabling them
# or at least disable on a file-level basis:
-Wno-unused-parameter -Wno-missing-noreturn -Wno-padded -Wno-implicit-fallthrough
-Wno-double-promotion
# This is a pretty useless warning, we've already got -Wswitch which is what we need:
-Wno-switch-enum
# Weverything with Clang exceptions: # Weverything with Clang exceptions:
-Weverything -Wno-error=disabled-macro-expansion -Wno-weak-vtables -Weverything -Wno-error=disabled-macro-expansion -Wno-weak-vtables
-Wno-exit-time-destructors -Wno-string-conversion -Wno-c++98-compat-pedantic -Wno-exit-time-destructors -Wno-string-conversion -Wno-c++98-compat-pedantic

View File

@ -1,7 +1,5 @@
project (AnvilStats) project (AnvilStats)
include(../../SetFlags.cmake)
# Set include paths to the used libraries: # Set include paths to the used libraries:
include_directories("../../lib") include_directories("../../lib")
include_directories("../../src") include_directories("../../src")
@ -107,9 +105,11 @@ add_executable(AnvilStats
${SHARED_OSS_HDR} ${SHARED_OSS_HDR}
) )
target_link_libraries(AnvilStats zlib) target_link_libraries(AnvilStats zlib)
include(../../SetFlags.cmake)
set_exe_flags(AnvilStats)
@ -128,6 +128,3 @@ if (MSVC)
SET(TEMP "${TEMP}/STACK:16777216") SET(TEMP "${TEMP}/STACK:16777216")
set_target_properties(AnvilStats PROPERTIES LINK_FLAGS ${TEMP}) set_target_properties(AnvilStats PROPERTIES LINK_FLAGS ${TEMP})
endif () endif ()

View File

@ -1,8 +1,6 @@
project (GrownBiomeGenVisualiser) project (GrownBiomeGenVisualiser)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
include(../../SetFlags.cmake)
# Set include paths to the used libraries: # Set include paths to the used libraries:
include_directories(SYSTEM "../../lib") include_directories(SYSTEM "../../lib")
include_directories("../../src") include_directories("../../src")
@ -80,5 +78,7 @@ add_executable(GrownBiomeGenVisualiser
) )
target_link_libraries(GrownBiomeGenVisualiser fmt::fmt Threads::Threads) target_link_libraries(GrownBiomeGenVisualiser fmt::fmt Threads::Threads)
set_target_properties(GrownBiomeGenVisualiser PROPERTIES FOLDER Tools) set_target_properties(GrownBiomeGenVisualiser PROPERTIES FOLDER Tools)
include(../../SetFlags.cmake)
set_exe_flags(GrownBiomeGenVisualiser)

View File

@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.13)
project (MCADefrag) project (MCADefrag)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
include(../../SetFlags.cmake)
# Set include paths to the used libraries: # Set include paths to the used libraries:
include_directories(SYSTEM "../../lib") include_directories(SYSTEM "../../lib")
include_directories("../../src") include_directories("../../src")
@ -87,3 +85,6 @@ add_executable(MCADefrag
) )
target_link_libraries(MCADefrag zlib fmt::fmt Threads::Threads) target_link_libraries(MCADefrag zlib fmt::fmt Threads::Threads)
include(../../SetFlags.cmake)
set_exe_flags(MCADefrag)

View File

@ -1,7 +1,5 @@
project (NoiseSpeedTest) project (NoiseSpeedTest)
include(../../SetFlags.cmake)
# Set include paths to the used libraries: # Set include paths to the used libraries:
include_directories(SYSTEM "../../lib") include_directories(SYSTEM "../../lib")
include_directories("../../src") include_directories("../../src")
@ -61,3 +59,6 @@ set_target_properties(
NoiseSpeedTest NoiseSpeedTest
PROPERTIES FOLDER Tools PROPERTIES FOLDER Tools
) )
include(../../SetFlags.cmake)
set_exe_flags(NoiseSpeedTest)

View File

@ -1,8 +1,6 @@
project (ProtoProxy) project (ProtoProxy)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
include(../../SetFlags.cmake)
# Set include paths to the used libraries: # Set include paths to the used libraries:
include_directories(SYSTEM "../../lib") include_directories(SYSTEM "../../lib")
include_directories(SYSTEM "../../lib/mbedtls/include") include_directories(SYSTEM "../../lib/mbedtls/include")
@ -96,3 +94,5 @@ add_executable(ProtoProxy
target_link_libraries(ProtoProxy zlib mbedtls fmt::fmt Threads::Threads) target_link_libraries(ProtoProxy zlib mbedtls fmt::fmt Threads::Threads)
include(../../SetFlags.cmake)
set_exe_flags(ProtoProxy)