CMakeLists.txt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. cmake_minimum_required(VERSION 3.0)
  2. set(PROJECT_NAME Sophiar2)
  3. set(CMAKE_CXX_STANDARD 20)
  4. project(${PROJECT_NAME})
  5. add_compile_options(-march=native)
  6. add_compile_options(-mno-avx) # enable avx will cause some stack pointer alignment error with Eigen
  7. include_directories(./src)
  8. find_package(Boost REQUIRED COMPONENTS iostreams)
  9. list(APPEND EXTRA_LIBS ${Boost_LIBRARIES} bcrypt)
  10. include_directories(${Boost_INCLUDE_DIRS})
  11. find_package(fmt REQUIRED)
  12. list(APPEND EXTRA_LIBS fmt::fmt)
  13. find_package(spdlog REQUIRED)
  14. list(APPEND EXTRA_LIBS spdlog::spdlog)
  15. add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE)
  16. find_package(Eigen3 REQUIRED)
  17. list(APPEND EXTRA_LIBS Eigen3::Eigen)
  18. find_package(nlohmann_json REQUIRED)
  19. list(APPEND EXTRA_LIBS nlohmann_json::nlohmann_json)
  20. file(GLOB_RECURSE ALGORITHM_IMPL_FILES ./src/algorithm/*.cpp)
  21. file(GLOB_RECURSE CORE_IMPL_FILES ./src/core/*.cpp)
  22. file(GLOB_RECURSE ROBOT_IMPL_FILES ./src/robot/*.cpp)
  23. file(GLOB_RECURSE SRC_FILES ./src/*.cpp)
  24. add_executable(${PROJECT_NAME} ${SRC_FILES})
  25. IF (WIN32)
  26. list(APPEND EXTRA_LIBS ws2_32 wsock32 winmm)
  27. ENDIF ()
  28. target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBS})
  29. add_subdirectory(benchmark)
  30. add_subdirectory(tests)