2021-05-18 15:32:54 +08: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-17 11:42:15 +08:00
|
|
|
"\n vcpkg remove flashlight-cuda\n")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
2021-04-24 01:41:58 +08:00
|
|
|
REPO flashlight/flashlight
|
2021-05-18 15:32:54 +08:00
|
|
|
REF 626914e79073c5547513de649af706f7e2b796ad # 0.3 branch tip
|
|
|
|
SHA512 a22057cfa4cfe7acd95cbc5445a30870cce3cdde89066d1d75f40be0d73b069a49e89b226fe5337488cfe5618dd25958679c0636a3e4008312f01606328becfa
|
2021-01-17 11:42:15 +08:00
|
|
|
HEAD_REF master
|
2021-06-10 06:38:28 +08:00
|
|
|
PATCHES fix-dependencies.patch
|
2021-01-17 11:42:15 +08:00
|
|
|
)
|
|
|
|
|
2021-05-18 15:32:54 +08:00
|
|
|
################################### Build ###################################
|
2021-01-17 11:42:15 +08: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-24 01:41:58 +08:00
|
|
|
objdet FL_BUILD_APP_OBJDET
|
2021-01-17 11:42:15 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# Build and install
|
2023-04-14 00:13:15 +08:00
|
|
|
vcpkg_cmake_configure(
|
2023-04-22 05:48:12 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2021-01-17 11:42:15 +08:00
|
|
|
OPTIONS
|
|
|
|
${FL_DEFAULT_VCPKG_CMAKE_FLAGS}
|
|
|
|
${FEATURE_OPTIONS}
|
2021-06-10 06:38:28 +08:00
|
|
|
OPTIONS_DEBUG
|
2023-04-22 05:48:12 +08:00
|
|
|
"-DFL_INSTALL_CMAKE_DIR=${CURRENT_PACKAGES_DIR}/debug/share/flashlight"
|
2021-06-10 06:38:28 +08:00
|
|
|
OPTIONS_RELEASE
|
2023-04-22 05:48:12 +08:00
|
|
|
"-DFL_INSTALL_CMAKE_DIR=${CURRENT_PACKAGES_DIR}/share/flashlight"
|
2021-01-17 11:42:15 +08:00
|
|
|
)
|
2023-04-14 00:13:15 +08:00
|
|
|
vcpkg_cmake_install()
|
2021-01-17 11:42:15 +08:00
|
|
|
|
2023-04-14 00:13:15 +08:00
|
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME flashlight)
|
2021-05-18 15:32:54 +08:00
|
|
|
|
2021-01-17 11:42:15 +08: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-24 01:41:58 +08:00
|
|
|
list(APPEND FLASHLIGHT_TOOLS
|
|
|
|
fl_img_imagenet_resnet34
|
|
|
|
fl_img_imagenet_eval
|
|
|
|
fl_img_imagenet_vit
|
|
|
|
)
|
2021-01-17 11:42:15 +08: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-24 01:41:58 +08:00
|
|
|
fl_asr_arch_benchmark
|
2021-01-17 11:42:15 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if ("lm" IN_LIST FEATURES)
|
2021-04-24 01:41:58 +08:00
|
|
|
list(APPEND FLASHLIGHT_TOOLS
|
|
|
|
fl_lm_dictionary_builder
|
|
|
|
fl_lm_train
|
|
|
|
fl_lm_test
|
|
|
|
)
|
2021-01-17 11:42:15 +08:00
|
|
|
endif()
|
|
|
|
list(LENGTH FLASHLIGHT_TOOLS NUM_TOOLS)
|
|
|
|
if (NUM_TOOLS GREATER 0)
|
|
|
|
vcpkg_copy_tools(TOOL_NAMES ${FLASHLIGHT_TOOLS} AUTO_CLEAN)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Copyright
|
2023-04-22 05:48:12 +08:00
|
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|