CMakeLists.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 "-D_GLIBCXX_DEBUG -g3 -fopenmp -march=native -funroll-loops -std=c++20")
  11. set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fopenmp -march=native -funroll-loops -std=c++20")
  12. FetchContent_Declare(
  13. objloader
  14. GIT_REPOSITORY https://github.com/manuel5975p/OBJ-Loader
  15. )
  16. FetchContent_GetProperties(objloader)
  17. if(NOT objloader_POPULATED)
  18. FetchContent_Populate(objloader)
  19. #add_subdirectory(${objloader_SOURCE_DIR} ${objloader_BINARY_DIR})
  20. endif()
  21. FetchContent_Declare(
  22. lodepng
  23. GIT_REPOSITORY https://github.com/lvandeve/lodepng.git
  24. )
  25. FetchContent_GetProperties(lodepng)
  26. if(NOT lodepng_POPULATED)
  27. FetchContent_Populate(lodepng)
  28. endif()
  29. FetchContent_Declare(
  30. xoshiro
  31. GIT_REPOSITORY https://github.com/manuel5975p/xoshiro-cpp.git
  32. )
  33. FetchContent_GetProperties(xoshiro)
  34. if(NOT xoshiro_POPULATED)
  35. FetchContent_Populate(xoshiro)
  36. endif()
  37. add_executable(chnuscht
  38. main.cpp
  39. camera.cpp
  40. scene.cpp
  41. "${lodepng_SOURCE_DIR}/lodepng.cpp"
  42. )
  43. target_include_directories(chnuscht PUBLIC "${objloader_SOURCE_DIR}/include")
  44. target_include_directories(chnuscht PUBLIC "${lodepng_SOURCE_DIR}")
  45. target_include_directories(chnuscht PUBLIC "${xoshiro_SOURCE_DIR}")
  46. option(EMBREE_TUTORIALS OFF FORCE)
  47. option(EMBREE_ISPC_SUPPORT OFF FORCE)
  48. set(EMBREE_TASKING_SYSTEM "kak" FORCE)
  49. FetchContent_Declare(
  50. embree
  51. GIT_REPOSITORY https://github.com/embree/embree/
  52. )
  53. FetchContent_GetProperties(embree)
  54. if(NOT embree_POPULATED)
  55. FetchContent_Populate(embree)
  56. add_subdirectory(${embree_SOURCE_DIR} ${embree_BINARY_DIR})
  57. endif()
  58. target_link_libraries(chnuscht embree)
  59. #target_link_libraries(chnuscht tbb)
  60. #target_link_libraries(chnuscht "gomp")
  61. #target_link_libraries(chnuscht "sfml-system")
  62. #target_link_libraries(chnuscht "sfml-graphics")
  63. #target_link_libraries(chnuscht "sfml-window")