2019-05-03 13:57:43 +08:00
vcpkg_check_linkage ( ONLY_STATIC_LIBRARY )
2020-11-10 06:38:53 +08:00
set ( BOND_VER 9.0.3 )
2020-05-29 04:07:54 +08:00
2019-06-21 05:52: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 m i c r o s o f t / b o n d
2020-06-03 07:14:26 +08:00
R E F $ { B O N D _ V E R }
2020-11-10 06:38:53 +08:00
S H A 5 1 2 3 a 7 8 8 4 e b 0 0 e 6 d 0 a b 4 0 c 6 8 8 f 4 a 4 0 c b 2 d 3 f 3 5 6 c 4 8 b 3 8 d 4 8 a 9 a 0 8 c 7 5 6 0 4 7 a 9 4 b 8 2 6 1 9 e f 3 4 5 4 8 3 f 4 2 c 3 2 4 0 7 3 2 f 5 d a 0 6 8 1 6 b 6 5 a 6 1 a c b 8 3 b f e b b 3 c 2 c 6 b 4 4 0 9 9 c e 7 1 b f 9
2019-06-21 05:52:28 +08:00
H E A D _ R E F m a s t e r
2020-06-03 07:14:26 +08:00
P A T C H E S f i x - i n s t a l l - p a t h . p a t c h s k i p - g r p c - c o m p i l a t i o n . p a t c h
2017-02-09 11:35:04 +08:00
)
2016-10-01 10:35:29 +08:00
2020-05-26 02:52:48 +08:00
if ( VCPKG_TARGET_IS_WINDOWS )
2019-06-21 05:52:28 +08:00
vcpkg_download_distfile ( GBC_ARCHIVE
2021-07-21 01:24:58 +08:00
U R L S " h t t p s : / / g i t h u b . c o m / m i c r o s o f t / b o n d / r e l e a s e s / d o w n l o a d / $ { B O N D _ V E R } / g b c - $ { B O N D _ V E R } - a m d 6 4 . z i p "
F I L E N A M E " g b c - $ { B O N D _ V E R } - a m d 6 4 . z i p "
S H A 5 1 2 4 1 a 4 e 0 1 a 9 a 0 f 6 2 4 6 a 3 c 0 7 f 5 1 6 f 2 c 0 c f c 8 a 8 3 7 e f f 2 1 6 6 c 2 b b 7 8 7 8 7 7 e 4 0 9 d 6 f 5 5 e e b 6 0 8 4 e 6 3 a a b c 3 5 0 2 4 9 2 7 7 5 a 3 f a 7 e 3 8 1 b f 3 7 f d e 0 b d f c e d 5 0 a 9 d 0 b 3 9 d f a c a 7 d f d
2019-06-21 05:52:28 +08:00
)
2019-10-08 01:35:13 +08:00
2020-05-29 04:07:54 +08:00
# Clear the generator to prevent it from updating
2021-11-30 09:02:49 +08:00
file ( REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/tools/" )
2019-06-21 05:52:28 +08:00
# Extract the precompiled gbc
2021-07-15 03:45:18 +08:00
vcpkg_extract_source_archive ( extracted_tool_dir ARCHIVE "${GBC_ARCHIVE}" NO_REMOVE_ONE_LEVEL )
file ( RENAME "${extracted_tool_dir}" "${CURRENT_BUILDTREES_DIR}/tools" )
2017-02-09 11:35:04 +08:00
2021-07-15 03:45:18 +08:00
set ( FETCHED_GBC_PATH "${CURRENT_BUILDTREES_DIR}/tools/gbc-${BOND_VER}-amd64.exe" )
if ( NOT EXISTS "${FETCHED_GBC_PATH}" )
message ( FATAL_ERROR "Fetching GBC failed. Expected '${FETCHED_GBC_PATH}' to exist, but it doesn't." )
2019-06-21 05:52:28 +08:00
endif ( )
else ( )
2019-07-18 02:12:47 +08:00
# According to the readme on https://github.com/microsoft/bond/
# The build needs a version of the Haskel Tool stack that is newer than some distros ship with.
# For this reason the message is not guarded by checking to see if the tool is installed.
message ( "\nA recent version of Haskell Tool Stack is required to build.\n For information on how to install see https://docs.haskellstack.org/en/stable/README/\n" )
2019-10-08 01:35:13 +08:00
2017-02-09 11:35:04 +08:00
endif ( )
2020-06-03 07:14:26 +08:00
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_OPTIONS
2021-07-21 01:24:58 +08:00
F E A T U R E S
b o n d - o v e r - g r p c B O N D _ E N A B L E _ G R P C
2020-06-03 07:14:26 +08:00
)
2021-11-30 09:02:49 +08:00
vcpkg_cmake_configure (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
D I S A B L E _ P A R A L L E L _ C O N F I G U R E
2021-07-21 01:24:58 +08:00
O P T I O N S
- D B O N D _ L I B R A R I E S _ O N L Y = T R U E
- D B O N D _ G B C _ P A T H = $ { F E T C H E D _ G B C _ P A T H }
- D B O N D _ S K I P _ G B C _ T E S T S = T R U E
- D B O N D _ E N A B L E _ C O M M = F A L S E
- D B O N D _ F I N D _ R A P I D J S O N = T R U E
- D B O N D _ S T A C K _ O P T I O N S = - - a l l o w - d i f f e r e n t - u s e r
$ { F E A T U R E _ O P T I O N S }
2016-10-01 10:35:29 +08:00
)
2021-11-30 09:02:49 +08:00
vcpkg_cmake_install ( )
2016-10-01 10:35:29 +08:00
2021-11-30 09:02:49 +08:00
vcpkg_cmake_config_fixup ( CONFIG_PATH lib/bond )
2019-06-21 05:52:28 +08:00
2020-05-26 02:52:48 +08:00
vcpkg_copy_pdbs ( )
2016-10-01 10:35:29 +08:00
2021-11-30 09:02:49 +08:00
cmake_path ( NATIVE_PATH SOURCE_PATH native_source_path )
foreach ( header bond_apply.h bond_const_apply.h bond_const_enum.h bond_const_reflection.h bond_const_types.h bond_enum.h bond_reflection.h bond_types.h )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/include/bond/core/${header}" "${native_source_path}" "" )
endforeach ( )
2016-10-01 10:35:29 +08:00
# There's no way to supress installation of the headers in the debug build,
# so we just delete them.
2021-11-30 09:02:49 +08:00
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" )
2016-10-01 10:35:29 +08:00
2020-05-26 02:52:48 +08:00
# Put the license file where vcpkg expects it
2021-11-30 09:02:49 +08:00
file ( INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright )