This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
150 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# ---[ LevelDB | ||
# - Find LevelDB | ||
# | ||
# LevelDB_INCLUDES - List of LevelDB includes | ||
# LevelDB_LIBRARIES - List of libraries when using LevelDB. | ||
# LevelDB_FOUND - True if LevelDB found. | ||
|
||
# Use pkg-config to help find libraries if it's available | ||
find_package(PkgConfig) | ||
if (PKG_CONFIG_FOUND) | ||
pkg_check_modules(LevelDB LevelDB) | ||
endif() | ||
|
||
# Look for the header files. | ||
find_path(LevelDB_INCLUDE_DIR | ||
NAMES leveldb/db.h | ||
PATHS $ENV{LEVELDB_ROOT}/include ${LevelDB_INCLUDE_DIRS} /opt/local/include /usr/local/include /usr/include | ||
DOC "Path in which the file leveldb/db.h is located." | ||
) | ||
|
||
# Look for the library. | ||
find_library(LevelDB_LIBRARY | ||
NAMES leveldb | ||
PATHS $ENV{LEVELDB_ROOT}/lib ${LevelDB_LIBRARY_DIRS} /opt/local/lib /usr/local/lib /usr/lib | ||
DOC "Path to leveldb library." | ||
) | ||
|
||
# Now delegate to this cmake function to make sure all paths exist | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(LevelDB | ||
FOUND_VAR LevelDB_FOUND | ||
REQUIRED_VARS LevelDB_LIBRARY LevelDB_INCLUDE_DIR | ||
) | ||
|
||
if (NOT LevelDB_FOUND) | ||
return() | ||
endif() | ||
|
||
message(STATUS "Found LevelDB (include: ${LevelDB_INCLUDE}, library: ${LevelDB_LIBRARY})") | ||
mark_as_advanced(LevelDB_INCLUDE_DIR LevelDB_LIBRARY) | ||
|
||
# Create a leveldb target | ||
if (NOT TARGET leveldb::leveldb) | ||
add_library(leveldb::leveldb UNKNOWN IMPORTED) | ||
endif() | ||
|
||
# Set target properties for the new leveldb target | ||
set_target_properties(leveldb::leveldb PROPERTIES | ||
IMPORTED_LOCATION "${LevelDB_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${LevelDB_CFLAGS_OTHER}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${LevelDB_INCLUDE_DIR}" | ||
) | ||
|
||
# Read the LevelDB version from the header | ||
if(EXISTS "${LevelDB_INCLUDE_DIR}/leveldb/db.h") | ||
file(STRINGS "${LevelDB_INCLUDE_DIR}/leveldb/db.h" __version_lines | ||
REGEX "static const int k[^V]+Version[ \t]+=[ \t]+[0-9]+;") | ||
|
||
foreach(__line ${__version_lines}) | ||
if(__line MATCHES "[^k]+kMajorVersion[ \t]+=[ \t]+([0-9]+);") | ||
set(LEVELDB_VERSION_MAJOR ${CMAKE_MATCH_1}) | ||
elseif(__line MATCHES "[^k]+kMinorVersion[ \t]+=[ \t]+([0-9]+);") | ||
set(LEVELDB_VERSION_MINOR ${CMAKE_MATCH_1}) | ||
endif() | ||
endforeach() | ||
|
||
if(LEVELDB_VERSION_MAJOR AND LEVELDB_VERSION_MINOR) | ||
set(LEVELDB_VERSION "${LEVELDB_VERSION_MAJOR}.${LEVELDB_VERSION_MINOR}") | ||
endif() | ||
|
||
# caffe_clear_vars(__line __version_lines) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# ---[ snappy | ||
# Find the Snappy libraries | ||
# | ||
# The following variables are optionally searched for defaults | ||
# SNAPPY_ROOT_DIR: Base directory where all Snappy components are found | ||
# | ||
# The following are set after configuration is done: | ||
# SNAPPY_FOUND | ||
# Snappy_INCLUDE_DIR | ||
# Snappy_LIBRARIES | ||
|
||
# Use pkg-config to help find libraries if it's available | ||
find_package(PkgConfig) | ||
if (PKG_CONFIG_FOUND) | ||
pkg_check_modules(Snappy Snappy) | ||
endif() | ||
|
||
# Look for the header files. | ||
find_path(Snappy_INCLUDE_DIR | ||
NAMES snappy.h | ||
PATHS ${SNAPPY_ROOT_DIR}/include ${Snappy_INCLUDE_DIRS} | ||
) | ||
|
||
# Look for the library. | ||
find_library(Snappy_LIBRARY | ||
NAMES snappy | ||
PATHS ${SNAPPY_ROOT_DIR}/lib ${Snappy_LIBRARY_DIRS} | ||
) | ||
|
||
# Now delegate to this cmake function to make sure all paths exist | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Snappy | ||
FOUND_VAR SNAPPY_FOUND | ||
REQUIRED_VARS Snappy_LIBRARY Snappy_INCLUDE_DIR | ||
) | ||
|
||
if(NOT SNAPPY_FOUND) | ||
return() | ||
endif() | ||
|
||
message(STATUS "Found Snappy (include: ${Snappy_INCLUDE_DIR}, library: ${Snappy_LIBRARY})") | ||
mark_as_advanced(Snappy_INCLUDE_DIR Snappy_LIBRARY) | ||
|
||
# Create a Snappy target | ||
if (NOT TARGET snappy::snappy) | ||
add_library(snappy::snappy UNKNOWN IMPORTED) | ||
endif() | ||
|
||
# Set target properties for the new snappy target | ||
set_target_properties(snappy::snappy PROPERTIES | ||
IMPORTED_LOCATION "${Snappy_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${Snappy_CFLAGS_OTHER}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${Snappy_INCLUDE_DIR}" | ||
) | ||
|
||
# Read the Snappy version from the header | ||
caffe_parse_header(${Snappy_INCLUDE_DIR}/snappy-stubs-public.h | ||
SNAPPY_VERION_LINES SNAPPY_MAJOR SNAPPY_MINOR SNAPPY_PATCHLEVEL) | ||
set(Snappy_VERSION "${SNAPPY_MAJOR}.${SNAPPY_MINOR}.${SNAPPY_PATCHLEVEL}") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters