diff options
| author | TrickyLeifa <date.epoch@gmail.com> | 2024-05-15 00:00:17 +0200 |
|---|---|---|
| committer | TrickyLeifa <date.epoch@gmail.com> | 2024-05-15 00:04:16 +0200 |
| commit | c9f52b7223685d2e7fca925594171f94dd8c6e3b (patch) | |
| tree | 740bb32a40da98a4d52836432f59a16b31333900 /CMakeLists.txt | |
| parent | 951766666621fa77e257e6b5616fe4ab1eb2a52f (diff) | |
Ported to CMake, ...
* Ported the project to CMake
* Android and Mac support dropped for the time
being.
* Tests, BASS and Discord-RPC are now options
* Restructured and reformated the project.
* Merged `include` and `src`
* Renamed `resource` to `data`
* Renamed various files
* External libraries headers are no longer included in `src`
* Replaced header guards with #pragma once
* Multiple refactors (keywords, headers)
* Added Qt6 compatibility
* Removed various unused functions and headers
* Reworked AOPacket
* When content is passed to AOPacket, it should be ensured that the content is already decoded.
* Encoding/decoding are now static methods.
* Fixed various memory leaks
* Removed animation code for AOImage
* AOImage is always using static images
* Simplified ChatLogPiece
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 138 |
1 files changed, 108 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fad3de08..d6194a91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ -# Configure cmake -cmake_minimum_required(VERSION 3.1.0) -cmake_policy(SET CMP0076 NEW) # silence warning +cmake_minimum_required(VERSION 3.7.0) -project(AttorneyOnline) +project(AttorneyOnline VERSION 2.11.0.0 LANGUAGES CXX C) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -11,39 +9,119 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -if(CMAKE_VERSION VERSION_LESS "3.7.0") - set(CMAKE_INCLUDE_CURRENT_DIR ON) -endif() +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +option(AO_BUILD_TESTS "Build test programs" OFF) +option(AO_ENABLE_BASS "Enable BASS audio library" ON) +option(AO_ENABLE_DISCORD_RPC "Enable Discord Rich Presence" ON) + +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Network Widgets Concurrent WebSockets UiTools) + +add_executable(Attorney_Online + src/aoapplication.cpp + src/aoapplication.h + src/aoblipplayer.cpp + src/aoblipplayer.h + src/aobutton.cpp + src/aobutton.h + src/aocharbutton.cpp + src/aocharbutton.h + src/aoclocklabel.cpp + src/aoclocklabel.h + src/aoemotebutton.cpp + src/aoemotebutton.h + src/aoemotepreview.cpp + src/aoemotepreview.h + src/aoevidencebutton.cpp + src/aoevidencebutton.h + src/aoevidencedisplay.cpp + src/aoevidencedisplay.h + src/aoimage.cpp + src/aoimage.h + src/aolayer.cpp + src/aolayer.h + src/aomusicplayer.cpp + src/aomusicplayer.h + src/aopacket.cpp + src/aopacket.h + src/aosfxplayer.cpp + src/aosfxplayer.h + src/aotextarea.cpp + src/aotextarea.h + src/aotextboxwidgets.cpp + src/aotextboxwidgets.h + src/aoutils.cpp + src/aoutils.h + src/charselect.cpp + src/chatlogpiece.cpp + src/chatlogpiece.h + src/courtroom.cpp + src/courtroom.h + src/datatypes.h + src/debug_functions.cpp + src/debug_functions.h + src/demoserver.cpp + src/demoserver.h + src/discord_rich_presence.cpp + src/discord_rich_presence.h + src/emotes.cpp + src/eventfilters.h + src/evidence.cpp + src/file_functions.cpp + src/file_functions.h + src/hardware_functions.cpp + src/hardware_functions.h + src/interfaces/server_dialog.h + src/lobby.cpp + src/lobby.h + src/main.cpp + src/networkmanager.cpp + src/networkmanager.h + src/options.cpp + src/options.h + src/packet_distribution.cpp + src/path_functions.cpp + src/scrolltext.cpp + src/scrolltext.h + src/text_file_functions.cpp + src/gui_utils.h + src/widgets/add_server_dialog.cpp + src/widgets/add_server_dialog.h + src/widgets/aooptionsdialog.cpp + src/widgets/aooptionsdialog.h + src/widgets/direct_connect_dialog.cpp + src/widgets/direct_connect_dialog.h + src/widgets/edit_server_dialog.cpp + src/widgets/edit_server_dialog.h + data.qrc + src/eventfilters.cpp +) -# AO -add_executable(Attorney_Online resources.qrc) +set_target_properties(Attorney_Online PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") -# WIN32 if(WIN32) - if(CMAKE_BUILD_TYPE STREQUAL "Release") - set_property(TARGET Attorney_Online PROPERTY WIN32_EXECUTABLE true) - set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/resource/logo_ao2.rc") - target_sources(Attorney_Online PRIVATE ${APP_ICON_RESOURCE_WINDOWS}) - endif() + if(CMAKE_BUILD_TYPE STREQUAL "Release") + set_property(TARGET Attorney_Online PROPERTY WIN32_EXECUTABLE true) + set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/data/logo-client.rc") + target_sources(Attorney_Online PRIVATE ${APP_ICON_RESOURCE_WINDOWS}) + endif() endif() -# Target Include -target_include_directories(Attorney_Online PRIVATE include) - -# Target Lib -find_package(Qt5 COMPONENTS Core Gui Network Widgets Concurrent WebSockets REQUIRED) +target_include_directories(Attorney_Online PRIVATE src lib) target_link_directories(Attorney_Online PRIVATE lib) -target_link_libraries(Attorney_Online PRIVATE Qt5::Core Qt5::Gui Qt5::Network Qt5::Widgets Qt5::Concurrent - Qt5::WebSockets bass bassmidi bassopus discord-rpc) -target_compile_definitions(Attorney_Online PRIVATE DISCORD) +target_link_libraries(Attorney_Online PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent Qt${QT_VERSION_MAJOR}::WebSockets Qt${QT_VERSION_MAJOR}::UiTools) + +if(AO_ENABLE_BASS) + target_compile_definitions(Attorney_Online PRIVATE AO_ENABLE_BASS) + target_link_libraries(Attorney_Online PRIVATE bass bassmidi bassopus) +endif() -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - target_link_libraries(Attorney_Online PRIVATE "-framework CoreFoundation" "-framework Foundation" "-framework CoreServices") +if(AO_ENABLE_DISCORD_RPC) + target_compile_definitions(Attorney_Online PRIVATE AO_ENABLE_DISCORD_RPC) + target_link_libraries(Attorney_Online PRIVATE discord-rpc) endif() -# Subdirectories -if (AO_BUILD_TESTS) - add_subdirectory(test) +if(AO_BUILD_TESTS) + add_subdirectory(test) endif() -add_subdirectory(src) -add_subdirectory(include) |
