vcpkg/ports/flashlight-cuda/portfile.cmake
2020-12-30 10:42:50 -08:00

65 lines
1.9 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebookresearch/flashlight
REF 0948e97dbff23d474500a5f55bcf59d3b3589cf4
SHA512 89c2efdebc6688a38f9fc3ebb8442c8fe2ad3d51c0e60c5dd8e7ca283715e07f48083543f09eed0db9929d86b765a898d9b3960a9b6f9844b20260f94cf71fdf
HEAD_REF master
)
################################### Build ###################################
# Default flags
set(FL_DEFAULT_VCPKG_CMAKE_FLAGS
-DFL_BUILD_TESTS=OFF
-DFL_BUILD_EXAMPLES=OFF
-DFL_BACKEND=CUDA # this port is CUDA-backend only
-DFL_BUILD_STANDALONE=OFF
-DFL_INSTALL_CMAKE_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} # for CMake configs/targets
)
# Determine which components to build via specified feature
vcpkg_check_features(
OUT_FEATURE_OPTIONS FL_FEATURE_OPTIONS
FEATURES
lib FL_BUILD_LIBRARIES
fl FL_BUILD_CORE
asr FL_BUILD_APP_ASR
imgclass FL_BUILD_APP_IMGCLASS
lm FL_BUILD_APP_LM
)
# Build and install
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FL_DEFAULT_VCPKG_CMAKE_FLAGS} ${FL_FEATURE_OPTIONS}
)
vcpkg_install_cmake()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
# Binaries/tools
set(FLASHLIGHT_TOOLS "")
if ("imgclass" IN_LIST FEATURES)
list(APPEND FLASHLIGHT_TOOLS fl_img_imagenet_resnet34)
endif()
if ("asr" IN_LIST FEATURES)
list(APPEND FLASHLIGHT_TOOLS
fl_asr_train
fl_asr_test
fl_asr_decode
fl_asr_align
fl_asr_voice_activity_detection_ctc
)
endif()
if ("lm" IN_LIST FEATURES)
list(APPEND FLASHLIGHT_TOOLS fl_lm_train fl_lm_dictionary_builder)
endif()
list(LENGTH FLASHLIGHT_TOOLS NUM_TOOLS)
if (NUM_TOOLS GREATER 0)
vcpkg_copy_tools(TOOL_NAMES ${FLASHLIGHT_TOOLS} AUTO_CLEAN)
endif()
# Copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)