CMakeLists.txt 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. project(DoRayTested)
  2. set(THREADS_PREFER_PTHREAD_FLAG ON)
  3. find_package(Threads REQUIRED)
  4. #Every executable here need these include folders and library
  5. include_directories(../source/include ../source/pattern ../source/uvpattern)
  6. link_libraries(rayonnement)
  7. set(TESTS_SRC math_test.cpp tuple_test.cpp colour_test.cpp canvas_test.cpp matrix_test.cpp transformation_test.cpp
  8. ray_test.cpp intersect_test.cpp sphere_test.cpp light_test.cpp material_test.cpp world_test.cpp camera_test.cpp
  9. shape_test.cpp plane_test.cpp pattern_test.cpp cube_test.cpp cylinder_test.cpp cone_test.cpp group_test.cpp
  10. boundingbox_test.cpp triangle_test.cpp sequence_test.cpp objfile_test.cpp smoothtriangle_test.cpp)
  11. add_executable(testMyRays)
  12. target_include_directories(testMyRays PUBLIC ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
  13. target_sources(testMyRays PRIVATE ${TESTS_SRC})
  14. target_link_libraries(testMyRays gtest gtest_main Threads::Threads)
  15. add_custom_command(
  16. TARGET testMyRays POST_BUILD
  17. COMMAND ${CMAKE_COMMAND} -E copy
  18. ${CMAKE_CURRENT_SOURCE_DIR}/triangles.obj
  19. ${CMAKE_CURRENT_BINARY_DIR}/
  20. )
  21. gtest_discover_tests(testMyRays
  22. WORKING_DIRECTORY ${PROJECT_DIR}
  23. PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_DIR}"
  24. )
  25. add_executable(hw3render)
  26. target_sources(hw3render PRIVATE hw3render.cpp)
  27. add_executable(test_render)
  28. target_sources(test_render PRIVATE test_render.cpp)
  29. add_executable(ch5_test)
  30. target_sources(ch5_test PRIVATE ch5_test.cpp)
  31. add_executable(ch6_test)
  32. target_sources(ch6_test PRIVATE ch6_test.cpp)
  33. add_executable(ch7_test)
  34. target_sources(ch7_test PRIVATE ch7_test.cpp)
  35. add_executable(ch9_test)
  36. target_sources(ch9_test PRIVATE ch9_test.cpp)
  37. add_executable(ch10_test)
  38. target_sources(ch10_test PRIVATE ch10_test.cpp)
  39. add_executable(ch11_reflection)
  40. target_sources(ch11_reflection PRIVATE ch11_reflection.cpp)
  41. add_executable(ch11_refraction)
  42. target_sources(ch11_refraction PRIVATE ch11_refraction.cpp)
  43. add_executable(ch11_test)
  44. target_sources(ch11_test PRIVATE ch11_test.cpp)
  45. add_executable(ch12_test)
  46. target_sources(ch12_test PRIVATE ch12_test.cpp)
  47. add_executable(ch13_test)
  48. target_sources(ch13_test PRIVATE ch13_test.cpp)
  49. add_executable(ch13_cone)
  50. target_sources(ch13_cone PRIVATE ch13_cone.cpp)
  51. add_executable(ch14_test)
  52. target_sources(ch14_test PRIVATE ch14_test.cpp)
  53. add_executable(ch15_teapot_objfile)
  54. target_sources(ch15_teapot_objfile PRIVATE ch15_teapot_objfile.cpp)
  55. add_custom_command(
  56. TARGET ch15_teapot_objfile POST_BUILD
  57. COMMAND ${CMAKE_COMMAND} -E copy
  58. ${CMAKE_SOURCE_DIR}/external/teapot*.obj
  59. ${CMAKE_CURRENT_BINARY_DIR}/
  60. )
  61. add_executable(arealight_test)
  62. target_sources(arealight_test PRIVATE arealight_test.cpp)
  63. add_executable(triangle_rendertest)
  64. target_sources(triangle_rendertest PRIVATE triangle_rendertest.cpp)
  65. add_executable(christmasball_render)
  66. target_sources(christmasball_render PRIVATE christmasball_render.cpp)
  67. add_executable(uvmap_checkeredsphere)
  68. target_sources(uvmap_checkeredsphere PRIVATE uvmap_checkeredsphere.cpp)
  69. add_executable(uvmap_checkeredplane)
  70. target_sources(uvmap_checkeredplane PRIVATE uvmap_checkeredplane.cpp)
  71. add_executable(uvmap_checkeredcylinder)
  72. target_sources(uvmap_checkeredcylinder PRIVATE uvmap_checkeredcylinder.cpp)
  73. add_executable(uvmap_checkeredcube)
  74. target_sources(uvmap_checkeredcube PRIVATE uvmap_checkeredcube.cpp)
  75. add_executable(uvmap_aligncheckplane)
  76. target_sources(uvmap_aligncheckplane PRIVATE uvmap_aligncheckplane.cpp)
  77. add_executable(uvmap_earth)
  78. target_sources(uvmap_earth PRIVATE uvmap_earth.cpp)
  79. file(DOWNLOAD
  80. http://planetpixelemporium.com/download/download.php?earthmap1k.jpg
  81. ${CMAKE_SOURCE_DIR}/external/earthmap1k.jpg
  82. EXPECTED_HASH MD5=49c3b412cfa448ec819412fb3ca089d2
  83. )
  84. add_custom_command(
  85. TARGET uvmap_earth POST_BUILD
  86. COMMAND convert ${CMAKE_SOURCE_DIR}/external/earthmap1k.jpg ${CMAKE_CURRENT_BINARY_DIR}/earthmap1k.png)
  87. add_executable(uvmap_skybox)
  88. target_sources(uvmap_skybox PRIVATE uvmap_skybox.cpp)
  89. file(DOWNLOAD
  90. http://www.humus.name/Textures/LancellottiChapel.zip
  91. ${CMAKE_SOURCE_DIR}/external/LancellottiChapel.zip
  92. EXPECTED_HASH MD5=cd16610b00a4ace6baf1f0aff80f5685
  93. )
  94. add_custom_command(
  95. TARGET uvmap_skybox POST_BUILD
  96. COMMAND unzip -o ${CMAKE_SOURCE_DIR}/external/LancellottiChapel.zip -d LancellottiChapel
  97. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/external/
  98. )
  99. add_custom_command(
  100. TARGET uvmap_skybox POST_BUILD
  101. COMMAND ${CMAKE_COMMAND} -E copy
  102. ${CMAKE_SOURCE_DIR}/external/LancellottiChapel/*.jpg
  103. ${CMAKE_CURRENT_BINARY_DIR}/
  104. )
  105. add_test(NAME Chapter05_Test COMMAND $<TARGET_FILE:ch5_test>)
  106. add_test(NAME Chapter06_Test COMMAND $<TARGET_FILE:ch6_test>)
  107. add_test(NAME Chapter07_Test COMMAND $<TARGET_FILE:ch7_test>)
  108. add_test(NAME Chapter09_Test COMMAND $<TARGET_FILE:ch9_test>)
  109. add_test(NAME Chapter10_Test COMMAND $<TARGET_FILE:ch10_test>)
  110. add_test(NAME Chapter11_Reflection COMMAND $<TARGET_FILE:ch11_reflection>)
  111. add_test(NAME Chapter11_Refraction COMMAND $<TARGET_FILE:ch11_refraction>)
  112. add_test(NAME Chapter11_Test COMMAND $<TARGET_FILE:ch11_test>)
  113. add_test(NAME Chapter12_Test COMMAND $<TARGET_FILE:ch12_test>)
  114. add_test(NAME Chapter13_Test COMMAND $<TARGET_FILE:ch13_test>)
  115. add_test(NAME Chapter13_ConeBonus COMMAND $<TARGET_FILE:ch13_cone>)
  116. add_test(NAME Chapter14_Test COMMAND $<TARGET_FILE:ch14_test>)
  117. add_test(NAME Chapter15_Teapots COMMAND $<TARGET_FILE:ch15_teapot_objfile>)
  118. add_test(NAME AreaLight_Test COMMAND $<TARGET_FILE:arealight_test>)
  119. add_test(NAME UVMap_CheckeredSphere COMMAND $<TARGET_FILE:uvmap_checkeredsphere>)
  120. add_test(NAME UVMap_CheckeredPlane COMMAND $<TARGET_FILE:uvmap_checkeredplane>)
  121. add_test(NAME UVMap_CheckeredCylinder COMMAND $<TARGET_FILE:uvmap_checkeredcylinder>)
  122. add_test(NAME UVMap_AlignCheckPlane COMMAND $<TARGET_FILE:uvmap_aligncheckplane>)
  123. add_test(NAME UVMap_CheckeredCube COMMAND $<TARGET_FILE:uvmap_checkeredcube>)
  124. add_test(NAME UVMap_Earth COMMAND $<TARGET_FILE:uvmap_earth>)
  125. add_test(NAME UVMap_Skybox COMMAND $<TARGET_FILE:uvmap_skybox>)
  126. add_test(NAME Test_Rendering COMMAND $<TARGET_FILE:test_render>)
  127. add_test(NAME Triangle_RenderTest COMMAND $<TARGET_FILE:triangle_rendertest>)
  128. add_test(NAME ChristmasBall_Rendering COMMAND $<TARGET_FILE:christmasball_render>)
  129. add_test(NAME Hw3Render COMMAND $<TARGET_FILE:hw3render> ${CMAKE_CURRENT_SOURCE_DIR}/test.hw3scene)
  130. add_test(NAME Hw3RenderAllCmds COMMAND $<TARGET_FILE:hw3render> ${CMAKE_CURRENT_SOURCE_DIR}/test_keys.hw3scene)