CMakeLists.txt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. cmake_minimum_required (VERSION 3.16)
  2. include(FetchContent)
  3. project(Flaschenray)
  4. if (NOT CMAKE_BUILD_TYPE)
  5. set(CMAKE_BUILD_TYPE Release)
  6. endif()
  7. #set(CMAKE_CXX_STANDARD 20)
  8. set(CMAKE_EXPORT_COMPILE_COMMANDS True)
  9. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pthread -fopenmp")
  10. set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fopenmp -march=native -funroll-loops -std=c++20")
  11. FetchContent_Declare(
  12. objloader
  13. GIT_REPOSITORY https://github.com/manuel5975p/OBJ-Loader
  14. )
  15. FetchContent_GetProperties(objloader)
  16. if(NOT objloader_POPULATED)
  17. FetchContent_Populate(objloader)
  18. #add_subdirectory(${objloader_SOURCE_DIR} ${objloader_BINARY_DIR})
  19. endif()
  20. FetchContent_Declare(
  21. lodepng
  22. GIT_REPOSITORY https://github.com/lvandeve/lodepng.git
  23. )
  24. FetchContent_GetProperties(lodepng)
  25. if(NOT lodepng_POPULATED)
  26. FetchContent_Populate(lodepng)
  27. endif()
  28. add_executable(chnuscht
  29. main.cpp
  30. camera.cpp
  31. scene.cpp
  32. "${lodepng_SOURCE_DIR}/lodepng.cpp"
  33. )
  34. target_include_directories(chnuscht PUBLIC "${objloader_SOURCE_DIR}/include")
  35. target_include_directories(chnuscht PUBLIC "${lodepng_SOURCE_DIR}")
  36. option(EMBREE_TUTORIALS OFF FORCE)
  37. FetchContent_Declare(
  38. embree
  39. GIT_REPOSITORY https://github.com/embree/embree/
  40. )
  41. FetchContent_GetProperties(embree)
  42. if(NOT embree_POPULATED)
  43. FetchContent_Populate(embree)
  44. add_subdirectory(${embree_SOURCE_DIR} ${embree_BINARY_DIR})
  45. endif()
  46. target_link_libraries(chnuscht embree)
  47. target_link_libraries(chnuscht tbb)
  48. target_link_libraries(chnuscht "gomp")
  49. target_link_libraries(chnuscht "sfml-system")
  50. target_link_libraries(chnuscht "sfml-graphics")
  51. target_link_libraries(chnuscht "sfml-window")