123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- cmake_minimum_required(VERSION 2.8.7)
- set(GSD_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
- 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()
- # 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")
- # ---[ Options
- option(build_ExpelPlugin "build module ExpelPlugin" ON)
- option(build_HttpPlugin "build module HttpPlugin" ON)
- option(build_MonitorPlugin "build module MonitorPlugin" ON)
- option(build_TcpPlugin "build module TcpPlugin" ON)
- # ---[ 3rdparty
- set(3RDPARTY_LIBS "")
- set(CMAKE_MODULE_PATH ${GSD_ROOT_DIR}/cmake)
- # ---[ rapidjson
- include_directories(${GSD_ROOT_DIR}/3rdparty/)
- include_directories(${GSD_ROOT_DIR}/framework/core/include)
- include_directories(${GSD_ROOT_DIR}/framework/request/include)
- include_directories(${GSD_ROOT_DIR}/modules/Expel/include)
- include_directories(${GSD_ROOT_DIR}/modules/HttpClient/include)
- include_directories(${GSD_ROOT_DIR}/modules/InfineFilter/include)
- include_directories(${GSD_ROOT_DIR}/modules/Monitor/include)
- include_directories(${GSD_ROOT_DIR}/modules/TCPClient/include)
- include_directories(${GSD_ROOT_DIR}/modules/HttpServer/include)
- include_directories(${GSD_ROOT_DIR}/modules/config/include)
- set(module_list "")
- set(srcs "")
- if(build_ExpelPlugin)
- list(APPEND module_list ExpelPlugin)
- include_directories(${PROJECT_SOURCE_DIR}/modules/ExpelPlugin/src)
- install(DIRECTORY ExpelPlugin/include/ DESTINATION include)
- endif()
- if(build_HttpPlugin)
- list(APPEND module_list HttpPlugin)
- include_directories(${PROJECT_SOURCE_DIR}/modules/HttpPlugin/src)
- install(DIRECTORY HttpPlugin/include/ DESTINATION include)
- endif()
- if(build_MonitorPlugin)
- list(APPEND module_list MonitorPlugin)
- include_directories(${PROJECT_SOURCE_DIR}/modules/MonitorPlugin/src)
- install(DIRECTORY MonitorPlugin/include/ DESTINATION include)
- endif()
- if(build_TcpPlugin)
- list(APPEND module_list TcpPlugin)
- include_directories(${PROJECT_SOURCE_DIR}/modules/TcpPlugin/src)
- install(DIRECTORY TcpPlugin/include/ DESTINATION include)
- endif()
- include_directories(${CMAKE_CURRENT_SOURCE_DIR})
- foreach(module ${module_list})
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/${module}/include)
- file(GLOB_RECURSE module_src ${CMAKE_CURRENT_SOURCE_DIR}/${module}/*.cpp)
- list(APPEND srcs ${module_src})
- endforeach()
- set(LIBRARY_OUTPUT_PATH ${GSD_ROOT_DIR}/lib)
- add_library(gsd_plugins SHARED ${srcs})
- target_link_libraries(gsd_plugins ${3RDPARTY_LIBS} rt dl uuid pthread ZLToolKit)
|