2022-10-14 02:17:28 +08:00
vcpkg_check_linkage ( ONLY_DYNAMIC_LIBRARY )
# Notes on Clang 7 binary download:
# MDL-SDK requires Clang version 7.0.0 previsely as a *build tool* not as a *source compiler* as it is usually used.
# This ports provides CMake instructions to fetch and use it to build this port - and only for this purpose:
# it will not be installed and as such not be usable by any other ports.
#
# More details on the why below:
# MDL-SDK supports its own source file format (NVIDIA MDL sources `.mdl`), and can codegen executable code at runtime using its own vendored and modified version of LLVM 7.0.0.
# Also, at buildtime MDL-SDK also "pre-compile" MDL core libraries as LLVM bitcode directly into its binaries (through generated c array in headers) using this very Clang 7.0.0.
# To have everything working together, we have to use a Clang as build tool which match the vendored LLVM version so that LLVM bitcode can be loaded/linked properly as it is not compatible across MLLVM versions.
# Clang 7 build tool
set ( LLVM_VERSION 7.0.0 )
set ( LLVM_BASE_URL "https://releases.llvm.org/${LLVM_VERSION}" )
if ( VCPKG_HOST_IS_WINDOWS )
set ( LLVM_FILENAME "LLVM-${LLVM_VERSION}-win64.exe" )
set ( LLVM_HASH c2b1342469275279f833fdc1e17ba5a9f99021306d6ab3d7209822a01d690767739eebf92fd9f23a44de5c5d00260fed50d5262b23a8eccac55b8ae901e2815c )
elseif ( VCPKG_HOST_IS_LINUX )
set ( LLVM_FILENAME "clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-16.04.tar.xz" )
set ( LLVM_HASH fb3dc588137426dc28a20ef5e34e9341b18114f03bf7d83fafbb301efbfd801bba08615b804817c80252e366de9d2f8efbef034e53a1b885b34c86c2fbbf9c28 )
elseif ( VCPKG_HOST_IS_FREEBSD )
set ( LLVM_FILENAME "clang+llvm-${LLVM_VERSION}-amd64-unknown-freebsd11.tar.xz" )
set ( LLVM_HASH d501484c38cfced196128866a19f7fef1e0b5d609ea050d085b7deab04ac8cc2bbf74b3cfe6cd90d8ea17a1d9cfca028a6c933f0736153ba48785ddc8646574f )
elseif ( VCPKG_HOST_IS_OSX )
set ( LLVM_FILENAME "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz" )
set ( LLVM_HASH c5ca6a7756e0cecdf78d4d0c522fe7e803d4b1b2049cb502a034fe8f5ca30fcbf0e738ebfbc89c87de8adcd90ea64f637eb82e9130bb846b43b91f67dfa4b916 )
else ( )
message ( FATAL_ERROR "Pre-built binaries for Clang 7 not available, aborting install (platform: ${VCPKG_CMAKE_SYSTEM_NAME})." )
endif ( )
vcpkg_download_distfile ( LLVM_ARCHIVE_PATH
U R L S " $ { L L V M _ B A S E _ U R L } / $ { L L V M _ F I L E N A M E } "
S H A 5 1 2 $ { L L V M _ H A S H }
F I L E N A M E " $ { L L V M _ F I L E N A M E } "
)
if ( VCPKG_TARGET_IS_WINDOWS )
get_filename_component ( LLVM_BASENAME "${LLVM_FILENAME}" NAME_WE )
set ( LLVM_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/${LLVM_BASENAME}" )
file ( REMOVE_RECURSE "${LLVM_DIRECTORY}" )
file ( MAKE_DIRECTORY "${LLVM_DIRECTORY}" )
vcpkg_find_acquire_program ( 7Z )
vcpkg_execute_in_download_mode (
C O M M A N D $ { 7 Z } x
" $ { L L V M _ A R C H I V E _ P A T H } "
" - o $ { L L V M _ D I R E C T O R Y } "
- y - b s o 0 - b s p 0
W O R K I N G _ D I R E C T O R Y " $ { L L V M _ D I R E C T O R Y } "
)
else ( )
vcpkg_extract_source_archive ( LLVM_DIRECTORY
A R C H I V E " $ { L L V M _ A R C H I V E _ P A T H } "
S O U R C E _ B A S E " c l a n g + l l v m - $ { L L V M _ V E R S I O N } "
)
endif ( )
set ( LLVM_CLANG7 "${LLVM_DIRECTORY}/bin/clang${VCPKG_HOST_EXECUTABLE_SUFFIX}" )
if ( NOT EXISTS "${LLVM_CLANG7}" )
message ( FATAL_ERROR "Missing required build tool clang 7, please check your setup." )
endif ( )
# MDL-SDK
2023-06-16 01:39:13 +08:00
# The patch "workaround gcc bit" works around <bit> included with gcc included with Ubuntu 22.04
# failing to compile as used here, with errors originating *inside* <bit> like:
# [156/1742] /usr/bin/c++ -DBIT64=1 -DDEBUG -DHAS_SSE -DMDL_SOURCE_RELEASE -DMI_PLATFORM=\"linux-x86-64-gcc\" -DMI_PLATFORM_UNIX -DX86=1 -D_DEBUG -I/home/bion/vcpkg/buildtrees/mdl-sdk/x64-linux-dbg/src/base/system/main -I/home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src/base/system/main -I/home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/include -I/home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src -fPIC -g -fPIC -fno-strict-aliasing -march=nocona -gdwarf-3 -gstrict-dwarf -Wall -Wvla -Wno-init-list-lifetime -Wno-placement-new -Wno-parentheses -Wno-sign-compare -Wno-narrowing -Wno-unused-but-set-variable -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wno-unknown-pragmas -std=gnu++17 -MD -MT src/base/system/main/CMakeFiles/base-system-main.dir/module_registration_entry.cpp.o -MF src/base/system/main/CMakeFiles/base-system-main.dir/module_registration_entry.cpp.o.d -o src/base/system/main/CMakeFiles/base-system-main.dir/module_registration_entry.cpp.o -c /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src/base/system/main/module_registration_entry.cpp
# FAILED: src/base/system/main/CMakeFiles/base-system-main.dir/module_registration_entry.cpp.o
# /usr/bin/c++ -DBIT64=1 -DDEBUG -DHAS_SSE -DMDL_SOURCE_RELEASE -DMI_PLATFORM=\"linux-x86-64-gcc\" -DMI_PLATFORM_UNIX -DX86=1 -D_DEBUG -I/home/bion/vcpkg/buildtrees/mdl-sdk/x64-linux-dbg/src/base/system/main -I/home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src/base/system/main -I/home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/include -I/home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src -fPIC -g -fPIC -fno-strict-aliasing -march=nocona -gdwarf-3 -gstrict-dwarf -Wall -Wvla -Wno-init-list-lifetime -Wno-placement-new -Wno-parentheses -Wno-sign-compare -Wno-narrowing -Wno-unused-but-set-variable -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wno-unknown-pragmas -std=gnu++17 -MD -MT src/base/system/main/CMakeFiles/base-system-main.dir/module_registration_entry.cpp.o -MF src/base/system/main/CMakeFiles/base-system-main.dir/module_registration_entry.cpp.o.d -o src/base/system/main/CMakeFiles/base-system-main.dir/module_registration_entry.cpp.o -c /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src/base/system/main/module_registration_entry.cpp
# In file included from /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src/base/system/main/types.h:37,
# from /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src/base/system/main/module_registration_entry.h:39,
# from /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/src/base/system/main/module_registration_entry.cpp:34:
# /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/include/mi/base/types.h: In function ‘ constexpr T mi::base::binary_cast(const S&)’ :
# /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/include/mi/base/types.h:356:89: error: ‘ bit_cast’ is not a member of ‘ mi::base::std’
# 356 | template<class T, class S> constexpr T binary_cast(const S& src) noexcept { return std::bit_cast<T,S>(src); }
# | ^~~~~~~~
# /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/include/mi/base/types.h:356:99: error: expected primary-expression before ‘ ,’ token
# 356 | template<class T, class S> constexpr T binary_cast(const S& src) noexcept { return std::bit_cast<T,S>(src); }
# | ^
# /home/bion/vcpkg/buildtrees/mdl-sdk/src/830ab63109-115b19fca8/include/mi/base/types.h:356:101: error: expected primary-expression before ‘ >’ token
# 356 | template<class T, class S> constexpr T binary_cast(const S& src) noexcept { return std::bit_cast<T,S>(src); }
# | ^
2022-10-14 02:17:28 +08:00
vcpkg_from_github (
O U T _ S O U R C E _ P A T H S O U R C E _ P A T H
R E P O N V I D I A / M D L - S D K
R E F d 6 c 9 a 6 5 6 0 2 6 5 0 2 5 a 3 0 d 1 6 f c d 9 d 6 6 4 f 8 3 0 a b 6 3 1 0 9
S H A 5 1 2 d 6 1 6 1 a 3 1 7 c a 0 f d 3 c f 8 c 7 8 2 f 0 5 8 f c 4 3 7 6 5 d 6 1 1 b 5 f 6 a 8 e 8 2 d a 7 3 6 f 5 1 6 4 a 0 e 1 8 2 9 a 4 6 f 7 5 e 3 7 6 7 1 5 f c b 7 c b 9 5 2 1 4 0 6 3 6 5 a a 8 8 8 8 0 e d 4 4 2 3 5 b 2 b f 6 3 8 9 9 a f f c c 5 b d 5 4 0 9 1
H E A D _ R E F m a s t e r
P A T C H E S
0 0 1 - f r e e i m a g e - f r o m - v c p k g . p a t c h
0 0 2 - i n s t a l l - r u l e s . p a t c h
0 0 3 - f r e e i m a g e - d i s a b l e - f a x g 3 . p a t c h
0 0 4 - m i s s i n g - s t d - i n c l u d e s . p a t c h
0 0 5 - m i s s i n g - l i n k - w i n d o w s - c r y p t - l i b r a r i e s . p a t c h
0 0 6 - g u a r d - n o n e x i s t i n g - t a r g e t s . p a t c h
0 0 7 - p l u g i n - o p t i o n s . p a t c h
0 0 8 - b u i l d - s t a t i c - l l v m . p a t c h
0 0 9 - i n c l u d e - p r i o r i t y - v e n d o r e d - l l v m . p a t c h
2023-06-16 01:39:13 +08:00
0 1 0 - w o r k a r o u n d - g c c - b i t . p a t c h
2023-08-08 04:19:53 +08:00
0 1 1 - f i x - p y t h o n . p a t c h
2022-10-14 02:17:28 +08:00
)
string ( COMPARE NOTEQUAL "${VCPKG_CRT_LINKAGE}" "static" _MVSC_CRT_LINKAGE_OPTION )
vcpkg_find_acquire_program ( PYTHON3 )
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_OPTIONS
F E A T U R E S
d d s M D L _ B U I L D _ D D S _ P L U G I N
f r e e i m a g e M D L _ B U I L D _ F R E E I M A G E _ P L U G I N
)
file ( COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-mdl-config.cmake.in" DESTINATION "${SOURCE_PATH}" )
vcpkg_cmake_configure (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
O P T I O N S
- D M D L _ L O G _ D E P E N D E N C I E S : B O O L = O N
- D M D L _ M S V C _ D Y N A M I C _ R U N T I M E _ E X A M P L E S : B O O L = $ { _ M V S C _ C R T _ L I N K A G E _ O P T I O N }
- D M D L _ E N A B L E _ C U D A _ E X A M P L E S : B O O L = O F F
- D M D L _ E N A B L E _ O P E N G L _ E X A M P L E S : B O O L = O F F
- D M D L _ E N A B L E _ Q T _ E X A M P L E S : B O O L = O F F
- D M D L _ E N A B L E _ D 3 D 1 2 _ E X A M P L E S : B O O L = O F F
- D M D L _ E N A B L E _ O P T I X 7 _ E X A M P L E S : B O O L = O F F
- D M D L _ E N A B L E _ M A T E R I A L X : B O O L = O F F
- D M D L _ B U I L D _ S D K _ E X A M P L E S : B O O L = O F F
- D M D L _ B U I L D _ C O R E _ E X A M P L E S : B O O L = O F F
- D M D L _ B U I L D _ A R N O L D _ P L U G I N : B O O L = O F F
- D p y t h o n _ P A T H : P A T H = $ { P Y T H O N 3 }
- D c l a n g _ P A T H : P A T H = $ { L L V M _ C L A N G 7 }
$ { F E A T U R E _ O P T I O N S }
M A Y B E _ U N U S E D _ V A R I A B L E S
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ G L E W = O N
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ g l f w 3 = O N
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ L i b X m l 2 = O N
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ O C a m l = O N
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ O p e n G L = O N
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ Q t 5 = O N
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ S u b v e r s i o n = O N
)
vcpkg_cmake_install ( )
vcpkg_copy_pdbs ( )
vcpkg_cmake_config_fixup ( PACKAGE_NAME unofficial-mdl )
vcpkg_copy_tools (
T O O L _ N A M E S i 1 8 n m d l c m d l m
A U T O _ C L E A N
)
file ( REMOVE_RECURSE
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / i n c l u d e "
)
file ( INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright )