Skip to content

Commit 5d2d092

Browse files
committed
Merge branch 'master' into for-0.56.0/sync
2 parents a1d7322 + 2a3ebd8 commit 5d2d092

25 files changed

+245
-570
lines changed

CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,11 @@ function(ADD_PRECOMPILED_HEADER Target)
333333
separate_arguments(Flags)
334334

335335
# Get the per-configuration compile flags
336-
foreach(Config Debug Release RelWithDebInfo MinSizeRel)
337-
string(TOUPPER ${Config} CONFIG)
338-
set(ConfigFlags ${CMAKE_CXX_FLAGS_${CONFIG}})
336+
foreach(Config DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
337+
set(ConfigFlags ${CMAKE_CXX_FLAGS_${Config}})
339338
separate_arguments(ConfigFlags)
340339
foreach(Flag ${ConfigFlags})
341-
set(Flags ${Flags} $<$<CONFIG:${Config}>:${Flag}>)
340+
set(Flags ${Flags} $<${${Config}_GENEXP_COND}:${Flag}>)
342341
endforeach()
343342
endforeach()
344343

@@ -892,7 +891,7 @@ function(AddApplication)
892891
ADD_PRECOMPILED_HEADER(${A_Target}-objects)
893892
endfunction()
894893

895-
daemon_write_buildinfo()
894+
daemon_write_buildinfo("Engine")
896895

897896
if (NOT NACL)
898897
add_library(engine-lib EXCLUDE_FROM_ALL ${PCH_FILE} ${BUILDINFOLIST} ${COMMONLIST} ${ENGINELIST})

cmake/DaemonBuildInfo.cmake

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
11
set(DAEMON_BUILDINFO_HEADER "// Automatically generated, do not modify!\n")
2-
set(DAEMON_BUILDINFO_CPP "${DAEMON_BUILDINFO_HEADER}")
3-
set(DAEMON_BUILDINFO_H "${DAEMON_BUILDINFO_HEADER}")
2+
set(DAEMON_BUILDINFO_PARENT "${CMAKE_CURRENT_BINARY_DIR}/GeneratedSource")
3+
set(DAEMON_BUILDINFO_DIR "DaemonBuildInfo")
4+
set(DAEMON_BUILDINFO_DIR_FULLPATH "${DAEMON_BUILDINFO_PARENT}/${DAEMON_BUILDINFO_DIR}")
5+
set(DAEMON_BUILDINFO_CPP_EXT ".cpp")
6+
set(DAEMON_BUILDINFO_H_EXT ".h")
7+
set(BUILDINFOLIST)
8+
9+
file(MAKE_DIRECTORY "${DAEMON_BUILDINFO_DIR_FULLPATH}")
10+
include_directories("${DAEMON_BUILDINFO_PARENT}")
11+
12+
foreach(kind CPP H)
13+
set(DAEMON_BUILDINFO_${kind} "${DAEMON_BUILDINFO_HEADER}")
14+
endforeach()
415

516
macro(daemon_add_buildinfo TYPE NAME VALUE)
617
set(DAEMON_BUILDINFO_CPP "${DAEMON_BUILDINFO_CPP}const ${TYPE} ${NAME}=${VALUE};\n")
718
set(DAEMON_BUILDINFO_H "${DAEMON_BUILDINFO_H}extern const ${TYPE} ${NAME};\n")
819
endmacro()
920

10-
set(DAEMON_BUILDINFO_DIR "${CMAKE_CURRENT_BINARY_DIR}/DaemonBuildInfo")
11-
set(DAEMON_BUILDINFO_CPP_FILE "${DAEMON_BUILDINFO_DIR}/DaemonBuildInfo.cpp")
12-
set(DAEMON_BUILDINFO_H_FILE "${DAEMON_BUILDINFO_DIR}/DaemonBuildInfo.h")
13-
14-
file(MAKE_DIRECTORY "${DAEMON_BUILDINFO_DIR}")
15-
include_directories("${DAEMON_BUILDINFO_DIR}")
16-
17-
set(BUILDINFOLIST "${DAEMON_BUILDINFO_CPP_FILE}" "${DAEMON_BUILDINFO_H_FILE}")
18-
19-
macro(daemon_write_buildinfo)
21+
macro(daemon_write_buildinfo NAME)
2022
foreach(kind CPP H)
21-
if (EXISTS "${DAEMON_BUILDINFO_${kind}_FILE}")
22-
file(READ "${DAEMON_BUILDINFO_${kind}_FILE}" DAEMON_BUILDINFO_${kind}_READ)
23+
set(DAEMON_BUILDINFO_${kind}_NAME "${NAME}${DAEMON_BUILDINFO_${kind}_EXT}")
24+
set(DAEMON_BUILDINFO_${kind}_FILE "${DAEMON_BUILDINFO_DIR}/${DAEMON_BUILDINFO_${kind}_NAME}")
25+
set(DAEMON_BUILDINFO_${kind}_FILE_FULLPATH "${DAEMON_BUILDINFO_PARENT}/${DAEMON_BUILDINFO_${kind}_FILE}")
26+
list(APPEND BUILDINFOLIST "${DAEMON_BUILDINFO_${kind}_FILE_FULLPATH}")
27+
28+
if (EXISTS "${DAEMON_BUILDINFO_${kind}_FILE_FULLPATH}")
29+
file(READ "${DAEMON_BUILDINFO_${kind}_FILE_FULLPATH}" DAEMON_BUILDINFO_${kind}_READ)
2330
endif()
2431

2532
if (NOT "${DAEMON_BUILDINFO_${kind}}" STREQUAL "${DAEMON_BUILDINFO_${kind}_READ}")
26-
file(WRITE "${DAEMON_BUILDINFO_${kind}_FILE}" "${DAEMON_BUILDINFO_${kind}}")
33+
message(STATUS "Generating ${DAEMON_BUILDINFO_${kind}_FILE}")
34+
file(WRITE "${DAEMON_BUILDINFO_${kind}_FILE_FULLPATH}" "${DAEMON_BUILDINFO_${kind}}")
2735
endif()
2836
endforeach()
2937
endmacro()
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Daemon BSD Source Code
2+
# Copyright (c) 2025, Daemon Developers
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
# * Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# * Redistributions in binary form must reproduce the above copyright
10+
# notice, this list of conditions and the following disclaimer in the
11+
# documentation and/or other materials provided with the distribution.
12+
# * Neither the name of the <organization> nor the
13+
# names of its contributors may be used to endorse or promote products
14+
# derived from this software without specific prior written permission.
15+
#
16+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
27+
# Work around https://github.com/DaemonEngine/Daemon/issues/398. The Visual Studio CMake
28+
# integration, which uses a (single-config) Ninja generator, sets the configuration name
29+
# to an arbitrary name instead of "Release", "Debug" etc. So then $<CONFIG:Debug> etc.
30+
# doesn't work since it doesn't correspond to CMAKE_BUILD_TYPE.
31+
get_property(are_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
32+
if (are_multi_config)
33+
set(DEBUG_GENEXP_COND "$<CONFIG:Debug>")
34+
set(MINSIZEREL_GENEXP_COND "$<CONFIG:MinSizeRel>")
35+
set(RELWITHDEBINFO_GENEXP_COND "$<CONFIG:RelWithDebInfo>")
36+
set(RELEASE_GENEXP_COND "$<CONFIG:Release>")
37+
else()
38+
set(DEBUG_GENEXP_COND "0")
39+
set(MINSIZEREL_GENEXP_COND "0")
40+
set(RELWITHDEBINFO_GENEXP_COND "0")
41+
set(RELEASE_GENEXP_COND "0")
42+
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type_upper)
43+
set(${build_type_upper}_GENEXP_COND "1")
44+
endif()

cmake/DaemonFlags.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
include(CheckCCompilerFlag)
2828
include(CheckCXXCompilerFlag)
29+
include(DaemonBuildTypeGeneratorExpression)
2930

3031
add_definitions(-DDAEMON_BUILD_${CMAKE_BUILD_TYPE})
3132

@@ -49,6 +50,9 @@ else()
4950
message(STATUS "Disabling compiler custom attributes and operators")
5051
endif()
5152

53+
option(USE_RECOMMENDED_CXX_STANDARD "Use recommended C++ standard" ON)
54+
mark_as_advanced(USE_RECOMMENDED_CXX_STANDARD)
55+
5256
# Set flag without checking, optional argument specifies build type
5357
macro(set_c_flag FLAG)
5458
if (${ARGC} GREATER 1)
@@ -248,9 +252,6 @@ else()
248252
endif()
249253
endif()
250254

251-
option(USE_RECOMMENDED_CXX_STANDARD "Use recommended C++ standard" ON)
252-
mark_as_advanced(USE_RECOMMENDED_CXX_STANDARD)
253-
254255
if (USE_RECOMMENDED_CXX_STANDARD)
255256
# PNaCl only defines isascii if __STRICT_ANSI__ is not defined,
256257
# always prefer GNU dialect.
@@ -592,4 +593,4 @@ endif()
592593
# is so that it doesn't break the hacky gcc/clang PCH code which reads all the definitions
593594
# and prefixes "-D" to them.
594595
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
595-
$<$<NOT:$<CONFIG:Debug>>:THIS_IS_NOT_A_>DEBUG_BUILD)
596+
$<$<NOT:${DEBUG_GENEXP_COND}>:THIS_IS_NOT_A_>DEBUG_BUILD)

cmake/DaemonGame.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ else()
104104
set(NACL_TARGETS "")
105105
endif()
106106

107+
daemon_write_buildinfo("Game")
108+
107109
function(GAMEMODULE)
108110
# ParseArguments setup
109111
set(oneValueArgs NAME)
110112
set(multiValueArgs DEFINITIONS FLAGS FILES LIBS)
111113
cmake_parse_arguments(GAMEMODULE "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
112114

113-
daemon_write_buildinfo()
114-
115115
if (NOT NACL)
116116
if (BUILD_GAME_NATIVE_DLL)
117117
add_library(${GAMEMODULE_NAME}-native-dll MODULE ${PCH_FILE} ${GAMEMODULE_FILES} ${SHAREDLIST_${GAMEMODULE_NAME}} ${SHAREDLIST} ${BUILDINFOLIST} ${COMMONLIST})

cmake/toolchain-pnacl.cmake

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ set(NACL ON)
9696
set(CMAKE_C_FLAGS "")
9797
set(CMAKE_CXX_FLAGS "")
9898

99-
set(PNACL_TRANSLATE_OPTIONS
100-
--allow-llvm-bitcode-input # FIXME: finalize as part of the build process
101-
--pnacl-allow-exceptions
102-
$<$<CONFIG:None>:-O3>
103-
$<$<CONFIG:Release>:-O3>
104-
$<$<CONFIG:Debug>:-O0>
105-
$<$<CONFIG:RelWithDebInfo>:-O2>
106-
$<$<CONFIG:MinSizeRel>:-O2>
107-
)
108-
10999
function(pnacl_finalize dir module arch)
100+
include(DaemonBuildTypeGeneratorExpression)
101+
102+
set(PNACL_TRANSLATE_OPTIONS
103+
--allow-llvm-bitcode-input # FIXME: finalize as part of the build process
104+
--pnacl-allow-exceptions
105+
$<${RELEASE_GENEXP_COND}:-O3>
106+
$<${DEBUG_GENEXP_COND}:-O0>
107+
$<${RELWITHDEBINFO_GENEXP_COND}:-O2>
108+
$<${MINSIZEREL_GENEXP_COND}:-O2>
109+
)
110110
set(PEXE ${dir}/${module}.pexe)
111111
set(NEXE ${dir}/${module}-${arch}.nexe)
112112
set(STRIPPED_NEXE ${dir}/${module}-${arch}-stripped.nexe)

src.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ set(RENDERERLIST
9191
${ENGINE_DIR}/renderer/tr_cmds.cpp
9292
${ENGINE_DIR}/renderer/tr_curve.cpp
9393
${ENGINE_DIR}/renderer/tr_fbo.cpp
94-
${ENGINE_DIR}/renderer/tr_flares.cpp
9594
${ENGINE_DIR}/renderer/tr_font.cpp
9695
${ENGINE_DIR}/renderer/GeometryCache.cpp
9796
${ENGINE_DIR}/renderer/GeometryCache.h

src/common/Defs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
#ifndef COMMON_DEFS_H_
3232
#define COMMON_DEFS_H_
3333

34-
#include "DaemonBuildInfo.h"
35-
3634
#define PRODUCT_NAME "Unvanquished"
3735
/** Case, No spaces */
3836
#define PRODUCT_NAME_UPPER "UNVANQUISHED"

src/engine/null/null_renderer.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ bool R_inPVVS( const vec3_t, const vec3_t )
119119
{
120120
return false;
121121
}
122-
bool RE_LoadDynamicShader( const char*, const char* )
123-
{
124-
return true;
125-
}
126-
void RE_Finish() { }
127122
void RE_TakeVideoFrame( int, int, byte*, byte*, bool ) { }
128123
int RE_RegisterAnimation( const char* )
129124
{
@@ -250,11 +245,6 @@ refexport_t *GetRefAPI( int, refimport_t* )
250245
re.inPVS = R_inPVS;
251246
re.inPVVS = R_inPVVS;
252247

253-
//bani
254-
re.LoadDynamicShader = RE_LoadDynamicShader;
255-
//bani
256-
re.Finish = RE_Finish;
257-
258248
re.TakeVideoFrame = RE_TakeVideoFrame;
259249

260250
// RB: alternative skeletal animation system

src/engine/qcommon/q_shared.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Maryland 20850 USA.
3737

3838
#include "common/Defs.h"
3939

40+
#if defined(BUILD_VM)
41+
#include "DaemonBuildInfo/Game.h"
42+
#else
43+
#include "DaemonBuildInfo/Engine.h"
44+
#endif
45+
4046
// math.h/cmath uses _USE_MATH_DEFINES to decide if to define M_PI etc or not.
4147
// So define _USE_MATH_DEFINES early before including math.h/cmath
4248
// and before including any other header in case they bring in math.h/cmath indirectly.

0 commit comments

Comments
 (0)