CMake cleanup (#5082)
Build / Linux (push) Has been cancelled
Build / Windows (push) Has been cancelled

This commit is contained in:
brainiac
2026-05-17 15:05:46 -07:00
committed by GitHub
parent 7d98b10c18
commit 11a8e46ee8
21 changed files with 1643 additions and 1665 deletions
+4 -4
View File
@@ -39,7 +39,7 @@ jobs:
- name: Configure
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DEQEMU_BUILD_TESTS=ON \
@@ -89,7 +89,7 @@ jobs:
shell: pwsh
run: |
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_BUILD_TYPE=Release `
-DEQEMU_BUILD_TESTS=ON `
-DEQEMU_BUILD_LOGIN=ON `
-DEQEMU_BUILD_LUA=ON `
@@ -98,8 +98,8 @@ jobs:
- name: Build
shell: pwsh
run: cmake --build build --config RelWithDebInfo --target ALL_BUILD -- /m
run: cmake --build build --config Release --target ALL_BUILD -- /m
- name: Test
working-directory: build
run: ./bin/RelWithDebInfo/tests.exe
run: ./bin/Release/tests.exe
+20 -15
View File
@@ -18,6 +18,17 @@ if(NOT CMAKE_TOOLCHAIN_FILE)
endif()
endif()
# Uncomment to generate just the standard Debug and Release configurations
#set(CMAKE_BUILD_TYPE "Debug")
#set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(dummy "${CMAKE_C_COMPILER}")
project(EQEmu
VERSION 24.10.3
LANGUAGES CXX
@@ -30,31 +41,25 @@ if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type")
endif()
option(EQEMU_BUILD_PCH "Build with precompiled headers" ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
if(MSVC)
add_compile_options(/bigobj)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS NOMINMAX WIN32_LEAN_AND_MEAN CRASH_LOGGING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
# Always build with debug symbols
add_compile_options("$<$<CONFIG:RELEASE>:/Zi>")
add_link_options("$<$<CONFIG:RELEASE>:/DEBUG /OPT:REF /OPT:ICF>")
option(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." OFF)
if(EQEMU_DISABLE_MSVC_WARNINGS)
add_compile_options(/W0 /wd4005 /wd4996 /nologo /Os)
endif()
add_compile_options(/bigobj /MP)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS NOMINMAX WIN32_LEAN_AND_MEAN CRASH_LOGGING)
option(EQEMU_MSVC_DEBUG_CRT "Use the debug CRT on MSVC debug builds" OFF)
if(EQEMU_MSVC_DEBUG_CRT)
add_compile_definitions(_CRT_DBG_MAP_ALLOC)
endif()
else()
add_compile_options("$<$<CONFIG:RELEASE>:-g>")
add_compile_definitions(HAS_UNION_SEMUN)
endif()
+46 -21
View File
@@ -2,46 +2,71 @@
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "linux-debug",
"displayName": "Linux Debug",
"name": "linux",
"displayName": "Linux-Ninja",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"EQEMU_BUILD_LOGIN": "ON",
"EQEMU_BUILD_TESTS": "ON",
"EQEMU_ADD_PROFILER": "ON"
"EQEMU_BUILD_TESTS": "ON"
}
},
{
"name": "linux-release",
"displayName": "Linux Release",
"name": "linux-clang",
"displayName": "Linux-Ninja (Clang)",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/release",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"EQEMU_BUILD_LOGIN": "ON"
"EQEMU_BUILD_TESTS": "ON",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "win-msvc",
"name": "linux-ccache",
"displayName": "Linux-Ninja (Ccache)",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"EQEMU_BUILD_TESTS": "ON"
}
},
{
"name": "linux-clang-ccache",
"displayName": "Linux-Ninja (Clang, Ccache)",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"EQEMU_BUILD_TESTS": "ON",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "win-msvc-2022",
"displayName": "Windows MSVC (VS 2022)",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build/${presetName}",
"binaryDir": "${sourceDir}/build",
"architecture": { "value": "x64" },
"cacheVariables": {
"EQEMU_BUILD_TESTS": "ON"
}
},
{
"name": "win-msvc-2026",
"displayName": "Windows MSVC (VS 2026)",
"generator": "Visual Studio 18 2026",
"binaryDir": "${sourceDir}/build",
"architecture": { "value": "x64" },
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "Debug;Release",
"EQEMU_BUILD_LOGIN": "ON",
"EQEMU_BUILD_TESTS": "ON"
}
}
-2
View File
@@ -1,4 +1,2 @@
cmake_minimum_required(VERSION 3.20)
add_subdirectory(import)
add_subdirectory(export)
-3
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20.0)
set(export_sources
main.cpp
)
@@ -12,7 +10,6 @@ add_executable(export_client_files ${export_sources} ${export_headers})
install(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
target_link_libraries(export_client_files common)
target_include_directories(export_client_files PRIVATE ../..)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set_property(TARGET export_client_files PROPERTY FOLDER executables/tools)
-3
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20.0)
set(import_sources
main.cpp
)
@@ -12,7 +10,6 @@ add_executable(import_client_files ${import_sources} ${import_headers})
install(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
target_link_libraries(import_client_files common)
target_include_directories(import_client_files PRIVATE ../..)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set_property(TARGET import_client_files PROPERTY FOLDER executables/tools)
-9
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20.0)
set(common_sources
base_packet.cpp
bazaar.cpp
@@ -767,7 +765,6 @@ add_library(common ${common_sources} ${common_headers} ${repositories})
target_compile_definitions(common PUBLIC BOOST_BIND_GLOBAL_PLACEHOLDERS GLM_FORCE_RADIANS GLM_FORCE_CTOR_INIT GLM_ENABLE_EXPERIMENTAL ENABLE_SECURITY)
target_include_directories(common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../submodules/websocketpp")
target_include_directories(common PRIVATE ..)
target_link_libraries(common PUBLIC cereal::cereal fmt::fmt unofficial::libmariadb $<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv> OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB unofficial-sodium::sodium)
# Requires libgoogle-perftools-dev google-perftools packages for linux (debian)
@@ -809,16 +806,10 @@ endif()
if(UNIX)
target_link_libraries(common PUBLIC uuid)
set_source_files_properties("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
endif()
if(EQEMU_BUILD_PCH)
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h)
# Avoid PCH/__OPTIMIZE__ mismatch when compiling certain patch sources with -O0
# These files are compiled with -O0 on UNIX (see COMPILE_FLAGS above), which
# disables the __OPTIMIZE__ predefined macro. Disabling PCH for them prevents
# Clang from erroring due to macro state differences between the PCH and TU.
set_source_files_properties("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-3
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20)
set(eqlaunch_sources
eqlaunch.cpp
worldserver.cpp
@@ -16,7 +14,6 @@ add_executable(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
install(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
target_link_libraries(eqlaunch common)
target_include_directories(eqlaunch PRIVATE ..)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set_property(TARGET eqlaunch PROPERTY FOLDER executables/tools)
-3
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20)
set(eqlogin_sources
account_management.cpp
client.cpp
@@ -33,7 +31,6 @@ add_executable(loginserver ${eqlogin_sources} ${eqlogin_headers})
install(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
target_link_libraries(loginserver common)
target_include_directories(loginserver PRIVATE ..)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set_property(TARGET loginserver PROPERTY FOLDER executables/servers)
-3
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20)
set(qserv_sources
database.cpp
lfguild.cpp
@@ -26,7 +24,6 @@ install(TARGETS queryserv RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
add_definitions(-DQSERV)
target_link_libraries(queryserv common)
target_include_directories(queryserv PRIVATE ..)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set_property(TARGET queryserv PROPERTY FOLDER executables/servers)
-3
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.17.0)
set(shared_memory_sources
items.cpp
main.cpp
@@ -16,7 +14,6 @@ add_executable(shared_memory ${shared_memory_sources} ${shared_memory_headers})
install(TARGETS shared_memory RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
target_link_libraries(shared_memory common)
target_include_directories(shared_memory PRIVATE ..)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set_property(TARGET shared_memory PROPERTY FOLDER executables/servers)
-3
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20.0)
add_subdirectory(cppunit)
set(tests_sources
@@ -22,7 +20,6 @@ set(tests_headers
add_executable(tests ${tests_sources} ${tests_headers})
target_link_libraries(tests common cppunit)
target_include_directories(tests PRIVATE ..)
install(TARGETS tests RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
-2
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20.0)
set(cppunit_sources
collectoroutput.cpp
compileroutput.cpp
-3
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20)
set(ucs_sources
chatchannel.cpp
clientlist.cpp
@@ -24,7 +22,6 @@ install(TARGETS ucs RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
add_definitions(-DUCS)
target_link_libraries(ucs common)
target_include_directories(ucs PRIVATE ..)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set_property(TARGET ucs PROPERTY FOLDER executables/servers)
-2
View File
@@ -1,5 +1,3 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(PFSUtil)
IF(NOT CMAKE_BUILD_TYPE)
@@ -1,5 +1,3 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(common_sources
Source/PFSArchive.cpp
Source/Compression.cpp
@@ -1,5 +1,3 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(pfslist_sources
Source/main.cpp
)
+2 -2
View File
@@ -14,12 +14,12 @@ perl utils/scripts/build/tag-version.pl
mkdir -p build && cd build && \
cmake -DEQEMU_BUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_BUILD_TYPE=Release \
-DEQEMU_BUILD_STATIC=ON \
-DEQEMU_BUILD_LOGIN=ON \
-DEQEMU_BUILD_LUA=ON \
-DEQEMU_BUILD_PERL=ON \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-g -Wno-everything" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="-g -Wno-everything" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-G 'Unix Makefiles' \
.. && make -j$((`nproc`-2))
+1 -4
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20)
set(world_sources
adventure.cpp
adventure_manager.cpp
@@ -96,9 +94,8 @@ add_executable(world ${world_sources} ${world_headers})
target_compile_definitions(world PRIVATE WORLD)
target_link_libraries(world common)
target_include_directories(world PRIVATE ..)
if(WIN32 AND EQEMU_BUILD_PCH)
if(EQEMU_BUILD_PCH)
target_precompile_headers(world PRIVATE ../common/pch/std-pch.h)
endif()
-6
View File
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.20)
set(zone_sources
aa.cpp
aa_ability.cpp
@@ -271,7 +269,6 @@ add_library(lua_zone STATIC ${lua_sources})
set_property(TARGET lua_zone PROPERTY FOLDER libraries)
set_target_properties(lua_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 8)
target_include_directories(lua_zone PRIVATE ..)
set(perl_sources
perl_bot.cpp
@@ -304,7 +301,6 @@ add_library(perl_zone STATIC ${perl_sources})
set_property(TARGET perl_zone PROPERTY FOLDER libraries)
set_target_properties(perl_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 8)
target_link_libraries(perl_zone PUBLIC cereal::cereal fmt::fmt unofficial::libmariadb)
target_include_directories(perl_zone PRIVATE ..)
set(gm_command_sources
bot_command.cpp
@@ -668,7 +664,6 @@ source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Source Files" FILES ${gm
add_library(gm_commands_zone STATIC ${gm_command_sources})
target_link_libraries(gm_commands_zone PRIVATE common)
target_include_directories(gm_commands_zone PRIVATE ..)
set_target_properties(gm_commands_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 32)
set_property(TARGET gm_commands_zone PROPERTY FOLDER libraries)
@@ -704,7 +699,6 @@ if(EQEMU_BUILD_PERL)
endif()
target_link_libraries(zone PRIVATE gm_commands_zone common RecastNavigation::Detour)
target_include_directories(zone PRIVATE ..)
if(EQEMU_BUILD_LUA)
target_link_libraries(zone PRIVATE lua_zone)