Add options to build gflag as a shared library.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/096abe29 Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/096abe29 Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/096abe29 Branch: refs/heads/decimal-type Commit: 096abe29ab8f8510b177168f9e492f59b10e49f5 Parents: 2d39b8e Author: Navneet Potti <nav...@gmail.com> Authored: Wed Jun 8 16:59:07 2016 -0500 Committer: Zuyu Zhang <zzh...@pivotal.io> Committed: Wed Jun 8 20:30:29 2016 -0700 ---------------------------------------------------------------------- CMakeLists.txt | 8 +++++++- cli/CMakeLists.txt | 8 +++++++- query_execution/CMakeLists.txt | 8 +++++++- query_optimizer/CMakeLists.txt | 8 +++++++- query_optimizer/tests/CMakeLists.txt | 10 ++++++++-- relational_operators/CMakeLists.txt | 20 +++++++++++++------- storage/CMakeLists.txt | 12 +++++++++--- transaction/CMakeLists.txt | 8 +++++++- 8 files changed, 65 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index ef7fd50..2d10a78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,12 @@ endif() option(ENABLE_DISTRIBUTED "Use the distributed version of Quickstep" OFF) +if (BUILD_SHARED_LIBS) + set(GFLAGS_LIB_NAME gflags_nothreads-shared) +else() + set(GFLAGS_LIB_NAME gflags_nothreads-static) +endif() + # Turn on the QUICKSTEP_DEBUG flag in the source if this is a debug build. if (CMAKE_MAJOR_VERSION GREATER 2) cmake_policy(SET CMP0043 NEW) @@ -700,7 +706,7 @@ add_subdirectory(yarn) add_executable (quickstep_cli_shell cli/QuickstepCli.cpp) # Link against direct deps (will transitively pull in everything needed). target_link_libraries(quickstep_cli_shell - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog quickstep_catalog_CatalogRelation quickstep_cli_CommandExecutor http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/cli/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 8fee7a4..faf5040 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -30,6 +30,12 @@ if(LIBNUMA_FOUND) set(QUICKSTEP_HAVE_LIBNUMA TRUE) endif() +if (BUILD_SHARED_LIBS) + set(GFLAGS_LIB_NAME gflags_nothreads-shared) +else() + set(GFLAGS_LIB_NAME gflags_nothreads-static) +endif() + configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/CliConfig.h.in" "${CMAKE_CURRENT_BINARY_DIR}/CliConfig.h" @@ -110,7 +116,7 @@ target_link_libraries(quickstep_cli_InputParserUtil ${LIBNUMA_LIBRARY}) endif() target_link_libraries(quickstep_cli_PrintToScreen - gflags_nothreads-static + ${GFLAGS_LIB_NAME} quickstep_catalog_CatalogAttribute quickstep_catalog_CatalogRelation quickstep_storage_StorageBlock http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/query_execution/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/query_execution/CMakeLists.txt b/query_execution/CMakeLists.txt index 7d9d601..8306f78 100644 --- a/query_execution/CMakeLists.txt +++ b/query_execution/CMakeLists.txt @@ -19,6 +19,12 @@ QS_PROTOBUF_GENERATE_CPP(queryexecution_QueryExecutionMessages_proto_srcs queryexecution_QueryExecutionMessages_proto_hdrs QueryExecutionMessages.proto) +if (BUILD_SHARED_LIBS) + set(GFLAGS_LIB_NAME gflags_nothreads-shared) +else() + set(GFLAGS_LIB_NAME gflags_nothreads-static) +endif() + # Declare micro-libs: if (ENABLE_DISTRIBUTED) add_library(quickstep_queryexecution_BlockLocator BlockLocator.cpp BlockLocator.hpp) @@ -202,7 +208,7 @@ if (ENABLE_DISTRIBUTED) add_executable(BlockLocator_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/BlockLocator_unittest.cpp") target_link_libraries(BlockLocator_unittest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogAttribute http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/query_optimizer/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt index 5c9438d..8f08130 100644 --- a/query_optimizer/CMakeLists.txt +++ b/query_optimizer/CMakeLists.txt @@ -24,6 +24,12 @@ configure_file ( "${CMAKE_CURRENT_BINARY_DIR}/QueryOptimizerConfig.h" ) +if (BUILD_SHARED_LIBS) + set(GFLAGS_LIB_NAME gflags_nothreads-shared) +else() + set(GFLAGS_LIB_NAME gflags_nothreads-static) +endif() + add_subdirectory(cost_model) add_subdirectory(expressions) add_subdirectory(logical) @@ -182,7 +188,7 @@ target_link_libraries(quickstep_queryoptimizer_OptimizerTree quickstep_utility_Macros quickstep_utility_TreeStringSerializable) target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator - gflags_nothreads-static + ${GFLAGS_LIB_NAME} quickstep_queryoptimizer_LogicalToPhysicalMapper quickstep_queryoptimizer_logical_Logical quickstep_queryoptimizer_physical_Physical http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/query_optimizer/tests/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/CMakeLists.txt b/query_optimizer/tests/CMakeLists.txt index 07af404..6ef2a03 100644 --- a/query_optimizer/tests/CMakeLists.txt +++ b/query_optimizer/tests/CMakeLists.txt @@ -18,6 +18,12 @@ add_subdirectory(logical_generator) add_subdirectory(physical_generator) add_subdirectory(resolver) +if (BUILD_SHARED_LIBS) + set(GFLAGS_LIB_NAME gflags_nothreads-shared) +else() + set(GFLAGS_LIB_NAME gflags_nothreads-static) +endif() + add_library(quickstep_queryoptimizer_tests_OptimizerTest OptimizerTest.cpp OptimizerTest.hpp) add_library(quickstep_queryoptimizer_tests_TestDatabaseLoader TestDatabaseLoader.cpp TestDatabaseLoader.hpp) @@ -102,7 +108,7 @@ add_executable(quickstep_queryoptimizer_tests_OptimizerTextTest "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp") target_link_libraries(quickstep_queryoptimizer_tests_ExecutionGeneratorTest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogDatabase @@ -132,7 +138,7 @@ target_link_libraries(quickstep_queryoptimizer_tests_ExecutionGeneratorTest tmb ${LIBS}) target_link_libraries(quickstep_queryoptimizer_tests_OptimizerTextTest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest gtest_main http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/relational_operators/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/relational_operators/CMakeLists.txt b/relational_operators/CMakeLists.txt index eec5300..d2693eb 100644 --- a/relational_operators/CMakeLists.txt +++ b/relational_operators/CMakeLists.txt @@ -23,6 +23,12 @@ QS_PROTOBUF_GENERATE_CPP(relationaloperators_WorkOrder_proto_srcs relationaloperators_WorkOrder_proto_hdrs WorkOrder.proto) +if (BUILD_SHARED_LIBS) + set(GFLAGS_LIB_NAME gflags_nothreads-shared) +else() + set(GFLAGS_LIB_NAME gflags_nothreads-static) +endif() + # Declare micro-libs: add_library(quickstep_relationaloperators_AggregationOperator AggregationOperator.cpp AggregationOperator.hpp) add_library(quickstep_relationaloperators_BuildHashOperator BuildHashOperator.cpp BuildHashOperator.hpp) @@ -160,7 +166,7 @@ target_link_libraries(quickstep_relationaloperators_FinalizeAggregationOperator quickstep_utility_Macros tmb) target_link_libraries(quickstep_relationaloperators_HashJoinOperator - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog quickstep_catalog_CatalogRelation quickstep_catalog_CatalogRelationSchema @@ -350,7 +356,7 @@ target_link_libraries(quickstep_relationaloperators_TableGeneratorOperator quickstep_utility_Macros tmb) target_link_libraries(quickstep_relationaloperators_TextScanOperator - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog quickstep_catalog_CatalogAttribute quickstep_catalog_CatalogRelation @@ -470,7 +476,7 @@ target_link_libraries(quickstep_relationaloperators add_executable(AggregationOperator_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/AggregationOperator_unittest.cpp") target_link_libraries(AggregationOperator_unittest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogAttribute @@ -523,7 +529,7 @@ add_test(AggregationOperator_unittest AggregationOperator_unittest) add_executable(HashJoinOperator_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/HashJoinOperator_unittest.cpp") target_link_libraries(HashJoinOperator_unittest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogAttribute @@ -573,7 +579,7 @@ add_test(HashJoinOperator_unittest HashJoinOperator_unittest) add_executable(SortMergeRunOperator_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/SortMergeRunOperator_unittest.cpp") target_link_libraries(SortMergeRunOperator_unittest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogAttribute @@ -624,7 +630,7 @@ add_test(SortMergeRunOperator_unittest SortMergeRunOperator_unittest) add_executable(SortRunGenerationOperator_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/SortRunGenerationOperator_unittest.cpp") target_link_libraries(SortRunGenerationOperator_unittest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogAttribute @@ -672,7 +678,7 @@ add_test(SortRunGenerationOperator_unittest SortRunGenerationOperator_unittest) add_executable(TextScanOperator_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/TextScanOperator_unittest.cpp") target_link_libraries(TextScanOperator_unittest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogAttribute http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/storage/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index a77976a..b536411 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -21,6 +21,12 @@ if (REBUILD_INDEX_ON_UPDATE_OVERFLOW) set(QUICKSTEP_REBUILD_INDEX_ON_UPDATE_OVERFLOW TRUE) endif() +if (BUILD_SHARED_LIBS) + set(GFLAGS_LIB_NAME gflags_nothreads-shared) +else() + set(GFLAGS_LIB_NAME gflags_nothreads-static) +endif() + include(CheckIncludeFileCXX) check_include_files("fcntl.h;glob.h;unistd.h;sys/stat.h;sys/types.h" QUICKSTEP_HAVE_FILE_MANAGER_POSIX) if (NOT QUICKSTEP_HAVE_FILE_MANAGER_POSIX) @@ -617,7 +623,7 @@ target_link_libraries(quickstep_storage_FileManager if (QUICKSTEP_HAVE_FILE_MANAGER_HDFS) target_link_libraries(quickstep_storage_FileManagerHdfs glog - gflags_nothreads-static + ${GFLAGS_LIB_NAME} quickstep_storage_FileManager quickstep_storage_StorageBlockInfo quickstep_storage_StorageConstants @@ -950,7 +956,7 @@ target_link_libraries(quickstep_storage_StorageBlockLayout target_link_libraries(quickstep_storage_StorageBlockLayout_proto ${PROTOBUF_LIBRARY}) target_link_libraries(quickstep_storage_StorageManager - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogTypedefs @@ -1380,7 +1386,7 @@ if (ENABLE_DISTRIBUTED) add_executable(DataExchange_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/DataExchange_unittest.cpp") target_link_libraries(DataExchange_unittest - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog gtest quickstep_catalog_CatalogAttribute http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/transaction/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/transaction/CMakeLists.txt b/transaction/CMakeLists.txt index c6c87b6..430b4bc 100644 --- a/transaction/CMakeLists.txt +++ b/transaction/CMakeLists.txt @@ -13,6 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +if (BUILD_SHARED_LIBS) + set(GFLAGS_LIB_NAME gflags_nothreads-shared) +else() + set(GFLAGS_LIB_NAME gflags_nothreads-static) +endif() + add_library(quickstep_transaction_AccessMode AccessMode.cpp AccessMode.hpp) @@ -68,7 +74,7 @@ target_link_libraries(quickstep_transaction_Lock quickstep_transaction_AccessMode quickstep_transaction_ResourceId) target_link_libraries(quickstep_transaction_LockManager - gflags_nothreads-static + ${GFLAGS_LIB_NAME} glog quickstep_utility_ThreadSafeQueue quickstep_threading_Thread