diff --git a/CMakeLists.txt b/CMakeLists.txt index 90e890ec..2daa733a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -398,31 +398,26 @@ endif() # --- End of section --- target_link_libraries(${LIB_NAME} PUBLIC ${${PROJECT_NAME}_PLATFORM_LIBS}) -setup_plugin_target(${PROJECT_NAME}) -install_advss_lib(${LIB_NAME}) - -# --- Helpers for debian package creation --- if(DEB_INSTALL) - # Additional commands to install the module in the correct place. Find all the - # translation files so we can copy them to the correct place later on. file(GLOB ASS_TRANSLATION_FILES "data/locale/*.ini") - - # Linux - if(UNIX AND NOT APPLE) - if(NOT LIB_OUT_DIR) - set(LIB_OUT_DIR "/lib/obs-plugins") - endif() - if(NOT DATA_OUT_DIR) - set(DATA_OUT_DIR "/share/obs/obs-plugins/${PROJECT_NAME}") - endif() - install(TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_OUT_DIR}) - install(DIRECTORY data/locale - DESTINATION ${CMAKE_INSTALL_PREFIX}/${DATA_OUT_DIR}) - install(DIRECTORY data/res - DESTINATION ${CMAKE_INSTALL_PREFIX}/${DATA_OUT_DIR}) + if(NOT LIB_OUT_DIR) + set(LIB_OUT_DIR "/lib/obs-plugins") endif() + if(NOT DATA_OUT_DIR) + set(DATA_OUT_DIR "/share/obs/obs-plugins/${PROJECT_NAME}") + endif() + install(TARGETS ${PROJECT_NAME} + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_OUT_DIR}) + install(TARGETS ${LIB_NAME} + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_OUT_DIR}) + install(DIRECTORY data/locale + DESTINATION ${CMAKE_INSTALL_PREFIX}/${DATA_OUT_DIR}) + install(DIRECTORY data/res + DESTINATION ${CMAKE_INSTALL_PREFIX}/${DATA_OUT_DIR}) +else() + setup_plugin_target(${PROJECT_NAME}) + install_advss_lib(${LIB_NAME}) endif() # --- End of section --- diff --git a/cmake/AdvSSHelpers.cmake b/cmake/AdvSSHelpers.cmake index d37c65ec..f2a75f9d 100644 --- a/cmake/AdvSSHelpers.cmake +++ b/cmake/AdvSSHelpers.cmake @@ -67,18 +67,27 @@ if(OS_MACOS) else() # --- Windows / Linux section --- function(plugin_install_helper what where where_deb) - install( - TARGETS ${what} - RUNTIME DESTINATION "${where}" COMPONENT ${what}_Runtime - LIBRARY DESTINATION "${where}" - COMPONENT ${what}_Runtime - NAMELINK_COMPONENT ${what}_Development) - install( - FILES $ - DESTINATION $/${where} - COMPONENT ${what}_rundir - EXCLUDE_FROM_ALL) + if(DEB_INSTALL) + if(NOT LIB_OUT_DIR) + set(LIB_OUT_DIR "/lib/obs-plugins") + endif() + install( + TARGETS ${what} + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_OUT_DIR}/${where_deb}) + else() + install( + TARGETS ${what} + RUNTIME DESTINATION "${where}" COMPONENT ${what}_Runtime + LIBRARY DESTINATION "${where}" + COMPONENT ${what}_Runtime + NAMELINK_COMPONENT ${what}_Development) + install( + FILES $ + DESTINATION $/${where} + COMPONENT ${what}_rundir + EXCLUDE_FROM_ALL) + endif() if(OS_WINDOWS) install( FILES $ @@ -93,7 +102,6 @@ else() COMPONENT ${what}_rundir OPTIONAL EXCLUDE_FROM_ALL) endif() - add_custom_command( TARGET ${what} POST_BUILD @@ -104,15 +112,6 @@ else() ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake COMMENT "Installing ${what} to plugin rundir ${OBS_OUTPUT_DIR}/${where}\n" VERBATIM) - - if(OS_POSIX AND DEB_INSTALL) - if(NOT LIB_OUT_DIR) - set(LIB_OUT_DIR "/lib/obs-plugins") - endif() - install( - TARGETS ${what} - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_OUT_DIR}/${where_deb}) - endif() endfunction() function(install_advss_lib target)