2018-02-17 13:25:30 +08:00
include ( vcpkg_common_functions )
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 o s r a / m a g n u m - e x t r a s
R E F v 2 0 1 8 . 0 2
S H A 5 1 2 6 2 c 0 8 3 2 d 1 9 a 3 6 e 0 f 8 9 f f c d 9 5 8 3 5 6 1 3 0 c 8 1 f 5 7 7 b 1 0 9 1 a 9 2 3 2 d 4 3 3 0 7 8 6 8 c a f 5 1 a 1 f d 1 8 6 c 4 a a 1 9 6 b d 4 5 6 d 3 c 3 7 c b 8 8 7 c 9 8 0 2 d 8 0 e b 0 b 3 3 2 8 9 3 b a f a 8 1 2 2 9 8 d b c 3 9 d 7 b 7
H E A D _ R E F m a s t e r
)
2018-03-25 00:33:40 +08:00
string ( COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC )
2018-02-17 13:25:30 +08:00
# Handle features
set ( _COMPONENT_FLAGS "" )
foreach ( _feature IN LISTS ALL_FEATURES )
# Uppercase the feature name and replace "-" with "_"
string ( TOUPPER "${_feature}" _FEATURE )
string ( REPLACE "-" "_" _FEATURE "${_FEATURE}" )
# Turn "-DWITH_*=" ON or OFF depending on whether the feature
# is in the list.
if ( _feature IN_LIST FEATURES )
list ( APPEND _COMPONENT_FLAGS "-DWITH_${_FEATURE}=ON" )
else ( )
list ( APPEND _COMPONENT_FLAGS "-DWITH_${_FEATURE}=OFF" )
endif ( )
endforeach ( )
vcpkg_configure_cmake (
S O U R C E _ P A T H $ { S O U R C E _ P A T H }
P R E F E R _ N I N J A # Disable this option if project cannot be built with Ninja
O P T I O N S
$ { _ C O M P O N E N T _ F L A G S }
- D B U I L D _ S T A T I C = $ { B U I L D _ S T A T I C }
- D M A G N U M _ P L U G I N S _ D E B U G _ D I R = $ { C U R R E N T _ I N S T A L L E D _ D I R } / d e b u g / b i n / m a g n u m - d
- D M A G N U M _ P L U G I N S _ R E L E A S E _ D I R = $ { C U R R E N T _ I N S T A L L E D _ D I R } / b i n / m a g n u m
)
vcpkg_install_cmake ( )
2018-02-24 18:27:48 +08:00
vcpkg_fixup_cmake_targets ( CONFIG_PATH share/cmake/MagnumExtras TARGET_PATH share/MagnumExtras )
2018-02-17 13:25:30 +08:00
# Messages to the user
if ( "ui" IN_LIST FEATURES )
message ( WARNING "It is recommended to install one of magnum-plugins[freetypefont,harfbuzzfont,stbtruetypefont] to have the UI library working out of the box" )
endif ( )
# Debug includes and share are the same as release
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
2018-03-25 00:33:40 +08:00
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / s h a r e
)
2018-02-17 13:25:30 +08:00
# Clean up empty directories
2018-03-25 00:33:40 +08:00
if ( "${FEATURES}" STREQUAL "core" )
2018-02-17 13:25:30 +08:00
file ( REMOVE_RECURSE
$ { C U R R E N T _ P A C K A G E S _ D I R } / b i n
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b
2018-02-24 18:27:48 +08:00
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g
)
2018-02-17 13:25:30 +08:00
set ( VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled )
endif ( )
2018-02-24 18:27:48 +08:00
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "static" )
2018-02-17 13:25:30 +08:00
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /bin )
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /debug/bin )
endif ( )
# Handle copyright
file ( COPY ${ SOURCE_PATH } /COPYING DESTINATION ${ CURRENT_PACKAGES_DIR } /share/magnum-extras )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /share/magnum-extras/COPYING ${ CURRENT_PACKAGES_DIR } /share/magnum-extras/copyright )
vcpkg_copy_pdbs ( )