vcpkg/ports/mdl-sdk/001-freeimage-from-vcpkg.patch

82 lines
3.3 KiB
Diff
Raw Normal View History

[mdl] Add port MDL-SDK 2021.1.2 (#24633) * [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>
2022-10-14 02:17:28 +08:00
diff --git a/cmake/dependencies/add_freeimage.cmake b/cmake/dependencies/add_freeimage.cmake
index 944d452..3916352 100644
--- a/cmake/dependencies/add_freeimage.cmake
+++ b/cmake/dependencies/add_freeimage.cmake
@@ -67,13 +67,4 @@ else()
)
endif()
endif()
-
- # copy runtime dependencies
- # copy system libraries only on windows, we assume the libraries are installed in a unix environment
- if(NOT __TARGET_ADD_DEPENDENCY_NO_RUNTIME_COPY AND WINDOWS)
- target_copy_to_output_dir(TARGET ${__TARGET_ADD_DEPENDENCY_TARGET}
- FILES
- ${MDL_DEPENDENCY_FREEIMAGE_SHARED}
- )
- endif()
endif()
diff --git a/cmake/find/find_freeimage_ext.cmake b/cmake/find/find_freeimage_ext.cmake
index b11573a..703458e 100644
--- a/cmake/find/find_freeimage_ext.cmake
+++ b/cmake/find/find_freeimage_ext.cmake
@@ -28,6 +28,9 @@
function(FIND_FREEIMAGE_EXT)
+ find_package(freeimage CONFIG REQUIRED)
+ if(0)
+
set(FREEIMAGE_DIR "NOT-SPECIFIED" CACHE PATH "Directory that contains the freeimage library and the corresponding headers.")
#-----------------------------------------------------------------------------------------------
@@ -90,6 +93,35 @@ function(FIND_FREEIMAGE_EXT)
endif()
endif()
+ else()
+ get_target_property(_FREEIMAGE_INCLUDE freeimage::FreeImage INTERFACE_INCLUDE_DIRECTORIES)
+ get_target_property(_FREEIMAGE_DEPENDENCIES freeimage::FreeImage INTERFACE_LINK_LIBRARIES )
+
+ get_target_property(_FREEIMAGE_SHARED freeimage::FreeImage IMPORTED_LOCATION)
+ if(NOT _FREEIMAGE_SHARED)
+ get_target_property(_FREEIMAGE_SHARED freeimage::FreeImage IMPORTED_LOCATION_RELEASE)
+ endif()
+ if(NOT _FREEIMAGE_SHARED)
+ get_target_property(_FREEIMAGE_SHARED freeimage::FreeImage IMPORTED_LOCATION_DEBUG)
+ endif()
+
+ get_target_property(_FREEIMAGE_TYPE freeimage::FreeImage TYPE)
+ if(${_FREEIMAGE_TYPE} STREQUAL "SHARED_LIBRARY")
+ get_target_property(_FREEIMAGE_LIB freeimage::FreeImage IMPORTED_IMPLIB)
+ if(NOT _FREEIMAGE_LIB)
+ get_target_property(_FREEIMAGE_LIB freeimage::FreeImage IMPORTED_IMPLIB_RELEASE)
+ endif()
+ if(NOT _FREEIMAGE_LIB)
+ get_target_property(_FREEIMAGE_LIB freeimage::FreeImage IMPORTED_IMPLIB_DEBUG)
+ endif()
+ endif()
+
+ find_file(_FREEIMAGE_HEADER_FILE "FreeImage.h"
+ HINTS
+ ${_FREEIMAGE_INCLUDE}
+ )
+ endif()
+
# error if dependencies can not be resolved
if(NOT EXISTS ${_FREEIMAGE_INCLUDE} OR (WINDOWS AND NOT EXISTS ${_FREEIMAGE_LIB}) OR NOT EXISTS ${_FREEIMAGE_SHARED})
message(STATUS "FREEIMAGE_DIR: ${FREEIMAGE_DIR}")
diff --git a/src/shaders/plugin/freeimage/CMakeLists.txt b/src/shaders/plugin/freeimage/CMakeLists.txt
index a28b50e..910141e 100644
--- a/src/shaders/plugin/freeimage/CMakeLists.txt
+++ b/src/shaders/plugin/freeimage/CMakeLists.txt
@@ -69,7 +69,7 @@ add_library(mdl::nv_freeimage ALIAS ${PROJECT_NAME})
# add dependencies other dependencies
target_add_dependencies(TARGET ${PROJECT_NAME}
DEPENDS
- freeimage
+ freeimage::FreeImage
mdl::base-system-version
)