cmake_minimum_required(VERSION 3.10) project( FastExtract VERSION 0.0.1 LANGUAGES C CXX ) set(CMAKE_BUILD_TYPE Release CACHE STRING "build type") set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 17) if(NOT MSVC) set(CMAKE_CXX_FLAGS "-Wno-format -g0 -O3") if(NEED_ABI0) add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) else() add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1) endif() endif(NOT MSVC) option(ENABLE_GPU "" ON) option(BUILD_CLIENT "" OFF) option(BUILD_SERVER "" OFF) option(BUILD_TUTORIAL "" OFF) option(ENABLE_HEADER_FOOTER "" ON) option(ENABLE_POSTPROCESS "" ON) set(Workflow_DIR "" CACHE PATH "WORKFLOW_DIRECTORY") set(TRT_DRECTORY "" CACHE PATH "TRT_DRECTORY") set(FASTDEPLOY_DRECTORY "" CACHE PATH "FASTDEPLOY_DRECTORY") set(RAPIDJSON_DRECTORY "" CACHE PATH "RAPIDJSON_DRECTORY") set(Srpc_DIR "" CACHE PATH "Srpc_DIR") set(THIRDPARTY_PATH ${PROJECT_SOURCE_DIR}/third_party) set(RUNTIME_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/bin) set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build) set(PROJECT_SOURCE_PATH ${PROJECT_SOURCE_DIR}/src) set(PROJECT_ROOT_PATH ${PROJECT_SOURCE_DIR}) if (WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /wd4200") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4200 /std:c++17") else () set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC -pipe -std=gnu99") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++17 -Wno-invalid-offsetof") endif () if(BUILD_CLIENT OR BUILD_SERVER) find_package(srpc REQUIRED CONFIG HINTS ${Srpc_DIR}) find_package(OpenSSL REQUIRED) find_package(Protobuf) if ("x${Protobuf_DIR}" STREQUAL "xProtobuf_DIR-NOTFOUND") if (APPLE) message (FATAL_ERROR ${Protobuf_ERROR_MSG_MACOS}) else () message (FATAL_ERROR ${Protobuf_ERROR_MSG_LINUX}) endif () endif () get_filename_component(Protobuf_LIB_DIR ${Protobuf_LIBRARY} DIRECTORY) if (NOT EXISTS "${Srpc_DIR}/third_party/lz4/lib/lz4.h") set(LZ4_LIB lz4) endif () if (NOT EXISTS "${Srpc_DIR}/third_party/snappy/cmake") set(SNAPPY_LIB snappy) endif () find_package(ZLIB REQUIRED) find_package(Workflow REQUIRED CONFIG HINTS ${Workflow_DIR}) # Prefer to static link first set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ${CMAKE_FIND_LIBRARY_SUFFIXES}) find_library(Workflow_LIB workflow HINTS ${Workflow_DIR}/_lib) find_library(Srpc_LIB srpc HINTS ${Srpc_DIR}/_lib) endif(BUILD_CLIENT OR BUILD_SERVER) add_subdirectory(src)