cmake_minimum_required(VERSION 2.8) #set(CMAKE_VERBOSE_MAKEFILE ON) SET(CMAKE_C_COMPILER "/usr/local/bin/gcc") SET(CMAKE_CXX_COMPILER "/usr/local/bin/g++") #输出项目名称 project(ya-serv) message(STATUS "src dir = ${ya-serv_SOURCE_DIR}") message(STATUS "binary dir = ${ya-serv_BINARY_DIR}") message(STATUS "leoox src dir = ${CMAKE_SOURCE_DIR}") message(STATUS "leoox binary dir = ${CMAKE_BINARY_DIR}") message(STATUS "CMAKE_CXX_FLAGS_DEBUG = " ${CMAKE_C_FLAGS_DEBUG}) message(STATUS "CMAKE_CXX_FLAGS_RELEASE = " ${CMAKE_C_FLAGS_RELEASE}) #在项目中显示所有源码 file(GLOB files_ya-serv ./*.cpp ./*.h ./websocket/* ./db_api/* ./src/* ./src/internal/* ./module_service/* ./monkey_car/*) add_custom_target(files_ya-serv SOURCES ${files_ya-serv}) MESSAGE(STATUS "module: ya-serv") #g++编译参数 # 版本 SET(CMAKE_BUILD_TYPE DEBUG) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pthread -m64 -std=c++11 -fPIC -fno-strict-aliasing") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -pthread -m64 -std=c++11 -fPIC -fno-strict-aliasing") #第三方库库文件目录 link_directories( "/usr/local/mysql/lib" "${CMAKE_CURRENT_SOURCE_DIR}/../dist/lib") #第三方库头文件目录 include_directories("/usr/local/include" "." "usr/include" "../dist/include" "../rapidjson/include" "/usr/local/mysql/include" "src/" "src/internal/" "websocket/" "db_api/" "module_service/") #编译项目所需源码 set(SRC_YASL "ant.cpp" "ant.h" "base64.cpp" "base64.h" "card.cpp" "card.h" "clock.h" "io_buf.h" "line.h" "message.cpp" "message.h" "point.cpp" "point.h" "tdoa_sync.cpp" "tdoa_sync.h" "web-client.cpp" "web-client.h" "worker.cpp" "worker.h" "zio.h" "zloop.h" "znet.cpp" "znet.h" "zstream.h" "card_path.h" "card_path.cpp" "select_tool.h" "select_tool.cpp" "loc_point.h" "loc_point.cpp" "line_fit.h" "line_fit.cpp" "net-service.h" "net-service.cpp" "loc_tool.h" "loc_tool.cpp" "db_api/CDBCommon.h" "db_api/CDBConnect.h" "db_api/CDBConnect.cpp" "db_api/CjasonCommon.h" "db_api/CDBConnPool.h" "db_api/CDBConnPool.cpp" "db_api/CDBHelper.h" "db_api/CDBHelper.cpp" "db_api/CDBResultSet.h" "db_api/CDBResultSet.cpp" "db_api/CDBSingletonDefine.h" "src/sio_client.h" "src/sio_client.cpp" "src/sio_message.h" "src/sio_socket.h" "src/sio_socket.cpp" "src/internal/sio_client_impl.h" "src/internal/sio_client_impl.cpp" "src/internal/sio_packet.h" "src/internal/sio_packet.cpp" "websocket/constdef.h" "websocket/jsonBuilder.h" "websocket/jsonBuilder.cpp" "websocket/jsonCommon.h" "websocket/thread_safe_map.h" "websocket/ws_common.h" "websocket/wsClient.h" "websocket/wsClient.cpp" "websocket/wsClientMgr.h" "websocket/wsClientMgr.cpp" "websocket/wsTimerThread.h" "websocket/wsTimerThread.cpp" "monkey_car/monkeycar_area.h" "monkey_car/monkeycar_area.cpp" "monkey_car/monkeycar_bus.h" "monkey_car/monkeycar_bus.cpp" "monkey_car/monkeycar_person.h" "monkey_car/monkeycar_person.cpp" "monkey_car/base_data.h" "monkey_car/fp_path.h" "monkey_car/linear_fit.h" "monkey_car/monkey_fit.h" "landmark.h" "landmark.cpp" "area.h" "area.cpp" "site_area.h" "site_area.cpp" "special_area.h" "special_area.cpp" "cardMgr.h" "cardMgr.cpp" "geo_hash.h" "geo_hash.cpp" "bindmorecard.h" "bindmorecard.cpp" "common.h" ) set(SRC_MODULE "mine.h" "mine.cpp" "ya_event.h" "ya_event.cpp" "common_tool.h" "module_service/module_area.h" "module_service/module_site.h" "module_service/module_area_over_count.h" "module_service/module_area_timeout.h" "module_service/module_attendance_person.h" "module_service/module_attendance_vehicle.h" "module_service/module_call.h" "module_service/module_call.cpp" "module_service/module_call_help.h" "module_service/module_const.h" "module_service/module_web.h" "module_service/module_web.cpp" "module_service/module_mgr.h" "module_service/module_mine.h" "module_service/module_over_speed_vehicle.h" "module_service/module_other_alarm.h" "module_service/module_meta_date_changed.cpp" "module_service/module_meta_date_changed.h" ) add_executable(${PROJECT_NAME} "main.cpp" ${SRC_YASL} ${SRC_MODULE}) target_link_libraries (${PROJECT_NAME} zlog rt ev boost_chrono boost_system boost_thread mysqlclient three_rates) #file(COPY data_reader_antenna.txt DESTINATION ${PROJECT_BINARY_DIR}) #file(COPY path_tof.txt DESTINATION ${PROJECT_BINARY_DIR}) #file(COPY /root/projection/out/bin/logger DESTINATION ${PROJECT_BINARY_DIR}) #file(COPY /root/projection/out/etc DESTINATION ${PROJECT_SOURCE_DIR}) #file(COPY /root/projection/out/log DESTINATION ${PROJECT_SOURCE_DIR}) #file(COPY /root/projection/out/include/ DESTINATION ${PROJECT_SOURCE_DIR}) #message(${PROJECT_BINARY_DIR})