123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- cmake_minimum_required(VERSION 2.8.7)
- include(CheckCXXCompilerFlag)
- CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
- if(NOT COMPILER_SUPPORTS_CXX11)
- message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
- endif()
- if(USE_libstdcpp)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
- message("-- Warning: forcing libstdc++ (controlled by USE_libstdcpp option in cmake)")
- endif()
- set(CNSTREAM_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)
- set(SOURCE_ROOT_DIR ${CNSTREAM_ROOT_DIR}/source)
- # # compile flags
- # 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")
- option(build_kafka "build model kafka" ON)
- # ---[ kafka
- if(build_kafka)
- find_package(LibRDKafka)
- if(LIBRDKAFKA_FOUND)
- include_directories(${LibRDKafka_INCLUDE_DIR})
- list(APPEND 3RDPARTY_LIBS ${LibRDKafka_C_LIBRARIES})
- message(STATUS "LibRDKafka include: ${LibRDKafka_INCLUDE_DIR}")
- message(STATUS "LibRDKafka libraries: ${LibRDKafka_C_LIBRARIES}")
- else()
- message(FATAL_ERROR "rdkafka not found!")
- endif()
- endif()
- set(CMAKE_MODULE_PATH ${CNSTREAM_ROOT_DIR}/cmake/sanitizers ${CNSTREAM_ROOT_DIR}/cmake)
- # ---[ rapidjson
- include_directories(${CNSTREAM_ROOT_DIR}/3rdparty/)
- # ---[ modules include dirs
- include_directories(${CNSTREAM_ROOT_DIR}/modules/Expel/include)
- include_directories(${CNSTREAM_ROOT_DIR}/modules/HttpClient/include)
- include_directories(${CNSTREAM_ROOT_DIR}/modules/HttpServer/include)
- include_directories(${CNSTREAM_ROOT_DIR}/modules/InfineFilter/include)
- include_directories(${CNSTREAM_ROOT_DIR}/modules/Monitor/include)
- include_directories(${CNSTREAM_ROOT_DIR}/modules/TCPClient/include)
- include_directories(${CNSTREAM_ROOT_DIR}/modules/config/include)
- include_directories(${CNSTREAM_ROOT_DIR}/source/UserApp/include)
- include_directories(${CNSTREAM_ROOT_DIR}/framework/core/include)
- include_directories(${CNSTREAM_ROOT_DIR}/framework/request/include)
- include_directories(${CNSTREAM_ROOT_DIR}/plugins/ExpelPlugin/include)
- include_directories(${CNSTREAM_ROOT_DIR}/plugins/HttpPlugin/include)
- include_directories(${CNSTREAM_ROOT_DIR}/plugins/MonitorPlugin/include)
- include_directories(${CNSTREAM_ROOT_DIR}/plugins/TcpPlugin/include)
- aux_source_directory(${CNSTREAM_ROOT_DIR}/source/src srcs)
- aux_source_directory(${CNSTREAM_ROOT_DIR}/source/UserApp/src userApps)
- # ---[ add targets
- # set(EXECUTABLE_OUTPUT_PATH ${SOURCE_ROOT_DIR}/bin)
- add_executable(gsd ${srcs} ${userApps} ${3RDPARTY_LIBS})
- target_link_libraries(gsd gsd_core gsd_modules gsd_plugins pthread dl)
|