mirror of
https://github.com/ModOrganizer2/cmake_common.git
synced 2026-07-27 14:06:46 -07:00
Add MO2_INSTALL_IS_BIN option.
This commit is contained in:
@@ -4,6 +4,15 @@ if (DEFINED MO2_DEFINED)
|
||||
return()
|
||||
endif()
|
||||
|
||||
option(MO2_INSTALL_IS_BIN
|
||||
"if set, CMAKE_INSTALL_PREFIX is assumed to point to bin rather than one level below")
|
||||
|
||||
if (MO2_INSTALL_IS_BIN)
|
||||
set(MO2_INSTALL_BIN ".")
|
||||
else()
|
||||
set(MO2_INSTALL_BIN "bin")
|
||||
endif()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/mo2_versions.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/mo2_utils.cmake)
|
||||
|
||||
|
||||
+8
-6
@@ -304,7 +304,7 @@ endfunction()
|
||||
function(mo2_configure_plugin TARGET)
|
||||
mo2_configure_target(${TARGET} ${ARGN})
|
||||
mo2_set_project_to_run_from_install(
|
||||
${TARGET} EXECUTABLE ${CMAKE_INSTALL_PREFIX}/bin/ModOrganizer.exe)
|
||||
${TARGET} EXECUTABLE ${CMAKE_INSTALL_PREFIX}/${MO2_INSTALL_BIN}/ModOrganizer.exe)
|
||||
endfunction()
|
||||
|
||||
#! mo2_install_plugin : install the given MO2 plugin
|
||||
@@ -317,13 +317,15 @@ function(mo2_install_plugin TARGET)
|
||||
cmake_parse_arguments(MO2 "FOLDER" "" "" ${ARGN})
|
||||
|
||||
if (${MO2_FOLDER})
|
||||
install(TARGETS ${TARGET} RUNTIME DESTINATION bin/plugins/$<TARGET_FILE_BASE_NAME:${TARGET}>)
|
||||
install(TARGETS ${TARGET} RUNTIME DESTINATION ${MO2_INSTALL_BIN}/plugins/$<TARGET_FILE_BASE_NAME:${TARGET}>)
|
||||
else()
|
||||
install(TARGETS ${TARGET} RUNTIME DESTINATION bin/plugins)
|
||||
install(TARGETS ${TARGET} RUNTIME DESTINATION ${MO2_INSTALL_BIN}/plugins)
|
||||
endif()
|
||||
install(TARGETS ${TARGET} ARCHIVE DESTINATION lib)
|
||||
|
||||
# install PDB if possible
|
||||
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION pdb OPTIONAL)
|
||||
if (NOT MO2_INSTALL_IS_BIN)
|
||||
install(TARGETS ${TARGET} ARCHIVE DESTINATION lib)
|
||||
# install PDB if possible
|
||||
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION pdb OPTIONAL)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
+3
-3
@@ -175,7 +175,7 @@ function(mo2_python_requirements TARGET)
|
||||
|
||||
install(
|
||||
DIRECTORY "${MO2_LIBDIR}"
|
||||
DESTINATION "bin/plugins/${TARGET}/"
|
||||
DESTINATION "${MO2_INSTALL_BIN}/plugins/${TARGET}/"
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
)
|
||||
|
||||
@@ -230,7 +230,7 @@ function(mo2_configure_python_module TARGET)
|
||||
FILES "${PROJECT_SOURCE_DIR}/plugin-requirements.txt")
|
||||
endif()
|
||||
|
||||
set(install_dir "bin/plugins/${TARGET}")
|
||||
set(install_dir "${MO2_INSTALL_BIN}/plugins/${TARGET}")
|
||||
|
||||
# directories that go in bin/plugins/${name}
|
||||
install(
|
||||
@@ -290,7 +290,7 @@ function(mo2_configure_python_simple TARGET)
|
||||
PREFIX data
|
||||
FILES ${json_files})
|
||||
|
||||
set(install_dir "bin/plugins")
|
||||
set(install_dir "${MO2_INSTALL_BIN}/plugins")
|
||||
|
||||
# .py files directly in src/ go to plugins/
|
||||
install(FILES ${py_files} DESTINATION ${install_dir})
|
||||
|
||||
+7
-5
@@ -181,12 +181,14 @@ endfunction()
|
||||
# this function attach install() entries that deploy Qt for the given binaries
|
||||
#
|
||||
# \param:NOPLUGINS do not deploy Qt plugins
|
||||
# \param:DIRECTORY directory, relative to CMAKE_INSTALL_PREFIX, to deploy to, default
|
||||
# to ${MO2_INSTALL_BIN}
|
||||
# \param:BINARIES names of the binaries (in the install path) to deploy from
|
||||
#
|
||||
function(mo2_deploy_qt)
|
||||
cmake_parse_arguments(DEPLOY "NOPLUGINS" "DIRECTORY" "BINARIES" ${ARGN})
|
||||
|
||||
mo2_set_if_not_defined(DEPLOY_DIRECTORY "bin")
|
||||
mo2_set_if_not_defined(DEPLOY_DIRECTORY "${MO2_INSTALL_BIN}")
|
||||
|
||||
mo2_find_qt_executable(windeployqt windeployqt)
|
||||
|
||||
@@ -353,14 +355,14 @@ endfunction()
|
||||
# \param:TARGET target to generate releases for
|
||||
# \param:INSTALL if set, QM files will be installed
|
||||
# \param:DIRECTORY if INSTALL is set, path where translations should be installed,
|
||||
# default to bin/translations
|
||||
# default to ${MO2_INSTALL_BIN}/translations
|
||||
# \param:QM_FILE .qm file to generate
|
||||
# \param:TS_FILES source ts
|
||||
#
|
||||
function(mo2_add_lrelease TARGET)
|
||||
cmake_parse_arguments(MO2 "INSTALL" "DIRECTORY;QM_FILE" "TS_FILES" ${ARGN})
|
||||
|
||||
mo2_set_if_not_defined(MO2_DIRECTORY "bin/translations")
|
||||
mo2_set_if_not_defined(MO2_DIRECTORY "${MO2_INSTALL_BIN}/translations")
|
||||
|
||||
mo2_find_qt_executable(lrelease_command lrelease)
|
||||
|
||||
@@ -395,7 +397,7 @@ endfunction()
|
||||
# \param:TARGET target to generate translations for
|
||||
# \param:RELEASE if set, will use mo2_add_lrelease to generate .qm files
|
||||
# \param:INSTALL_RELEASE if true, will install generated .qm files (force RELEASE)
|
||||
# \param:INSTALL_DIRECTORY installation directory for .qm files, default to bin/translations
|
||||
# \param:INSTALL_DIRECTORY installation directory for .qm files, default to ${MO2_INSTALL_BIN}/translations
|
||||
# \param:TS_FILE intermediate .ts file to generate
|
||||
# \param:QM_FILE file .qm file to generate if RELEASE or INSTALL_RELEASE is set
|
||||
# \param:SOURCES source directories to look for translations, send to mo2_add_lupdate
|
||||
@@ -405,7 +407,7 @@ function(mo2_add_translations TARGET)
|
||||
|
||||
mo2_set_if_not_defined(MO2_TS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}_en.ts)
|
||||
mo2_set_if_not_defined(MO2_QM_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_en.qm)
|
||||
mo2_set_if_not_defined(MO2_INSTALL_DIRECTORY "bin/translations")
|
||||
mo2_set_if_not_defined(MO2_INSTALL_DIRECTORY "${MO2_INSTALL_BIN}/translations")
|
||||
|
||||
# force release with install
|
||||
if (${MO2_INSTALL_RELEASE})
|
||||
|
||||
Reference in New Issue
Block a user