Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flashlight-cpu] Fix installation #18089

Merged
merged 4 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions ports/flashlight-cpu/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d9eacb..b530743 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -183,7 +183,7 @@ if (FL_BUILD_CORE)

# If cereal is found in a user-defined location, use it rather than
# downloading from source
- find_package(cereal)
+ find_package(cereal CONFIG REQUIRED)
if (NOT TARGET cereal AND NOT cereal_FOUND AND FL_BUILD_STANDALONE)
message(STATUS "cereal NOT found. Will download from source")
set(CEREAL_INSTALL_PATH ${FL_INSTALL_INC_DIR}/cereal)
@@ -206,7 +206,6 @@ if (FL_BUILD_CORE)
message(STATUS "Found cereal")
target_link_libraries(flashlight PRIVATE cereal)
endif()
- setup_install_find_module(${CMAKE_MODULE_PATH}/Findcereal.cmake)

# -------------------- Locate Backend-specific Dependencies --------------------
# TODO: rather than conditionally searching for backend-specific dependencies,
diff --git a/cmake/flashlightConfig.cmake.in b/cmake/flashlightConfig.cmake.in
index 00f9442..f265b8f 100644
--- a/cmake/flashlightConfig.cmake.in
+++ b/cmake/flashlightConfig.cmake.in
@@ -36,6 +36,7 @@ if (@FL_BUILD_LIBRARIES@)
endif()
# Core dependencies
if (@FL_BUILD_CORE@)
+ find_dependency(cereal CONFIG)
find_dependency(ArrayFire 3.7.1)
endif()
if (@FL_BUILD_DISTRIBUTED@)
8 changes: 6 additions & 2 deletions ports/flashlight-cpu/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ vcpkg_from_github(
REF 626914e79073c5547513de649af706f7e2b796ad # 0.3 branch tip
SHA512 a22057cfa4cfe7acd95cbc5445a30870cce3cdde89066d1d75f40be0d73b069a49e89b226fe5337488cfe5618dd25958679c0636a3e4008312f01606328becfa
HEAD_REF master
PATCHES fix-dependencies.patch
)

################################### Build ###################################
Expand All @@ -19,7 +20,6 @@ set(FL_DEFAULT_VCPKG_CMAKE_FLAGS
-DFL_BUILD_EXAMPLES=OFF
-DFL_BACKEND=CPU # this port is CPU-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
Expand All @@ -41,10 +41,14 @@ vcpkg_configure_cmake(
OPTIONS
${FL_DEFAULT_VCPKG_CMAKE_FLAGS}
${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DFL_INSTALL_CMAKE_DIR=${CURRENT_PACKAGES_DIR}/debug/share/flashlight
OPTIONS_RELEASE
-DFL_INSTALL_CMAKE_DIR=${CURRENT_PACKAGES_DIR}/share/flashlight
)
vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH share/flashlight-cpu TARGET_PATH share/flashlight)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/flashlight TARGET_PATH share/flashlight)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
Expand Down
2 changes: 1 addition & 1 deletion ports/flashlight-cpu/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "flashlight-cpu",
"version": "0.3",
"port-version": 1,
"port-version": 2,
"description": "A C++ standalone library for machine learning. CPU backend.",
"homepage": "https://github.com/facebookresearch/flashlight",
"supports": "!(windows | osx)",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@
},
"flashlight-cpu": {
"baseline": "0.3",
"port-version": 1
"port-version": 2
},
"flashlight-cuda": {
"baseline": "0.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/flashlight-cpu.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b37aa1e8b06ce24319b6969ed0fa87664e4ec308",
"version": "0.3",
"port-version": 2
},
{
"git-tree": "9de5ce0a5763ebc2b46378a46172b8cda7ac95c5",
"version": "0.3",
Expand Down