@ -766,7 +766,8 @@ endif()
set ( ROCKSDB_STATIC_LIB rocksdb ${ ARTIFACT_SUFFIX } )
set ( ROCKSDB_SHARED_LIB rocksdb-shared ${ ARTIFACT_SUFFIX } )
set ( ROCKSDB_IMPORT_LIB ${ ROCKSDB_SHARED_LIB } )
option ( ROCKSDB_BUILD_SHARED "Build shared versions of the RocksDB libraries" ON )
option ( WITH_LIBRADOS "Build with librados" OFF )
if ( WITH_LIBRADOS )
@ -777,38 +778,42 @@ endif()
if ( WIN32 )
set ( SYSTEM_LIBS ${ SYSTEM_LIBS } shlwapi.lib rpcrt4.lib )
set ( LIBS ${ ROCKSDB_STATIC_LIB } ${ THIRDPARTY_LIBS } ${ SYSTEM_LIBS } )
else ( )
set ( SYSTEM_LIBS ${ CMAKE_THREAD_LIBS_INIT } )
set ( LIBS ${ ROCKSDB_SHARED_LIB } ${ THIRDPARTY_LIBS } ${ SYSTEM_LIBS } )
add_library ( ${ ROCKSDB_SHARED_LIB } SHARED ${ SOURCES } )
target_link_libraries ( ${ ROCKSDB_SHARED_LIB }
$ { T H I R D P A R T Y _ L I B S } $ { S Y S T E M _ L I B S } )
set_target_properties ( ${ ROCKSDB_SHARED_LIB } PROPERTIES
L I N K E R _ L A N G U A G E C X X
V E R S I O N $ { r o c k s d b _ V E R S I O N }
S O V E R S I O N $ { r o c k s d b _ V E R S I O N _ M A J O R }
C X X _ S T A N D A R D 1 1
O U T P U T _ N A M E " r o c k s d b " )
endif ( )
add_library ( ${ ROCKSDB_STATIC_LIB } STATIC ${ SOURCES } )
target_link_libraries ( ${ ROCKSDB_STATIC_LIB }
$ { T H I R D P A R T Y _ L I B S } $ { S Y S T E M _ L I B S } )
if ( WIN32 )
add_library ( ${ ROCKSDB_IMPORT _LIB } SHARED ${ SOURCES } )
target_link_libraries ( ${ ROCKSDB_IMPORT _LIB }
if ( ROCKSDB_BUILD_SHARED )
add_library ( ${ ROCKSDB_SHARED_LIB } SHARED ${ SOURCES } )
target_link_libraries ( ${ ROCKSDB_SHARED_LIB }
$ { T H I R D P A R T Y _ L I B S } $ { S Y S T E M _ L I B S } )
set_target_properties ( ${ ROCKSDB_IMPORT_LIB } PROPERTIES
if ( WIN32 )
set_target_properties ( ${ ROCKSDB_SHARED_LIB } PROPERTIES
C O M P I L E _ D E F I N I T I O N S " R O C K S D B _ D L L ; R O C K S D B _ L I B R A R Y _ E X P O R T S " )
if ( MSVC )
set_target_properties ( ${ ROCKSDB_STATIC_LIB } PROPERTIES
C O M P I L E _ F L A G S " / F d $ { C M A K E _ C F G _ I N T D I R } / $ { R O C K S D B _ S T A T I C _ L I B } . p d b " )
set_target_properties ( ${ ROCKSDB_IMPORT _LIB } PROPERTIES
C O M P I L E _ F L A G S " / F d $ { C M A K E _ C F G _ I N T D I R } / $ { R O C K S D B _ I M P O R T _ L I B } . p d b " )
set_target_properties ( ${ ROCKSDB_SHARED _LIB } PROPERTIES
C O M P I L E _ F L A G S " / F d $ { C M A K E _ C F G _ I N T D I R } / $ { R O C K S D B _ S H A R E D _ L I B } . p d b " )
endif ( )
else ( )
set_target_properties ( ${ ROCKSDB_SHARED_LIB } PROPERTIES
L I N K E R _ L A N G U A G E C X X
V E R S I O N $ { r o c k s d b _ V E R S I O N }
S O V E R S I O N $ { r o c k s d b _ V E R S I O N _ M A J O R }
C X X _ S T A N D A R D 1 1
O U T P U T _ N A M E " r o c k s d b " )
endif ( )
endif ( )
if ( ROCKSDB_BUILD_SHARED AND NOT WIN32 )
set ( ROCKSDB_LIB ${ ROCKSDB_SHARED_LIB } )
else ( )
set ( ROCKSDB_LIB ${ ROCKSDB_STATIC_LIB } )
endif ( )
option ( WITH_JNI "build with JNI" OFF )
@ -857,6 +862,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS)
I N C L U D E S D E S T I N A T I O N " $ { C M A K E _ I N S T A L L _ I N C L U D E D I R } "
)
if ( ROCKSDB_BUILD_SHARED )
install (
T A R G E T S $ { R O C K S D B _ S H A R E D _ L I B }
E X P O R T R o c k s D B T a r g e t s
@ -866,6 +872,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS)
L I B R A R Y D E S T I N A T I O N " $ { C M A K E _ I N S T A L L _ L I B D I R } "
I N C L U D E S D E S T I N A T I O N " $ { C M A K E _ I N S T A L L _ I N C L U D E D I R } "
)
endif ( )
install (
E X P O R T R o c k s D B T a r g e t s
@ -1052,7 +1059,7 @@ if(WITH_TESTS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
add_custom_target ( check COMMAND ${ CMAKE_CTEST_COMMAND } )
set ( TESTUTILLIB testutillib ${ ARTIFACT_SUFFIX } )
add_library ( ${ TESTUTILLIB } STATIC ${ TESTUTIL_SOURCE } )
target_link_libraries ( ${ TESTUTILLIB } ${ LIBS } )
target_link_libraries ( ${ TESTUTILLIB } ${ ROCKSDB_ LIB} )
if ( MSVC )
set_target_properties ( ${ TESTUTILLIB } PROPERTIES COMPILE_FLAGS "/Fd${CMAKE_CFG_INTDIR}/testutillib${ARTIFACT_SUFFIX}.pdb" )
endif ( )
@ -1073,14 +1080,25 @@ if(WITH_TESTS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
E X C L U D E _ F R O M _ D E F A U L T _ B U I L D _ R E L W I T H D E B I N F O 1
O U T P U T _ N A M E $ { e x e n a m e } $ { A R T I F A C T _ S U F F I X }
)
target_link_libraries ( ${ CMAKE_PROJECT_NAME } _ ${ exename } ${ ARTIFACT_SUFFIX } testutillib ${ ARTIFACT_SUFFIX } gtest ${ LIBS } )
target_link_libraries ( ${ CMAKE_PROJECT_NAME } _ ${ exename } ${ ARTIFACT_SUFFIX } testutillib ${ ARTIFACT_SUFFIX } gtest ${ ROCKSDB_ LIB} )
if ( NOT "${exename}" MATCHES "db_sanity_test" )
add_test ( NAME ${ exename } COMMAND ${ exename } ${ ARTIFACT_SUFFIX } )
add_dependencies ( check ${ CMAKE_PROJECT_NAME } _ ${ exename } ${ ARTIFACT_SUFFIX } )
endif ( )
endforeach ( sourcefile ${ TEST_EXES } )
if ( WIN32 )
# C e x e c u t a b l e s m u s t l i n k t o a s h a r e d o b j e c t
if ( ROCKSDB_BUILD_SHARED )
set ( ROCKSDB_LIB_FOR_C ${ ROCKSDB_SHARED_LIB } )
else ( )
set ( ROCKSDB_LIB_FOR_C OFF )
endif ( )
else ( )
set ( ROCKSDB_LIB_FOR_C ${ ROCKSDB_LIB } )
endif ( )
if ( ROCKSDB_LIB_FOR_C )
set ( C_TESTS db/c_test.c )
set ( C_TEST_EXES ${ C_TESTS } )
@ -1093,11 +1111,12 @@ if(WITH_TESTS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
E X C L U D E _ F R O M _ D E F A U L T _ B U I L D _ M I N R E L E A S E 1
E X C L U D E _ F R O M _ D E F A U L T _ B U I L D _ R E L W I T H D E B I N F O 1
)
target_link_libraries ( ${ exename } ${ ARTIFACT_SUFFIX } ${ ROCKSDB_IMPORT_LIB } testutillib ${ ARTIFACT_SUFFIX } )
target_link_libraries ( ${ exename } ${ ARTIFACT_SUFFIX } ${ ROCKSDB_LIB_FOR_C } testutillib ${ ARTIFACT_SUFFIX } )
add_test ( NAME ${ exename } COMMAND ${ exename } ${ ARTIFACT_SUFFIX } )
add_dependencies ( check ${ exename } ${ ARTIFACT_SUFFIX } )
endforeach ( sourcefile ${ C_TEST_EXES } )
endif ( )
endif ( )
option ( WITH_BENCHMARK_TOOLS "build with benchmarks" ON )
if ( WITH_BENCHMARK_TOOLS )
@ -1117,14 +1136,14 @@ if(WITH_BENCHMARK_TOOLS)
get_filename_component ( exename ${ sourcefile } NAME_WE )
add_executable ( ${ exename } ${ ARTIFACT_SUFFIX } ${ sourcefile }
$ < T A R G E T _ O B J E C T S : t e s t h a r n e s s > )
target_link_libraries ( ${ exename } ${ ARTIFACT_SUFFIX } gtest ${ LIBS } )
target_link_libraries ( ${ exename } ${ ARTIFACT_SUFFIX } gtest ${ ROCKSDB_ LIB} )
endforeach ( sourcefile ${ BENCHMARKS } )
add_executable ( db_bench ${ ARTIFACT_SUFFIX }
t o o l s / d b _ b e n c h . c c
t o o l s / d b _ b e n c h _ t o o l . c c
$ < T A R G E T _ O B J E C T S : t e s t h a r n e s s > )
target_link_libraries ( db_bench ${ ARTIFACT_SUFFIX } gtest ${ LIBS } )
target_link_libraries ( db_bench ${ ARTIFACT_SUFFIX } gtest ${ ROCKSDB_ LIB} )
endif ( )
option ( WITH_TOOLS "build with tools" ON )