2021-05-18 02:32:54 -05:00
|
|
|
if (EXISTS "${CURRENT_INSTALLED_DIR}/share/flashlight")
|
|
|
|
message(FATAL_ERROR "Only one of flashlight-cpu and flashlight-cuda"
|
|
|
|
"can be installed at once. Uninstall and try again:"
|
2021-01-16 21:42:15 -06:00
|
|
|
"\n vcpkg remove flashlight-cuda\n")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
2021-04-23 12:41:58 -05:00
|
|
|
REPO flashlight/flashlight
|
2021-05-18 02:32:54 -05:00
|
|
|
REF 626914e79073c5547513de649af706f7e2b796ad # 0.3 branch tip
|
|
|
|
SHA512 a22057cfa4cfe7acd95cbc5445a30870cce3cdde89066d1d75f40be0d73b069a49e89b226fe5337488cfe5618dd25958679c0636a3e4008312f01606328becfa
|
2021-01-16 21:42:15 -06:00
|
|
|
HEAD_REF master
|
2021-06-10 06:38:28 +08:00
|
|
|
PATCHES fix-dependencies.patch
|
2021-01-16 21:42:15 -06:00
|
|
|
)
|
|
|
|
|
2021-05-18 02:32:54 -05:00
|
|
|
################################### Build ###################################
|
2021-01-16 21:42:15 -06:00
|
|
|
# Default flags
|
|
|
|
set(FL_DEFAULT_VCPKG_CMAKE_FLAGS
|
|
|
|
-DFL_BUILD_TESTS=OFF
|
|
|
|
-DFL_BUILD_EXAMPLES=OFF
|
|
|
|
-DFL_BACKEND=CPU # this port is CPU-backend only
|
|
|
|
-DFL_BUILD_STANDALONE=OFF
|
|
|
|
)
|
|
|
|
|
|
|
|
# Determine which components to build via specified feature
|
|
|
|
vcpkg_check_features(
|
|
|
|
OUT_FEATURE_OPTIONS 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
|
2021-04-23 12:41:58 -05:00
|
|
|
objdet FL_BUILD_APP_OBJDET
|
2021-01-16 21:42:15 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
# Build and install
|
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PREFER_NINJA
|
|
|
|
OPTIONS
|
|
|
|
${FL_DEFAULT_VCPKG_CMAKE_FLAGS}
|
|
|
|
${FEATURE_OPTIONS}
|
2021-06-10 06:38:28 +08:00
|
|
|
OPTIONS_DEBUG
|
|
|
|
-DFL_INSTALL_CMAKE_DIR=${CURRENT_PACKAGES_DIR}/debug/share/flashlight
|
|
|
|
OPTIONS_RELEASE
|
|
|
|
-DFL_INSTALL_CMAKE_DIR=${CURRENT_PACKAGES_DIR}/share/flashlight
|
2021-01-16 21:42:15 -06:00
|
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
|
2021-06-10 06:38:28 +08:00
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH share/flashlight TARGET_PATH share/flashlight)
|
2021-05-18 02:32:54 -05:00
|
|
|
|
2021-01-16 21:42:15 -06:00
|
|
|
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)
|
2021-04-23 12:41:58 -05:00
|
|
|
list(APPEND FLASHLIGHT_TOOLS
|
|
|
|
fl_img_imagenet_resnet34
|
|
|
|
fl_img_imagenet_eval
|
|
|
|
fl_img_imagenet_vit
|
|
|
|
)
|
2021-01-16 21:42:15 -06:00
|
|
|
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
|
2021-04-23 12:41:58 -05:00
|
|
|
fl_asr_arch_benchmark
|
2021-01-16 21:42:15 -06:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if ("lm" IN_LIST FEATURES)
|
2021-04-23 12:41:58 -05:00
|
|
|
list(APPEND FLASHLIGHT_TOOLS
|
|
|
|
fl_lm_dictionary_builder
|
|
|
|
fl_lm_train
|
|
|
|
fl_lm_test
|
|
|
|
)
|
2021-01-16 21:42:15 -06:00
|
|
|
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)
|