Change CROSSCOMPILE flag to NO_NATIVE_OPTIMIZATION (#3279)
* Change CROSSCOMPILE flag to NOMARCHNATIVE. The old name was confusing, the new name describes exactly what it does. This fixes issue #3272 * Break configuration when using CROSSCOMPILE. This stops any old build scripts from producing broken builds. * Use NO_NATIVE_OPTIMIZATION rather than NOMARCHNATIVE. Addresses @madmaxoft's concerns.
This commit is contained in:
parent
62702cab48
commit
9e52982f0e
@ -5,7 +5,7 @@
|
|||||||
# This script supports some configuration through CMake arguments (-Dparam=val syntax):
|
# 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_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)
|
# BUILD_UNSTABLE_TOOLS=1 sets up yet more executables to be built, these can be broken and generally are obsolete (GeneratorPerformanceTest)
|
||||||
# CROSSCOMPILE=1 marks the build as a crosscompile (doesn't include optimizations for current platform)
|
# 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
|
# 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
|
# SELF_TEST=1 enables testing code to be built
|
||||||
|
|
||||||
@ -118,16 +118,10 @@ if (NOT(DISABLE_SYSTEM_LUA))
|
|||||||
message(STATUS "Lua 5.1 has been found in your system and will be used for the build.")
|
message(STATUS "Lua 5.1 has been found in your system and will be used for the build.")
|
||||||
set(USE_SYSTEM_LUA 1)
|
set(USE_SYSTEM_LUA 1)
|
||||||
else()
|
else()
|
||||||
if (CROSSCOMPILE)
|
|
||||||
message(FATAL "To crosscompile, you need to have Lua 5.1 installed in your system and available in PATH.")
|
|
||||||
endif()
|
|
||||||
message(STATUS "Lua 5.1 has NOT been found in your system, the build will use its own Lua implementation.")
|
message(STATUS "Lua 5.1 has NOT been found in your system, the build will use its own Lua implementation.")
|
||||||
unset(USE_SYSTEM_LUA)
|
unset(USE_SYSTEM_LUA)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
if (CROSSCOMPILE)
|
|
||||||
message(FATAL "CMake parameter mismatch: CROSSCOMPILE is mutually exclusive with DISABLE_SYSTEM_LUA")
|
|
||||||
endif()
|
|
||||||
message(STATUS "System Lua is disabled via CMake command-line parameters. The build will use its own Lua implementation.")
|
message(STATUS "System Lua is disabled via CMake command-line parameters. The build will use its own Lua implementation.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
12
COMPILING.md
12
COMPILING.md
@ -142,16 +142,14 @@ This is useful if you want to compile Cuberite on an x64 (64-bit Intel) machine
|
|||||||
|
|
||||||
to your cmake command and 32 bit will be forced.
|
to your cmake command and 32 bit will be forced.
|
||||||
|
|
||||||
### Compiling for another computer ###
|
### Compiling for another computer of the same architecture ###
|
||||||
|
|
||||||
When cross-compiling for another computer it is important to set cross compiling mode. This tells the compiler not to optimise for your machine. This switch can be used with debug or release mode. To enable, simply add:
|
When cross-compiling for another computer of the same architecture it is important to set the NO_NATIVE_OPTIMIZATION flag. This tells the compiler not to optimise for your machine. This switch can be used with debug or release mode. To enable, simply add:
|
||||||
|
|
||||||
-DCROSSCOMPILE=1
|
-DNO_NATIVE_OPTIMIZATION=1
|
||||||
|
|
||||||
to your cmake command.
|
to your cmake command.
|
||||||
|
|
||||||
Note that real cross-compilation is hard at this moment, because an executable generated during the build process is required for later stages, so if your computer cannot run executables it generates the build will not work.
|
|
||||||
|
|
||||||
### List of all build flags ###
|
### List of all build flags ###
|
||||||
|
|
||||||
Cuberite's build process supports a large number of flags for customising the builds. Use these flags by adding `-DFlag_name=Value` to the cmake configuration command. For example to enable test generation using the `SELF_TEST` flag add: `-DSELF_TEST=ON`
|
Cuberite's build process supports a large number of flags for customising the builds. Use these flags by adding `-DFlag_name=Value` to the cmake configuration command. For example to enable test generation using the `SELF_TEST` flag add: `-DSELF_TEST=ON`
|
||||||
@ -168,7 +166,5 @@ Enables generation of tests and self-test startup code. Tests can be run with ct
|
|||||||
###### FORCE_32
|
###### FORCE_32
|
||||||
Forces the build to use 32 bit builds on *nix systems. Define as ON to enable. Define as OFF to disable.
|
Forces the build to use 32 bit builds on *nix systems. Define as ON to enable. Define as OFF to disable.
|
||||||
|
|
||||||
###### CROSSCOMPILE
|
###### NO_NATIVE_OPTIMIZATION
|
||||||
Disables optimizations for the build host. This is important when building on a different machine from the one you will run Cuberite on as the build machine may support instructions the final machine does not. This flag only has any effect on linux. Define as ON to enable. Define as OFF to disable.
|
Disables optimizations for the build host. This is important when building on a different machine from the one you will run Cuberite on as the build machine may support instructions the final machine does not. This flag only has any effect on linux. Define as ON to enable. Define as OFF to disable.
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,10 +124,14 @@ macro(set_flags)
|
|||||||
|
|
||||||
|
|
||||||
# Have the compiler generate code specifically targeted at the current machine on Linux
|
# Have the compiler generate code specifically targeted at the current machine on Linux
|
||||||
if(LINUX AND NOT CROSSCOMPILE)
|
if(LINUX AND NOT NO_NATIVE_OPTIMIZATION)
|
||||||
add_flags_cxx("-march=native")
|
add_flags_cxx("-march=native")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CROSSCOMPILE)
|
||||||
|
message(FATAL_ERROR "The CROSSCOMPILE flag has been renamed to NO_NATIVE_OPTIMIZATION. Please update your build scripts to compile Cuberite.")
|
||||||
|
endif()
|
||||||
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
get_clang_version()
|
get_clang_version()
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user