CMakeLists.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. add_compile_definitions(EIGEN_DONT_VECTORIZE)
  9. add_compile_definitions(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
  10. include_directories(.)
  11. find_package(Boost REQUIRED COMPONENTS iostreams)
  12. list(APPEND BASIC_LIBS ${Boost_LIBRARIES})
  13. include_directories(${Boost_INCLUDE_DIRS})
  14. if (NOT WIN32)
  15. find_package(fmt REQUIRED)
  16. list(APPEND BASIC_LIBS fmt::fmt)
  17. endif ()
  18. find_package(spdlog REQUIRED)
  19. list(APPEND BASIC_LIBS spdlog::spdlog)
  20. add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE)
  21. find_package(Eigen3 REQUIRED)
  22. list(APPEND BASIC_LIBS Eigen3::Eigen)
  23. find_package(nlohmann_json REQUIRED)
  24. list(APPEND BASIC_LIBS nlohmann_json::nlohmann_json)
  25. IF (WIN32)
  26. list(APPEND BASIC_LIBS ws2_32 wsock32 winmm bcrypt)
  27. ELSEIF (UNIX)
  28. list(APPEND BASIC_LIBS crypt)
  29. ENDIF ()
  30. include(core/CMakeLists.txt)
  31. include(algorithm/CMakeLists.txt)
  32. include(sensor/CMakeLists.txt)
  33. include(robot/CMakeLists.txt)
  34. add_library(${PROJECT_NAME} main_empty.cpp)
  35. target_link_libraries(${PROJECT_NAME} ${BASIC_LIBS})
  36. target_link_libraries(${PROJECT_NAME} ${SOPHIAR_LIBS})
  37. #add_subdirectory(../tests tests)