Skip to content

Commit 5d31fb8

Browse files
committed
cmake: make DaemonPlatform, Architecture, Compiler, etc. autonomous and reusable
1 parent 3b35db9 commit 5d31fb8

File tree

14 files changed

+53
-30
lines changed

14 files changed

+53
-30
lines changed

CMakeLists.txt

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

78-
include(DaemonSourceGenerator)
79-
include(DaemonPlatform)
78+
include(DaemonPlatform/SourceGenerator)
79+
include(DaemonPlatform/Platform)
8080

8181
################################################################################
8282
# Configuration options

cmake/DaemonCompiler/DaemonCompiler.cpp

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

cmake/DaemonGame.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ 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)
4443

4544
# Do not report unused native compiler if native vms are not built.
4645
# If only NACL vms are built, this will be reported in chainloaded build.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

2727
################################################################################
28-
# Determine architecture
28+
# Architecture detection.
2929
################################################################################
3030

3131
# When adding a new architecture, look at all the places ARCH is used
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,14 +57,14 @@ 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")
6464
message(FATAL_ERROR "Architecture not supported")
6565
endif()
6666

67-
message(STATUS "Detected architecture: ${ARCH}")
67+
message(STATUS "Detected target architecture: ${ARCH}")
6868

6969
add_definitions(-D${ARCH_DEFINE})
7070

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
File renamed without changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

2727
################################################################################
28-
# Determine compiler
28+
# Compiler detection.
2929
################################################################################
3030

3131
# FIXME: Force -W#pragma-messages and -Wno-error
@@ -39,15 +39,15 @@ 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
)
4646

4747
get_filename_component(compiler_basename "${CMAKE_${lang}_COMPILER}" NAME)
4848

4949
if (NOT BUILD_RESULT)
50-
message(WARNING "Failed to build DaemonCompiler${${lang}_EXT}, relying on CMake builtin detection.")
50+
message(WARNING "Failed to build Compiler${${lang}_EXT}, relying on CMake builtin detection.")
5151
set(compiler_name "Unknown")
5252
else()
5353
set(BUILD_LOG "\n${BUILD_LOG}\n")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "Compiler.c"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
set -ueo pipefail
3333

3434
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
35-
file_path="${script_dir}/DaemonCompiler.c"
35+
file_path="${script_dir}/Compiler.c"
3636

3737
# PNaCl doesn't work with “-o /dev/null” as it uses the output path as a
3838
# pattern for temporary files and then the parent folder should be writable.

0 commit comments

Comments
 (0)