build: Install include folders of plugin libraries to SDK (#2074)
Partially fixes #2068 . This assumes the headers are in "include" for all plugins - this is necessary since the INCLUDES argument of add_imhex_plugin may contain paths to third party libs, whose headers should not be copied. To fix this I think it is necessary to add a second argument like "PRIVATE_INCLUDES", which is included, but not installed. With this it possible to append the ui plugin for example: ``` INCLUDES $ENV{IMHEX_SDK_PATH}/lib/plugins/ui/ ``` and to link against it: ``` LIBRARIES /usr/local/lib/imhex/plugins/ui.hexpluglib ``` In a follow-up in the CMake Template for plugins imho there should be fixed, that: - you can include plugin includes relative to the SDK Path - you can link plugins relative to the lib path + without the hexpluglib or hexplug extension --------- Co-authored-by: Tim Blume <git@3nd.io> Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
parent
fe18cbaa41
commit
4e9f944204
@ -843,17 +843,20 @@ function(enableUnityBuild TARGET)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(generateSDKDirectory)
|
||||
function(setSDKPaths)
|
||||
if (WIN32)
|
||||
set(SDK_PATH "./sdk")
|
||||
set(SDK_PATH "./sdk" PARENT_SCOPE)
|
||||
elseif (APPLE)
|
||||
set(SDK_PATH "${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME}/Contents/Resources/sdk")
|
||||
set(SDK_PATH "${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME}/Contents/Resources/sdk" PARENT_SCOPE)
|
||||
else()
|
||||
set(SDK_PATH "share/imhex/sdk")
|
||||
set(SDK_PATH "share/imhex/sdk" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set(SDK_BUILD_PATH "${CMAKE_BINARY_DIR}/sdk")
|
||||
set(SDK_BUILD_PATH "${CMAKE_BINARY_DIR}/sdk" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(generateSDKDirectory)
|
||||
setSDKPaths()
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/libimhex DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE)
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/external DESTINATION "${SDK_PATH}/lib")
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/imgui DESTINATION "${SDK_PATH}/lib/third_party" PATTERN "**/source/*" EXCLUDE)
|
||||
|
@ -1,4 +1,5 @@
|
||||
macro(add_imhex_plugin)
|
||||
setSDKPaths()
|
||||
# Parse arguments
|
||||
set(options LIBRARY_PLUGIN)
|
||||
set(oneValueArgs NAME IMHEX_VERSION)
|
||||
@ -28,6 +29,10 @@ macro(add_imhex_plugin)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (IMHEX_PLUGIN_LIBRARY_PLUGIN)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_PREFIX}/${SDK_PATH}/lib/plugins/${IMHEX_PLUGIN_NAME}/")
|
||||
endif()
|
||||
|
||||
# Define new project for plugin
|
||||
project(${IMHEX_PLUGIN_NAME})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user