mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 05:21:29 +08:00
e2aa9d12c4
* [mdl] Add port MDL-SDK 2020.0.1 * [mdl] Expose `dds` and `freeimage` features * [mdl] Upgrade MDL-SDK 2020.1.2 * Update ports/mdl/portfile.cmake Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * [mdl] simplify patch 001-freeimage-from-vcpkg.patch * [mdl] improve and simplify patch 003-install-rules.patch * [mdl] enable dependency log for better debugging in case of failure * [mdl] expose interface include directions for mdl core & mdl sdk * [mdl] build clang as part of vendored LLVM * [mdl] remove unnecessary export * [mdl] Use `unofficial::` namespace prefix * [mdl] remove unnecessary checks about clang CMake target * [mdl] `vcpkg_extract_source_archive` -> `vcpkg_extract_source_archive_ex` * [mdl] Use `vcpkg_find_acquire_program(CLANG7)` * [mdl] disable osx arm64 * [mdl] add license cf. https://developer.nvidia.com/nvidia-mdl-sdk-get-started * [mdl] Use `vcpkg-tool-clang7` * [mdl] restrict arm build * [vcpkg-tool-clang7] Fix broken symlink on UNIX platform * [mdl] Revert changes in `vckpg_find_acquire_program` * [mdl] Rely on `vcpkg-tool-clang7` `vcpkg-port-config.cmake` * [mdl] No support for x86 nor static CRT (because of dynamic linkage only) * Mark Windows static linkage ports as fail due to freeimage requirement * [mdl] Restrict static on Windows * [mdl] remove leftover patch * [vcpkg-tool-clang7] patch cleanup * Commit suggestion. * Versions * [mdl] include priority to vendored LLVM * [mdl] path in quotes * [mdl] update 001-freeimage-from-vcpkg.patch with comments * [mdl] Download clang 7 prior to build MDL-SDK * Fix incorrect clang path for UNIX * [mdl] portfile cleanup * Apply code review suggestions * Update ports/mdl/portfile.cmake Co-authored-by: Victor Romero <romerosanchezv@gmail.com> * bump version * Address review comments * mdl -> mdl-sdk * minimize 006-guard-nonexisting-targets.patch * minimize 002-install-rules.patch * Notes in portfile about clang 7 usage * Add CMAKE_DISABLE_FIND_PACKAGE-<PACKAGE_NAME> to disable optional packages * Address comments Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> Co-authored-by: Victor Romero <romerosanchezv@gmail.com>
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
|