Partially unify Linux/Windows install
Also partially make cmake --install --prefix work on Linux Hopefully this doesn't break anything except the way Debian forces the binaries into /usr/bin/games, which they can now do in the normal CMake way instead.
This commit is contained in:
@@ -31,6 +31,12 @@ if [[ $CI_OPENMW_USE_STATIC_DEPS ]]; then
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ $OPENMW_LOCAL_INSTALL ]]; then
|
||||
CMAKE_CONF_OPTS+=(
|
||||
-DOPENMW_LOCAL_INSTALL=ON
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ $CI_CLANG_TIDY ]]; then
|
||||
CMAKE_CONF_OPTS+=(
|
||||
-DCMAKE_CXX_CLANG_TIDY=${CMAKE_CXX_CLANG_TIDY}
|
||||
|
||||
+24
-43
@@ -12,8 +12,6 @@ set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
option(OPENMW_GL4ES_MANUAL_INIT "Manually initialize gl4es. This is more reliable on platforms without a windowing system. Requires gl4es to be configured with -DNOEGL=ON -DNO_LOADER=ON -DNO_INIT_CONSTRUCTOR=ON." OFF)
|
||||
if(OPENMW_GL4ES_MANUAL_INIT)
|
||||
add_compile_definitions(OPENMW_GL4ES_MANUAL_INIT)
|
||||
@@ -227,13 +225,27 @@ if (MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
set(CMAKE_INSTALL_SYSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}/openmw")
|
||||
|
||||
# Set up common paths
|
||||
if (UNIX AND NOT APPLE)
|
||||
set(OPENMW_LOCAL_INSTALL_DEFAULT OFF)
|
||||
else()
|
||||
set(OPENMW_LOCAL_INSTALL_DEFAULT ON)
|
||||
endif()
|
||||
option(OPENMW_LOCAL_INSTALL "Local install of OpenMW instead of Global" ${OPENMW_LOCAL_INSTALL_DEFAULT})
|
||||
if (OPENMW_LOCAL_INSTALL)
|
||||
set(CMAKE_INSTALL_BINDIR ".")
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
set(CMAKE_INSTALL_DATADIR ".")
|
||||
set(CMAKE_INSTALL_SYSCONFDIR ".")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
set(OPENMW_RESOURCE_FILES "../Resources/resources" CACHE PATH "location of OpenMW resources files")
|
||||
elseif(UNIX)
|
||||
# Paths
|
||||
SET(BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Where to install binaries")
|
||||
SET(LIBDIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "Where to install libraries")
|
||||
SET(DATAROOTDIR "${CMAKE_INSTALL_DATAROOTDIR}" CACHE PATH "Sets the root of data directories to a non-default location")
|
||||
SET(GLOBAL_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/games/" CACHE PATH "Set data path prefix")
|
||||
SET(DATADIR "${GLOBAL_DATA_PATH}/openmw" CACHE PATH "Sets the openmw data directories to a non-default location")
|
||||
@@ -611,6 +623,14 @@ if (APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
if (OPENMW_LOCAL_INSTALL AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
|
||||
# file(RELATIVE_PATH ...) can't handle pure lexical relativity, but cmake_path only came with 3.20.0
|
||||
cmake_path(RELATIVE_PATH CMAKE_INSTALL_LIBDIR BASE_DIRECTORY "${CMAKE_INSTALL_BINDIR}" OUTPUT_VARIABLE origin_relative_libdir)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN/${origin_relative_libdir}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Extern
|
||||
|
||||
add_subdirectory (extern/osg-ffmpeg-videoplayer)
|
||||
@@ -1027,41 +1047,6 @@ elseif(NOT APPLE)
|
||||
else(WIN32)
|
||||
# Linux installation
|
||||
|
||||
# Install binaries
|
||||
IF(BUILD_OPENMW)
|
||||
install(TARGETS openmw DESTINATION "${BINDIR}")
|
||||
ENDIF(BUILD_OPENMW)
|
||||
IF(BUILD_LAUNCHER)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/openmw-launcher" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_LAUNCHER)
|
||||
IF(BUILD_BSATOOL)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/bsatool" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_BSATOOL)
|
||||
IF(BUILD_ESMTOOL)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/esmtool" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_ESMTOOL)
|
||||
IF(BUILD_NIFTEST)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/niftest" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_NIFTEST)
|
||||
IF(BUILD_MWINIIMPORTER)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/openmw-iniimporter" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_MWINIIMPORTER)
|
||||
IF(BUILD_ESSIMPORTER)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/openmw-essimporter" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_ESSIMPORTER)
|
||||
IF(BUILD_OPENCS)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/openmw-cs" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_OPENCS)
|
||||
IF(BUILD_WIZARD)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/openmw-wizard" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_WIZARD)
|
||||
if(BUILD_NAVMESHTOOL)
|
||||
install(PROGRAMS "${INSTALL_SOURCE}/openmw-navmeshtool" DESTINATION "${BINDIR}" )
|
||||
endif()
|
||||
IF(BUILD_BULLETOBJECTTOOL)
|
||||
INSTALL(PROGRAMS "${INSTALL_SOURCE}/openmw-bulletobjecttool" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_BULLETOBJECTTOOL)
|
||||
|
||||
# Install icon and desktop file
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/org.openmw.launcher.desktop" DESTINATION "${DATAROOTDIR}/applications" COMPONENT "openmw")
|
||||
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "${ICONDIR}" COMPONENT "openmw")
|
||||
@@ -1076,10 +1061,6 @@ elseif(NOT APPLE)
|
||||
INSTALL(FILES "${INSTALL_SOURCE}/openmw.cfg.install" DESTINATION "${SYSCONFDIR}" RENAME "openmw.cfg" COMPONENT "openmw")
|
||||
INSTALL(FILES "${INSTALL_SOURCE}/gamecontrollerdb.txt" DESTINATION "${SYSCONFDIR}" COMPONENT "openmw")
|
||||
|
||||
IF(BUILD_OPENCS)
|
||||
INSTALL(FILES "${INSTALL_SOURCE}/defaults-cs.bin" DESTINATION "${SYSCONFDIR}" COMPONENT "opencs")
|
||||
ENDIF(BUILD_OPENCS)
|
||||
|
||||
# Install resources
|
||||
INSTALL(DIRECTORY "${INSTALL_SOURCE}/resources" DESTINATION "${DATADIR}" COMPONENT "Resources")
|
||||
endif(WIN32)
|
||||
|
||||
@@ -22,8 +22,8 @@ if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_link_libraries(bsatool gcov)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
install(TARGETS bsatool RUNTIME DESTINATION ".")
|
||||
if (NOT APPLE)
|
||||
install(TARGETS bsatool)
|
||||
endif()
|
||||
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
|
||||
@@ -19,8 +19,8 @@ if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_link_libraries(openmw-bulletobjecttool gcov)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
install(TARGETS openmw-bulletobjecttool RUNTIME DESTINATION ".")
|
||||
if (NOT APPLE)
|
||||
install(TARGETS openmw-bulletobjecttool)
|
||||
endif()
|
||||
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
|
||||
@@ -29,8 +29,8 @@ if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_link_libraries(esmtool gcov)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
install(TARGETS esmtool RUNTIME DESTINATION ".")
|
||||
if (NOT APPLE)
|
||||
install(TARGETS esmtool)
|
||||
endif()
|
||||
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
|
||||
@@ -46,9 +46,9 @@ if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_link_libraries(openmw-essimporter gcov)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
INSTALL(TARGETS openmw-essimporter RUNTIME DESTINATION ".")
|
||||
endif(WIN32)
|
||||
if (NOT APPLE)
|
||||
INSTALL(TARGETS openmw-essimporter)
|
||||
endif()
|
||||
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw-essimporter PRIVATE
|
||||
|
||||
@@ -62,9 +62,9 @@ openmw_add_executable(openmw-launcher
|
||||
|
||||
add_dependencies(openmw-launcher qm-files)
|
||||
|
||||
if (WIN32)
|
||||
INSTALL(TARGETS openmw-launcher RUNTIME DESTINATION ".")
|
||||
endif (WIN32)
|
||||
if (NOT APPLE)
|
||||
INSTALL(TARGETS openmw-launcher)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(openmw-launcher
|
||||
SDL2::SDL2
|
||||
|
||||
@@ -22,9 +22,9 @@ if (WIN32)
|
||||
target_sources(openmw-iniimporter PRIVATE ${CMAKE_SOURCE_DIR}/files/windows/other-apps.manifest)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
INSTALL(TARGETS openmw-iniimporter RUNTIME DESTINATION ".")
|
||||
endif(WIN32)
|
||||
if (NOT APPLE)
|
||||
INSTALL(TARGETS openmw-iniimporter)
|
||||
endif()
|
||||
|
||||
if (MINGW)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode")
|
||||
|
||||
@@ -29,8 +29,8 @@ if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_link_libraries(openmw-navmeshtool gcov)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
install(TARGETS openmw-navmeshtool RUNTIME DESTINATION ".")
|
||||
if (NOT APPLE)
|
||||
install(TARGETS openmw-navmeshtool)
|
||||
endif()
|
||||
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
|
||||
@@ -21,8 +21,8 @@ if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_link_libraries(niftest gcov)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
install(TARGETS niftest RUNTIME DESTINATION ".")
|
||||
if (NOT APPLE)
|
||||
install(TARGETS niftest)
|
||||
endif()
|
||||
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
|
||||
@@ -249,17 +249,9 @@ if (WIN32)
|
||||
target_sources(openmw-cs PRIVATE ${CMAKE_SOURCE_DIR}/files/windows/other-apps.manifest)
|
||||
endif()
|
||||
|
||||
if (WIN32 AND BUILD_OPENCS)
|
||||
INSTALL(TARGETS openmw-cs RUNTIME DESTINATION ".")
|
||||
|
||||
get_generator_is_multi_config(multi_config)
|
||||
if (multi_config)
|
||||
SET(INSTALL_SOURCE "${OpenMW_BINARY_DIR}/$<CONFIG>")
|
||||
else ()
|
||||
SET(INSTALL_SOURCE "${OpenMW_BINARY_DIR}")
|
||||
endif ()
|
||||
|
||||
INSTALL(FILES "${INSTALL_SOURCE}/defaults-cs.bin" DESTINATION ".")
|
||||
if (NOT APPLE AND BUILD_OPENCS)
|
||||
INSTALL(TARGETS openmw-cs)
|
||||
INSTALL(FILES "$<TARGET_FILE_DIR:openmw-cs>/defaults-cs.bin" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
|
||||
@@ -271,6 +271,6 @@ if (BUILD_WITH_CODE_COVERAGE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32 AND BUILD_OPENMW)
|
||||
INSTALL(TARGETS openmw RUNTIME DESTINATION ".")
|
||||
if (NOT APPLE AND BUILD_OPENMW)
|
||||
INSTALL(TARGETS openmw)
|
||||
endif()
|
||||
|
||||
@@ -86,18 +86,14 @@ if (WIN32)
|
||||
target_sources(openmw-wizard PRIVATE ${CMAKE_SOURCE_DIR}/files/windows/other-apps.manifest)
|
||||
endif()
|
||||
|
||||
if(DPKG_PROGRAM)
|
||||
INSTALL(TARGETS openmw-wizard RUNTIME DESTINATION games COMPONENT openmw-wizard)
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_compile_options(openmw-wizard PRIVATE --coverage)
|
||||
target_link_libraries(openmw-wizard gcov)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
INSTALL(TARGETS openmw-wizard RUNTIME DESTINATION ".")
|
||||
endif(WIN32)
|
||||
if (NOT APPLE)
|
||||
INSTALL(TARGETS openmw-wizard)
|
||||
endif()
|
||||
|
||||
if(USE_QT)
|
||||
set_property(TARGET openmw-wizard PROPERTY AUTOMOC ON)
|
||||
|
||||
Reference in New Issue
Block a user