@lupnfer
2016-12-14T12:02:09.000000Z
字数 14934
阅读 800
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 linux
option(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 linux
option(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 check
if (CMAKE_CL_64)
set(IA_64 1)
set(IA_32 0)
set(IA_ARCH "x64")
endif (CMAKE_CL_64)
# check compiler
if (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 & RelWithDebInfo
set(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 vs
source_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")
# flags
set(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)
# flags
set(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_IA
thrift/ias/gen-cpp/auth.cpp
thrift/ias/gen-cpp/auth.h
thrift/ias/gen-cpp/auth.tcc
thrift/ias/gen-cpp/cluster.cpp
thrift/ias/gen-cpp/cluster.h
thrift/ias/gen-cpp/cluster.tcc
thrift/ias/gen-cpp/config.cpp
thrift/ias/gen-cpp/config.h
thrift/ias/gen-cpp/config.tcc
thrift/ias/gen-cpp/engine.cpp
thrift/ias/gen-cpp/engine.h
thrift/ias/gen-cpp/engine.tcc
thrift/ias/gen-cpp/ias_constants.cpp
thrift/ias/gen-cpp/ias_constants.h
thrift/ias/gen-cpp/ias_types.cpp
thrift/ias/gen-cpp/ias_types.h
thrift/ias/gen-cpp/ias_types.tcc
thrift/ias/gen-cpp/signature.cpp
thrift/ias/gen-cpp/signature.h
thrift/ias/gen-cpp/signature.tcc
thrift/ias/gen-cpp/status.cpp
thrift/ias/gen-cpp/status.h
thrift/ias/gen-cpp/status.tcc
thrift/ias/gen-cpp/task.cpp
thrift/ias/gen-cpp/task.h
thrift/ias/gen-cpp/task.tcc
)
set (THRIFT_SRC_BD
thrift/bigdata/gen-cpp/bigdataFace/bigdata_common_constants.cpp
thrift/bigdata/gen-cpp/bigdataFace/bigdata_common_constants.h
thrift/bigdata/gen-cpp/bigdataFace/bigdata_common_types.cpp
thrift/bigdata/gen-cpp/bigdataFace/bigdata_common_types.h
thrift/bigdata/gen-cpp/bigdataFace/face_master_constants.cpp
thrift/bigdata/gen-cpp/bigdataFace/face_master_constants.h
thrift/bigdata/gen-cpp/bigdataFace/face_master_types.cpp
thrift/bigdata/gen-cpp/bigdataFace/face_master_types.h
thrift/bigdata/gen-cpp/bigdataFace/FaceDataService.cpp
thrift/bigdata/gen-cpp/bigdataFace/FaceDataService.h
thrift/bigdata/gen-cpp/bigdataFace/hbase_master_types.h
thrift/bigdata/gen-cpp/bigdataFace/HbaseMasterOperation.cpp
thrift/bigdata/gen-cpp/bigdataFace/HbaseMasterOperation.h
thrift/bigdata/gen-cpp/bigdataFace/image_face_data_constants.cpp
thrift/bigdata/gen-cpp/bigdataFace/image_face_data_constants.h
thrift/bigdata/gen-cpp/bigdataFace/image_face_data_types.cpp
thrift/bigdata/gen-cpp/bigdataFace/image_face_data_types.h
thrift/bigdata/gen-cpp/bigdataFace/ThriftSlaveBaseService.cpp
thrift/bigdata/gen-cpp/bigdataFace/ThriftSlaveBaseService.h
)
set (THRIFT_SRC_OLD
thrift/gen-cpp/ia_constants.cpp
thrift/gen-cpp/ia_constants.h
thrift/gen-cpp/IA.cpp
thrift/gen-cpp/IADebug.cpp
thrift/gen-cpp/IADebug.h
thrift/gen-cpp/IADebug.tcc
thrift/gen-cpp/IAE.cpp
thrift/gen-cpp/IAE.h
thrift/gen-cpp/IAE.tcc
thrift/gen-cpp/IA.h
thrift/gen-cpp/IALicense.cpp
thrift/gen-cpp/IALicense.h
thrift/gen-cpp/IALicense.tcc
thrift/gen-cpp/IASBeta.cpp
thrift/gen-cpp/IASBeta.h
thrift/gen-cpp/IASBeta.tcc
thrift/gen-cpp/IAS.cpp
thrift/gen-cpp/IAS.h
thrift/gen-cpp/IASNotify.cpp
thrift/gen-cpp/IASNotify.h
thrift/gen-cpp/IASNotify.tcc
thrift/gen-cpp/IAS.tcc
thrift/gen-cpp/IATaskServiceUnstable.cpp
thrift/gen-cpp/IATaskServiceUnstable.h
thrift/gen-cpp/IATaskServiceUnstable.tcc
thrift/gen-cpp/IA.tcc
thrift/gen-cpp/ia_types.cpp
thrift/gen-cpp/ia_types.h
thrift/gen-cpp/ia_types.tcc
)
set (THRIFT_SRC_IA8500_IT
thrift/iait/gen-cpp/HbaseMasterOperation.cpp
thrift/iait/gen-cpp/HbaseMasterOperation.h
thrift/iait/gen-cpp/HbaseMasterOperation.tcc
thrift/iait/gen-cpp/HbaseSlaveOperation.cpp
thrift/iait/gen-cpp/HbaseSlaveOperation.h
thrift/iait/gen-cpp/HbaseSlaveOperation.tcc
thrift/iait/gen-cpp/ReduceFileServer_constants.cpp
thrift/iait/gen-cpp/ReduceFileServer_constants.h
thrift/iait/gen-cpp/ReduceFileServerThrift.cpp
thrift/iait/gen-cpp/ReduceFileServerThrift.h
thrift/iait/gen-cpp/ReduceFileServerThrift.tcc
thrift/iait/gen-cpp/ReduceFileServer_types.cpp
thrift/iait/gen-cpp/ReduceFileServer_types.h
thrift/iait/gen-cpp/ReduceFileServer_types.tcc
thrift/iait/gen-cpp/traffic_master_constants.cpp
thrift/iait/gen-cpp/traffic_master_constants.h
thrift/iait/gen-cpp/traffic_master_types.cpp
thrift/iait/gen-cpp/traffic_master_types.h
thrift/iait/gen-cpp/traffic_master_types.tcc
thrift/iait/gen-cpp/traffic_slave_constants.cpp
thrift/iait/gen-cpp/traffic_slave_constants.h
thrift/iait/gen-cpp/traffic_slave_types.cpp
thrift/iait/gen-cpp/traffic_slave_types.h
thrift/iait/gen-cpp/traffic_slave_types.tcc
)
# add model source
set(IA_SRC_MODEL_IMOS
wiseos/model/imos.h
wiseos/model/imos-odb.hxx
wiseos/model/imos-odb.cxx
wiseos/model/imos-odb.ixx
)
set(IA_SRC_MODEL_IA
wiseos/model/ias.h
wiseos/model/ias-odb.cxx
wiseos/model/ias-odb.hxx
wiseos/model/ias-odb.ixx
wiseos/model/ias-odb-sqlite.cxx
wiseos/model/ias-odb-sqlite.hxx
wiseos/model/ias-odb-sqlite.ixx
wiseos/model/ias-odb-pgsql.cxx
wiseos/model/ias-odb-pgsql.hxx
wiseos/model/ias-odb-pgsql.ixx
)
set(IA_SRC_PROTO_IA
wiseos/proto/device.pb.cc
wiseos/proto/device.pb.h
wiseos/iae/proto/iafa.pb.cc
wiseos/iae/proto/iafa.pb.h
)
set(IA_SRC_COMMON
wiseos/common/config.cc
wiseos/common/config.h
wiseos/common/db.cc
wiseos/common/db.h
wiseos/common/mq.h
wiseos/common/mq.cc
wiseos/common/defs.h
wiseos/common/error.h
wiseos/common/id.cc
wiseos/common/id.h
wiseos/common/log.cc
wiseos/common/log.h
wiseos/common/memorypool.cc
wiseos/common/memorypool.h
wiseos/common/objectpool.h
wiseos/common/resource.h
wiseos/common/service.cc
wiseos/common/service.h
wiseos/common/singleton.h
wiseos/common/status.cc
wiseos/common/status.h
wiseos/common/types.h
wiseos/common/utils.cc
wiseos/common/utils.h
wiseos/common/version.h
wiseos/common/thrift/client.cc
wiseos/common/thrift/client.h
wiseos/common/thrift/server.cc
wiseos/common/thrift/server.h
wiseos/common/task/monitor.cc
wiseos/common/task/monitor.h
wiseos/common/task/queue.h
wiseos/common/task/runner.cc
wiseos/common/task/runner.h
wiseos/common/task/ticktask.h
wiseos/common/auth/base.cc
wiseos/common/auth/base.h
wiseos/common/auth/interface.h
)
set(THRIFT_SRC_API
wiseos/ias/engine/engine.cc
wiseos/ias/engine/engine.h
wiseos/ias/engine/cluster.cc
wiseos/ias/engine/cluster.h
wiseos/ias/engine/signature.cc
wiseos/ias/engine/signature.h
##wiseos/ias/engine/manager.cc
##wiseos/ias/engine/manager.h
wiseos/ias/engine/task.cc
wiseos/ias/engine/task.h
wiseos/api/thrift/new/ia_auth.cc
wiseos/api/thrift/new/ia_auth.h
wiseos/api/thrift/new/ia_config.cc
wiseos/api/thrift/new/ia_config.h
wiseos/api/thrift/new/ia_task.cc
wiseos/api/thrift/new/ia_task.h
wiseos/api/thrift/new/ia_engine.cc
wiseos/api/thrift/new/ia_engine.h
wiseos/api/thrift/new/ia_status.cc
wiseos/api/thrift/new/ia_status.h
wiseos/api/thrift/new/ia_signature.cc
wiseos/api/thrift/new/ia_signature.h
)
set(THRIFT_SRC_OLD_API
wiseos/api/thrift/old/iae.cc
wiseos/api/thrift/old/iae.h
wiseos/api/thrift/old/ia.cc
wiseos/api/thrift/old/ia.h
)
set (IAS_SRC_LIST
wiseos/ias_main.cc
wiseos/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_LIST
wiseos/iae_main.cc
wiseos/iae/base_component_element.h
wiseos/iae/base_component_element.cc
wiseos/iae/fa/dsphandle_objpool.cc
wiseos/iae/fa/dsphandle_objpool.h
wiseos/iae/fa/table_manager.h
wiseos/iae/engine.cc
wiseos/iae/engine.h
wiseos/iae/fa/include/ipc_common_def.h
wiseos/iae/fa/include/dsp_video_mjpeg.h
wiseos/iae/fa/include/cds_interface.h
wiseos/iae/fa/include/cds_sys_def.h
wiseos/iae/fa/include/cds_sys_func.h
wiseos/iae/fa/include/cds_sys_mod.h
wiseos/iae/fa/include/imos_def.h
wiseos/iae/fa/include/imos_public.h
wiseos/iae/fa/ipc_recieve.cc
wiseos/iae/fa/ipc_recieve.h
wiseos/iae/fa/media_decode.h
wiseos/iae/fa/media_decode.cc
wiseos/iae/fa/pic_recieve.h
wiseos/iae/fa/pic_recieve.cc
wiseos/iae/fa/store_signature.h
wiseos/iae/fa/store_signature.cc
wiseos/iae/fa/prepotency.cc
wiseos/iae/fa/prepotency.h
wiseos/iae/fa/YUV2BRG.cc
wiseos/iae/fa/YUV2BRG.h
wiseos/iae/fa/preprocess.h
wiseos/iae/fa/preprocess.cc
wiseos/iae/mp/media_element.h
wiseos/iae/mp/media_process.h
wiseos/iae/regist_keepalive.cc
wiseos/iae/regist_keepalive.h
wiseos/iae/fa/task_management.h
wiseos/iae/fa/task_management.cc
wiseos/iae/fa/dsp_model.h
wiseos/iae/fa/dsp_model.cc
wiseos/iae/fa/feature_extract.h
wiseos/iae/fa/feature_extract.cc
wiseos/iae/fa/face_analyze.h
wiseos/iae/fa/face_analyze.cc
wiseos/iae/fa/task_aquire.h
wiseos/iae/fa/task_aquire.cc
wiseos/iae/fa/bd.h
wiseos/iae/fa/bd.cc
wiseos/iae/fa/cds.h
wiseos/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 EXECUTABLE
add_executable(ias ${IAS_SRC_LIST})
add_executable(iae ${IAE_SRC_LIST})
# include directory
set(IA_INCLUDE_DIR
algroithm
opensource/source_include
opensource/dest/${IA_PLATFORM}/${IA_ARCH}/${IA_COMPILER}/${IA_TARGET}/include
${CMAKE_HOME_DIRECTORY}
)
include_directories(${IA_INCLUDE_DIR})
# common definitions
set(IA_COMMON_DEFINES
LIBODB_STATIC_LIB=1
LIBODB_SQLITE_STATIC_LIB=1
LIBODB_PGSQL_STATIC_LIB=1
LIBODB_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)
# definitions
target_compile_definitions(ias
PUBLIC IAS ${IA_COMMON_DEFINES}
)
# libs
target_link_libraries(ias
PUBLIC
libthrift.lib libthriftnb.lib
ssleay32.lib libeay32.lib
libevent.lib zlib.lib
gflags.lib glog.lib
odb.lib odb-sqlite.lib odb-pgsql.lib odb-boost.lib sqlite3.lib libpq.lib libcurl.lib
Shlwapi.lib Crypt32.lib Secur32.lib
)
endif (IA_WINDOWS)
if (IA_COMPILER_GCC)
# definitions
target_compile_definitions(ias
PUBLIC IAS ${IA_COMMON_DEFINES}
)
target_compile_definitions(iae
PUBLIC IAE ${IA_COMMON_DEFINES}
)
set_target_properties(ias
PROPERTIES
LINK_FLAGS -Wl,-rpath=/opt/uniview/ia10k/lib
)
set_target_properties(iae
PROPERTIES
LINK_FLAGS -Wl,-rpath=/opt/uniview/ia10k/lib
)
# libs
target_link_libraries(ias PUBLIC
${IA_DEFAULT_LIBS}
)
target_link_libraries(iae PUBLIC
${IA_DEFAULT_LIBS}
-lsdk_video
-ldspvideomjpeg
-lcds_libc
)
endif (IA_COMPILER_GCC)
## TESTING
enable_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)