CMakeLists.txt 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. project(dx11_sample)
  2. set_property(GLOBAL PROPERTY USE_FOLDERS ON)
  3. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /UMBCS /D_UNICODE /DUNICODE")
  4. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin/DX11/)
  5. set(IMGUI_PATH "${CMAKE_SOURCE_DIR}/third_party/imgui/")
  6. set(IMGUI_INCLUDE "${IMGUI_PATH}" "${IMGUI_PATH}/backends/")
  7. set(IMGUI_SRC "${IMGUI_PATH}/backends/imgui_impl_dx11.cpp"
  8. "${IMGUI_PATH}/backends/imgui_impl_win32.cpp"
  9. "${IMGUI_PATH}/imgui.cpp"
  10. "${IMGUI_PATH}/imgui_demo.cpp"
  11. "${IMGUI_PATH}/imgui_draw.cpp"
  12. "${IMGUI_PATH}/imgui_tables.cpp"
  13. "${IMGUI_PATH}/imgui_widgets.cpp"
  14. )
  15. set(TINYEXR_PATH "${CMAKE_SOURCE_DIR}/third_party/tinyexr/")
  16. set(TINYEXR_INCLUDE "${TINYEXR_PATH}" "${TINYEXR_PATH}/deps/miniz")
  17. set(TINYEXR_SRC "${TINYEXR_PATH}/deps/miniz/miniz.c")
  18. set(STB_PATH "${CMAKE_SOURCE_DIR}/third_party/stb/")
  19. set(STB_INCLUDE "${STB_PATH}")
  20. set(NIS_PATH "${CMAKE_SOURCE_DIR}/../NIS")
  21. set(SAMPLES_PATH "${CMAKE_SOURCE_DIR}")
  22. set(DX_SAMPLE_SRC "src/Sample.cpp"
  23. "src/AppRenderer.cpp"
  24. "src/UIRenderer.cpp"
  25. "src/DeviceResources.cpp"
  26. "src/NVScaler.cpp"
  27. "src/NVSharpen.cpp"
  28. "src/BilinearUpscale.cpp"
  29. "${SAMPLES_PATH}/common/Image.cpp"
  30. "src/dpi.manifest"
  31. )
  32. set(DX_SAMPLE_HEADERS "include/AppRenderer.h"
  33. "include/DeviceResources.h"
  34. "include/NVScaler.h"
  35. "include/NVSharpen.h"
  36. "include/UIRenderer.h"
  37. "include/BilinearUpscale.h"
  38. "include/DXUtilities.h"
  39. "${NIS_PATH}/NIS_Config.h"
  40. "${SAMPLES_PATH}/common/Image.h"
  41. "${SAMPLES_PATH}/common/Utilities.h"
  42. )
  43. set(DX_SAMPLE_SHADERS "${NIS_PATH}/NIS_Scaler.h"
  44. "${NIS_PATH}/NIS_Main.hlsl"
  45. )
  46. set(DX_SAMPLE_MEDIA "${SAMPLES_PATH}/media/images/1080.png"
  47. "${SAMPLES_PATH}/media/images/1440.png"
  48. "${SAMPLES_PATH}/media/images/1660.png"
  49. )
  50. set_source_files_properties(${DX_SAMPLE_SHADERS} PROPERTIES VS_COPY_TO_OUT_DIR TRUE)
  51. source_group("external" FILES ${IMGUI_SRC} ${TINYEXR_SRC})
  52. source_group("shaders" FILES ${DX_SAMPLE_SHADERS})
  53. add_executable(${PROJECT_NAME} ${DX_SAMPLE_SRC} ${IMGUI_SRC} ${TINYEXR_SRC} ${DX_SAMPLE_HEADERS} ${DX_SAMPLE_SHADERS})
  54. target_include_directories (${PROJECT_NAME} PUBLIC include ${IMGUI_INCLUDE} ${TINYEXR_INCLUDE} ${STB_INCLUDE} ${NIS_PATH} ${SAMPLES_PATH}/common)
  55. add_custom_command(
  56. TARGET ${PROJECT_NAME} POST_BUILD
  57. COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${PROJECT_NAME}>/NIS
  58. COMMAND ${CMAKE_COMMAND} -E copy_directory ${NIS_PATH} $<TARGET_FILE_DIR:${PROJECT_NAME}>/NIS
  59. )
  60. add_custom_command(
  61. TARGET ${PROJECT_NAME} POST_BUILD
  62. COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${PROJECT_NAME}>/media/images
  63. COMMAND ${CMAKE_COMMAND} -E copy_directory ${SAMPLES_PATH}/media/images $<TARGET_FILE_DIR:${PROJECT_NAME}>/media/images
  64. )