@ -1,4 +1,5 @@
# T h i s c m a k e b u i l d i s f o r W i n d o w s 6 4 - b i t o n l y .
# P r e r e q u i s i t e s f o r W i n d o w s :
# T h i s c m a k e b u i l d i s f o r W i n d o w s 6 4 - b i t o n l y .
#
# P r e r e q u i s i t e s :
# Y o u m u s t h a v e a t l e a s t V i s u a l S t u d i o 2 0 1 5 U p d a t e 3 . S t a r t t h e D e v e l o p e r C o m m a n d P r o m p t w i n d o w t h a t i s a p a r t o f V i s u a l S t u d i o i n s t a l l a t i o n .
@ -24,6 +25,12 @@
# 5 . A n d r e l e a s e mode ( /m[:<N>] is also supported )
# m s b u i l d r o c k s d b . s l n / p : C o n f i g u r a t i o n = R e l e a s e
#
# L i n u x :
#
# 1 . I n s t a l l a r e c e n t t o o l c h a i n s u c h a s d e v t o o l s e t - 3 i f y o u ' r e o n a o l d e r d i s t r o . C + + 1 1 r e q u i r e d .
# 2 . m k d i r b u i l d ; c d b u i l d
# 3 . c m a k e . .
# 4 . m a k e - j
cmake_minimum_required ( VERSION 2.6 )
project ( rocksdb )
@ -236,19 +243,9 @@ endif()
include_directories ( ${ PROJECT_SOURCE_DIR } )
include_directories ( ${ PROJECT_SOURCE_DIR } /include )
include_directories ( SYSTEM ${ PROJECT_SOURCE_DIR } /third-party/gtest-1.7.0/fused-src )
find_package ( Threads REQUIRED )
if ( WIN32 )
set ( SYSTEM_LIBS ${ SYSTEM_LIBS } Shlwapi.lib Rpcrt4.lib )
else ( )
set ( SYSTEM_LIBS ${ CMAKE_THREAD_LIBS_INIT } )
endif ( )
set ( ROCKSDB_LIBS rocksdblib ${ ARTIFACT_SUFFIX } )
set ( LIBS ${ ROCKSDB_LIBS } ${ THIRDPARTY_LIBS } ${ SYSTEM_LIBS } )
add_subdirectory ( third-party/gtest-1.7.0/fused-src/gtest )
add_subdirectory ( tools )
# M a i n l i b r a r y s o u r c e c o d e
@ -458,6 +455,27 @@ else()
u t i l / i o _ p o s i x . c c )
endif ( )
if ( WIN32 )
set ( SYSTEM_LIBS ${ SYSTEM_LIBS } Shlwapi.lib Rpcrt4.lib )
set ( ROCKSDB_STATIC_LIB rocksdblib ${ ARTIFACT_SUFFIX } )
set ( ROCKSDB_IMPORT_LIB rocksdb ${ ARTIFACT_SUFFIX } )
set ( LIBS ${ ROCKSDB_STATIC_LIB } ${ THIRDPARTY_LIBS } ${ SYSTEM_LIBS } )
else ( )
set ( SYSTEM_LIBS ${ CMAKE_THREAD_LIBS_INIT } rt )
set ( ROCKSDB_STATIC_LIB rocksdb ${ ARTIFACT_SUFFIX } )
set ( ROCKSDB_SHARED_LIB rocksdb-shared )
set ( ROCKSDB_IMPORT_LIB ${ ROCKSDB_SHARED_LIB } )
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
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 ( )
option ( WITH_LIBRADOS "Build with librados" OFF )
if ( WITH_LIBRADOS )
list ( APPEND SOURCES
@ -465,22 +483,22 @@ if(WITH_LIBRADOS)
list ( APPEND THIRDPARTY_LIBS rados )
endif ( )
add_library ( rocksdblib ${ ARTIFACT_SUFFIX } STATIC ${ SOURCES } )
target_link_libraries ( rocksdblib ${ ARTIFACT_SUFFIX }
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 )
set_target_properties ( rocksdblib ${ ARTIFACT_SUFFIX } 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 l i b $ { A R T I F A C T _ S U F F I X } . p d b " )
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 " )
endif ( )
add_library ( rocksdb ${ ARTIFACT_SUFFIX } SHARED ${ SOURCES } )
target_link_libraries ( rocksdb ${ ARTIFACT_SUFFIX }
$ { 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 )
set_target_properties ( rocksdb ${ ARTIFACT_SUFFIX } PROPERTIES
C O M P I L E _ F L A G S " - D R O C K S D B _ D L L - D R O C K S D B _ L I B R A R Y _ E X P O R T S / F d $ { C M A K E _ C F G _ I N T D I R } / r o c k s d b $ { A R T I F A C T _ S U F F I X } . p d b " )
add_library ( ${ ROCKSDB_IMPORT_LIB } SHARED ${ SOURCES } )
target_link_libraries ( ${ ROCKSDB_IMPORT_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
C O M P I L E _ F L A G S " - D R O C K S D B _ D L L - D R O C K S D B _ L I B R A R Y _ E X P O R T 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 " )
else ( )
endif ( )
option ( WITH_JNI "build with JNI" OFF )
@ -628,7 +646,7 @@ foreach(sourcefile ${BENCHMARKS})
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 } ${ LIBS } gtest )
target_link_libraries ( ${ exename } ${ ARTIFACT_SUFFIX } gtest ${ LIBS } )
endforeach ( sourcefile ${ BENCHMARKS } )
# F o r t e s t u t i l l i b r a r y t h a t i s b u i l d o n l y i n D E B U G m o d e
@ -666,7 +684,7 @@ foreach(sourcefile ${TEST_EXES})
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 } testutillib ${ ARTIFACT_SUFFIX } ${ LIBS } gtest )
target_link_libraries ( ${ exename } ${ ARTIFACT_SUFFIX } testutillib ${ ARTIFACT_SUFFIX } gtest ${ LIBS } )
if ( NOT "${exename}" MATCHES "db_sanity_test" )
add_test ( NAME ${ exename } COMMAND ${ exename } ${ ARTIFACT_SUFFIX } )
add_dependencies ( check ${ exename } ${ ARTIFACT_SUFFIX } )
@ -686,7 +704,8 @@ foreach(sourcefile ${C_TEST_EXES})
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 ${ ARTIFACT_SUFFIX } testutillib ${ ARTIFACT_SUFFIX } )
target_link_libraries ( ${ exename } ${ ARTIFACT_SUFFIX } ${ ROCKSDB_IMPORT_LIB } testutillib ${ ARTIFACT_SUFFIX } )
add_test ( NAME ${ exename } COMMAND ${ exename } ${ ARTIFACT_SUFFIX } )
add_dependencies ( check ${ exename } ${ ARTIFACT_SUFFIX } )
endforeach ( sourcefile ${ C_TEST_EXES } )
add_subdirectory ( tools )