Skip to content

Commit 745bede

Browse files
committed
cmake: make DaemonPlatform, Architecture, Compiler, etc. autonomous and reusable
1 parent 5ab62e7 commit 745bede

File tree

15 files changed

+24
-35
lines changed

15 files changed

+24
-35
lines changed

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ if (Daemon_OUT)
7575
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Daemon_OUT})
7676
endif()
7777

78-
include(DaemonSourceGenerator)
79-
include(DaemonPlatform)
78+
include(DaemonPlatform/Platform)
8079

8180
################################################################################
8281
# Configuration options

cmake/DaemonCompiler/DaemonCompiler.cpp

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmake/DaemonFlags.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ else()
491491
try_c_cxx_flag(FNO_STRICT_OVERFLOW "-fno-strict-overflow")
492492
try_c_cxx_flag(WSTACK_PROTECTOR "-Wstack-protector")
493493

494-
if (NOT NACL OR (NACL AND GAME_PIE))
494+
if (NOT NACL OR (NACL AND NACL_PIE))
495495
# The -pie flag requires -fPIC:
496496
# > ld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
497497
# This flag isn't used on macOS:

cmake/DaemonGame.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ option(BUILD_GAME_NATIVE_DLL "Build the shared library files, mostly useful for
3939
option(BUILD_GAME_NATIVE_EXE "Build native executable, which might be used for better performances by server owners" OFF)
4040

4141
include(ExternalProject)
42-
include(DaemonSourceGenerator)
43-
include(DaemonPlatform)
42+
include(DaemonPlatform/Platform)
43+
# TODO: Delete when Game uses NACL_PIE instead of GAME_PIE.
44+
set(GAME_PIE ${NACL_PIE})
4445

4546
# Do not report unused native compiler if native vms are not built.
4647
# If only NACL vms are built, this will be reported in chainloaded build.

cmake/DaemonArchitecture.cmake renamed to cmake/DaemonPlatform/Architecture.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
try_compile(BUILD_RESULT
3434
"${CMAKE_BINARY_DIR}"
35-
"${DAEMON_DIR}/cmake/DaemonArchitecture/DaemonArchitecture.cpp"
35+
"${CMAKE_CURRENT_LIST_DIR}/Architecture/Architecture.cpp"
3636
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
3737
OUTPUT_VARIABLE BUILD_LOG
3838
)
@@ -46,7 +46,7 @@ try_compile(BUILD_RESULT
4646
# Setting USE_WERROR to ON doesn't print this warning.
4747
if (NOT BUILD_RESULT)
4848
message(WARNING
49-
"Failed to build DaemonArchitecture.cpp\n"
49+
"Failed to build Architecture.cpp\n"
5050
"Setting -Werror in CXXFLAGS can produce false positive errors\n"
5151
"${BUILD_LOG}"
5252
)
@@ -57,7 +57,7 @@ string(REPLACE "DAEMON_ARCH_" "" ARCH "${ARCH_DEFINE}")
5757

5858
if (NOT ARCH)
5959
message(FATAL_ERROR
60-
"Missing DAEMON_ARCH, there is a mistake in DaemonArchitecture.cpp\n"
60+
"Missing DAEMON_ARCH, there is a mistake in Architecture.cpp\n"
6161
"${BUILD_LOG}"
6262
)
6363
elseif(ARCH STREQUAL "unsupported")

cmake/DaemonArchitecture/DaemonArchitecture.cpp renamed to cmake/DaemonPlatform/Architecture/Architecture.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
platforms including ppc64, but we know how to do it for them. */
3333

3434
#include <stdint.h>
35-
#include "../../src/common/Endian.h"
36-
37-
/* qprocessordetection.h will print an error if it fails to detect
38-
endianness and while it is not already set, so the else clause is
39-
outsourced to that qprocessordetection.h file instead. */
40-
41-
#if defined(Q3_BIG_ENDIAN)
42-
#define Q_BYTE_ORDER Q_BIG_ENDIAN
43-
#elif defined(Q3_LITTLE_ENDIAN)
44-
#define Q_BYTE_ORDER Q_LITTLE_ENDIAN
45-
#endif
4635

4736
/* This source file includes qprocessordetection.h from Qt:
4837

cmake/DaemonCompiler.cmake renamed to cmake/DaemonPlatform/Compiler.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function(detect_daemon_compiler lang)
3939

4040
try_compile(BUILD_RESULT
4141
"${CMAKE_BINARY_DIR}"
42-
"${DAEMON_DIR}/cmake/DaemonCompiler/DaemonCompiler${${lang}_EXT}"
42+
"${CMAKE_CURRENT_LIST_DIR}/Compiler/Compiler${${lang}_EXT}"
4343
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
4444
OUTPUT_VARIABLE BUILD_LOG
4545
)
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "Compiler.c"

0 commit comments

Comments
 (0)