forked from openembedded/meta-openembedded
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rocksdb: Add an option to set static library
Modify the CMakeLists.txt to add an Option for STATIC target import, as available for shared library. Link: facebook/rocksdb#12890 Configure static library default to switched off as shared libraries are sufficient in most cases. Signed-off-by: Bhabu Bindu <bindu.bhabu@kpit.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
meta-oe/recipes-dbs/rocksdb/files/static_library_as_option.patch
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 @@ | ||
From 285d306494bde3e9c24c8cd6fea1eb380a304d03 Mon Sep 17 00:00:00 2001 | ||
From: Bindu-Bhabu <bindudaniel1996@gmail.com> | ||
Date: Fri, 26 Jul 2024 15:14:45 +0530 | ||
Subject: Add option to CMake for building static libraries | ||
|
||
ROCKSDB creates a STATIC library target reference by default. | ||
Modify the cmake so that the STATIC library is also an option | ||
just like creating a SHARED library and set default to ON. | ||
|
||
Upstream-Status: Accepted | ||
Link: https://github.com/facebook/rocksdb/pull/12890 | ||
|
||
Signed-off-by: Nisha Parrakat <nisha.m.parrakat@bmw.de> | ||
Signed-off-by: Bindu Bhabu <bhabu.bindu@kpit.com> | ||
--- | ||
CMakeLists.txt | 29 +++++++++++++++++------------ | ||
1 file changed, 17 insertions(+), 12 deletions(-) | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 93b884dd9c1..2ca925d505c 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -98,6 +98,7 @@ if (WITH_WINDOWS_UTF8_FILENAMES) | ||
add_definitions(-DROCKSDB_WINDOWS_UTF8_FILENAMES) | ||
endif() | ||
option(ROCKSDB_BUILD_SHARED "Build shared versions of the RocksDB libraries" ON) | ||
+option(ROCKSDB_BUILD_STATIC "Build static versions of the RocksDB libraries" ON) | ||
|
||
if( NOT DEFINED CMAKE_CXX_STANDARD ) | ||
set(CMAKE_CXX_STANDARD 17) | ||
@@ -1139,11 +1140,13 @@ string(REGEX REPLACE "[^0-9: /-]+" "" GIT_DATE "${GIT_DATE}") | ||
set(BUILD_VERSION_CC ${CMAKE_BINARY_DIR}/build_version.cc) | ||
configure_file(util/build_version.cc.in ${BUILD_VERSION_CC} @ONLY) | ||
|
||
-add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES} ${BUILD_VERSION_CC}) | ||
-target_include_directories(${ROCKSDB_STATIC_LIB} PUBLIC | ||
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>) | ||
-target_link_libraries(${ROCKSDB_STATIC_LIB} PRIVATE | ||
- ${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) | ||
+if(ROCKSDB_BUILD_STATIC) | ||
+ add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES} ${BUILD_VERSION_CC}) | ||
+ target_include_directories(${ROCKSDB_STATIC_LIB} PUBLIC | ||
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>) | ||
+ target_link_libraries(${ROCKSDB_STATIC_LIB} PRIVATE | ||
+ ${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) | ||
+endif() | ||
|
||
if(ROCKSDB_BUILD_SHARED) | ||
add_library(${ROCKSDB_SHARED_LIB} SHARED ${SOURCES} ${BUILD_VERSION_CC}) | ||
@@ -1238,13 +1241,15 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS) | ||
|
||
install(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/modules" COMPONENT devel DESTINATION ${package_config_destination}) | ||
|
||
- install( | ||
- TARGETS ${ROCKSDB_STATIC_LIB} | ||
- EXPORT RocksDBTargets | ||
- COMPONENT devel | ||
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
- INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
- ) | ||
+ if(ROCKSDB_BUILD_STATIC) | ||
+ install( | ||
+ TARGETS ${ROCKSDB_STATIC_LIB} | ||
+ EXPORT RocksDBTargets | ||
+ COMPONENT devel | ||
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
+ ) | ||
+ endif() | ||
|
||
if(ROCKSDB_BUILD_SHARED) | ||
install( |
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