-
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.
- Loading branch information
1 parent
245c278
commit 40043ea
Showing
18 changed files
with
1,789 additions
and
1 deletion.
There are no files selected for viewing
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
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,44 @@ | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer") | ||
|
||
set(sanitizers "address") | ||
if(ENABLE_UB_SANITIZER) | ||
# NOTE: UB check requires instrumented libstdc++ | ||
set(sanitizers "${sanitizers},undefined") | ||
endif() | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
# do nothing for gcc | ||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$") | ||
set(sanitizers "${sanitizers},nullability") | ||
else() | ||
message(FATAL_ERROR "unsupported compiler ${CMAKE_CXX_COMPILER_ID}") | ||
endif() | ||
|
||
if(ENABLE_SANITIZER) | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=${sanitizers}") | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-sanitize=alignment") | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-sanitize-recover=${sanitizers}") | ||
endif() | ||
if(ENABLE_COVERAGE) | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage") | ||
endif() | ||
|
||
function(set_compile_options target_name) | ||
target_compile_options(${target_name} | ||
PRIVATE -Wall -Wextra -Werror) | ||
endfunction(set_compile_options) | ||
|
||
if(TRACY_ENABLE) | ||
message("trace enabled") | ||
add_definitions(-DTRACY_ENABLE) | ||
add_definitions(-DTRACY_NO_SAMPLING) | ||
|
||
# tracy code has many unused variables/parameters | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-unused-parameter -Wno-maybe-uninitialized") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wno-unused-parameter -Wno-maybe-uninitialized") | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-unused-parameter -Wno-maybe-uninitialized") | ||
endif() |
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 @@ | ||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") |
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,24 @@ | ||
if(TARGET gflags::gflags) | ||
return() | ||
endif() | ||
|
||
find_library(gflags_LIBRARY_FILE NAMES gflags) | ||
find_path(gflags_INCLUDE_DIR NAMES gflags/gflags.h) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(gflags DEFAULT_MSG | ||
gflags_LIBRARY_FILE | ||
gflags_INCLUDE_DIR) | ||
|
||
if(gflags_LIBRARY_FILE AND gflags_INCLUDE_DIR) | ||
set(gflags_FOUND ON) | ||
add_library(gflags::gflags SHARED IMPORTED) | ||
set_target_properties(gflags::gflags PROPERTIES | ||
IMPORTED_LOCATION "${gflags_LIBRARY_FILE}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${gflags_INCLUDE_DIR}") | ||
else() | ||
set(gflags_FOUND OFF) | ||
endif() | ||
|
||
unset(gflags_LIBRARY_FILE CACHE) | ||
unset(gflags_INCLUDE_DIR CACHE) |
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,24 @@ | ||
if(TARGET glog::glog) | ||
return() | ||
endif() | ||
|
||
find_library(glog_LIBRARY_FILE NAMES glog) | ||
find_path(glog_INCLUDE_DIR NAMES glog/logging.h) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(glog DEFAULT_MSG | ||
glog_LIBRARY_FILE | ||
glog_INCLUDE_DIR) | ||
|
||
if(glog_LIBRARY_FILE AND glog_INCLUDE_DIR) | ||
set(glog_FOUND ON) | ||
add_library(glog::glog SHARED IMPORTED) | ||
set_target_properties(glog::glog PROPERTIES | ||
IMPORTED_LOCATION "${glog_LIBRARY_FILE}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${glog_INCLUDE_DIR}") | ||
else() | ||
set(glog_FOUND OFF) | ||
endif() | ||
|
||
unset(glog_LIBRARY_FILE CACHE) | ||
unset(glog_INCLUDE_DIR CACHE) |
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,31 @@ | ||
if(TARGET mpdecpp) | ||
return() | ||
endif() | ||
|
||
find_path(mpdecpp_INCLUDE_DIR NAMES decimal.hh) | ||
find_library(mpdecpp_LIBRARY_FILE NAMES mpdec++) | ||
find_library(mpdec_LIBRARY_FILE NAMES mpdec) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(mpdecpp DEFAULT_MSG | ||
mpdecpp_INCLUDE_DIR | ||
mpdecpp_LIBRARY_FILE | ||
mpdec_LIBRARY_FILE | ||
) | ||
|
||
if(mpdecpp_INCLUDE_DIR AND mpdecpp_LIBRARY_FILE AND mpdec_LIBRARY_FILE) | ||
set(mpdecpp_FOUND ON) | ||
add_library(mpdecpp SHARED IMPORTED) | ||
target_link_libraries(mpdecpp | ||
INTERFACE "${mpdec_LIBRARY_FILE}" | ||
) | ||
set_target_properties(mpdecpp PROPERTIES | ||
IMPORTED_LOCATION "${mpdecpp_LIBRARY_FILE}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${mpdecpp_INCLUDE_DIR}") | ||
else() | ||
set(mpdecpp_FOUND OFF) | ||
endif() | ||
|
||
unset(mpdecpp_INCLUDE_DIR CACHE) | ||
unset(mpdecpp_LIBRARY_FILE CACHE) | ||
unset(mpdec_LIBRARY_FILE CACHE) |
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,87 @@ | ||
function(install_custom target_name export_name) | ||
install( | ||
TARGETS | ||
${target_name} | ||
EXPORT | ||
${export_name} | ||
LIBRARY | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
COMPONENT Runtime | ||
ARCHIVE | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${export_name} | ||
COMPONENT Development | ||
RUNTIME | ||
DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
COMPONENT Runtime | ||
) | ||
# Add INSTALL_RPATH from CMAKE_INSTALL_PREFIX and CMAKE_PREFIX_PATH | ||
# The default behavior of CMake omits RUNPATH if it is already in CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES. | ||
if (FORCE_INSTALL_RPATH) | ||
get_target_property(target_type ${target_name} TYPE) | ||
if (target_type STREQUAL "SHARED_LIBRARY" | ||
OR target_type STREQUAL "EXECUTABLE") | ||
get_target_property(rpath ${target_name} INSTALL_RPATH) | ||
|
||
# add ${CMAKE_INSTALL_PREFIX}/lib if it is not in system link directories | ||
get_filename_component(p "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" ABSOLUTE) | ||
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${p}" is_system) | ||
if (is_system STREQUAL "-1") | ||
list(APPEND rpath "${p}") | ||
endif() | ||
|
||
# add each ${CMAKE_PREFIX_PATH}/lib | ||
foreach (p IN LISTS CMAKE_PREFIX_PATH) | ||
get_filename_component(p "${p}/${CMAKE_INSTALL_LIBDIR}" ABSOLUTE) | ||
list(APPEND rpath "${p}") | ||
endforeach() | ||
|
||
if (rpath) | ||
set_target_properties(${target_name} PROPERTIES | ||
INSTALL_RPATH "${rpath}") | ||
endif() | ||
|
||
# add other than */lib paths | ||
set_target_properties(${target_name} PROPERTIES | ||
INSTALL_RPATH_USE_LINK_PATH ON) | ||
endif() | ||
endif (FORCE_INSTALL_RPATH) | ||
# Install include files of interface libraries manually | ||
# INTERFACE_INCLUDE_DIRECTORIES must contains the following entries: | ||
# - one or more `$<BUILD_INTERFACE:...>` paths (may be absolute paths on source-tree) | ||
# - just one `$<INSTALL_INTERFACE:...>` path (must be a relative path from the install prefix) | ||
# then, this copies files in the BUILD_INTERFACE paths onto INSTALL_INTERFACE path | ||
# e.g. | ||
# add_library(shakujo-interface INTERFACE) | ||
# target_include_directories(shakujo-interface INTERFACE | ||
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
# $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/shakujo>) | ||
get_target_property( | ||
_includes | ||
${target_name} INTERFACE_INCLUDE_DIRECTORIES | ||
) | ||
if (_includes) | ||
unset(_build_dir) | ||
unset(_install_dir) | ||
foreach (f IN LISTS _includes) | ||
if (f MATCHES "^\\$<BUILD_INTERFACE:(.+)>$") | ||
list(APPEND _build_dir ${CMAKE_MATCH_1}) | ||
elseif (f MATCHES "^\\$<INSTALL_INTERFACE:(.+)>$") | ||
set(_install_dir ${CMAKE_MATCH_1}) | ||
else() | ||
message(FATAL_ERROR "invalid include specification (${target_name}): ${f}") | ||
endif() | ||
endforeach() | ||
if (NOT _build_dir) | ||
message(FATAL_ERROR "${target_name} must declare \$<BUILD_INTERFACE:...> in INTERFACE_INCLUDE_DIRECTORIES") | ||
endif() | ||
if (NOT _install_dir) | ||
message(FATAL_ERROR "${target_name} must declare \$<INSTALL_INTERFACE:...> in INTERFACE_INCLUDE_DIRECTORIES") | ||
endif() | ||
install( | ||
DIRECTORY ${_build_dir}/ | ||
DESTINATION ${_install_dir} | ||
COMPONENT Development | ||
PATTERN "doxygen.h" EXCLUDE | ||
) | ||
endif() | ||
endfunction(install_custom) |
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,26 @@ | ||
# CMake | ||
/build* | ||
/*-config.cmake | ||
|
||
# MS Office | ||
~* | ||
|
||
# Mac | ||
.DS_Store | ||
|
||
# VSCode | ||
/.vscode | ||
|
||
# CLion | ||
cmake-build-* | ||
.idea | ||
*.tokens | ||
|
||
# work in progress files | ||
*.wip | ||
|
||
#GLOBAL | ||
GPATH | ||
GRTAGS | ||
GTAGS | ||
HTML/ |
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,81 @@ | ||
# Copyright 2020-2021 tsurugi project. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
cmake_minimum_required(VERSION 3.10) | ||
|
||
project(tpcc-datagen | ||
VERSION 0.0.1 | ||
DESCRIPTION "TPC-C benchmark program running on Jogasaki SQL Execution Engine" | ||
LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../cmake") | ||
|
||
option(ENABLE_SANITIZER "enable sanitizer on debug build" ON) | ||
option(ENABLE_UB_SANITIZER "enable undefined behavior sanitizer on debug build" OFF) | ||
option(ENABLE_COVERAGE "enable coverage on debug build" OFF) | ||
option(BUILD_DOCUMENTS "build documents" ON) | ||
option(ENABLE_GOOGLE_PERFTOOLS "Enable Google Perftools" OFF) | ||
option(TRACY_ENABLE "enable tracy profiler" OFF) | ||
|
||
if (ENABLE_GOOGLE_PERFTOOLS) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_GOOGLE_PERFTOOLS") | ||
endif() | ||
|
||
if(NOT DEFINED SHARKSFIN_IMPLEMENTATION) | ||
set( | ||
SHARKSFIN_IMPLEMENTATION "memory" | ||
CACHE STRING | ||
"sharksfin target name to link" | ||
FORCE | ||
) | ||
endif() | ||
|
||
find_package(Doxygen) | ||
find_package(glog REQUIRED) | ||
find_package(gflags REQUIRED) | ||
find_package(Threads REQUIRED) | ||
find_package(Boost | ||
COMPONENTS filesystem thread system container stacktrace_backtrace | ||
REQUIRED | ||
) | ||
find_package(mpdecpp REQUIRED) | ||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
include(CompileOptions) | ||
include(InstallOptions) | ||
|
||
# add_subdirectory(third_party) # should be before enable_testing() | ||
|
||
set(export_name "tpcc-datagen") | ||
set(package_name "tpcc-datagen") | ||
|
||
configure_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Config.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/../${package_name}-config.cmake | ||
@ONLY | ||
) | ||
|
||
# install( | ||
# EXPORT ${package_name} | ||
# NAMESPACE ${package_name}- | ||
# FILE ${package_name}-targets.cmake | ||
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${package_name} | ||
# EXPORT_LINK_INTERFACE_LIBRARIES | ||
# ) | ||
|
||
add_subdirectory(src) |
Oops, something went wrong.