cmake_minimum_required(VERSION 3.5.1) set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib/) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/) set(INS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) add_compile_options(-std=c++11) # compile flags set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -O2") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_REENTRANT -fPIC -Wall -Werror") set(CNSTREAM_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) set(LIBRARY_OUTPUT_PATH ${CNSTREAM_ROOT_DIR}/lib) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/) set(CMAKE_MODULE_PATH ${CNSTREAM_ROOT_DIR}/cmake) set(VERSION_HEAD_FILE ${INS_ROOT_DIR}/framework/core/include/ins_version.hpp) execute_process(COMMAND awk /INS_MAJOR_VERSION/ ${VERSION_HEAD_FILE} OUTPUT_VARIABLE VERSION_STR) string(REGEX MATCH "[0-9]+" MAJOR_VERSION ${VERSION_STR}) execute_process(COMMAND awk /INS_MINOR_VERSION/ ${VERSION_HEAD_FILE} OUTPUT_VARIABLE VERSION_STR) string(REGEX MATCH "[0-9]+" MINOR_VERSION ${VERSION_STR}) execute_process(COMMAND awk /INS_PATCH_VERSION/ ${VERSION_HEAD_FILE} OUTPUT_VARIABLE VERSION_STR) string(REGEX MATCH "[0-9]+" PATCH_VERSION ${VERSION_STR}) set(ISNS_TARGET_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") include_directories(${3RDPARTY_INCLUDE_DIRS}) include_directories(${PROJECT_SOURCE_DIR}/3rdparty/) include_directories(${PROJECT_SOURCE_DIR}/3rdparty/rapidjson/include/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/dataType/include/) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/core/src core_srcs) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/dataType/src core_srcs) add_library(ins_core SHARED ${core_srcs} ) target_link_libraries(ins_core protobuf ${SOURCE_LINKER_LIBS}) target_link_libraries(ins_core dl pthread ${CNRT_LIBS} ${GFLAGS_LIBRARIES}) set_target_properties(ins_core PROPERTIES LINK_FLAGS_RELEASE -s) set_target_properties(ins_core PROPERTIES VERSION ${ISNS_TARGET_VERSION})