Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Add the INSTALL_DIR argument to gammaray_add_plugin #938

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions cmake/GammaRayMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ include(CMakeParseArguments)
# GAMMARAY_ADD_PLUGIN: create a gammaray plugin, install at the right place, etc
# arguments:
# - JSON <file> - the plugin .json file
# - INSTALL_DIR <dir> - plugin installation subdirectory
# - SOURCES <files> - the plugin sources
#
macro(gammaray_add_plugin _target_name)
set(oneValueArgs JSON)
function(gammaray_add_plugin _target_name)
set(oneValueArgs JSON INSTALL_DIR)
set(multiValueArgs SOURCES)
cmake_parse_arguments(
_gammaray_add_plugin
Expand All @@ -27,10 +28,15 @@ macro(gammaray_add_plugin _target_name)
${ARGN}
)

if(NOT PROBE_PLUGIN_INSTALL_DIR) # HACK for external plugins that don't set PLUGIN_INSTALL_DIR
set(PROBE_PLUGIN_INSTALL_DIR ${GAMMARAY_PROBE_PLUGIN_INSTALL_DIR})
# HACK for external plugins that don't set PLUGIN_INSTALL_DIR
set(_install_target_dir "${GAMMARAY_PROBE_PLUGIN_INSTALL_DIR}")
if(PROBE_PLUGIN_INSTALL_DIR)
set(_install_target_dir "${PROBE_PLUGIN_INSTALL_DIR}")
endif()
set(_build_target_dir "${GAMMARAY_OUTPUT_PREFIX}/${PROBE_PLUGIN_INSTALL_DIR}")
if(DEFINED _gammaray_add_plugin_INSTALL_DIR)
set(_install_target_dir "${_install_target_dir}/${_gammaray_add_plugin_INSTALL_DIR}")
endif()
set(_build_target_dir "${GAMMARAY_OUTPUT_PREFIX}/${_install_target_dir}")

add_library(${_target_name} ${GAMMARAY_PLUGIN_TYPE} ${_gammaray_add_plugin_SOURCES})
set_target_properties(${_target_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_build_target_dir})
Expand All @@ -42,21 +48,21 @@ macro(gammaray_add_plugin _target_name)
if(GAMMARAY_INSTALL_QT_LAYOUT)
set_target_properties(${_target_name} PROPERTIES OUTPUT_NAME ${_target_name}-${GAMMARAY_PROBE_ABI})
endif()
gammaray_set_rpath(${_target_name} ${PROBE_PLUGIN_INSTALL_DIR})
gammaray_set_rpath(${_target_name} ${_install_target_dir})

install(TARGETS ${_target_name} DESTINATION ${PROBE_PLUGIN_INSTALL_DIR})
install(TARGETS ${_target_name} DESTINATION ${_install_target_dir})
if(MSVC)
install(
FILES "$<TARGET_PDB_FILE_DIR:${_target_name}>/$<TARGET_PDB_FILE_NAME:${_target_name}>"
DESTINATION ${PROBE_PLUGIN_INSTALL_DIR}
DESTINATION ${_install_target_dir}
CONFIGURATIONS Debug RelWithDebInfo
)
endif()

if(GAMMARAY_USE_PCH)
target_precompile_headers(${_target_name} REUSE_FROM gammaray_pch_core_gui)
endif()
endmacro()
endfunction()

# Common RPATH setup
# @internal
Expand Down
12 changes: 9 additions & 3 deletions plugins/positioning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
positioninginterface.cpp
positioninginterface.h
)

add_library(gammaray_geopositioninfosource MODULE ${gammaray_geopositioninfosource_srcs})
gammaray_add_plugin(
gammaray_geopositioninfosource
JSON
geopositioninfosourcefactory.json
SOURCES
${gammaray_positioning_srcs}
INSTALL_DIR
position
)
target_compile_features(gammaray_geopositioninfosource PUBLIC ${GAMMARAY_REQUIRED_CXX_FEATURES})
target_link_libraries(gammaray_geopositioninfosource gammaray_common Qt::Positioning Qt::CorePrivate)
install(TARGETS gammaray_geopositioninfosource DESTINATION ${TARGET_PLUGIN_INSTALL_DIR}/position)
endif()

# ui plugin
Expand Down
Loading