@lupnfer
2016-12-14T12:02:09.000000Z
字数 14934
阅读 877
cmake_minimum_required(VERSION 3.3)project (IAS)set(IA_WINDOWS 0)set(IA_LINUX 0)set(IA_64 0)set(IA_32 1)set(IA_ARCH "x86")set(IA_VC "vc14")set(IA_COMPILER "vc14")set(IA_PLATFORM "windows")set(IA_COMPILER_VC 0)set(IA_COMPILER_GCC 0)# --------------------------------------------------------------------------# common# --------------------------------------------------------------------------if (CMAKE_SYSTEM_NAME MATCHES "Linux")cmake_minimum_required(VERSION 2.8)message (STATUS "current platform: Linux ")set(IA_LINUX 1)set(IA_PLATFORM "linux")set(IA_COMPILER "gcc")set(IA_COMPILER_GCC 1)if (CMAKE_BUILD_TYPE STREQUAL "Debug")set(CMAKE_BUILD_TYPE "Debug")else (CMAKE_BUILD_TYPE STREQUAL "Debug")set(CMAKE_BUILD_TYPE "RelWithDebInfo")endif(CMAKE_BUILD_TYPE STREQUAL "Debug")set(IA_TARGET ${CMAKE_BUILD_TYPE})# default is b4bit under linuxoption(IAS_32BIT "build ias using 32bit under linux if set ON." OFF)if (IAS_32BIT)set(IA_32 1)set(IA_64 0)set(IA_ARCH "x86")else (IAS_32BIT)set(IA_32 0)set(IA_64 1)set(IA_ARCH "x64")endif (IAS_32BIT)elseif (CMAKE_SYSTEM_NAME MATCHES "CYGWIN")message (STATUS "current platform: Linux ")set(IA_CYGWIN 1)set(IA_PLATFORM "cygwin")set(IA_COMPILER "gcc")set(IA_COMPILER_GCC 1)if (CMAKE_BUILD_TYPE STREQUAL "Debug")set(CMAKE_BUILD_TYPE "Debug")else (CMAKE_BUILD_TYPE STREQUAL "Debug")set(CMAKE_BUILD_TYPE "RelWithDebInfo")endif(CMAKE_BUILD_TYPE STREQUAL "Debug")set(IA_TARGET ${CMAKE_BUILD_TYPE})# default is b4bit under linuxoption(IAS_32BIT "build ias using 32bit under linux if set ON." OFF)if (IAS_32BIT)set(IA_32 1)set(IA_64 0)set(IA_ARCH "x86")else (IAS_32BIT)set(IA_32 0)set(IA_64 1)set(IA_ARCH "x64")endif (IAS_32BIT)elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")message (STATUS "current platform: Windows")set(IA_WINDOWS 1)set(IA_PLATFORM "windows")set(IA_COMPILER_VC 1)# for 64bit checkif (CMAKE_CL_64)set(IA_64 1)set(IA_32 0)set(IA_ARCH "x64")endif (CMAKE_CL_64)# check compilerif (MSVC14)set(IA_VC "vc14")elseif (MSVC12)set(IA_VC "vc12")elseif (MSVC11)set(IA_VC "vc11")elseif (MSVC10)set(IA_VC "vc10")else (MSVC14)message (FATAL_ERROR "not support msvc version: ${MSVC_VERSION}")endif(MSVC14)set(IA_COMPILER ${IA_VC})set(IA_TARGET ${CMAKE_CFG_INTDIR})else (CMAKE_SYSTEM_NAME MATCHES "Linux")message (FATAL_ERROR "not support platform: ${CMAKE_SYSTEM_NAME}")endif (CMAKE_SYSTEM_NAME MATCHES "Linux")# only Debug & RelWithDebInfoset(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING "possible configurations" FORCE)link_directories(${CMAKE_HOME_DIRECTORY}/opensource/dest/${IA_PLATFORM}/${IA_ARCH}/${IA_COMPILER}/${IA_TARGET}/lib${CMAKE_HOME_DIRECTORY}/algorithm/linux/x64)if (IA_WINDOWS)# source group in vssource_group(common REGULAR_EXPRESSION "wiseos/common/.+\.(h|inc|cc)")source_group(thrift-api-old REGULAR_EXPRESSION "wiseos/api/thrift/old/.+\.(h|inc|cc)")source_group(thrift-api-new REGULAR_EXPRESSION "wiseos/api/thrift/new/.+\.(h|inc|cc)")source_group(restful-new REGULAR_EXPRESSION "wiseos/api/restful/.+\.(h|inc|cc)")source_group(auth REGULAR_EXPRESSION "wiseos/auth/.+\.(h|inc|cc)")source_group(engine REGULAR_EXPRESSION "wiseos/engine/.+\.(h|inc|cc)")source_group(device REGULAR_EXPRESSION "wiseos/device/.+\.(h|inc|cc)")source_group(task REGULAR_EXPRESSION "wiseos/task/.+\.(h|inc|cc)")source_group(model REGULAR_EXPRESSION "wiseos/model/.+\.(h|inc|cc|cxx|ixx|hxx)")source_group(proto REGULAR_EXPRESSION "wiseos/proto/.+\.(h|inc|cc|proto)")source_group(ias\\it REGULAR_EXPRESSION "wiseos/ias/it/.+\.(h|inc|cc)")source_group(ias\\engine REGULAR_EXPRESSION "wiseos/ias/engine/.+\.(h|inc|cc)")source_group(ias\\ipc-config REGULAR_EXPRESSION "wiseos/ias/ipc/.+\.(h|inc|cc)")source_group(iae\\dsp_include REGULAR_EXPRESSION "wiseos/iae/dsp_include/.+\.(h|inc|cc)")source_group(iae\\it REGULAR_EXPRESSION "wiseos/iae/it/.+\.(h|inc|cc)")source_group(iae\\fa REGULAR_EXPRESSION "wiseos/iae/fa/.+\.(h|inc|cc)")source_group(iae\\mp REGULAR_EXPRESSION "wiseos/iae/mp/.+\.(h|inc|cc)")source_group(iae\\vmp REGULAR_EXPRESSION "wiseos/iae/vmp/.+\.(h|inc|cc)")source_group(iae\\proto REGULAR_EXPRESSION "wiseos/iae/proto/.+\.(h|inc|cc|proto)")source_group(iae REGULAR_EXPRESSION "wiseos/iae/.+\.(h|inc|cc)")source_group(license REGULAR_EXPRESSION "wiseos/license/.+\.(h|inc|cc)")source_group(thrift REGULAR_EXPRESSION "thrift/gen-cpp/.+\.(h|tcc|hpp|cpp)")source_group(thrift-iait REGULAR_EXPRESSION "thrift/iait/gen-cpp/.+\.(h|tcc|hpp|cpp)")source_group(thrift-restful REGULAR_EXPRESSION "thrift/ias/gen-cpp/.+\.(h|tcc|hpp|cpp)")source_group(main REGULAR_EXPRESSION "wiseos/[a-zA-Z_]+\.cc")# flagsset(COMMON_FLAGS "/wd4819 /wd4250 /wd4068")set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")endif (IA_WINDOWS)if (IA_COMPILER_GCC)#set(CMAKE_SKIP_RPATH ON)# flagsset(COMMON_FLAGS "-march=core2 -Wall -Wno-unused -Wno-deprecated-declarations")set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS} -std=c++11")set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")if (IA_ARCH STREQUAL "x86")set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")endif (IA_ARCH STREQUAL "x86")endif (IA_COMPILER_GCC)# --------------------------------------------------------------------------# projects# --------------------------------------------------------------------------set (THRIFT_SRC_IAthrift/ias/gen-cpp/auth.cppthrift/ias/gen-cpp/auth.hthrift/ias/gen-cpp/auth.tccthrift/ias/gen-cpp/cluster.cppthrift/ias/gen-cpp/cluster.hthrift/ias/gen-cpp/cluster.tccthrift/ias/gen-cpp/config.cppthrift/ias/gen-cpp/config.hthrift/ias/gen-cpp/config.tccthrift/ias/gen-cpp/engine.cppthrift/ias/gen-cpp/engine.hthrift/ias/gen-cpp/engine.tccthrift/ias/gen-cpp/ias_constants.cppthrift/ias/gen-cpp/ias_constants.hthrift/ias/gen-cpp/ias_types.cppthrift/ias/gen-cpp/ias_types.hthrift/ias/gen-cpp/ias_types.tccthrift/ias/gen-cpp/signature.cppthrift/ias/gen-cpp/signature.hthrift/ias/gen-cpp/signature.tccthrift/ias/gen-cpp/status.cppthrift/ias/gen-cpp/status.hthrift/ias/gen-cpp/status.tccthrift/ias/gen-cpp/task.cppthrift/ias/gen-cpp/task.hthrift/ias/gen-cpp/task.tcc)set (THRIFT_SRC_BDthrift/bigdata/gen-cpp/bigdataFace/bigdata_common_constants.cppthrift/bigdata/gen-cpp/bigdataFace/bigdata_common_constants.hthrift/bigdata/gen-cpp/bigdataFace/bigdata_common_types.cppthrift/bigdata/gen-cpp/bigdataFace/bigdata_common_types.hthrift/bigdata/gen-cpp/bigdataFace/face_master_constants.cppthrift/bigdata/gen-cpp/bigdataFace/face_master_constants.hthrift/bigdata/gen-cpp/bigdataFace/face_master_types.cppthrift/bigdata/gen-cpp/bigdataFace/face_master_types.hthrift/bigdata/gen-cpp/bigdataFace/FaceDataService.cppthrift/bigdata/gen-cpp/bigdataFace/FaceDataService.hthrift/bigdata/gen-cpp/bigdataFace/hbase_master_types.hthrift/bigdata/gen-cpp/bigdataFace/HbaseMasterOperation.cppthrift/bigdata/gen-cpp/bigdataFace/HbaseMasterOperation.hthrift/bigdata/gen-cpp/bigdataFace/image_face_data_constants.cppthrift/bigdata/gen-cpp/bigdataFace/image_face_data_constants.hthrift/bigdata/gen-cpp/bigdataFace/image_face_data_types.cppthrift/bigdata/gen-cpp/bigdataFace/image_face_data_types.hthrift/bigdata/gen-cpp/bigdataFace/ThriftSlaveBaseService.cppthrift/bigdata/gen-cpp/bigdataFace/ThriftSlaveBaseService.h)set (THRIFT_SRC_OLDthrift/gen-cpp/ia_constants.cppthrift/gen-cpp/ia_constants.hthrift/gen-cpp/IA.cppthrift/gen-cpp/IADebug.cppthrift/gen-cpp/IADebug.hthrift/gen-cpp/IADebug.tccthrift/gen-cpp/IAE.cppthrift/gen-cpp/IAE.hthrift/gen-cpp/IAE.tccthrift/gen-cpp/IA.hthrift/gen-cpp/IALicense.cppthrift/gen-cpp/IALicense.hthrift/gen-cpp/IALicense.tccthrift/gen-cpp/IASBeta.cppthrift/gen-cpp/IASBeta.hthrift/gen-cpp/IASBeta.tccthrift/gen-cpp/IAS.cppthrift/gen-cpp/IAS.hthrift/gen-cpp/IASNotify.cppthrift/gen-cpp/IASNotify.hthrift/gen-cpp/IASNotify.tccthrift/gen-cpp/IAS.tccthrift/gen-cpp/IATaskServiceUnstable.cppthrift/gen-cpp/IATaskServiceUnstable.hthrift/gen-cpp/IATaskServiceUnstable.tccthrift/gen-cpp/IA.tccthrift/gen-cpp/ia_types.cppthrift/gen-cpp/ia_types.hthrift/gen-cpp/ia_types.tcc)set (THRIFT_SRC_IA8500_ITthrift/iait/gen-cpp/HbaseMasterOperation.cppthrift/iait/gen-cpp/HbaseMasterOperation.hthrift/iait/gen-cpp/HbaseMasterOperation.tccthrift/iait/gen-cpp/HbaseSlaveOperation.cppthrift/iait/gen-cpp/HbaseSlaveOperation.hthrift/iait/gen-cpp/HbaseSlaveOperation.tccthrift/iait/gen-cpp/ReduceFileServer_constants.cppthrift/iait/gen-cpp/ReduceFileServer_constants.hthrift/iait/gen-cpp/ReduceFileServerThrift.cppthrift/iait/gen-cpp/ReduceFileServerThrift.hthrift/iait/gen-cpp/ReduceFileServerThrift.tccthrift/iait/gen-cpp/ReduceFileServer_types.cppthrift/iait/gen-cpp/ReduceFileServer_types.hthrift/iait/gen-cpp/ReduceFileServer_types.tccthrift/iait/gen-cpp/traffic_master_constants.cppthrift/iait/gen-cpp/traffic_master_constants.hthrift/iait/gen-cpp/traffic_master_types.cppthrift/iait/gen-cpp/traffic_master_types.hthrift/iait/gen-cpp/traffic_master_types.tccthrift/iait/gen-cpp/traffic_slave_constants.cppthrift/iait/gen-cpp/traffic_slave_constants.hthrift/iait/gen-cpp/traffic_slave_types.cppthrift/iait/gen-cpp/traffic_slave_types.hthrift/iait/gen-cpp/traffic_slave_types.tcc)# add model sourceset(IA_SRC_MODEL_IMOSwiseos/model/imos.hwiseos/model/imos-odb.hxxwiseos/model/imos-odb.cxxwiseos/model/imos-odb.ixx)set(IA_SRC_MODEL_IAwiseos/model/ias.hwiseos/model/ias-odb.cxxwiseos/model/ias-odb.hxxwiseos/model/ias-odb.ixxwiseos/model/ias-odb-sqlite.cxxwiseos/model/ias-odb-sqlite.hxxwiseos/model/ias-odb-sqlite.ixxwiseos/model/ias-odb-pgsql.cxxwiseos/model/ias-odb-pgsql.hxxwiseos/model/ias-odb-pgsql.ixx)set(IA_SRC_PROTO_IAwiseos/proto/device.pb.ccwiseos/proto/device.pb.hwiseos/iae/proto/iafa.pb.ccwiseos/iae/proto/iafa.pb.h)set(IA_SRC_COMMONwiseos/common/config.ccwiseos/common/config.hwiseos/common/db.ccwiseos/common/db.hwiseos/common/mq.hwiseos/common/mq.ccwiseos/common/defs.hwiseos/common/error.hwiseos/common/id.ccwiseos/common/id.hwiseos/common/log.ccwiseos/common/log.hwiseos/common/memorypool.ccwiseos/common/memorypool.hwiseos/common/objectpool.hwiseos/common/resource.hwiseos/common/service.ccwiseos/common/service.hwiseos/common/singleton.hwiseos/common/status.ccwiseos/common/status.hwiseos/common/types.hwiseos/common/utils.ccwiseos/common/utils.hwiseos/common/version.hwiseos/common/thrift/client.ccwiseos/common/thrift/client.hwiseos/common/thrift/server.ccwiseos/common/thrift/server.hwiseos/common/task/monitor.ccwiseos/common/task/monitor.hwiseos/common/task/queue.hwiseos/common/task/runner.ccwiseos/common/task/runner.hwiseos/common/task/ticktask.hwiseos/common/auth/base.ccwiseos/common/auth/base.hwiseos/common/auth/interface.h)set(THRIFT_SRC_APIwiseos/ias/engine/engine.ccwiseos/ias/engine/engine.hwiseos/ias/engine/cluster.ccwiseos/ias/engine/cluster.hwiseos/ias/engine/signature.ccwiseos/ias/engine/signature.h##wiseos/ias/engine/manager.cc##wiseos/ias/engine/manager.hwiseos/ias/engine/task.ccwiseos/ias/engine/task.hwiseos/api/thrift/new/ia_auth.ccwiseos/api/thrift/new/ia_auth.hwiseos/api/thrift/new/ia_config.ccwiseos/api/thrift/new/ia_config.hwiseos/api/thrift/new/ia_task.ccwiseos/api/thrift/new/ia_task.hwiseos/api/thrift/new/ia_engine.ccwiseos/api/thrift/new/ia_engine.hwiseos/api/thrift/new/ia_status.ccwiseos/api/thrift/new/ia_status.hwiseos/api/thrift/new/ia_signature.ccwiseos/api/thrift/new/ia_signature.h)set(THRIFT_SRC_OLD_APIwiseos/api/thrift/old/iae.ccwiseos/api/thrift/old/iae.hwiseos/api/thrift/old/ia.ccwiseos/api/thrift/old/ia.h)set (IAS_SRC_LISTwiseos/ias_main.ccwiseos/ias/ipc/ipc_config.h${IA_SRC_COMMON}${IA_SRC_MODEL_IA}${IA_SRC_PROTO_IA}${THRIFT_SRC_IA}${THRIFT_SRC_OLD}${THRIFT_SRC_API})set (IAE_SRC_LISTwiseos/iae_main.ccwiseos/iae/base_component_element.hwiseos/iae/base_component_element.ccwiseos/iae/fa/dsphandle_objpool.ccwiseos/iae/fa/dsphandle_objpool.hwiseos/iae/fa/table_manager.hwiseos/iae/engine.ccwiseos/iae/engine.hwiseos/iae/fa/include/ipc_common_def.hwiseos/iae/fa/include/dsp_video_mjpeg.hwiseos/iae/fa/include/cds_interface.hwiseos/iae/fa/include/cds_sys_def.hwiseos/iae/fa/include/cds_sys_func.hwiseos/iae/fa/include/cds_sys_mod.hwiseos/iae/fa/include/imos_def.hwiseos/iae/fa/include/imos_public.hwiseos/iae/fa/ipc_recieve.ccwiseos/iae/fa/ipc_recieve.hwiseos/iae/fa/media_decode.hwiseos/iae/fa/media_decode.ccwiseos/iae/fa/pic_recieve.hwiseos/iae/fa/pic_recieve.ccwiseos/iae/fa/store_signature.hwiseos/iae/fa/store_signature.ccwiseos/iae/fa/prepotency.ccwiseos/iae/fa/prepotency.hwiseos/iae/fa/YUV2BRG.ccwiseos/iae/fa/YUV2BRG.hwiseos/iae/fa/preprocess.hwiseos/iae/fa/preprocess.ccwiseos/iae/mp/media_element.hwiseos/iae/mp/media_process.hwiseos/iae/regist_keepalive.ccwiseos/iae/regist_keepalive.hwiseos/iae/fa/task_management.hwiseos/iae/fa/task_management.ccwiseos/iae/fa/dsp_model.hwiseos/iae/fa/dsp_model.ccwiseos/iae/fa/feature_extract.hwiseos/iae/fa/feature_extract.ccwiseos/iae/fa/face_analyze.hwiseos/iae/fa/face_analyze.ccwiseos/iae/fa/task_aquire.hwiseos/iae/fa/task_aquire.ccwiseos/iae/fa/bd.hwiseos/iae/fa/bd.ccwiseos/iae/fa/cds.hwiseos/iae/fa/cds.cc${IA_SRC_COMMON}${IA_SRC_MODEL_IA}${IA_SRC_PROTO_IA}${THRIFT_SRC_IA}${THRIFT_SRC_OLD}${THRIFT_SRC_OLD_API}${THRIFT_SRC_BD})if (IA_COMPILER_GCC)set(IA_DEFAULT_LIBS-lcurl-lodb-pgsql-lodb-sqlite-lodb-boost-lodb-lpq-lsqlite3-lthriftz-lthriftnb-lthrift-levent-lglog-lgflags-ljsoncpp-lboost_serialization-lboost_regex-lboost_locale-lboost_filesystem-lboost_thread-lboost_date_time-lboost_exception-lboost_chrono-lboost_system-lboost_atomic-lprofiler-ltcmalloc-lsystemd-lssl-lprotobuf-lqpidmessaging-lqpidtypes-lcrypto-lz-lpthread-ldl-lrt-lm#-ldspvideomjpeg)else(IA_COMPILER_GCC)set(IA_DEFAULT_LIBS)endif(IA_COMPILER_GCC)# IAS EXECUTABLEadd_executable(ias ${IAS_SRC_LIST})add_executable(iae ${IAE_SRC_LIST})# include directoryset(IA_INCLUDE_DIRalgroithmopensource/source_includeopensource/dest/${IA_PLATFORM}/${IA_ARCH}/${IA_COMPILER}/${IA_TARGET}/include${CMAKE_HOME_DIRECTORY})include_directories(${IA_INCLUDE_DIR})# common definitionsset(IA_COMMON_DEFINESLIBODB_STATIC_LIB=1LIBODB_SQLITE_STATIC_LIB=1LIBODB_PGSQL_STATIC_LIB=1LIBODB_BOOST_STATIC_LIB=1## CURL_STATICLIB=1)if(CYGWIN)set(IA_COMMON_DEFINES${IA_COMMON_DEFINES}__USE_W32_SOCKETS_WIN32_WINNT=0x0501)endif(CYGWIN)if (IA_WINDOWS)# definitionstarget_compile_definitions(iasPUBLIC IAS ${IA_COMMON_DEFINES})# libstarget_link_libraries(iasPUBLIClibthrift.lib libthriftnb.libssleay32.lib libeay32.liblibevent.lib zlib.libgflags.lib glog.libodb.lib odb-sqlite.lib odb-pgsql.lib odb-boost.lib sqlite3.lib libpq.lib libcurl.libShlwapi.lib Crypt32.lib Secur32.lib)endif (IA_WINDOWS)if (IA_COMPILER_GCC)# definitionstarget_compile_definitions(iasPUBLIC IAS ${IA_COMMON_DEFINES})target_compile_definitions(iaePUBLIC IAE ${IA_COMMON_DEFINES})set_target_properties(iasPROPERTIESLINK_FLAGS -Wl,-rpath=/opt/uniview/ia10k/lib)set_target_properties(iaePROPERTIESLINK_FLAGS -Wl,-rpath=/opt/uniview/ia10k/lib)# libstarget_link_libraries(ias PUBLIC${IA_DEFAULT_LIBS})target_link_libraries(iae PUBLIC${IA_DEFAULT_LIBS}-lsdk_video-ldspvideomjpeg-lcds_libc)endif (IA_COMPILER_GCC)## TESTINGenable_testing()##include(test/ut/test_media_process.cmake)###include(test/ut/test_config.cmake)###include(test/ut/test_cluster.cmake)###include(test/ut/test_iae_task_manager.cmake)#include(test/ut/test_table_manager.cmake)#include(test/ut/test_featureToBD.cmake)