mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-05 08:49:01 +08:00
172 lines
6.5 KiB
Diff
172 lines
6.5 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 1f1902c..623bec8 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -53,6 +53,9 @@ option(MDL_LOG_FILE_DEPENDENCIES "Prints the list of files that is copied after
|
||
|
set(MDL_ADDITIONAL_COMPILER_DEFINES "MDL_SOURCE_RELEASE" CACHE STRING "Additional compile defines that are passed to each of the projects")
|
||
|
set(MDL_ADDITIONAL_COMPILER_OPTIONS "" CACHE STRING "Additional compile options that are passed to each of the projects")
|
||
|
|
||
|
+include(GNUInstallDirs)
|
||
|
+include(CMakePackageConfigHelpers)
|
||
|
+
|
||
|
# set the default installation path
|
||
|
if(NOT DEFINED CMAKE_INSTALL_PREFIX OR CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "..." FORCE)
|
||
|
@@ -235,3 +238,35 @@ foreach(_TEST_POST ${MDL_TEST_LIST_POST})
|
||
|
add_subdirectory(${_TEST_POST})
|
||
|
endforeach()
|
||
|
|
||
|
+# Config
|
||
|
+#--------------------------------------------------------------------------------------------------
|
||
|
+
|
||
|
+set(PATH_EXPORT_TARGETS "${CMAKE_INSTALL_DATADIR}/unofficial-mdl/unofficial-mdl-targets.cmake")
|
||
|
+configure_package_config_file(
|
||
|
+ "${CMAKE_CURRENT_SOURCE_DIR}/unofficial-mdl-config.cmake.in"
|
||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-mdl-config.cmake"
|
||
|
+ PATH_VARS
|
||
|
+ PATH_EXPORT_TARGETS
|
||
|
+ INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/unofficial-mdl
|
||
|
+)
|
||
|
+
|
||
|
+write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-mdl-config-version.cmake"
|
||
|
+ VERSION 2021.0.1
|
||
|
+ COMPATIBILITY SameMajorVersion
|
||
|
+)
|
||
|
+
|
||
|
+# Install
|
||
|
+#--------------------------------------------------------------------------------------------------
|
||
|
+
|
||
|
+install(
|
||
|
+ EXPORT unofficial-mdl-targets
|
||
|
+ NAMESPACE "unofficial::mdl::"
|
||
|
+ DESTINATION "${CMAKE_INSTALL_DATADIR}/unofficial-mdl"
|
||
|
+)
|
||
|
+
|
||
|
+install(
|
||
|
+ FILES
|
||
|
+ ${CMAKE_CURRENT_BINARY_DIR}/unofficial-mdl-config.cmake
|
||
|
+ ${CMAKE_CURRENT_BINARY_DIR}/unofficial-mdl-config-version.cmake
|
||
|
+ DESTINATION "${CMAKE_INSTALL_DATADIR}/unofficial-mdl"
|
||
|
+)
|
||
|
diff --git a/cmake/utilities.cmake b/cmake/utilities.cmake
|
||
|
index 5e9774f..51dc65c 100644
|
||
|
--- a/cmake/utilities.cmake
|
||
|
+++ b/cmake/utilities.cmake
|
||
|
@@ -705,6 +705,7 @@ function(CREATE_FROM_BASE_PRESET)
|
||
|
# adjust output file name if requested
|
||
|
if(CREATE_FROM_BASE_PRESET_OUTPUT_NAME)
|
||
|
set_target_properties(${CREATE_FROM_BASE_PRESET_TARGET} PROPERTIES OUTPUT_NAME ${CREATE_FROM_BASE_PRESET_OUTPUT_NAME})
|
||
|
+ set_target_properties(${CREATE_FROM_BASE_PRESET_TARGET} PROPERTIES EXPORT_NAME ${CREATE_FROM_BASE_PRESET_OUTPUT_NAME})
|
||
|
endif()
|
||
|
|
||
|
# log message
|
||
|
@@ -1143,6 +1144,15 @@ endfunction()
|
||
|
# -------------------------------------------------------------------------------------------------
|
||
|
# basic install logic to copy the entire output folder
|
||
|
|
||
|
+set(_MDL_PROD_TARGETS
|
||
|
+ prod-lib-mdl_core
|
||
|
+ prod-lib-mdl_sdk
|
||
|
+ prod-bin-i18n
|
||
|
+ prod-bin-mdlc
|
||
|
+ prod-bin-mdlm
|
||
|
+ shaders-plugin-dds
|
||
|
+ shaders-plugin-freeimage
|
||
|
+)
|
||
|
function(ADD_TARGET_INSTALL)
|
||
|
set(options)
|
||
|
set(oneValueArgs TARGET DESTINATION)
|
||
|
@@ -1152,6 +1162,14 @@ function(ADD_TARGET_INSTALL)
|
||
|
# - ADD_TARGET_INSTALL_TARGET
|
||
|
# - ADD_TARGET_INSTALL_DESTINATION
|
||
|
|
||
|
+ if(${ADD_TARGET_INSTALL_TARGET} IN_LIST _MDL_PROD_TARGETS)
|
||
|
+ install(
|
||
|
+ TARGETS ${ADD_TARGET_INSTALL_TARGET}
|
||
|
+ EXPORT unofficial-mdl-targets
|
||
|
+ )
|
||
|
+ return()
|
||
|
+ endif()
|
||
|
+
|
||
|
install(DIRECTORY $<TARGET_FILE_DIR:${ADD_TARGET_INSTALL_TARGET}>/
|
||
|
DESTINATION ${ADD_TARGET_INSTALL_DESTINATION}
|
||
|
USE_SOURCE_PERMISSIONS
|
||
|
|
||
|
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
||
|
index 246303d..28934b4 100644
|
||
|
--- a/include/CMakeLists.txt
|
||
|
+++ b/include/CMakeLists.txt
|
||
|
@@ -229,3 +229,8 @@ source_group("base" FILES ${PROJECT_HEADERS_BASE})
|
||
|
source_group("math" FILES ${PROJECT_HEADERS_MATH})
|
||
|
source_group("mdl" FILES ${PROJECT_HEADERS_MDL})
|
||
|
source_group("neuraylib" FILES ${PROJECT_HEADERS_NEURAYLIB})
|
||
|
+
|
||
|
+install(
|
||
|
+ DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/mi"
|
||
|
+ TYPE INCLUDE
|
||
|
+)
|
||
|
diff --git a/src/prod/lib/mdl_core/CMakeLists.txt b/src/prod/lib/mdl_core/CMakeLists.txt
|
||
|
index b60a1fc..3c3d2f4 100644
|
||
|
--- a/src/prod/lib/mdl_core/CMakeLists.txt
|
||
|
+++ b/src/prod/lib/mdl_core/CMakeLists.txt
|
||
|
@@ -42,9 +42,15 @@ create_from_base_preset(
|
||
|
EMBED_RC "mdl_core.rc"
|
||
|
)
|
||
|
|
||
|
+target_include_directories(${PROJECT_NAME}
|
||
|
+ PUBLIC
|
||
|
+ $<INSTALL_INTERFACE:include>
|
||
|
+)
|
||
|
+
|
||
|
# customize name
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "lib")
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "mdl_core")
|
||
|
+set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME "mdl_core")
|
||
|
|
||
|
if(MACOSX)
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".so") # corresponding to the binary release
|
||
|
diff --git a/src/prod/lib/mdl_sdk/CMakeLists.txt b/src/prod/lib/mdl_sdk/CMakeLists.txt
|
||
|
index 6ddfc24..51c84e7 100644
|
||
|
--- a/src/prod/lib/mdl_sdk/CMakeLists.txt
|
||
|
+++ b/src/prod/lib/mdl_sdk/CMakeLists.txt
|
||
|
@@ -44,9 +44,15 @@ create_from_base_preset(
|
||
|
EMBED_RC "mdl_sdk.rc"
|
||
|
)
|
||
|
|
||
|
+target_include_directories(${PROJECT_NAME}
|
||
|
+ PUBLIC
|
||
|
+ $<INSTALL_INTERFACE:include>
|
||
|
+)
|
||
|
+
|
||
|
# customize name
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "lib")
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "mdl_sdk")
|
||
|
+set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME "mdl_sdk")
|
||
|
|
||
|
if(MACOSX)
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".so") # corresponding to the binary release
|
||
|
diff --git a/src/shaders/plugin/dds/CMakeLists.txt b/src/shaders/plugin/dds/CMakeLists.txt
|
||
|
index 81558b0..179e1df 100644
|
||
|
--- a/src/shaders/plugin/dds/CMakeLists.txt
|
||
|
+++ b/src/shaders/plugin/dds/CMakeLists.txt
|
||
|
@@ -65,6 +65,7 @@ create_from_base_preset(
|
||
|
# customize name
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "dds")
|
||
|
+set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME "dds")
|
||
|
|
||
|
if(MACOSX)
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".so") # corresponding to the binary release
|
||
|
diff --git a/src/shaders/plugin/freeimage/CMakeLists.txt b/src/shaders/plugin/freeimage/CMakeLists.txt
|
||
|
index b3ae039..a28b50e 100644
|
||
|
--- a/src/shaders/plugin/freeimage/CMakeLists.txt
|
||
|
+++ b/src/shaders/plugin/freeimage/CMakeLists.txt
|
||
|
@@ -56,6 +56,7 @@ create_from_base_preset(
|
||
|
# customize name
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "nv_freeimage")
|
||
|
+set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME "nv_freeimage")
|
||
|
|
||
|
if(MACOSX)
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".so") # corresponding to the binary release
|