diff --git a/.github/workflows/shared-build.yml b/.github/workflows/shared-build.yml index fa75431b..c1778b2a 100644 --- a/.github/workflows/shared-build.yml +++ b/.github/workflows/shared-build.yml @@ -139,8 +139,11 @@ jobs: run: | cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} # Copy libraries - cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.so.0 '${{github.workspace}}/install/' - cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.so.1 '${{github.workspace}}/install/' + mkdir ${{github.workspace}}/package + cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.so.0 '${{github.workspace}}/package/' + cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.so.1 '${{github.workspace}}/package/' + if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/. '${{github.workspace}}/package'; fi + if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/. '${{github.workspace}}/package'; fi ### # Artifacts @@ -151,7 +154,7 @@ jobs: name: out-linux-${{matrix.architecture.name}} if-no-files-found: error path: - ${{github.workspace}}/install + ${{github.workspace}}/package ########################## # @@ -306,8 +309,11 @@ jobs: # Install to the directory defined in CMAKE_INSTALL_PREFIX run: | cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/install' - Copy-Item '${{github.workspace}}/thirdparties/soft-oal/install/bin/*.dll' -Destination '${{github.workspace}}/install' + New-Item -ItemType Directory '${{github.workspace}}/package' + Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/package' + Copy-Item '${{github.workspace}}/thirdparties/soft-oal/install/bin/*.dll' -Destination '${{github.workspace}}/package' + if (Test-Path ${{github.workspace}}/install/bin) { Copy-Item '${{github.workspace}}/install/bin/*' -Include '*.dll','*.exe' -Destination '${{github.workspace}}/package' } + if (Test-Path ${{github.workspace}}/install/lib) { Copy-Item '${{github.workspace}}/install/lib/*' -Include '*.dll','*.exe' -Destination '${{github.workspace}}/package' } ### # Artifact @@ -318,15 +324,15 @@ jobs: name: out-windows-${{matrix.architecture.name}} if-no-files-found: error path: | - ${{github.workspace}}/install - !${{github.workspace}}/install/**/*.pdb + ${{github.workspace}}/package + !${{github.workspace}}/package/**/*.pdb - uses: actions/upload-artifact@v4 with: name: out-windows-${{matrix.architecture.name}}-pdb if-no-files-found: error path: | - ${{github.workspace}}/install + ${{github.workspace}}/package ########################## # @@ -447,8 +453,11 @@ jobs: run: | cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} # Create hard-link and copy symbolic links - cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.0.dylib '${{github.workspace}}/install/' - cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.1.dylib '${{github.workspace}}/install/' + mkdir ${{github.workspace}}/package + cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.0.dylib '${{github.workspace}}/package/' + cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.1.dylib '${{github.workspace}}/package/' + if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/. '${{github.workspace}}/package'; fi + if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/. '${{github.workspace}}/package'; fi ### # Artifacts @@ -459,4 +468,4 @@ jobs: name: out-macos-${{matrix.architecture.name}} if-no-files-found: error path: - ${{github.workspace}}/install + ${{github.workspace}}/package diff --git a/CMakeLists.txt b/CMakeLists.txt index b68c0e40..58551cc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,10 @@ option(USE_INTERNAL_JPEG "If set, use bundled libjpeg." ${USE_INTERNAL_LIBS}) option(USE_INTERNAL_MAD "If set, use bundled libmad." ${USE_INTERNAL_LIBS}) option(USE_INTERNAL_ZLIB "If set, use bundled zlib." ${USE_INTERNAL_LIBS}) +# Installation directory +set(CMAKE_INSTALL_BINDIR bin CACHE PATH "Binary dir") +set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Library dir") +include(GNUInstallDirs) if(TARGET_GAME_TYPE) message(SEND_ERROR "TARGET_GAME_TYPE is now unsupported, it is now done at runtime.") @@ -138,10 +142,10 @@ set_target_properties(omohaaded PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) if (MSVC) target_link_options(omohaaded PRIVATE "/MANIFEST:NO") - INSTALL(FILES $ DESTINATION "./" OPTIONAL) + INSTALL(FILES $ DESTINATION bin OPTIONAL) endif() -INSTALL(TARGETS omohaaded DESTINATION "./") +INSTALL(TARGETS omohaaded) if (NOT BUILD_NO_CLIENT) ## Client app @@ -212,10 +216,10 @@ if (NOT BUILD_NO_CLIENT) if (MSVC) target_link_options(openmohaa PRIVATE "/MANIFEST:NO") - INSTALL(FILES $ DESTINATION "./" OPTIONAL) + INSTALL(FILES $ DESTINATION bin OPTIONAL) endif() - INSTALL(TARGETS openmohaa DESTINATION "./") + INSTALL(TARGETS openmohaa) endif() # Launcher diff --git a/code/Launcher/CMakeLists.txt b/code/Launcher/CMakeLists.txt index 68fa6abd..6dd6f509 100644 --- a/code/Launcher/CMakeLists.txt +++ b/code/Launcher/CMakeLists.txt @@ -18,7 +18,7 @@ function (create_launcher name type) target_compile_features(openmohaa_launcher_${name} PRIVATE cxx_std_17) set_target_properties(openmohaa_launcher_${name} PROPERTIES OUTPUT_NAME "launch_openmohaa_${name}${TARGET_BIN_SUFFIX}") - INSTALL(TARGETS openmohaa_launcher_${name} DESTINATION "./") + INSTALL(TARGETS openmohaa_launcher_${name}) #add_executable(omohaaded_launcher_${name} ${LAUNCHER_SOURCES}) #target_include_directories(omohaaded_launcher_${name} PUBLIC "../qcommon") @@ -26,7 +26,7 @@ function (create_launcher name type) #target_compile_features(omohaaded_launcher_${name} PRIVATE cxx_std_17) #set_target_properties(omohaaded_launcher_${name} PROPERTIES OUTPUT_NAME "launch_omohaaded_${name}${TARGET_BIN_SUFFIX}") # - #INSTALL(TARGETS omohaaded_launcher_${name} DESTINATION "./") + #INSTALL(TARGETS omohaaded_launcher_${name}) endfunction() create_launcher(base 0) diff --git a/code/cgame/CMakeLists.txt b/code/cgame/CMakeLists.txt index fd6974b8..1f6ef8ed 100644 --- a/code/cgame/CMakeLists.txt +++ b/code/cgame/CMakeLists.txt @@ -27,16 +27,11 @@ target_compile_features(cgame PUBLIC cxx_nullptr) target_compile_features(cgame PUBLIC c_variadic_macros) target_link_libraries(cgame PUBLIC qcommon) -set_target_properties(cgame PROPERTIES PREFIX "${TARGET_PLATFORM_PREFIX}") +set_target_properties(cgame PROPERTIES PREFIX "") set_target_properties(cgame PROPERTIES OUTPUT_NAME "cgame${TARGET_BIN_SUFFIX}") -set_target_properties(cgame PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TARGET_BASE_GAME}") -INSTALL( - TARGETS cgame - LIBRARY DESTINATION "${TARGET_BASE_GAME}" - RUNTIME DESTINATION "${TARGET_BASE_GAME}" -) +INSTALL(TARGETS cgame) if(MSVC) - INSTALL(FILES $ DESTINATION "${TARGET_BASE_GAME}" OPTIONAL) + INSTALL(FILES $ DESTINATION bin OPTIONAL) endif() \ No newline at end of file diff --git a/code/fgame/CMakeLists.txt b/code/fgame/CMakeLists.txt index 35524cd6..950ac59e 100644 --- a/code/fgame/CMakeLists.txt +++ b/code/fgame/CMakeLists.txt @@ -66,16 +66,11 @@ target_compile_features(fgame PUBLIC cxx_nullptr) target_compile_features(fgame PUBLIC c_variadic_macros) target_link_libraries(fgame PUBLIC qcommon) -set_target_properties(fgame PROPERTIES PREFIX "${TARGET_PLATFORM_PREFIX}") +set_target_properties(fgame PROPERTIES PREFIX "") set_target_properties(fgame PROPERTIES OUTPUT_NAME "game${TARGET_BIN_SUFFIX}") -set_target_properties(fgame PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TARGET_BASE_GAME}") -INSTALL( - TARGETS fgame - LIBRARY DESTINATION "${TARGET_BASE_GAME}" - RUNTIME DESTINATION "${TARGET_BASE_GAME}" -) +INSTALL(TARGETS fgame) if(MSVC) - INSTALL(FILES $ DESTINATION "${TARGET_BASE_GAME}" OPTIONAL) + INSTALL(FILES $ DESTINATION bin OPTIONAL) endif()