CMakeLists.txt 1.3 KB

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