Skip to content

Commit 985cdee

Browse files
committed
[skip ci] Change vcpkg install to use CMake
1 parent d6353f1 commit 985cdee

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

script/create-vcpkg.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
cfg_vcpkg_description = '(no description found)'
3030
cfg_vcpkg_root = os.environ['VCPKG_ROOT']
3131

32+
cfg_cmake_optpfx = "VARIANT_LITE"
33+
3234
# End configuration.
3335

3436
# vcpkg control and port templates:
@@ -51,10 +53,28 @@
5153
SHA512 {sha}
5254
)
5355
54-
# To allow side-by-side use with ms-gsl, only provide include/gsl/gsl-lite.hpp:
56+
vcpkg_configure_cmake(
57+
SOURCE_PATH ${{SOURCE_PATH}}
58+
PREFER_NINJA
59+
OPTIONS
60+
-D{optpfx}_OPT_BUILD_TESTS=OFF
61+
-D{optpfx}_OPT_BUILD_EXAMPLES=OFF
62+
)
63+
64+
vcpkg_install_cmake()
65+
66+
vcpkg_fixup_cmake_targets(
67+
CONFIG_PATH lib/cmake/${{PORT}}
68+
)
69+
70+
file(REMOVE_RECURSE
71+
${{CURRENT_PACKAGES_DIR}}/debug
72+
${{CURRENT_PACKAGES_DIR}}/lib
73+
)
5574
56-
file(INSTALL ${{SOURCE_PATH}}/include/gsl/gsl-lite.hpp DESTINATION ${{CURRENT_PACKAGES_DIR}}/include/gsl)
57-
file(INSTALL ${{SOURCE_PATH}}/{lic} DESTINATION ${{CURRENT_PACKAGES_DIR}}/share/{prj} RENAME copyright)"""
75+
file(INSTALL
76+
${{SOURCE_PATH}}/{lic} DESTINATION ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}} RENAME copyright
77+
)"""
5878

5979
tpl_vcpkg_note_sha =\
6080
"""
@@ -114,7 +134,7 @@ def createControl( args ):
114134
def createPortfile( args ):
115135
"""Create vcpkg portfile"""
116136
output = tpl_vcpkg_portfile.format(
117-
usr=args.user, prj=args.project, ref=to_ref(args.version), sha=args.sha, lic=cfg_license )
137+
optpfx=cfg_cmake_optpfx, usr=args.user, prj=args.project, ref=to_ref(args.version), sha=args.sha, lic=cfg_license )
118138
if args.verbose:
119139
print( "Creating portfile '{f}':".format( f=portfile_path( args ) ) )
120140
if args.verbose > 1:

0 commit comments

Comments
 (0)