Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate header file dependencies for test and src. #364

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ under the License.
cmake_minimum_required(VERSION 3.11)
project(TsFile_CPP)

cmake_policy(SET CMP0079 NEW)
set(TsFile_CPP_VERSION 2.0.0.dev)
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Werror")
message("cmake using: USE_CPP11=${USE_CPP11}")
Expand Down Expand Up @@ -65,24 +64,18 @@ elseif (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
endif()
message("CMAKE DEBUG: CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")


# All libs will store here, including libtsfile, compress-encoding lib.
jt2594838 marked this conversation as resolved.
Show resolved Hide resolved
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(PROJECT_INCLUDE_DIR ${PROJECT_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/third_party/lz4
${PROJECT_SOURCE_DIR}/third_party/lzokay
${PROJECT_SOURCE_DIR}/third_party/zlib-1.2.13
${PROJECT_BINARY_DIR}/third_party/zlib-1.2.13
)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
include_directories(${PROJECT_INCLUDE_DIR})
# TsFile code will store here.
set(PROJECT_SRC_DIR ${PROJECT_SOURCE_DIR}/src)

include_directories(${PROJECT_SOURCE_DIR}/third_party/antlr4-cpp-runtime-4/runtime/src)
# All include files will install here.
set(LIBRARY_INCLUDE_DIR ${PROJECT_BINARY_DIR}/include)

add_subdirectory(third_party)

add_subdirectory(src)

add_subdirectory(test)
if(TESTS_ENABLED)
add_dependencies(TsFile_Test tsfile)
Expand Down
19 changes: 19 additions & 0 deletions cpp/cmake/CopyToDIr.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CopyToDir.cmake
jt2594838 marked this conversation as resolved.
Show resolved Hide resolved

# This function is used to copy files to a directory and it will handle relative paths automatically.
function(copy_to_dir)
set(INCLUDE_EXPORT_DR ${LIBRARY_INCLUDE_DIR} CACHE INTERNAL "Include export directory")
foreach(file ${ARGN})
get_filename_component(file_name ${file} NAME)
get_filename_component(file_path ${file} PATH)
string(REPLACE "${CMAKE_SOURCE_DIR}/src" "" relative_path "${file_path}")
add_custom_target(
copy_${file_name} ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${INCLUDE_EXPORT_DR}/${relative_path}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${file} ${INCLUDE_EXPORT_DR}/${relative_path}/${file_name}
COMMENT "Copying ${file_name} to ${INCLUDE_EXPORT_DR}/${relative_path}"
)
endforeach()
endfunction()


37 changes: 25 additions & 12 deletions cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,33 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
]]
message("Running in src diectory")
cmake_minimum_required(VERSION 3.11)
project(TsFile_CPP_SDK)

include (${CMAKE_SOURCE_DIR}/cmake/CopyToDir.cmake)

if(POLICY CMP0079)
cmake_policy(SET CMP0079 NEW)
endif()

message("Running in src directory")
if (${COV_ENABLED})
add_compile_options(-fprofile-arcs -ftest-coverage)
endif ()
add_definitions(-DANTLR4CPP_STATIC)
set(ANTLR4_WITH_STATIC_CRT OFF)


set(PROJECT_INCLUDE_DIR
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/third_party/lz4
${CMAKE_SOURCE_DIR}/third_party/lzokay
${CMAKE_SOURCE_DIR}/third_party/zlib-1.2.13
${CMAKE_SOURCE_DIR}/third_party/antlr4-cpp-runtime-4/runtime/src
)

include_directories(${PROJECT_INCLUDE_DIR})

add_subdirectory(parser)
add_subdirectory(common)
add_subdirectory(compress)
Expand All @@ -32,6 +53,7 @@ add_subdirectory(reader)
add_subdirectory(utils)
add_subdirectory(writer)


set(COMPRESSION_LIBS snappy LZ4 lzokay zlibstatic)
target_link_libraries(parser_obj antlr4_static)
target_link_libraries(compress_obj ${COMPRESSION_LIBS})
Expand All @@ -53,16 +75,7 @@ set(LIBTSFILE_SO_VERSION ${TsFile_CPP_VERSION})
set_target_properties(tsfile PROPERTIES VERSION ${LIBTSFILE_PROJECT_VERSION})
set_target_properties(tsfile PROPERTIES SOVERSION ${LIBTSFILE_SO_VERSION})

set(LIBTSFILE_SDK_DIR ${LIBRARY_OUTPUT_PATH})
install(TARGETS tsfile LIBRARY DESTINATION ${LIBTSFILE_SDK_DIR})
install(TARGETS tsfile LIBRARY DESTINATION ${LIBRARY_OUTPUT_PATH})


# set(CMAKE_PREFIX_PATH ../../third-party/lz4-dev/lib)
# set(LZ4_LIB_DIR ../../third-party/lz4-dev/lib)
# find_library(my_lz4_lib NAMES lz4 PATHS ${LZ4_LIB_DIR} NO_DEFAULT_PATH REQUIRED)
# link_directories(${LZ4_LIB_DIR})
# target_link_libraries(tsfile ${my_lz4_lib})

# if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
# add_custom_command(TARGET tsfile POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change `otool -L ${LIBRARY_OUTPUT_PATH}/libtsfile.dylib | grep liblz4 | sed 's/dylib.*/dylib/g'` ${my_lz4_lib} ${LIBRARY_OUTPUT_PATH}/libtsfile.dylib)
# add_custom_command(TARGET tsfile POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change `otool -L ${LIBRARY_OUTPUT_PATH}/libtsfile.dylib | grep libz | sed 's/dylib.*/dylib/g'` ${my_z_lib} ${LIBRARY_OUTPUT_PATH}/libtsfile.dylib)
# endif()
3 changes: 3 additions & 0 deletions cpp/src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ add_library(common_obj OBJECT ${common_SRC_LIST}
${common_mutex_SRC_LIST}
${common_datatype_SRC_LIST})

# install header files recursively
file(GLOB_RECURSE HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
copy_to_dir(${HEADERS})
110 changes: 0 additions & 110 deletions cpp/src/common/allocator/object_pool.h

This file was deleted.

2 changes: 0 additions & 2 deletions cpp/src/common/allocator/page_arena.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
#include "page_arena.h"

#include <stdio.h>

#include <new>

namespace common {
Expand Down
90 changes: 0 additions & 90 deletions cpp/src/common/allocator/stl_allocator.h

This file was deleted.

Loading
Loading