diff options
| author | Osmium Sorcerer <os@sof.beauty> | 2026-03-22 17:30:32 +0000 |
|---|---|---|
| committer | Osmium Sorcerer <os@sof.beauty> | 2026-03-29 20:34:23 +0000 |
| commit | 8475cfb7ac19f8698d2b96a0367f4735a016c375 (patch) | |
| tree | baaca1dc079dd17648ee701ae97a0be704ff3685 /CMakeLists.txt | |
| parent | 5af6531e0b248016479b707011d1f9b18735b8c1 (diff) | |
Update CMake build information
- Change CMake minimum version.
- Turn off tests and Discord RPC by default in CMake. Let these features
be explicitly enabled if desired.
- Add three build profiles: Dev, Debug, Release. Dev offers the fastest
unoptimized builds. Debug enables additional symbols, tracing, and
turns on Address Sanitizer. Release is aggressively optimized,
including LTO.
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ebaaae2..4942736 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.7.0) +cmake_minimum_required(VERSION 3.31.0) project(AttorneyOnline VERSION 2.11.0.0 LANGUAGES CXX C) @@ -11,8 +11,8 @@ set(CMAKE_AUTOUIC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -option(AO_BUILD_TESTS "Build test programs" ON) -option(AO_ENABLE_DISCORD_RPC "Enable Discord Rich Presence" ON) +option(AO_BUILD_TESTS "Build test programs" OFF) +option(AO_ENABLE_DISCORD_RPC "Enable Discord Rich Presence" OFF) find_package(QT NAMES Qt6) find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets Concurrent WebSockets UiTools) @@ -105,6 +105,22 @@ qt_add_executable(Attorney_Online src/network/serverinfo.h src/network/serverinfo.cpp ) +if(CMAKE_BUILD_TYPE STREQUAL "Dev") + target_compile_definitions(Attorney_Online PRIVATE NETWORK_DEBUG) + target_compile_options(Attorney_Online PRIVATE -O0 -Wall -Wextra -pedantic) +endif() + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + target_compile_definitions(Attorney_Online PRIVATE NETWORK_DEBUG) + target_compile_options(Attorney_Online PRIVATE -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address) + target_link_options(Attorney_Online PRIVATE -g -fsanitize=address) +endif() + +if(CMAKE_BUILD_TYPE STREQUAL "Release") + target_compile_options(Attorney_Online PRIVATE -O3 -pipe -fno-plt -fno-semantic-interposition -fvisibility=hidden -flto -fno-rtti -fno-exceptions -Werror=odr -Werror=strict-aliasing) + target_link_options(Attorney_Online PRIVATE -Wl,-O2 -Wl,--as-needed -flto -fuse-ld=lld) +endif() + set_target_properties(Attorney_Online PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") if(WIN32) |
