summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-07-07 01:04:32 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-07-12 23:00:07 +0200
commit4f85931c42ce4aad454a1dbf38a6f0565822056d (patch)
tree558b05e353d1b6984d6c9fd4fed80c6bc18fc56b
parentFunktions (diff)
downloadcuberite-4f85931c42ce4aad454a1dbf38a6f0565822056d.tar
cuberite-4f85931c42ce4aad454a1dbf38a6f0565822056d.tar.gz
cuberite-4f85931c42ce4aad454a1dbf38a6f0565822056d.tar.bz2
cuberite-4f85931c42ce4aad454a1dbf38a6f0565822056d.tar.lz
cuberite-4f85931c42ce4aad454a1dbf38a6f0565822056d.tar.xz
cuberite-4f85931c42ce4aad454a1dbf38a6f0565822056d.tar.zst
cuberite-4f85931c42ce4aad454a1dbf38a6f0565822056d.zip
-rw-r--r--.travis.yml5
-rw-r--r--CMake/AddDependencies.cmake12
-rw-r--r--CMakeLists.txt11
-rw-r--r--SetFlags.cmake18
-rw-r--r--Tools/AnvilStats/CMakeLists.txt9
-rw-r--r--Tools/GrownBiomeGenVisualiser/CMakeLists.txt6
-rw-r--r--Tools/MCADefrag/CMakeLists.txt5
-rw-r--r--Tools/NoiseSpeedTest/CMakeLists.txt5
-rw-r--r--Tools/ProtoProxy/CMakeLists.txt4
9 files changed, 41 insertions, 34 deletions
diff --git a/.travis.yml b/.travis.yml
index 79e51593a..f57727eca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -60,6 +60,11 @@ jobs:
before_install: *use-cmake
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
script: ./travisbuild.sh
diff --git a/CMake/AddDependencies.cmake b/CMake/AddDependencies.cmake
index ecf18dd27..5173e4487 100644
--- a/CMake/AddDependencies.cmake
+++ b/CMake/AddDependencies.cmake
@@ -1,4 +1,4 @@
-function(build_dependencies TARGET)
+function(build_dependencies)
# 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_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)
endforeach()
+ if (WIN32)
+ add_subdirectory(lib/luaproxy)
+ endif()
+endfunction()
+
+function(link_dependencies TARGET)
# Add required includes:
target_include_directories(
${TARGET} SYSTEM PRIVATE
@@ -76,8 +82,4 @@ function(build_dependencies TARGET)
# Prettify jsoncpp_lib name in VS solution explorer:
set_property(TARGET jsoncpp_lib PROPERTY PROJECT_LABEL "jsoncpp")
-
- if (WIN32)
- add_subdirectory(lib/luaproxy)
- endif()
endfunction()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9931176fe..077a411a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,9 +37,6 @@ include("SetFlags.cmake")
# Add build timestamp and details:
include("CMake/StampBuild.cmake")
-# TODO: set_build_stamp()
-set_global_flags()
-
# We need C++17 features:
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -55,11 +52,15 @@ endif()
# Static CRT:
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+# TODO: set_build_stamp()
+set_global_flags()
+build_dependencies()
+
add_executable(${CMAKE_PROJECT_NAME})
add_subdirectory(src)
-enable_warnings(${CMAKE_PROJECT_NAME})
-build_dependencies(${CMAKE_PROJECT_NAME})
+set_exe_flags(${CMAKE_PROJECT_NAME})
+link_dependencies(${CMAKE_PROJECT_NAME})
# Set the startup project to Cuberite, and the debugger dir:
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${CMAKE_PROJECT_NAME})
diff --git a/SetFlags.cmake b/SetFlags.cmake
index d203c5d95..9c635b5fd 100644
--- a/SetFlags.cmake
+++ b/SetFlags.cmake
@@ -111,7 +111,7 @@ function(set_global_flags)
endif()
endfunction()
-function(enable_warnings TARGET)
+function(set_exe_flags TARGET)
if (MSVC)
# TODO: MSVC level 4, warnings as errors
return ()
@@ -129,14 +129,6 @@ function(enable_warnings TARGET)
# All warnings:
-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")
@@ -146,6 +138,14 @@ function(enable_warnings TARGET)
# Warnings-as-errors only on Clang for now:
-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 -Wno-error=disabled-macro-expansion -Wno-weak-vtables
-Wno-exit-time-destructors -Wno-string-conversion -Wno-c++98-compat-pedantic
diff --git a/Tools/AnvilStats/CMakeLists.txt b/Tools/AnvilStats/CMakeLists.txt
index a5cf4b9e7..760bc0063 100644
--- a/Tools/AnvilStats/CMakeLists.txt
+++ b/Tools/AnvilStats/CMakeLists.txt
@@ -1,7 +1,5 @@
project (AnvilStats)
-include(../../SetFlags.cmake)
-
# Set include paths to the used libraries:
include_directories("../../lib")
include_directories("../../src")
@@ -107,9 +105,11 @@ add_executable(AnvilStats
${SHARED_OSS_HDR}
)
-
target_link_libraries(AnvilStats zlib)
+include(../../SetFlags.cmake)
+set_exe_flags(AnvilStats)
+
@@ -128,6 +128,3 @@ if (MSVC)
SET(TEMP "${TEMP}/STACK:16777216")
set_target_properties(AnvilStats PROPERTIES LINK_FLAGS ${TEMP})
endif ()
-
-
-
diff --git a/Tools/GrownBiomeGenVisualiser/CMakeLists.txt b/Tools/GrownBiomeGenVisualiser/CMakeLists.txt
index ed8cd5d1d..37862e8c4 100644
--- a/Tools/GrownBiomeGenVisualiser/CMakeLists.txt
+++ b/Tools/GrownBiomeGenVisualiser/CMakeLists.txt
@@ -1,8 +1,6 @@
project (GrownBiomeGenVisualiser)
find_package(Threads REQUIRED)
-include(../../SetFlags.cmake)
-
# Set include paths to the used libraries:
include_directories(SYSTEM "../../lib")
include_directories("../../src")
@@ -80,5 +78,7 @@ add_executable(GrownBiomeGenVisualiser
)
target_link_libraries(GrownBiomeGenVisualiser fmt::fmt Threads::Threads)
-
set_target_properties(GrownBiomeGenVisualiser PROPERTIES FOLDER Tools)
+
+include(../../SetFlags.cmake)
+set_exe_flags(GrownBiomeGenVisualiser)
diff --git a/Tools/MCADefrag/CMakeLists.txt b/Tools/MCADefrag/CMakeLists.txt
index b093a759b..6ad894390 100644
--- a/Tools/MCADefrag/CMakeLists.txt
+++ b/Tools/MCADefrag/CMakeLists.txt
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.13)
project (MCADefrag)
find_package(Threads REQUIRED)
-include(../../SetFlags.cmake)
-
# Set include paths to the used libraries:
include_directories(SYSTEM "../../lib")
include_directories("../../src")
@@ -87,3 +85,6 @@ add_executable(MCADefrag
)
target_link_libraries(MCADefrag zlib fmt::fmt Threads::Threads)
+
+include(../../SetFlags.cmake)
+set_exe_flags(MCADefrag)
diff --git a/Tools/NoiseSpeedTest/CMakeLists.txt b/Tools/NoiseSpeedTest/CMakeLists.txt
index f207cead3..9488fdca0 100644
--- a/Tools/NoiseSpeedTest/CMakeLists.txt
+++ b/Tools/NoiseSpeedTest/CMakeLists.txt
@@ -1,7 +1,5 @@
project (NoiseSpeedTest)
-include(../../SetFlags.cmake)
-
# Set include paths to the used libraries:
include_directories(SYSTEM "../../lib")
include_directories("../../src")
@@ -61,3 +59,6 @@ set_target_properties(
NoiseSpeedTest
PROPERTIES FOLDER Tools
)
+
+include(../../SetFlags.cmake)
+set_exe_flags(NoiseSpeedTest)
diff --git a/Tools/ProtoProxy/CMakeLists.txt b/Tools/ProtoProxy/CMakeLists.txt
index 8f3228a47..90258f64f 100644
--- a/Tools/ProtoProxy/CMakeLists.txt
+++ b/Tools/ProtoProxy/CMakeLists.txt
@@ -1,8 +1,6 @@
project (ProtoProxy)
find_package(Threads REQUIRED)
-include(../../SetFlags.cmake)
-
# Set include paths to the used libraries:
include_directories(SYSTEM "../../lib")
include_directories(SYSTEM "../../lib/mbedtls/include")
@@ -96,3 +94,5 @@ add_executable(ProtoProxy
target_link_libraries(ProtoProxy zlib mbedtls fmt::fmt Threads::Threads)
+include(../../SetFlags.cmake)
+set_exe_flags(ProtoProxy)