CMakeLists.txt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. cmake_minimum_required(VERSION 3.0.0)
  2. project(update_time VERSION 0.1.0 LANGUAGES C CXX)
  3. MESSAGE(STATUS "operation system is ${CMAKE_HOST_SYSTEM_PROCESSOR}")
  4. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  5. SET (CMAKE_C_COMPILER "/usr/bin/clang")
  6. SET (CMAKE_CXX_COMPILER "/usr/bin/clang++")
  7. SET (CMAKE_AR "/usr/bin/llvm-ar")
  8. SET (CMAKE_LINKER "/usr/bin/llvm-link")
  9. SET (CMAKE_NM "/usr/bin/llvm-nm")
  10. SET (CMAKE_OBJDUMP "/usr/bin/llvm-objdump")
  11. ENDIF()
  12. if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
  13. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g2 -ggdb -Wall -Wno-unused-variable -pthread")
  14. endif()
  15. find_package(Protobuf REQUIRED)
  16. include_directories(${Protobuf_INCLUDE_DIRS})
  17. add_definitions(-DJSONCPP_USING_SECURE_MEMORY=0)
  18. add_definitions(-DWEBRTC_POSIX=1)
  19. add_definitions(-DWEBRTC_LINUX=1)
  20. file(GLOB native_srcs "*.cpp")
  21. set(CURDIR ${CMAKE_CURRENT_LIST_DIR})
  22. file(GLOB common_srcs ${CURDIR}/../common/socketclient.cpp ${CURDIR}/../common/iobuffer.cpp)
  23. IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  24. include_directories("../thirdparty/protobuf/include")
  25. ELSE()
  26. find_package(Protobuf REQUIRED)
  27. include_directories(${Protobuf_INCLUDE_DIRS})
  28. include_directories("../thirdparty/Eigen/eigen3")
  29. ENDIF()
  30. include_directories(${CURDIR}/../protocol/linux/)
  31. file(GLOB proto_srcs ${CURDIR}/../protocol/linux/*.cc)
  32. file(GLOB native_srcs "*.cpp")
  33. add_executable(update_time ${native_srcs} ${common_srcs} ${proto_srcs})
  34. target_link_libraries(update_time ${Protobuf_LIBRARIES})