CMakeLists.txt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. cmake_minimum_required(VERSION 3.0)
  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. include_directories(./src)
  7. find_package(Boost REQUIRED COMPONENTS iostreams)
  8. list(APPEND EXTRA_LIBS ${Boost_LIBRARIES})
  9. include_directories(${Boost_INCLUDE_DIRS})
  10. find_package(fmt REQUIRED)
  11. list(APPEND EXTRA_LIBS fmt::fmt)
  12. find_package(spdlog REQUIRED)
  13. list(APPEND EXTRA_LIBS spdlog::spdlog)
  14. add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE)
  15. find_package(Eigen3 REQUIRED)
  16. list(APPEND EXTRA_LIBS Eigen3::Eigen)
  17. find_package(nlohmann_json REQUIRED)
  18. list(APPEND EXTRA_LIBS nlohmann_json::nlohmann_json)
  19. file(GLOB_RECURSE ALGORITHM_IMPL_FILES ./src/algorithm/*.cpp)
  20. file(GLOB_RECURSE CORE_IMPL_FILES ./src/core/*.cpp)
  21. file(GLOB_RECURSE ROBOT_IMPL_FILES ./src/robot/*.cpp)
  22. file(GLOB_RECURSE SRC_FILES ./src/*.cpp)
  23. add_executable(${PROJECT_NAME} ${SRC_FILES})
  24. IF (WIN32)
  25. list(APPEND EXTRA_LIBS ws2_32 wsock32 winmm bcrypt)
  26. ELSEIF (UNIX)
  27. list(APPEND crypt)
  28. ENDIF ()
  29. target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBS})
  30. add_subdirectory(app)
  31. add_subdirectory(benchmark)
  32. add_subdirectory(tests)