CMakeLists.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. cmake_minimum_required(VERSION 3.13)
  2. project(Sophiar2)
  3. set(CMAKE_CXX_STANDARD 20)
  4. add_compile_options(-march=native)
  5. add_compile_options(-mno-avx) # enable avx will cause some stack pointer alignment error with Eigen
  6. #add_compile_definitions(CORO_SIGNAL2_USE_TIMER)
  7. include_directories(./src)
  8. find_package(Boost REQUIRED COMPONENTS iostreams)
  9. list(APPEND BASIC_LIBS ${Boost_LIBRARIES})
  10. include_directories(${Boost_INCLUDE_DIRS})
  11. find_package(fmt REQUIRED)
  12. list(APPEND BASIC_LIBS fmt::fmt)
  13. find_package(spdlog REQUIRED)
  14. list(APPEND BASIC_LIBS spdlog::spdlog)
  15. add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE)
  16. find_package(Eigen3 REQUIRED)
  17. list(APPEND BASIC_LIBS Eigen3::Eigen)
  18. find_package(nlohmann_json REQUIRED)
  19. list(APPEND BASIC_LIBS nlohmann_json::nlohmann_json)
  20. IF (WIN32)
  21. list(APPEND BASIC_LIBS ws2_32 wsock32 winmm bcrypt)
  22. ELSEIF (UNIX)
  23. list(APPEND BASIC_LIBS crypt)
  24. ENDIF ()
  25. include(src/core/CMakeLists.txt)
  26. include(src/algorithm/CMakeLists.txt)
  27. include(src/sensor/CMakeLists.txt)
  28. include(src/robot/CMakeLists.txt)
  29. add_executable(${PROJECT_NAME} src/main.cpp)
  30. target_link_libraries(${PROJECT_NAME} ${BASIC_LIBS})
  31. target_link_libraries(${PROJECT_NAME} ${SOPHIAR_LIBS})
  32. add_subdirectory(app)
  33. add_subdirectory(tests)