From 526c9a1d02bebb297c181917241a1a4ddb0ee0d3 Mon Sep 17 00:00:00 2001 From: Jake Smarter Date: Mon, 4 Mar 2024 00:00:00 +0000 Subject: [PATCH] =?UTF-8?q?Enable=20separate=20building=20of=20TFE=20and?= =?UTF-8?q?=20the=20=E2=80=9CAdjustableHud=E2=80=9D=20mod:=20*=20`CMakeLis?= =?UTF-8?q?ts.txt`:=20Add=20`ENABLE=5FTFE`=20and=20`ENABLE=5FADJUSTABLEHOD?= =?UTF-8?q?=5FMOD`=20=20=20=20configuration=20options=20to=20for=20package?= =?UTF-8?q?=20maintainers=20to=20be=20able=20to=20build=20separate=20=20?= =?UTF-8?q?=20=20packages=20*=20Add=20AppStream=20component=20meta=20data?= =?UTF-8?q?=20for=20the=20built=E2=80=91in=20=E2=80=9CAdjustableHud?= =?UTF-8?q?=E2=80=9D=20mod=20*=20`README.md`:=20Add=20info=20on=20packagin?= =?UTF-8?q?g=20TFE=20to=20*=20`ProjectStructure.md`:=20Add=20`Mods`=20dire?= =?UTF-8?q?ctory=20and=20description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 215 ++++++++++-------- ProjectStructure.md | 3 + README.md | 8 + .../Mods/TFE/AdjustableHud/CMakeLists.txt | 41 ++++ ...eengine.tfe.Mod.AdjustableHud.metainfo.xml | 38 ++++ 5 files changed, 209 insertions(+), 96 deletions(-) create mode 100644 TheForceEngine/Mods/TFE/AdjustableHud/CMakeLists.txt create mode 100644 TheForceEngine/io.github.theforceengine.tfe.Mod.AdjustableHud.metainfo.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 91c9660a3..eee9b04da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,116 +46,139 @@ endif() include(GNUInstallDirs) ## Options +option(ENABLE_TFE "Enable building “The Force Engine”" ON) option(DISABLE_SYSMIDI "Disable System-MIDI Output" OFF) option(ENABLE_EDITOR "Enable TFE Editor" OFF) option(ENABLE_FORCE_SCRIPT "Enable Force Script" OFF) - -add_executable(tfe) -set_target_properties(tfe PROPERTIES OUTPUT_NAME "theforceengine") - -if(LINUX) - find_package(PkgConfig REQUIRED) - find_package(Threads REQUIRED) - find_package(SDL2 2.0.20 REQUIRED) - pkg_check_modules(SDL2_IMAGE REQUIRED SDL2_image) - pkg_check_modules(GLEW REQUIRED glew) - set(OpenGL_GL_PREFERENCE GLVND) - find_package(OpenGL REQUIRED) - target_include_directories(tfe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) - target_include_directories(tfe PRIVATE ${SDL2_INCLUDE_DIRS}) - target_include_directories(tfe PRIVATE ${SDL2_IMAGE_INCLUDE_DIRS}) - target_link_libraries(tfe PRIVATE - ${OPENGL_LIBRARIES} - ${GLEW_LIBRARIES} - ${SDL2_LIBRARIES} - ${SDL2_IMAGE_LIBRARIES} - ) - - if(NOT DISABLE_SYSMIDI) - pkg_check_modules(RTMIDI REQUIRED rtmidi>=5.0.0) - target_link_libraries(tfe PRIVATE ${RTMIDI_LIBRARIES}) +option(ENABLE_ADJUSTABLEHUD_MOD "Install the build‑in “AdjustableHud mod” with TFE" ON) + +if(ENABLE_TFE) + add_executable(tfe) + set_target_properties(tfe PROPERTIES OUTPUT_NAME "theforceengine") + + if(LINUX) + find_package(PkgConfig REQUIRED) + find_package(Threads REQUIRED) + find_package(SDL2 2.0.20 REQUIRED) + pkg_check_modules(SDL2_IMAGE REQUIRED SDL2_image) + pkg_check_modules(GLEW REQUIRED glew) + set(OpenGL_GL_PREFERENCE GLVND) + find_package(OpenGL REQUIRED) + target_include_directories(tfe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(tfe PRIVATE ${SDL2_INCLUDE_DIRS}) + target_include_directories(tfe PRIVATE ${SDL2_IMAGE_INCLUDE_DIRS}) + target_link_libraries(tfe PRIVATE + ${OPENGL_LIBRARIES} + ${GLEW_LIBRARIES} + ${SDL2_LIBRARIES} + ${SDL2_IMAGE_LIBRARIES} + ) + + if(NOT DISABLE_SYSMIDI) + pkg_check_modules(RTMIDI REQUIRED rtmidi>=5.0.0) + target_link_libraries(tfe PRIVATE ${RTMIDI_LIBRARIES}) + endif() + + # set up build directory to be able to run TFE immediately: symlink + # the necessary support file directories into the build env. + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Captions) + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Documentation) + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Fonts) + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Mods) + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Shaders) + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/SoundFonts) + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/UI_Images) + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/UI_Text) + execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/EditorDef) + include(CreateGitVersionH.cmake) + create_git_version_h() endif() - # set up build directory to be able to run TFE immediately: symlink - # the necessary support file directories into the build env. - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Captions) - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Documentation) - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Fonts) - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Mods) - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/Shaders) - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/SoundFonts) - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/UI_Images) - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/UI_Text) - execute_process(COMMAND ln -sf ${CMAKE_SOURCE_DIR}/TheForceEngine/EditorDef) - include(CreateGitVersionH.cmake) - create_git_version_h() -endif() + if(COMPILER_ENABLE_AUTOZERO) + message(STATUS "enabled -ftrivial-auto-var-init=zero") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftrivial-auto-var-init=zero") + endif() -if(COMPILER_ENABLE_AUTOZERO) - message(STATUS "enabled -ftrivial-auto-var-init=zero") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftrivial-auto-var-init=zero") -endif() + if(DISABLE_SYSMIDI) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOSYSMIDI") + endif() + if(ENABLE_EDITOR) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_EDITOR") + endif() + if(ENABLE_FORCE_SCRIPT) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_FORCE_SCRIPT") + endif() -if(DISABLE_SYSMIDI) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOSYSMIDI") -endif() -if(ENABLE_EDITOR) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_EDITOR") -endif() -if(ENABLE_FORCE_SCRIPT) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_FORCE_SCRIPT") -endif() + if(ENABLE_FORCE_SCRIPT) + target_include_directories(tfe PRIVATE "TheForceEngine/TFE_ForceScript/Angelscript/angelscript/include") + target_include_directories(tfe PRIVATE "TheForceEngine/TFE_ForceScript/Angelscript/add_on") + endif() + target_include_directories(tfe PRIVATE TheForceEngine) -if(ENABLE_FORCE_SCRIPT) - target_include_directories(tfe PRIVATE "TheForceEngine/TFE_ForceScript/Angelscript/angelscript/include") - target_include_directories(tfe PRIVATE "TheForceEngine/TFE_ForceScript/Angelscript/add_on") + add_subdirectory(TheForceEngine/) endif() -target_include_directories(tfe PRIVATE TheForceEngine) - - -add_subdirectory(TheForceEngine/) - ### installation ### -# Main binary -install(TARGETS tfe - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" -) - -# Support data -install(DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Captions" - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Documentation" - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/UI_Text" - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/UI_Images" - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/EditorDef" - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Shaders" - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/SoundFonts" - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Fonts" - "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Mods" - DESTINATION "${CMAKE_INSTALL_DATADIR}" - FILE_PERMISSIONS - OWNER_READ OWNER_WRITE - GROUP_READ - WORLD_READ - DIRECTORY_PERMISSIONS - OWNER_READ OWNER_EXECUTE OWNER_WRITE - GROUP_READ GROUP_EXECUTE GROUP_WRITE - WORLD_READ WORLD_EXECUTE -) - -# Linux .desktop files -if(LINUX) - install( - FILES "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/io.github.theforceengine.tfe.desktop" DESTINATION "share/applications" +if(ENABLE_TFE) + # Main binary + install(TARGETS tfe + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" ) - install( - FILES "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/io.github.theforceengine.tfe.png" DESTINATION "${TFE_ICONDIR}/256x256/apps" + + # Support data + install(DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Captions" + "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Documentation" + "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/UI_Text" + "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/UI_Images" + "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/EditorDef" + "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Shaders" + "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/SoundFonts" + "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/Fonts" + DESTINATION "${CMAKE_INSTALL_DATADIR}" + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE + GROUP_READ + WORLD_READ + DIRECTORY_PERMISSIONS + OWNER_READ OWNER_EXECUTE OWNER_WRITE + GROUP_READ GROUP_EXECUTE GROUP_WRITE + WORLD_READ WORLD_EXECUTE ) - install( - FILES "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/io.github.theforceengine.tfe.metainfo.xml" DESTINATION "share/metainfo" + # Always install the “Mods” directory but not always the “AdjustableHud” mod + install(DIRECTORY + DESTINATION "${CMAKE_INSTALL_DATADIR}/TheForceEngine/Mods" + DIRECTORY_PERMISSIONS + OWNER_READ OWNER_EXECUTE OWNER_WRITE + GROUP_READ GROUP_EXECUTE GROUP_WRITE + WORLD_READ WORLD_EXECUTE ) + + # Linux .desktop files + if(LINUX) + install( + FILES "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/io.github.theforceengine.tfe.desktop" DESTINATION "share/applications" + ) + install( + FILES "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/io.github.theforceengine.tfe.png" DESTINATION "${TFE_ICONDIR}/256x256/apps" + ) + install( + FILES "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/io.github.theforceengine.tfe.metainfo.xml" + DESTINATION "share/metainfo" + ) + endif() +endif() + +if(ENABLE_ADJUSTABLEHUD_MOD) + add_subdirectory(TheForceEngine/Mods/TFE/AdjustableHud) + + if(LINUX) + install( + FILES "${CMAKE_CURRENT_SOURCE_DIR}/TheForceEngine/io.github.theforceengine.tfe.Mod.AdjustableHud.metainfo.xml" + DESTINATION "share/metainfo" + ) + endif() endif() diff --git a/ProjectStructure.md b/ProjectStructure.md index ae7086282..693233d8c 100644 --- a/ProjectStructure.md +++ b/ProjectStructure.md @@ -91,3 +91,6 @@ The core system module, this covers the logging system, thread management, non-g ### TFE_UI The low-level UI system used by TFE for the System UI. This is built on top of imGUI, which is also included. This adds extra support such as markdown and file dialogs. + +### Mods +The directory where mods go. Each mod must be placed in a separate sub‑directory. diff --git a/README.md b/README.md index 146a3cc36..c484d8f29 100644 --- a/README.md +++ b/README.md @@ -83,3 +83,11 @@ __sudo make install__ ##### Launch * Start the Engine by clicking on the __"The Force Engine"__ Desktop icon or by running __"theforceengine"__ in a shell. + +## Packaging +TFE comes with the build‑in “[AdjustableHud](TheForceEngine/Mods/TFE/AdjustableHud)” mod. Package maintainers may wish and are encouraged to package “AdjustableHud” into a separate *required* or *recommended* package. + +By default TFE builds and installs with the “AdjustableHud” mod. If you do not want to install the “AdjustableHud” mod, for example when building separate packages, configure the CMake build with the `-DENABLE_ADJUSTABLEHUD_MOD=OFF` option. If you want to install the “AdjustableHud” mod only use the `-DENABLE_TFE=OFF` option. + +### Freedesktop +On freedesktop compliant systems package maintainers are encouraged to use the provided [AppStream meta data file](TheForceEngine/io.github.theforceengine.tfe.Mod.AdjustableHud.metadata.xml) when packing the “AdjustableHud” mod into a separate package. diff --git a/TheForceEngine/Mods/TFE/AdjustableHud/CMakeLists.txt b/TheForceEngine/Mods/TFE/AdjustableHud/CMakeLists.txt new file mode 100644 index 000000000..beeab1c22 --- /dev/null +++ b/TheForceEngine/Mods/TFE/AdjustableHud/CMakeLists.txt @@ -0,0 +1,41 @@ +project( + AdjustableHud + HOMEPAGE_URL "https://theforceengine.github.io" + DESCRIPTION "“The Force Engine’s” built‑in “AdjustableHud” mod" +) + +add_custom_target( + ${PROJECT_NAME} + "" + SOURCES + AdjustableHud.txt + Credits.txt + HudStatusLeftAddon.bm + HudStatusLeftAddon.png + HudStatusRightAddon.bm + HudStatusRightAddon.png + BYPRODUCTS + "${CMAKE_INSTALL_DATADIR}/Mods/TFE/${PROJECT_NAME}/AdjustableHud.txt" + "${CMAKE_INSTALL_DATADIR}/Mods/TFE/${PROJECT_NAME}/Credits.txt" + "${CMAKE_INSTALL_DATADIR}/Mods/TFE/${PROJECT_NAME}/HudStatusLeftAddon.bm" + "${CMAKE_INSTALL_DATADIR}/Mods/TFE/${PROJECT_NAME}/HudStatusLeftAddon.png" + "${CMAKE_INSTALL_DATADIR}/Mods/TFE/${PROJECT_NAME}/HudStatusRightAddon.bm" + "${CMAKE_INSTALL_DATADIR}/Mods/TFE/${PROJECT_NAME}/HudStatusRightAddon.png" +) + +install( + DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + DESTINATION + "${CMAKE_INSTALL_DATADIR}/Mods/TFE" + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE + GROUP_READ + WORLD_READ + DIRECTORY_PERMISSIONS + OWNER_READ OWNER_EXECUTE OWNER_WRITE + GROUP_READ GROUP_EXECUTE GROUP_WRITE + WORLD_READ WORLD_EXECUTE + PATTERN + CMakeLists.txt EXCLUDE +) diff --git a/TheForceEngine/io.github.theforceengine.tfe.Mod.AdjustableHud.metainfo.xml b/TheForceEngine/io.github.theforceengine.tfe.Mod.AdjustableHud.metainfo.xml new file mode 100644 index 000000000..663521866 --- /dev/null +++ b/TheForceEngine/io.github.theforceengine.tfe.Mod.AdjustableHud.metainfo.xml @@ -0,0 +1,38 @@ + + + io.github.theforceengine.tfe.Mod.AdjustableHud + The Force Engine Adjustable Hud Mod + „The Force Engine“ Einstellbare Bildschirmanzeigen Modifikation + Modyfikacja „The Force Engine” ustawiania wskaźników + + Paweł “Dzierzan” Dzierżanowski + Paweł „Dzierzan“ Dzierżanowski + Paweł „Dzierzan” Dzierżanowski + https://twitter.com/Dzierzan23 + + A “The Force Engine” built‑in mod enabling adjustable floating HUD elements in “STAR WARS: Dark Forces” + Eine in „The Force Engine“ eingebaute Mod, die einstellbar bewegliche Bildschirmanzeigen in „STAR WARS: Dark Forces“ ermöglicht + W „The Force Engine” wbudowana modyfikacja, umożliwiająca ustawianie unoszących się wskaźników w „STAR WARS: Dark Forces” + CC0-1.0 + GPL-2.0 + io.github.theforceengine.tfe + https://theforceengine.github.io + https://github.com/luciusDXL/TheForceEngine/issues + https://theforceengine.github.io/Documentation.html + https://github.com/luciusDXL/TheForceEngine/tree/master/TheForceEngine/Mods/TFE/AdjustableHud + +

A “The Force Engine” built‑in mod based on the work by Paweł “Dzierzan” Dzierżanowski. The purpose of the mod is to enable the floating HUD elements in “STAR WARS: Dark Forces” to be adjustable – specifically being able to move them away from the edges of the screen on widescreen displays.

+

Eine auf der Arbeit von Paweł „Dzierzan“ Dzierżanowski basierende in „The Force Engine“ eingebaute Mod. Die Mod hat zum Zwecke die Einstellbarkeit von beweglichen Bildschirmanzeigen in “STAR WARS: Dark Forces” zu ermöglichen, insbesondere sie weg von den Rändern auf Breitbildschirmen zu bewegen.

+

Wbudowana w „The Force Engine” modyfikacja na podstawie pracy Pawła „Dzierzan” Dzierżanowskiego. Celem modyfikacji jest umożliwienie ustawienia unoszących się wskaźników w „STAR WARS: Dark Forces”, zwłaszcza móc je odsunąć od krawędzi ekranu na szerokich ekranach.

+
+ + Game + Shooter + ActionGame + + https://theforceengine.github.io + + io.github.theforceengine.tfe + offline-only + +