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..f774bbf3db 100644 --- a/cmake/0ad-Functions.cmake +++ b/cmake/0ad-Functions.cmake @@ -1,3 +1,50 @@ 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..8a6f61f117 --- /dev/null +++ b/cmake/PrecompiledHeader.cmake @@ -0,0 +1,42 @@ +function(precompile_header _target _header _source) + set(single_args FORCE_INCLUDE) + cmake_parse_arguments(args "" "${single_args}" "" ${ARGN}) + + get_target_property(target_compiler_FLAGS ${_target} COMPILE_OPTIONS) + get_target_property(target_bindir ${_target} BINARY_DIR) + set(gcc_out ${target_bindir}/${_header}.gch) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_COMPILER_ID STREQUAL "MSVC") + # message(STATUS "Precompiled: ${_target} ${_header} ${_source}") + # target_compile_options(${_target} + # PRIVATE + # /Yu${_header} + # ) + # set_source_files_properties(${_source}/precompiled.cpp PROPERTIES + # COMPILE_FLAGS + # /Yc${_header} + # ) + # if(${args_FORCE_INCLUDE}) + # set_source_files_properties(${_source}/precompiled.cpp + # PROPERTIES + # COMPILE_FLAGS + # /FI${_header} + # ) + # endif() + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU|AppleClang") + message(STATUS "C++") + add_custom_command( + OUTPUT "${gcc_out}" + COMMAND ${CMAKE_CXX_COMPILER} "${target_compiler_FLAGS}" -x c++-header -o "${gcc_out}" -c "${_header}" + DEPENDS "${_header}" + COMMENT "Precompiling ${_header} for ${_target} (C++)" + ) + elseif(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|AppleClang") + message(STATUS "C") + add_custom_command( + OUTPUT "${gcc_out}" + COMMAND ${CMAKE_C_COMPILER} "${target_compiler_FLAGS}" -x c-header -o "${gcc_out}" -c "${_header}" + DEPENDS "${_header}" + COMMENT "Precompiling ${_header} for ${_target} (C)" + ) + endif() +endfunction() diff --git a/source/tools/atlas/AtlasFrontends/CMakeLists.txt b/source/tools/atlas/AtlasFrontends/CMakeLists.txt new file mode 100644 index 0000000000..6d0517ff70 --- /dev/null +++ b/source/tools/atlas/AtlasFrontends/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..58fcc4fc6b --- /dev/null +++ b/source/tools/atlas/AtlasObject/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +target_sources(AtlasObject + PRIVATE + AtlasObject.h + AtlasObjectImpl.cpp + AtlasObjectImpl.h + AtlasObjectJS.cpp + AtlasObjectText.cpp + AtlasObjectText.h + AtlasObjectXML.cpp + JSONSpiritInclude.h +) + +add_subdirectory(tests/) diff --git a/source/tools/atlas/AtlasObject/tests/CMakeLists.txt b/source/tools/atlas/AtlasObject/tests/CMakeLists.txt new file mode 100644 index 0000000000..2f3173c475 --- /dev/null +++ b/source/tools/atlas/AtlasObject/tests/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..df0082f8cc --- /dev/null +++ b/source/tools/atlas/AtlasUI/ActorEditor/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..297766c744 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..6d12a9034d --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/Buttons/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..5081f36ea4 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..ad43e87a21 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/Canvas/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..eafddcfd1f --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/ColorDialog/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..4cc16926b8 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/DraggableListCtrl/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..9c7dfe8612 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/EditableListCtrl/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..b5f0d30c66 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/FileHistory/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..6df35beca3 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/HighResTimer/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..958e3216dc --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/MapDialog/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..112bf6522f --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/MapResizeDialog/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..49144e19de --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/SnapSplitterWindow/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..1e0098a1e5 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..922bd8c202 --- /dev/null +++ b/source/tools/atlas/AtlasUI/CustomControls/Windows/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..6477941f9e --- /dev/null +++ b/source/tools/atlas/AtlasUI/General/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..cc0b3d829c --- /dev/null +++ b/source/tools/atlas/AtlasUI/Misc/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..2df4b292c4 --- /dev/null +++ b/source/tools/atlas/AtlasUI/Misc/Graphics/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..606f9fa2c9 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..7294d16d36 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..604cd73157 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinema/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..f7400ae25d --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Common/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..e39d91e6d4 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..5b3f29dd41 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..61a251ebc0 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..3554f711bc --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..5edc81d8f1 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..6fa981c8f5 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..6a135522b1 --- /dev/null +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.25.1...4.0.0) + +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..dbcf23d2ce --- /dev/null +++ b/source/tools/atlas/CMakeLists.txt @@ -0,0 +1,164 @@ +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 REQUIRED) +find_package(ZLIB REQUIRED) +find_package(LibXml2 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} + ) +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 +# )