summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt30
-rw-r--r--SetFlags.cmake13
-rw-r--r--src/CMakeLists.txt4
3 files changed, 22 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1204b8bf..b3ac53a4c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,20 +1,6 @@
# This is the top-level CMakeLists.txt file for the Cuberite project
#
# Use CMake to generate the build files for your platform
-#
-# This script supports some configuration through CMake arguments (-Dparam=val syntax):
-# BUILD_TOOLS=1 sets up additional executables to be built along with the server (ProtoProxy, GrownBiomeGenVisualiser, MCADefrag)
-# BUILD_UNSTABLE_TOOLS=1 sets up yet more executables to be built, these can be broken and generally are obsolete (GeneratorPerformanceTest)
-# NO_NATIVE_OPTIMIZATION=1 disables CPU-specific optimisations for the current machine, allows use on other CPUs of the same platform
-# DISABLE_SYSTEM_LUA=1 disables the use of system Lua interpreter; the tolua executable will be built and used instead. Incompatible with cross-compiling
-# SELF_TEST=1 enables testing code to be built
-# UNITY_BUILDS=OFF disables unity builds
-# PRECOMPILE_HEADERS=OFF disables precompiled headers
-# WHOLE_PROGRAM_OPTIMISATION=OFF disables link time optimisation
-
-
-
-
cmake_minimum_required (VERSION 3.13)
cmake_policy(VERSION 3.13...3.17.2)
@@ -26,10 +12,12 @@ project(
)
option(BUILD_TOOLS "Sets up additional executables to be built along with the server" OFF)
-option(WHOLE_PROGRAM_OPTIMISATION "Enables link time optimisation for Release" ON)
+option(BUILD_UNSTABLE_TOOLS "Sets up yet more executables to be built, these can be broken and generally are obsolete" OFF)
+option(NO_NATIVE_OPTIMIZATION "Disables CPU-specific optimisations for the current machine, allows use on other CPUs of the same platform" OFF)
option(PRECOMPILE_HEADERS "Enable precompiled headers for faster builds" ON)
option(SELF_TEST "Enables testing code to be built" OFF)
option(UNITY_BUILDS "Enables source aggregation for faster builds" ON)
+option(WHOLE_PROGRAM_OPTIMISATION "Enables link time optimisation for Release" ON)
include("CMake/AddDependencies.cmake")
include("CMake/Fixups.cmake")
@@ -91,22 +79,22 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set_source_files_properties("${PROJECT_SOURCE_DIR}/src/Bindings/Bindings.cpp" PROPERTIES COMPILE_OPTIONS -w)
endif()
-if(${BUILD_TOOLS})
- message("Building tools")
+if(BUILD_TOOLS)
+ message(STATUS "Building tools")
add_subdirectory(Tools/GrownBiomeGenVisualiser/)
add_subdirectory(Tools/MCADefrag/)
add_subdirectory(Tools/NoiseSpeedTest/)
add_subdirectory(Tools/ProtoProxy/)
endif()
-if(${BUILD_UNSTABLE_TOOLS})
- message("Building unstable tools")
+if(BUILD_UNSTABLE_TOOLS)
+ message(STATUS "Building unstable tools")
add_subdirectory(Tools/GeneratorPerformanceTest/)
endif()
# Self Test Mode enables extra checks at startup
-if(${SELF_TEST})
- message("Tests enabled")
+if(SELF_TEST)
+ message(STATUS "Tests enabled")
enable_testing()
add_subdirectory(tests)
endif()
diff --git a/SetFlags.cmake b/SetFlags.cmake
index 4ef8ecd2a..d3a7801ee 100644
--- a/SetFlags.cmake
+++ b/SetFlags.cmake
@@ -96,9 +96,18 @@ function(set_global_flags)
add_link_options(-m32)
endif()
+ # https://en.wikipedia.org/wiki/Uname
+ # https://gcc.gnu.org/onlinedocs/gcc/index.html
# Have the compiler generate code specifically targeted at the current machine on Linux:
- if(LINUX AND NOT NO_NATIVE_OPTIMIZATION)
- add_compile_options(-march=native)
+ if(UNIX AND NOT NO_NATIVE_OPTIMIZATION AND NOT CMAKE_CROSSCOMPILING)
+ string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR)
+ if (SYSTEM_PROCESSOR MATCHES "^(i386|i686|x86|amd64|mips)")
+ message(STATUS "Optimising for this machine (march=native)")
+ add_compile_options(-march=native)
+ elseif (SYSTEM_PROCESSOR MATCHES "^(arm|aarch|powerpc|ppc|sparc|alpha)")
+ message(STATUS "Optimising for this machine (mcpu=native)")
+ add_compile_options(-mcpu=native)
+ endif()
endif()
endfunction()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 02c372a1f..0a3332caa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -210,7 +210,7 @@ function(make_symlink orig link)
endif()
# Create the symlink (platform-dependent):
- message("Creating symlink, orig = ${orig}; link = ${link}")
+ message(STATUS "Creating symlink, orig = ${orig}; link = ${link}")
if (CMAKE_HOST_UNIX)
set(command ln -s ${orig} ${link})
else()
@@ -254,7 +254,7 @@ set(symlinks
monsters.ini
README.txt
)
-message("Creating output folder and symlinks...")
+message(STATUS "Creating output folder and symlinks...")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/Server")
foreach (symlink ${symlinks})
make_symlink("${CMAKE_CURRENT_SOURCE_DIR}/../Server/${symlink}" "${CMAKE_BINARY_DIR}/Server/${symlink}")