Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ if (Daemon_OUT)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Daemon_OUT})
endif()

include(DaemonSourceGenerator)
include(DaemonPlatform)
include(DaemonPlatform/Platform)

################################################################################
# Configuration options
Expand Down Expand Up @@ -465,7 +464,6 @@ endif()
include(DaemonNacl)
if (NACL)
add_library(srclibs-nacl-module EXCLUDE_FROM_ALL ${NACLLIST_MODULE})
set_target_properties(srclibs-nacl-module PROPERTIES POSITION_INDEPENDENT_CODE ${GAME_PIE} FOLDER "libs")
set(LIBS_BASE ${LIBS_BASE} srclibs-nacl-module)
else()
add_library(srclibs-nacl-native EXCLUDE_FROM_ALL ${NACLLIST_NATIVE})
Expand Down
1 change: 0 additions & 1 deletion cmake/DaemonCompiler/DaemonCompiler.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/DaemonFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,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)
# 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:
Expand Down
3 changes: 1 addition & 2 deletions cmake/DaemonGame.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ 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(DaemonSourceGenerator)
include(DaemonPlatform)
include(DaemonPlatform/Platform)

# 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# Determine architecture
# Architecture detection.
################################################################################

# When adding a new architecture, look at all the places ARCH is used

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
)
Expand All @@ -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}"
)
Expand All @@ -57,14 +57,14 @@ 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")
message(FATAL_ERROR "Architecture not supported")
endif()

message(STATUS "Detected architecture: ${ARCH}")
message(STATUS "Detected target architecture: ${ARCH}")

add_definitions(-D${ARCH_DEFINE})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdint.h>
#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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# Determine compiler
# Compiler detection.
################################################################################

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

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

if (NOT BUILD_RESULT)
message(WARNING "Failed to build DaemonCompiler${${lang}_EXT}, relying on CMake builtin detection.")
message(WARNING "Failed to build Compiler${${lang}_EXT}, relying on CMake builtin detection.")
set(compiler_name "Unknown")
else()
set(BUILD_LOG "\n${BUILD_LOG}\n")
Expand Down
1 change: 1 addition & 0 deletions cmake/DaemonPlatform/Compiler/Compiler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "Compiler.c"
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes.
40 changes: 40 additions & 0 deletions cmake/DaemonPlatform/Platform.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Daemon BSD Source Code
# Copyright (c) 2025, Daemon Developers
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <organization> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# Collection of reusable CMake helpers written for the Dæmon engine and related
# projects.
################################################################################

# Source generation and file embedding.
include(${CMAKE_CURRENT_LIST_DIR}/SourceGenerator.cmake)

# Target detection.
include(${CMAKE_CURRENT_LIST_DIR}/System.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/Architecture.cmake)

# Toolchain detection.
include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake)
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# Source generation and file embedding.
################################################################################

set(DAEMON_SOURCE_GENERATOR "${CMAKE_CURRENT_LIST_FILE}")
get_filename_component(current_list_dir "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
set(DAEMON_FILE_EMBEDDER "${current_list_dir}/DaemonFileEmbedder.cmake")
set(DAEMON_FILE_EMBEDDER "${current_list_dir}/FileEmbedder.cmake")

set(DAEMON_GENERATED_SUBDIR "GeneratedSource")
set(DAEMON_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/${DAEMON_GENERATED_SUBDIR}")
Expand Down
14 changes: 1 addition & 13 deletions cmake/DaemonPlatform.cmake → cmake/DaemonPlatform/System.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# Determine platform
# System detection.
################################################################################

# When adding a new platform, look at all the places WIN32, APPLE and LINUX are used
Expand All @@ -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)
Loading