From b4c53b720a073a41a50325f70bf655998e6deaef Mon Sep 17 00:00:00 2001 From: Cayleb-Ordo Date: Wed, 12 Nov 2025 22:51:49 +0100 Subject: [PATCH] Add CMake Configuration for ActorEditor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Name the project AtlasMisc as the atlas Object is shared. Not working as of 04.06.2026: - Linking to wxWidgets find_package target - Terrain.obj : `error LNK2019: Verweis auf nicht aufgel├Âstes externes Symbol ""int const wxEVT_NULL" (?wxEVT_NULL@@3HB)" in Funktion ""void __cdecl dynamic initializer for 'private: static struct wxEventTableEntry const * const TerrainSidebar::sm_eventTableEntries''(void)" (??__E?sm_eventTableEntries@TerrainSidebar@@0QBUwxEventTableEntry@@B@@YAXXZ)".` Working: - Using find_package extra variables to find most of the windows ext. libs - excluding SDL2 and Boost, which use the custom find_prebuild_library function --- CMakeLists.txt | 5 + cmake/0ad-Functions.cmake | 46 ++++- cmake/FindPrebuildLibrary.cmake | 54 ++++++ cmake/PrecompiledHeader.cmake | 35 ++++ .../tools/atlas/AtlasFrontends/CMakeLists.txt | 5 + source/tools/atlas/AtlasObject/CMakeLists.txt | 15 ++ .../atlas/AtlasObject/tests/CMakeLists.txt | 4 + .../atlas/AtlasUI/ActorEditor/CMakeLists.txt | 13 ++ source/tools/atlas/AtlasUI/CMakeLists.txt | 5 + .../CustomControls/Buttons/CMakeLists.txt | 7 + .../AtlasUI/CustomControls/CMakeLists.txt | 12 ++ .../CustomControls/Canvas/CMakeLists.txt | 5 + .../CustomControls/ColorDialog/CMakeLists.txt | 5 + .../DraggableListCtrl/CMakeLists.txt | 7 + .../EditableListCtrl/CMakeLists.txt | 17 ++ .../CustomControls/FileHistory/CMakeLists.txt | 5 + .../HighResTimer/CMakeLists.txt | 5 + .../CustomControls/MapDialog/CMakeLists.txt | 5 + .../MapResizeDialog/CMakeLists.txt | 7 + .../SnapSplitterWindow/CMakeLists.txt | 5 + .../VirtualDirTreeCtrl/CMakeLists.txt | 5 + .../CustomControls/Windows/CMakeLists.txt | 7 + .../atlas/AtlasUI/General/CMakeLists.txt | 16 ++ .../tools/atlas/AtlasUI/Misc/CMakeLists.txt | 13 ++ .../AtlasUI/Misc/Graphics/CMakeLists.txt | 12 ++ .../AtlasUI/ScenarioEditor/CMakeLists.txt | 10 ++ .../ScenarioEditor/Sections/CMakeLists.txt | 7 + .../Sections/Cinema/CMakeLists.txt | 5 + .../Sections/Common/CMakeLists.txt | 5 + .../Sections/Environment/CMakeLists.txt | 7 + .../Sections/Map/CMakeLists.txt | 5 + .../Sections/Object/CMakeLists.txt | 7 + .../Sections/Player/CMakeLists.txt | 5 + .../Sections/Terrain/CMakeLists.txt | 5 + .../ScenarioEditor/Tools/CMakeLists.txt | 17 ++ .../Tools/Common/CMakeLists.txt | 11 ++ source/tools/atlas/CMakeLists.txt | 165 ++++++++++++++++++ 37 files changed, 563 insertions(+), 1 deletion(-) create mode 100644 cmake/FindPrebuildLibrary.cmake create mode 100644 cmake/PrecompiledHeader.cmake create mode 100644 source/tools/atlas/AtlasFrontends/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasObject/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasObject/tests/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ActorEditor/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/Buttons/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/Canvas/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/ColorDialog/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/DraggableListCtrl/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/EditableListCtrl/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/FileHistory/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/HighResTimer/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/MapDialog/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/MapResizeDialog/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/SnapSplitterWindow/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/CustomControls/Windows/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/General/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/Misc/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/Misc/Graphics/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinema/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Common/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Tools/CMakeLists.txt create mode 100644 source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/CMakeLists.txt create mode 100644 source/tools/atlas/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 59214ca507..dd5d1b5f77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,6 +146,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") include(SetupWindowsLibs) endif() +# Add subprojects +if(NOT without-atlas) + add_subdirectory(${CMAKE_SOURCE_DIR}/source/tools/atlas/) +endif() + # Add doxygen target if(build-docs) add_subdirectory(${CMAKE_SOURCE_DIR}/docs/doxygen) diff --git a/cmake/0ad-Functions.cmake b/cmake/0ad-Functions.cmake index 70b5f27316..460c16b1b2 100644 --- a/cmake/0ad-Functions.cmake +++ b/cmake/0ad-Functions.cmake @@ -1,3 +1,47 @@ cmake_minimum_required(VERSION 3.25.1...4.0.0) -# 0AD Specific Functions \ No newline at end of file +# 0AD Specific Functions + +# Add Precompiled Headers. If no target is given, this macro will fail with a FATAL_ERROR. +# rationale: we need one PCH per static lib, since one global header would increase dependencies. To that end, we can either include them as +# "projectdir/precompiled.h", or add "source/PCH/projectdir" to the include path and put the PCH there. The latter is better because many +# projects contain several dirs and it's unclear where there the PCH should be stored. This way is also a bit easier to use in that +# source files always include "precompiled.h". +# Notes: +# * Visual Assist manages to use the project include path and can correctly open these files from the IDE. +# * precompiled.cpp (needed to "Create" the PCH) also goes in the abovementioned dir. +# * using CMakes precompiled Header is not possible, as it does not allow for a custom name like used here. +function(add_pch) + set(single_args TARGET PCH_DIR) + cmake_parse_arguments(args "" "${single_args}" "" ${ARGN}) + if(NOT args_TARGET) + message(FATAL_ERROR "add_pch: Missing target!!") + endif() + + include(PrecompiledHeader) + if(NOT args_PCH_DIR) + get_target_property(source_root ${args_TARGET} SOURCE_DIR) + set(args_PCH_DIR ${source_root}/pch/${args_TARGET}) + endif() + # Put the project-specific PCH directory at the start of the include path, so '#include "precompiled.h"' will look in there first + target_include_directories(${args_TARGET} + BEFORE PRIVATE + ${args_PCH_DIR}/ + ) + if (CMAKE_GENERATOR MATCHES "Visual Studio") + set(pch_header "precompiled.h") + elseif(CMAKE_GENERATOR MATCHES "Xcode") + set(pch_header "../${args_PCH_DIR}/precompiled.h") + else() + set(pch_header "${args_PCH_DIR}/precompiled.h") + endif() + + precompile_header(${args_TARGET} ${pch_header} ${args_PCH_DIR}/precompiled.cpp) + + target_sources(${args_TARGET} + PRIVATE + ${args_PCH_DIR}/precompiled.cpp + ${args_PCH_DIR}/precompiled.h + ) + target_compile_definitions(${args_TARGET} PRIVATE CONFIG_ENABLE_PCH=1) +endfunction(add_pch) diff --git a/cmake/FindPrebuildLibrary.cmake b/cmake/FindPrebuildLibrary.cmake new file mode 100644 index 0000000000..76c8b2bbd1 --- /dev/null +++ b/cmake/FindPrebuildLibrary.cmake @@ -0,0 +1,54 @@ +function(find_prebuild_library _name) + include(FindPackageHandleStandardArgs) + set(multi_args COMPONENTS PATHS) + set(single_args INC_PATH VERSION) + cmake_parse_arguments(args "${multi_args}" "${single_args}" "" ${ARGN}) + + string(TOLOWER ${_name} libname) + string(TOUPPER ${_name} target_name) + # ++++++++ Handle COMPONENTS +++++++++++++++++++++ + if(args_COMPONENTS) + + endif() + + # ++++++++ Find relevant elements ++++++++++++++++ + find_library(Lib${_name} NAMES ${libname} ${libname}${args_VERSION}) + if(NOT args_INC_PATH) + find_path(Lib${_name}_inc NAMES ${libname}.h PATHS ${0AD_EXT_LIBDIR}/${_name}/include/) + # recursive add all paths beneth included... + else() + set(Lib${_name}_inc ${args_INC_PATH}) + endif() + if(NOT Lib${_name}_inc) + set(Lib${_name}_inc ${0AD_EXT_LIBDIR}/${_name}/include/) + endif() + + find_package_handle_standard_args(Lib${_name} REQUIRED_VARS Lib${_name}) + message(STATUS "${Lib${_name}} - ${Lib${_name}_inc} - ${Lib${_name}_FOUND} - ${target_name}::${target_name}") + + if (Lib${_name}_FOUND) + mark_as_advanced( + Lib${_name} + Lib${_name}_inc + ) + endif() + if(Lib${_name} MATCHES "LibBoost") + add_library(${target_name}::headers INTERFACE IMPORTED) + set_target_properties(${target_name}::headers PROPERTIES + IMPORTED_LOCATION ${Lib${_name}_inc} + INTERFACE_INCLUDE_DIRECTORIES ${Lib${_name}_inc} + ) + elseif(Lib${_name} MATCHES "SDL2") + add_library(${target_name}::${target_name} UNKNOWN IMPORTED) + set_target_properties(${target_name}::${target_name} PROPERTIES + IMPORTED_LOCATION ${Lib${_name}} + INTERFACE_INCLUDE_DIRECTORIES ${Lib${_name}_inc}/SDL + ) + elseif (Lib${_name} AND NOT TARGET ${target_name}::${target_name}) + add_library(${target_name}::${target_name} UNKNOWN IMPORTED) + set_target_properties(${target_name}::${target_name} PROPERTIES + IMPORTED_LOCATION ${Lib${_name}} + INTERFACE_INCLUDE_DIRECTORIES ${Lib${_name}_inc} + ) + endif() +endfunction() diff --git a/cmake/PrecompiledHeader.cmake b/cmake/PrecompiledHeader.cmake new file mode 100644 index 0000000000..882658a8a9 --- /dev/null +++ b/cmake/PrecompiledHeader.cmake @@ -0,0 +1,35 @@ +# Adds a custom precompiled header. This header must be included in the code if not added with FORCE_INCLUDE +function(precompile_header _target _header _source) + set(single_args FORCE_INCLUDE) + cmake_parse_arguments(args "" "${single_args}" "" ${ARGN}) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_COMPILER_ID STREQUAL "MSVC") + # Solution based opon https://www.dominikgrabiec.com/posts/2022/10/18/precompiled_header_snippet.html + target_compile_options(${_target} + PRIVATE + "/Yu${_header}" + ) + set_source_files_properties(${_source} + PROPERTIES + COMPILE_OPTIONS "/Yc${_header}" + ) + if(${args_FORCE_INCLUDE}) + set_source_files_properties(${_source} + PROPERTIES + COMPILE_OPTIONS /FI${_header} + ) + endif() + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU|AppleClang" OR CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|AppleClang") + # Solution is based on internal cmake code + set_source_files_properties(${_source} + PROPERTIES + COMPILE_OPTIONS -Winvalid-pch -x ${_header}.gch + ) + if(${args_FORCE_INCLUDE}) + set_source_files_properties(${_source} + PROPERTIES + COMPILE_OPTIONS include ${_header}.gch + ) + endif() + endif() +endfunction() diff --git a/source/tools/atlas/AtlasFrontends/CMakeLists.txt b/source/tools/atlas/AtlasFrontends/CMakeLists.txt new file mode 100644 index 0000000000..9a989c696e --- /dev/null +++ b/source/tools/atlas/AtlasFrontends/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(ActorEditor + PRIVATE + $<$: ActorEditor.rc> # Caution, the blank before the File is needed + ActorEditor.cpp +) diff --git a/source/tools/atlas/AtlasObject/CMakeLists.txt b/source/tools/atlas/AtlasObject/CMakeLists.txt new file mode 100644 index 0000000000..cfbbcadafc --- /dev/null +++ b/source/tools/atlas/AtlasObject/CMakeLists.txt @@ -0,0 +1,15 @@ +target_sources(AtlasObject + PRIVATE + AtlasObject.h + AtlasObjectImpl.cpp + AtlasObjectImpl.h + AtlasObjectJS.cpp + AtlasObjectText.cpp + AtlasObjectText.h + AtlasObjectXML.cpp + JSONSpiritInclude.h +) + +if(NOT without-tests) + add_subdirectory(tests/) +endif() diff --git a/source/tools/atlas/AtlasObject/tests/CMakeLists.txt b/source/tools/atlas/AtlasObject/tests/CMakeLists.txt new file mode 100644 index 0000000000..6cc99c955c --- /dev/null +++ b/source/tools/atlas/AtlasObject/tests/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(AtlasObject + PRIVATE + test_AtlasObjectXML.h +) diff --git a/source/tools/atlas/AtlasUI/ActorEditor/CMakeLists.txt b/source/tools/atlas/AtlasUI/ActorEditor/CMakeLists.txt new file mode 100644 index 0000000000..3a4df69bf5 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ActorEditor/CMakeLists.txt @@ -0,0 +1,13 @@ +target_sources(AtlasUI + PRIVATE + ActorEditor.cpp + ActorEditor.h + ActorEditorListCtrl.cpp + ActorEditorListCtrl.h + AnimListEditor.cpp + AnimListEditor.h + PropListEditor.cpp + PropListEditor.h + TexListEditor.cpp + TexListEditor.h +) diff --git a/source/tools/atlas/AtlasUI/CMakeLists.txt b/source/tools/atlas/AtlasUI/CMakeLists.txt new file mode 100644 index 0000000000..cbce506358 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(ActorEditor/) +add_subdirectory(CustomControls/) +add_subdirectory(General/) +add_subdirectory(Misc/) +add_subdirectory(ScenarioEditor/) diff --git a/source/tools/atlas/AtlasUI/CustomControls/Buttons/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/Buttons/CMakeLists.txt new file mode 100644 index 0000000000..1ca3135d82 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/Buttons/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(AtlasUI + PRIVATE + ActionButton.cpp + ActionButton.h + ToolButton.cpp + ToolButton.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/CMakeLists.txt new file mode 100644 index 0000000000..a8a46ca15e --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/CMakeLists.txt @@ -0,0 +1,12 @@ +add_subdirectory(Buttons/) +add_subdirectory(Canvas/) +add_subdirectory(ColorDialog/) +add_subdirectory(DraggableListCtrl/) +add_subdirectory(EditableListCtrl/) +add_subdirectory(FileHistory/) +add_subdirectory(HighResTimer/) +add_subdirectory(MapDialog/) +add_subdirectory(MapResizeDialog/) +add_subdirectory(SnapSplitterWindow/) +add_subdirectory(VirtualDirTreeCtrl/) +add_subdirectory(Windows/) diff --git a/source/tools/atlas/AtlasUI/CustomControls/Canvas/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/Canvas/CMakeLists.txt new file mode 100644 index 0000000000..01b8dd8311 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/Canvas/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + Canvas.cpp + Canvas.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/ColorDialog/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/ColorDialog/CMakeLists.txt new file mode 100644 index 0000000000..909726625c --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/ColorDialog/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + ColorDialog.cpp + ColorDialog.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/DraggableListCtrl/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/DraggableListCtrl/CMakeLists.txt new file mode 100644 index 0000000000..108ea9a151 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/DraggableListCtrl/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(AtlasUI + PRIVATE + DraggableListCtrl.cpp + DraggableListCtrl.h + DraggableListCtrlCommands.cpp + DraggableListCtrlCommands.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/EditableListCtrl/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/EditableListCtrl/CMakeLists.txt new file mode 100644 index 0000000000..3ceee000b3 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/EditableListCtrl/CMakeLists.txt @@ -0,0 +1,17 @@ +target_sources(AtlasUI + PRIVATE + EditableListCtrl.cpp + EditableListCtrl.h + EditableListCtrlCommands.cpp + EditableListCtrlCommands.h + FieldEditCtrl.cpp + FieldEditCtrl.h + ListCtrlValidator.cpp + ListCtrlValidator.h + QuickComboBox.cpp + QuickComboBox.h + QuickFileCtrl.cpp + QuickFileCtrl.h + QuickTextCtrl.cpp + QuickTextCtrl.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/FileHistory/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/FileHistory/CMakeLists.txt new file mode 100644 index 0000000000..88a5a1c0e9 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/FileHistory/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + FileHistory.cpp + FileHistory.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/HighResTimer/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/HighResTimer/CMakeLists.txt new file mode 100644 index 0000000000..45af706ae8 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/HighResTimer/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + HighResTimer.cpp + HighResTimer.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/MapDialog/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/MapDialog/CMakeLists.txt new file mode 100644 index 0000000000..3c05fa7052 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/MapDialog/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + MapDialog.cpp + MapDialog.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/MapResizeDialog/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/MapResizeDialog/CMakeLists.txt new file mode 100644 index 0000000000..107c099a30 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/MapResizeDialog/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(AtlasUI + PRIVATE + MapResizeDialog.cpp + MapResizeDialog.h + PseudoMiniMapPanel.cpp + PseudoMiniMapPanel.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/SnapSplitterWindow/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/SnapSplitterWindow/CMakeLists.txt new file mode 100644 index 0000000000..43307c89c2 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/SnapSplitterWindow/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + SnapSplitterWindow.cpp + SnapSplitterWindow.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/CMakeLists.txt new file mode 100644 index 0000000000..0667a45698 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + virtualdirtreectrl.cpp + virtualdirtreectrl.h +) diff --git a/source/tools/atlas/AtlasUI/CustomControls/Windows/CMakeLists.txt b/source/tools/atlas/AtlasUI/CustomControls/Windows/CMakeLists.txt new file mode 100644 index 0000000000..c290f85a61 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/Windows/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(AtlasUI + PRIVATE + AtlasDialog.cpp + AtlasDialog.h + AtlasWindow.cpp + AtlasWindow.h +) diff --git a/source/tools/atlas/AtlasUI/General/CMakeLists.txt b/source/tools/atlas/AtlasUI/General/CMakeLists.txt new file mode 100644 index 0000000000..e3187e3f38 --- /dev/null +++ b/source/tools/atlas/AtlasUI/General/CMakeLists.txt @@ -0,0 +1,16 @@ +target_sources(AtlasUI + PRIVATE + AtlasClipboard.cpp + AtlasClipboard.h + AtlasEventLoop.cpp + AtlasEventLoop.h + AtlasWindowCommand.cpp + AtlasWindowCommand.h + AtlasWindowCommandProc.cpp + AtlasWindowCommandProc.h + Datafile.cpp + Datafile.h + IAtlasSerialiser.h + Observable.cpp + Observable.h +) diff --git a/source/tools/atlas/AtlasUI/Misc/CMakeLists.txt b/source/tools/atlas/AtlasUI/Misc/CMakeLists.txt new file mode 100644 index 0000000000..424f5d83cc --- /dev/null +++ b/source/tools/atlas/AtlasUI/Misc/CMakeLists.txt @@ -0,0 +1,13 @@ +target_sources(AtlasUI + PRIVATE + DLLInterface.cpp + DLLInterface.h + KeyMap.cpp + KeyMap.h + actored.h + precompiled.cpp + precompiled.h + $<$: atlas.rc> # Caution, the blank before the File is needed +) + +add_subdirectory(Graphics/) diff --git a/source/tools/atlas/AtlasUI/Misc/Graphics/CMakeLists.txt b/source/tools/atlas/AtlasUI/Misc/Graphics/CMakeLists.txt new file mode 100644 index 0000000000..d679016fe2 --- /dev/null +++ b/source/tools/atlas/AtlasUI/Misc/Graphics/CMakeLists.txt @@ -0,0 +1,12 @@ +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + include(GNUInstallDirs) + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/ActorEditor.ico + ${CMAKE_CURRENT_SOURCE_DIR}/ArchiveViewer.ico + ${CMAKE_CURRENT_SOURCE_DIR}/FileConverter.ico + ${CMAKE_CURRENT_SOURCE_DIR}/ScenarioEditor.ico + DESTINATION + ${CMAKE_INSTALL_DATADIR}/0ad/tools/ActorEditor/icons + ) +endif() diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/CMakeLists.txt new file mode 100644 index 0000000000..31ffe381a4 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(AtlasUI + PRIVATE + ScenarioEditor.cpp + ScenarioEditor.h + SectionLayout.cpp + SectionLayout.h +) + +add_subdirectory(Sections/) +add_subdirectory(Tools/) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/CMakeLists.txt new file mode 100644 index 0000000000..6426cdfcad --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/CMakeLists.txt @@ -0,0 +1,7 @@ +add_subdirectory(Cinema/) +add_subdirectory(Common/) +add_subdirectory(Environment/) +add_subdirectory(Map/) +add_subdirectory(Object/) +add_subdirectory(Player/) +add_subdirectory(Terrain/) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinema/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinema/CMakeLists.txt new file mode 100644 index 0000000000..2d8c7fcfe1 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinema/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + Cinema.cpp + Cinema.h +) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Common/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Common/CMakeLists.txt new file mode 100644 index 0000000000..8e328b9bcb --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Common/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + Sidebar.cpp + Sidebar.h +) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/CMakeLists.txt new file mode 100644 index 0000000000..27fc054390 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(AtlasUI + PRIVATE + Environment.cpp + Environment.h + LightControl.cpp + LightControl.h +) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/CMakeLists.txt new file mode 100644 index 0000000000..769271ba53 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + Map.cpp + Map.h +) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/CMakeLists.txt new file mode 100644 index 0000000000..e866edb492 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(AtlasUI + PRIVATE + Object.cpp + Object.h + VariationControl.cpp + VariationControl.h +) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/CMakeLists.txt new file mode 100644 index 0000000000..40aa3ced1f --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + Player.cpp + Player.h +) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/CMakeLists.txt new file mode 100644 index 0000000000..5f20c020f1 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(AtlasUI + PRIVATE + Terrain.cpp + Terrain.h +) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/CMakeLists.txt new file mode 100644 index 0000000000..9c017801e1 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/CMakeLists.txt @@ -0,0 +1,17 @@ +target_sources(AtlasUI + PRIVATE + ActorViewerTool.cpp + AlterElevation.cpp + FillTerrain.cpp + FlattenElevation.cpp + PaintTerrain.cpp + PickWaterHeight.cpp + PikeElevation.cpp + PlaceObject.cpp + ReplaceTerrain.cpp + SmoothElevation.cpp + TransformObject.cpp + TransformPath.cpp +) + +add_subdirectory(Common/) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/CMakeLists.txt b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/CMakeLists.txt new file mode 100644 index 0000000000..b83b71562a --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/CMakeLists.txt @@ -0,0 +1,11 @@ +target_sources(AtlasUI + PRIVATE + Brushes.cpp + Brushes.h + MiscState.cpp + MiscState.h + ObjectSettings.cpp + ObjectSettings.h + Tools.cpp + Tools.h +) diff --git a/source/tools/atlas/CMakeLists.txt b/source/tools/atlas/CMakeLists.txt new file mode 100644 index 0000000000..24f738cb49 --- /dev/null +++ b/source/tools/atlas/CMakeLists.txt @@ -0,0 +1,165 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +project(AtlasMisc LANGUAGES CXX) + +include(0ad-Functions) + +# +++++++++++++++++++++ Project Macros ++++++++++++++++++++ +macro(set_atlas_build_flags _target) + target_link_options(${_target} + PRIVATE + $<$:-fPIC> + $<$:-rdynamic> + ) + target_compile_options(${_target} + PRIVATE + $<$:-fPIC> + $<$:-Wno-unused-local-typedefs> + ) + target_link_libraries(${_target} + PRIVATE + $<$:winmm delayimp> + ) +endmacro() + +# +++++++++++++++++++++ Required Packages ++++++++++++++++++ +find_package(wxWidgets 3.0.4 REQUIRED COMPONENTS gl xml) +find_package(Iconv 1.0 REQUIRED) +find_package(ZLIB 1.2 REQUIRED) +find_package(LibXml2 2.9 REQUIRED) +if(UNIX) + find_package(Boost 1.69.0 REQUIRED CONFIG) + find_package(SDL2 2.0.2 REQUIRED) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_package(X11 REQUIRED) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + include(FindPrebuildLibrary) + find_prebuild_library(Sdl2) + find_prebuild_library(Boost INC_PATH ${0AD_EXT_LIBDIR}/boost/include/) +endif() + +# +++++++++++++++++++++ Project Targets ++++++++++++++++++++ +add_library(AtlasObject STATIC) +add_library(AtlasUI SHARED) +add_executable(ActorEditor) + +# Set Macos Bundle and Windows Window Application +set_target_properties(ActorEditor + PROPERTIES + WIN32_EXECUTABLE $<$:TRUE> + MACOSX_BUNDLE $<$:TRUE> +) + +add_subdirectory(AtlasFrontends/) +add_subdirectory(AtlasObject/) +add_subdirectory(AtlasUI/) + +# +++++++++++++++++++++ Set Output Paths +++++++++++++++++++ +set_target_properties(AtlasObject + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/binaries/system +) +set_target_properties(AtlasUI + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/binaries/system +) +set_target_properties(ActorEditor + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/binaries/system +) + +# +++++++++++++++++++++ AtlasObject ++++++++++++++++++++++++ +set_atlas_build_flags(AtlasObject) +target_include_directories(AtlasObject PRIVATE ${CMAKE_SOURCE_DIR}/source) +target_link_libraries(AtlasObject + PRIVATE + ${BUILD_FLAGS_TARGET} + $<$:Boost::headers> + $<$:BOOST::headers> + Iconv::Iconv + LibXml2::LibXml2 + SDL2::SDL2 +) + +# +++++++++++++++++++++ AtlasUI ++++++++++++++++++++++++++++ +if(NOT without-pch) + add_pch(TARGET AtlasUI PCH_DIR ${PROJECT_SOURCE_DIR}/AtlasUI/Misc) +else() + target_compile_definitions(AtlasUI PRIVATE CONFIG_ENABLE_PCH=0) + set_target_properties(AtlasUI PROPERTIES + DISABLE_PRECOMPILE_HEADERS TRUE + ) + target_include_directories(AtlasUI + BEFORE PRIVATE + ${PROJECT_SOURCE_DIR}/AtlasUI/Misc + ) +endif() + +set_atlas_build_flags(AtlasUI) + +target_include_directories(AtlasUI PRIVATE ${CMAKE_SOURCE_DIR}/source/) +target_link_libraries(AtlasUI + PRIVATE + ${BUILD_FLAGS_TARGET} + LibXml2::LibXml2 + Iconv::Iconv + $<$:Boost::headers> + $<$:BOOST::headers> + SDL2::SDL2 + ZLIB::ZLIB + AtlasObject + $<$:X11::X11> + wxWidgets::wxWidgets +) +target_compile_definitions(AtlasUI + PRIVATE + $<$:wxNO_REQUIRE_LITERAL_MSGIDS> +) + +# +++++++++++++++++++++ ActorEditor ++++++++++++++++++++++++ +target_include_directories(ActorEditor + PRIVATE + ${PROJECT_SOURCE_DIR}/ +) +target_link_libraries(ActorEditor + PRIVATE + ${BUILD_FLAGS_TARGET} + $<$>:AtlasObject> + AtlasUI +) +target_link_options(ActorEditor + PRIVATE + $<$,$>:/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df'> + $<$,$>:/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df'> + $<$:-arch ${MACOS_ARCH}> +) +target_compile_options(ActorEditor + PRIVATE + $<$:-arch ${MACOS_ARCH}> +) + +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_target_properties(ActorEditor PROPERTIES + XCODE_ATTRIBUTE_ARCHS ${MACOS_ARCH} + XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET $<$:${macosx-version-min}> + ) +endif() + +# get_target_property(win32 ActorEditor WIN32_EXECUTABLE) +# get_target_property(macos ActorEditor MACOSX_BUNDLE) +# file(GENERATE OUTPUT debugexpr.txt CONTENT "${win32} ${macos}" TARGET ActorEditor) +# include(CMakePrintHelpers) +# cmake_print_properties(TARGETS AtlasUI +# PROPERTIES +# # INCLUDE_DIRECTORIES +# # LINK_LIBRARIES +# # COMPILE_OPTIONS +# # COMPILE_DEFINITIONS +# # WIN32_EXECUTABLE +# # MACOSX_BUNDLE +# # IMPORTED_LOCATION +# # INTERFACE_INCLUDE_DIRECTORIES +# # CXX_EXTENSIONS +# # CXX_STANDARD_REQUIRED +# )