Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8fc079e
Merge various changes to CMakeLists.txt from dhewm3
DanielGibson Jan 5, 2026
8a197cd
Import changes from HeXen: Edge Of Chaos
DanielGibson Jan 6, 2026
4e22913
Setup HeXen: EOC in CMakeLists.txt, use README from @LegendaryGuard
DanielGibson Jan 6, 2026
7ad8a00
Make it compile (on Linux) by merging lots of fixes from @LegendaryGuard
DanielGibson Jan 7, 2026
cf4c6f1
Comment out idPlayer::AI_ATTACK2_HELD script bool
DanielGibson Jan 7, 2026
613744d
Fix some places where char* was used when const char* should've been …
DanielGibson Jan 7, 2026
5e02bb3
Initialize some potentially uninitialized variables
DanielGibson Jan 7, 2026
a33d8aa
Fix blowup code in Golem
DanielGibson Jan 7, 2026
2b06472
Fix script assert(data) when Veloxite is spawned
DanielGibson Jan 7, 2026
fc11b63
Disable TestHugeTranslation() assert(0)
DanielGibson Jan 7, 2026
3370836
Fix branch name (eoc, not hexeneoc) in compiling instructions
DanielGibson Jan 7, 2026
79ad32c
Fix idItem::GiveToPlayer again, this time with function checks
LegendaryGuard Dec 25, 2025
8696e91
Turn assertion in idEntity::StartSound() into warning
DanielGibson Jan 7, 2026
49cf25a
Fixed another unlinked script variables issue
DanielGibson Jan 8, 2026
58b249f
Fixed segfault when handling many AI entities on testmaps/test_lotsai…
klaussilveira Jan 5, 2026
cec1c91
Clip.cpp TestHugeTranslation(): Disable annoying assertion
DanielGibson Jan 6, 2026
7faa208
Introduce gameLocal.msecPrecise to game/
DanielGibson Jan 24, 2026
546b4ab
Introduce gameLocal.msecPrecise to d3xp/
DanielGibson Jan 26, 2026
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
61 changes: 48 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 2.8...3.22 FATAL_ERROR)
project(dhewm3sdk)

option(BASE "Build the base (game/) game code" ON)
set(BASE_NAME "base" CACHE STRING "Name of the mod built from game/ (will result in \${BASE_NAME}.dll)")
set(BASE_NAME "eoc" CACHE STRING "Name of the mod built from game/ (will result in \${BASE_NAME}.dll)")
set(BASE_DEFS "GAME_DLL" CACHE STRING "Compiler definitions for the mod built from game/")

option(D3XP "Build the d3xp/ game code" ON)
option(D3XP "Build the d3xp/ game code" OFF)
set(D3XP_NAME "d3xp" CACHE STRING "Name of the mod built from d3xp/ (will result in \${D3XP_NAME}.dll)")
set(D3XP_DEFS "GAME_DLL;_D3XP;CTF" CACHE STRING "Compiler definitions for the mod built from d3xp/")

Expand All @@ -20,6 +20,17 @@ set(src_game_mod
# add additional .cpp files of your mod in game/
# (that you added to the ones already existant in the SDK/in dhewm3)
# like "game/MyFile.cpp" (without quotes, one file per line)
game/PlayerArtifacts.cpp
game/PlayerScriptEvents.cpp
game/ai/AI_Golem.cpp
game/ai/AI_Shadowspawn.cpp
game/ai/AI_Veloxite.cpp
game/objects/Leaf.cpp
game/objects/LeafEmitter.cpp
game/objects/Tree.cpp
game/projectiles/FireStorm.cpp
game/projectiles/Soul.cpp
game/projectiles/Wraithverge.cpp
)

set(src_d3xp_mod
Expand Down Expand Up @@ -190,20 +201,30 @@ if(D3_COMPILER_IS_GCC_OR_CLANG)
endif ()
endif ()

set(CMAKE_C_FLAGS_DEBUG "-g -D_DEBUG -O0")
if(cpu STREQUAL "e2k" AND CMAKE_COMPILER_IS_GNUCC)
# O3 on E2K mcst-lcc approximately equal to O2 at X86/ARM gcc
set(OPT_LEVEL "-O3")
else()
set(OPT_LEVEL "-O2")
endif()

set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -D_DEBUG -O0")
set(CMAKE_C_FLAGS_DEBUGALL "-g -ggdb -D_DEBUG")
set(CMAKE_C_FLAGS_PROFILE "-g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_RELEASE "-O2 -fno-math-errno -fno-trapping-math -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -fno-math-errno -fno-trapping-math -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -fno-math-errno -fno-trapping-math -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELEASE "${OPT_LEVEL} -fno-math-errno -fno-trapping-math -ffinite-math-only -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -ggdb ${OPT_LEVEL} -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -fno-math-errno -fno-trapping-math -ffinite-math-only -fomit-frame-pointer")

set(CMAKE_CXX_FLAGS_DEBUGALL ${CMAKE_C_FLAGS_DEBUGALL})
set(CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})

add_compile_options(-fno-strict-aliasing)
# dear idiot compilers, don't fuck up math code with useless FMA "optimizations"
# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100839)
add_compile_options(-ffp-contract=off)
CHECK_CXX_COMPILER_FLAG("-ffp-contract=off" cxx_has_fp-contract)
if(cxx_has_fp-contract)
add_compile_options(-ffp-contract=off)
endif()

if(ASAN)
# if this doesn't work, ASan might not be available on your platform, don't set ASAN then..
Expand All @@ -212,14 +233,16 @@ if(D3_COMPILER_IS_GCC_OR_CLANG)
# set(ldflags ${ldflags} -fsanitize=address)
endif()

if(NOT AROS)
if(NOT AROS AND NOT WIN32)
CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" cxx_has_fvisibility)
if(NOT cxx_has_fvisibility)
message(FATAL_ERROR "Compiler does not support -fvisibility")
endif()
add_compile_options(-fvisibility=hidden)
endif()

add_compile_options(-Werror=format)

# TODO fix these warnings
add_compile_options(-Wno-sign-compare)
add_compile_options(-Wno-switch)
Expand All @@ -233,9 +256,21 @@ if(D3_COMPILER_IS_GCC_OR_CLANG)
add_compile_options(-Wno-class-memaccess)
endif()

CHECK_CXX_COMPILER_FLAG("-Wdangling-reference" cxx_has_Wdangling_reference)
if(cxx_has_Wdangling_reference)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=dangling-reference")
endif()

CHECK_CXX_COMPILER_FLAG("-Woverloaded-virtual" cxx_has_Woverload_virtual)
if(cxx_has_Woverload_virtual)
add_compile_options(-Woverloaded-virtual)
add_compile_options(-Wno-overloaded-virtual)
endif()

# ignore warnings about variables named "requires" for now (in C++20 it's a keyword,
# but currently we don't even use C++11 features)
CHECK_CXX_COMPILER_FLAG("-Wno-c++20-compat" cxx_has_Wno-cpp20-compat)
if(cxx_has_Wno-cpp20-compat)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++20-compat")
endif()

if(AROS)
Expand All @@ -245,11 +280,11 @@ if(D3_COMPILER_IS_GCC_OR_CLANG)
add_definitions(-DMACOS_X=1)

if(cpu STREQUAL "x86_64")
add_compile_options(-arch x86_64 -mmacosx-version-min=10.6)
set(ldflags "${ldflags} -arch x86_64 -mmacosx-version-min=10.6")
add_compile_options(-arch x86_64 -mmacosx-version-min=10.7)
set(ldflags "${ldflags} -arch x86_64 -mmacosx-version-min=10.7")
elseif(cpu STREQUAL "arm64")
add_compile_options(-arch arm64 -mmacosx-version-min=11.0)
set(ldflags "${ldflags} -arch arm64 -mmacosx-version-min=11.0")
add_compile_options(-arch arm64 -mmacosx-version-min=10.7)
set(ldflags "${ldflags} -arch arm64 -mmacosx-version-min=10.7")
elseif(cpu STREQUAL "x86")
CHECK_CXX_COMPILER_FLAG("-arch i386" cxx_has_arch_i386)
if(cxx_has_arch_i386)
Expand Down
Loading