diff --git a/CMakeLists.txt b/CMakeLists.txt index cabf86fd05..b02203e4f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,8 +85,7 @@ if (Daemon_OUT) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Daemon_OUT}) endif() -include(DaemonBuildInfo) -include(DaemonPlatform) +include(DaemonPlatform/Platform) ################################################################################ # Configuration options diff --git a/cmake/DaemonCompiler/DaemonCompiler.cpp b/cmake/DaemonCompiler/DaemonCompiler.cpp deleted file mode 100644 index 4b3d5f846a..0000000000 --- a/cmake/DaemonCompiler/DaemonCompiler.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "DaemonCompiler.c" diff --git a/cmake/DaemonFlags.cmake b/cmake/DaemonFlags.cmake index 036c32fbe9..e755c59643 100644 --- a/cmake/DaemonFlags.cmake +++ b/cmake/DaemonFlags.cmake @@ -396,7 +396,7 @@ else() try_c_cxx_flag(FNO_STRICT_OVERFLOW "-fno-strict-overflow") try_c_cxx_flag(WSTACK_PROTECTOR "-Wstack-protector") - if (NOT NACL OR (NACL AND GAME_PIE)) + if (NOT NACL OR (NACL AND NACL_PIE)) # The -pie flag requires -fPIC: # > ld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC # This flag isn't used on macOS: diff --git a/cmake/DaemonGame.cmake b/cmake/DaemonGame.cmake index 596b47361f..0c4eee3495 100644 --- a/cmake/DaemonGame.cmake +++ b/cmake/DaemonGame.cmake @@ -39,8 +39,9 @@ option(BUILD_GAME_NATIVE_DLL "Build the shared library files, mostly useful for option(BUILD_GAME_NATIVE_EXE "Build native executable, which might be used for better performances by server owners" OFF) include(ExternalProject) -include(DaemonBuildInfo) -include(DaemonPlatform) +include(DaemonPlatform/Platform) +# TODO: Delete when Game uses NACL_PIE instead of GAME_PIE. +set(GAME_PIE ${NACL_PIE}) # Do not report unused native compiler if native vms are not built. # If only NACL vms are built, this will be reported in chainloaded build. diff --git a/cmake/DaemonArchitecture.cmake b/cmake/DaemonPlatform/Architecture.cmake similarity index 95% rename from cmake/DaemonArchitecture.cmake rename to cmake/DaemonPlatform/Architecture.cmake index cbf0033b0b..c2abd5b80c 100644 --- a/cmake/DaemonArchitecture.cmake +++ b/cmake/DaemonPlatform/Architecture.cmake @@ -32,7 +32,7 @@ try_compile(BUILD_RESULT "${CMAKE_BINARY_DIR}" - "${DAEMON_DIR}/cmake/DaemonArchitecture/DaemonArchitecture.cpp" + "${CMAKE_CURRENT_LIST_DIR}/Architecture/Architecture.cpp" CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} OUTPUT_VARIABLE BUILD_LOG ) @@ -46,7 +46,7 @@ try_compile(BUILD_RESULT # Setting USE_WERROR to ON doesn't print this warning. if (NOT BUILD_RESULT) message(WARNING - "Failed to build DaemonArchitecture.cpp\n" + "Failed to build Architecture.cpp\n" "Setting -Werror in CXXFLAGS can produce false positive errors\n" "${BUILD_LOG}" ) @@ -57,7 +57,7 @@ string(REPLACE "DAEMON_ARCH_" "" ARCH "${ARCH_DEFINE}") if (NOT ARCH) message(FATAL_ERROR - "Missing DAEMON_ARCH, there is a mistake in DaemonArchitecture.cpp\n" + "Missing DAEMON_ARCH, there is a mistake in Architecture.cpp\n" "${BUILD_LOG}" ) elseif(ARCH STREQUAL "unsupported") diff --git a/cmake/DaemonArchitecture/DaemonArchitecture.cpp b/cmake/DaemonPlatform/Architecture/Architecture.cpp similarity index 92% rename from cmake/DaemonArchitecture/DaemonArchitecture.cpp rename to cmake/DaemonPlatform/Architecture/Architecture.cpp index b201f4a6be..fc595fb2e5 100644 --- a/cmake/DaemonArchitecture/DaemonArchitecture.cpp +++ b/cmake/DaemonPlatform/Architecture/Architecture.cpp @@ -32,17 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. platforms including ppc64, but we know how to do it for them. */ #include -#include "../../src/common/Endian.h" - -/* qprocessordetection.h will print an error if it fails to detect -endianness and while it is not already set, so the else clause is -outsourced to that qprocessordetection.h file instead. */ - -#if defined(Q3_BIG_ENDIAN) - #define Q_BYTE_ORDER Q_BIG_ENDIAN -#elif defined(Q3_LITTLE_ENDIAN) - #define Q_BYTE_ORDER Q_LITTLE_ENDIAN -#endif /* This source file includes qprocessordetection.h from Qt: diff --git a/cmake/DaemonArchitecture/qprocessordetection.h b/cmake/DaemonPlatform/Architecture/qprocessordetection.h similarity index 100% rename from cmake/DaemonArchitecture/qprocessordetection.h rename to cmake/DaemonPlatform/Architecture/qprocessordetection.h diff --git a/cmake/DaemonBuildInfo.cmake b/cmake/DaemonPlatform/BuildInfo.cmake similarity index 100% rename from cmake/DaemonBuildInfo.cmake rename to cmake/DaemonPlatform/BuildInfo.cmake diff --git a/cmake/DaemonCompiler.cmake b/cmake/DaemonPlatform/Compiler.cmake similarity index 99% rename from cmake/DaemonCompiler.cmake rename to cmake/DaemonPlatform/Compiler.cmake index e00480cd24..43765fd0a5 100644 --- a/cmake/DaemonCompiler.cmake +++ b/cmake/DaemonPlatform/Compiler.cmake @@ -39,7 +39,7 @@ function(detect_daemon_compiler lang) try_compile(BUILD_RESULT "${CMAKE_BINARY_DIR}" - "${DAEMON_DIR}/cmake/DaemonCompiler/DaemonCompiler${${lang}_EXT}" + "${CMAKE_CURRENT_LIST_DIR}/Compiler/Compiler${${lang}_EXT}" CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} OUTPUT_VARIABLE BUILD_LOG ) diff --git a/cmake/DaemonCompiler/DaemonCompiler.c b/cmake/DaemonPlatform/Compiler/Compiler.c similarity index 100% rename from cmake/DaemonCompiler/DaemonCompiler.c rename to cmake/DaemonPlatform/Compiler/Compiler.c diff --git a/cmake/DaemonPlatform/Compiler/Compiler.cpp b/cmake/DaemonPlatform/Compiler/Compiler.cpp new file mode 100644 index 0000000000..41c3f576b6 --- /dev/null +++ b/cmake/DaemonPlatform/Compiler/Compiler.cpp @@ -0,0 +1 @@ +#include "Compiler.c" diff --git a/cmake/DaemonCompiler/DaemonCompiler.sh b/cmake/DaemonPlatform/Compiler/Compiler.sh similarity index 98% rename from cmake/DaemonCompiler/DaemonCompiler.sh rename to cmake/DaemonPlatform/Compiler/Compiler.sh index d93cae3c44..e7ba16844d 100755 --- a/cmake/DaemonCompiler/DaemonCompiler.sh +++ b/cmake/DaemonPlatform/Compiler/Compiler.sh @@ -32,7 +32,7 @@ set -ueo pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -file_path="${script_dir}/DaemonCompiler.c" +file_path="${script_dir}/Compiler.c" # PNaCl doesn't work with “-o /dev/null” as it uses the output path as a # pattern for temporary files and then the parent folder should be writable. diff --git a/cmake/DaemonPlatform/Platform.cmake b/cmake/DaemonPlatform/Platform.cmake new file mode 100644 index 0000000000..7bbcb9c726 --- /dev/null +++ b/cmake/DaemonPlatform/Platform.cmake @@ -0,0 +1,12 @@ +include(${CMAKE_CURRENT_LIST_DIR}/BuildInfo.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/System.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/Architecture.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake) + +if (NACL AND DAEMON_CXX_COMPILER_Saigo) + # Saigo clang reports weird errors when building some Unvanquished cgame and sgame arm nexe with PIE. + # Saigo clang crashes when building Unvanquished amd64 cgame with PIE, sgame builds properly though. + set(NACL_PIE 0) +else() + set(NACL_PIE 1) +endif() diff --git a/cmake/DaemonPlatform.cmake b/cmake/DaemonPlatform/System.cmake similarity index 86% rename from cmake/DaemonPlatform.cmake rename to cmake/DaemonPlatform/System.cmake index be8f5f1c81..c4295dde0c 100644 --- a/cmake/DaemonPlatform.cmake +++ b/cmake/DaemonPlatform/System.cmake @@ -39,15 +39,3 @@ elseif( NACL ) else() message( FATAL_ERROR "Platform not supported" ) endif() - -if (NACL AND USE_NACL_SAIGO) - # Saigo clang reports weird errors when building some cgame and sgame arm nexe with PIE. - # Saigo clang crashes when building amd64 cgame with PIE, sgame builds properly though. - set(GAME_PIE 0) -else() - set(GAME_PIE 1) -endif() - - -include(DaemonArchitecture) -include(DaemonCompiler)