Skip to content

Commit

Permalink
Migrate OSS build from custom to getdeps
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookincubator/zstrong#1098

We have been manually syncing our builds when there is a change in builds of our dependencies (folly, thrift). This has been one of the major source of work in OSS maintenance. Migrating to getdeps will automatically sync the dependencies which means we only have to manage our own builds.

NOTE: There is a dependency of getdeps on zlib which requires us to first run sudo dnf install -y zlib-devel before we successfully run getdeps. I don't think this should affect the OSS build as it is a getdeps dependency.

Reviewed By: haowu14

Differential Revision: D65844211

fbshipit-source-id: 8e89e670cdec4a21ca7aba48ae58b5b72ddbf832
  • Loading branch information
Pranav Bhandari authored and facebook-github-bot committed Dec 27, 2024
1 parent f6f63a0 commit ee3655d
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cachelib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ find_package(wangle CONFIG REQUIRED)
find_package(Zlib REQUIRED)
find_package(Zstd REQUIRED)
find_package(FBThrift REQUIRED) # must come after wangle
find_package(NUMA REQUIRED)
find_package(Sparsemap REQUIRED)

find_package(uring)
if (NOT uring_FOUND)
Expand Down
11 changes: 10 additions & 1 deletion cachelib/allocator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ add_library (cachelib_allocator
${SERIALIZE_THRIFT_FILES}
${DATASTRUCT_SERIALIZE_THRIFT_FILES}
${MEMORY_SERIALIZE_THRIFT_FILES}
CacheAllocator.cpp
CacheAllocatorLru2QCache.cpp
CacheAllocatorLru5B2QCache.cpp
CacheAllocatorLru5BCache.cpp
CacheAllocatorLru5BCacheWithSpinBuckets.cpp
CacheAllocatorLruCache.cpp
CacheAllocatorLruCacheWithSpinBuckets.cpp
CacheAllocatorTinyLFU5BCache.cpp
CacheAllocatorTinyLFUCache.cpp
CacheAllocatorWTinyLFU5BCache.cpp
CacheAllocatorWTinyLFUCache.cpp
Cache.cpp
CacheDetails.cpp
CacheStats.cpp
Expand Down
50 changes: 50 additions & 0 deletions cachelib/cmake/FindNUMA.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# - Find NUMA
# Find the NUMA library and includes
#
# NUMA_INCLUDE_DIRS - where to find numa.h, etc.
# NUMA_LIBRARIES - List of libraries when using NUMA.
# NUMA_FOUND - True if NUMA found.

message(STATUS "looking numa in dir: : ${NUMA_INCLUDE_DIRS}")
message(STATUS "root: : ${NUMA_ROOT_DIR}")

find_path(NUMA_INCLUDE_DIRS
NAMES numa.h numaif.h
HINTS ${NUMA_ROOT_DIR}/include)

message(STATUS "root: : ${NUMA_ROOT_DIR}")

message(STATUS "looking numa in dir again : ${NUMA_INCLUDE_DIRS}")

find_library(NUMA_LIBRARIES
NAMES numa
HINTS ${NUMA_ROOT_DIR}/lib)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(NUMA DEFAULT_MSG NUMA_LIBRARIES NUMA_INCLUDE_DIRS)

mark_as_advanced(
NUMA_LIBRARIES
NUMA_INCLUDE_DIRS)

if(NUMA_FOUND AND NOT (TARGET NUMA::NUMA))
add_library (NUMA::NUMA UNKNOWN IMPORTED)
set_target_properties(NUMA::NUMA
PROPERTIES
IMPORTED_LOCATION ${NUMA_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${NUMA_INCLUDE_DIRS})
endif()
19 changes: 19 additions & 0 deletions cachelib/cmake/FindSparsemap.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

find_path(SPARSEMAP_INCLUDE_DIRS NAMES tsl/sparse_map.h
HINTS ${CMAKE_PREFIX_PATH}
PATH_SUFFIXES include
)
include_directories(${SPARSEMAP_INCLUDE_DIRS})
1 change: 1 addition & 0 deletions cachelib/datatype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ add_library (cachelib_datatype
add_dependencies(cachelib_datatype thrift_generated_files)
target_link_libraries(cachelib_datatype PUBLIC
cachelib_common
GTest::gtest
)

install(TARGETS cachelib_datatype
Expand Down
2 changes: 1 addition & 1 deletion cachelib/shm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ add_library (cachelib_shm
add_dependencies(cachelib_shm thrift_generated_files)
target_link_libraries(cachelib_shm PUBLIC
cachelib_common
numa
NUMA::NUMA
)

install(TARGETS cachelib_shm
Expand Down

0 comments on commit ee3655d

Please sign in to comment.