@ -14,7 +14,7 @@
# c d b u i l d
# c d b u i l d
# 3 . R u n c m a k e t o g e n e r a t e p r o j e c t f i l e s f o r W i n d o w s , a d d m o r e o p t i o n s t o e n a b l e r e q u i r e d t h i r d - p a r t y l i b r a r i e s .
# 3 . R u n c m a k e t o g e n e r a t e p r o j e c t f i l e s f o r W i n d o w s , a d d m o r e o p t i o n s t o e n a b l e r e q u i r e d t h i r d - p a r t y l i b r a r i e s .
# S e e t h i r d p a r t y . i n c f o r m o r e i n f o r m a t i o n .
# S e e t h i r d p a r t y . i n c f o r m o r e i n f o r m a t i o n .
# s a m p l e c o m m a n d : c m a k e - G " V i s u a l S t u d i o 1 5 W i n 6 4 " - D W I T H _ G F L A G S = 1 - D W I T H _ S N A P P Y = 1 - D W I T H _ J E M A L L O C = 1 - D W I T H _ J N I = 1 . .
# s a m p l e c o m m a n d : c m a k e - G " V i s u a l S t u d i o 1 5 W i n 6 4 " - D C M A K E _ B U I L D _ T Y P E = R e l e a s e - D W I T H _ G F L A G S = 1 - D W I T H _ S N A P P Y = 1 - D W I T H _ J E M A L L O C = 1 - D W I T H _ J N I = 1 . .
# 4 . T h e n b u i l d t h e p r o j e c t i n d e b u g mode ( you may want to add /m[:<N>] flag to run msbuild in <N> parallel threads
# 4 . T h e n b u i l d t h e p r o j e c t i n d e b u g mode ( you may want to add /m[:<N>] flag to run msbuild in <N> parallel threads
# o r s i m p l y / m t o u s e a l l a v a i l c o r e s )
# o r s i m p l y / m t o u s e a l l a v a i l c o r e s )
# m s b u i l d r o c k s d b . s l n
# m s b u i l d r o c k s d b . s l n
@ -174,7 +174,7 @@ else()
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wextra -Wall" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wextra -Wall" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing" )
if ( MINGW )
if ( MINGW )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format -fno-asynchronous-unwind-tables " )
add_definitions ( -D_POSIX_C_SOURCE=1 )
add_definitions ( -D_POSIX_C_SOURCE=1 )
endif ( )
endif ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
@ -885,7 +885,9 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS)
endif ( )
endif ( )
option ( WITH_TESTS "build with tests" ON )
option ( WITH_TESTS "build with tests" ON )
if ( WITH_TESTS )
# F o r t e s t l i b r a r i e s , u t i l i t i e s , a n d e x e s t h a t a r e b u i l d i f f W I T H _ T E S T S = O N a n d
# i n D e b u g m o d e . A d d t e s t o n l y c o d e t h a t i s n o t # i f d e f e d f o r R e l e a s e h e r e .
if ( WITH_TESTS AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
add_subdirectory ( third-party/gtest-1.8.1/fused-src/gtest )
add_subdirectory ( third-party/gtest-1.8.1/fused-src/gtest )
set ( TESTS
set ( TESTS
c a c h e / c a c h e _ t e s t . c c
c a c h e / c a c h e _ t e s t . c c
@ -1040,24 +1042,6 @@ if(WITH_TESTS)
list ( APPEND TESTS third-party/folly/folly/synchronization/test/DistributedMutexTest.cpp )
list ( APPEND TESTS third-party/folly/folly/synchronization/test/DistributedMutexTest.cpp )
endif ( )
endif ( )
set ( BENCHMARKS
c a c h e / c a c h e _ b e n c h . c c
m e m t a b l e / m e m t a b l e r e p _ b e n c h . c c
d b / r a n g e _ d e l _ a g g r e g a t o r _ b e n c h . c c
t o o l s / d b _ b e n c h . c c
t a b l e / t a b l e _ r e a d e r _ b e n c h . c c
u t i l / f i l t e r _ b e n c h . c c
u t i l i t i e s / p e r s i s t e n t _ c a c h e / h a s h _ t a b l e _ b e n c h . c c )
add_library ( testharness OBJECT test_util/testharness.cc )
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 } 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
# a n d l i n k e d t o t e s t s . A d d t e s t o n l y c o d e t h a t i s n o t # i f d e f e d f o r R e l e a s e h e r e .
set ( TESTUTIL_SOURCE
set ( TESTUTIL_SOURCE
d b / d b _ t e s t _ u t i l . c c
d b / d b _ t e s t _ u t i l . c c
m o n i t o r i n g / t h r e a d _ s t a t u s _ u p d a t e r _ d e b u g . c c
m o n i t o r i n g / t h r e a d _ s t a t u s _ u p d a t e r _ d e b u g . c c
@ -1065,7 +1049,6 @@ if(WITH_TESTS)
t e s t _ u t i l / f a u l t _ i n j e c t i o n _ t e s t _ e n v . c c
t e s t _ u t i l / f a u l t _ i n j e c t i o n _ t e s t _ e n v . c c
u t i l i t i e s / c a s s a n d r a / t e s t _ u t i l s . c c
u t i l i t i e s / c a s s a n d r a / t e s t _ u t i l s . c c
)
)
# t e s t u t i l i t i e s a r e o n l y b u i l d i n d e b u g
enable_testing ( )
enable_testing ( )
add_custom_target ( check COMMAND ${ CMAKE_CTEST_COMMAND } )
add_custom_target ( check COMMAND ${ CMAKE_CTEST_COMMAND } )
set ( TESTUTILLIB testutillib ${ ARTIFACT_SUFFIX } )
set ( TESTUTILLIB testutillib ${ ARTIFACT_SUFFIX } )
@ -1080,9 +1063,7 @@ if(WITH_TESTS)
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
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
)
)
# T e s t s a r e e x c l u d e d f r o m R e l e a s e b u i l d s
set ( TEST_EXES ${ TESTS } )
set ( TEST_EXES ${ TESTS } )
foreach ( sourcefile ${ TEST_EXES } )
foreach ( sourcefile ${ TEST_EXES } )
get_filename_component ( exename ${ sourcefile } NAME_WE )
get_filename_component ( exename ${ sourcefile } NAME_WE )
add_executable ( ${ CMAKE_PROJECT_NAME } _ ${ exename } ${ ARTIFACT_SUFFIX } ${ sourcefile }
add_executable ( ${ CMAKE_PROJECT_NAME } _ ${ exename } ${ ARTIFACT_SUFFIX } ${ sourcefile }
@ -1119,6 +1100,29 @@ if(WITH_TESTS)
endforeach ( sourcefile ${ C_TEST_EXES } )
endforeach ( sourcefile ${ C_TEST_EXES } )
endif ( )
endif ( )
option ( WITH_BENCHMARK_TOOLS "build with benchmarks" ON )
if ( WITH_BENCHMARK_TOOLS )
if ( NOT TARGET gtest )
add_subdirectory ( third-party/gtest-1.8.1/fused-src/gtest )
endif ( )
set ( BENCHMARKS
c a c h e / c a c h e _ b e n c h . c c
m e m t a b l e / m e m t a b l e r e p _ b e n c h . c c
d b / r a n g e _ d e l _ a g g r e g a t o r _ b e n c h . c c
t o o l s / d b _ b e n c h . c c
t a b l e / t a b l e _ r e a d e r _ b e n c h . c c
u t i l / f i l t e r _ b e n c h . c c
u t i l i t i e s / p e r s i s t e n t _ c a c h e / h a s h _ t a b l e _ b e n c h . c c
)
add_library ( testharness OBJECT test_util/testharness.cc )
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 } gtest ${ LIBS } )
endforeach ( sourcefile ${ BENCHMARKS } )
endif ( )
option ( WITH_TOOLS "build with tools" ON )
option ( WITH_TOOLS "build with tools" ON )
if ( WITH_TOOLS )
if ( WITH_TOOLS )
add_subdirectory ( tools )
add_subdirectory ( tools )