|
| 1 | +cmake_minimum_required (VERSION 3.10) |
| 2 | + |
| 3 | +include(../../BuildTools/CMake/BuildUtils.cmake) |
| 4 | + |
| 5 | +project(Diligent-SuperResolution CXX) |
| 6 | + |
| 7 | +set(INCLUDE |
| 8 | +) |
| 9 | + |
| 10 | +set(INTERFACE |
| 11 | + interface/SuperResolution.h |
| 12 | + interface/SuperResolutionFactory.h |
| 13 | + interface/SuperResolutionFactoryLoader.h |
| 14 | +) |
| 15 | + |
| 16 | +set(SOURCE |
| 17 | + src/SuperResolutionFactory.cpp |
| 18 | +) |
| 19 | + |
| 20 | +if(D3D12_SUPPORTED) |
| 21 | + list(APPEND SOURCE src/SuperResolution_D3D12.cpp) |
| 22 | +endif() |
| 23 | + |
| 24 | +set(DLL_SOURCE |
| 25 | + src/DLLMain.cpp |
| 26 | + src/SuperResolution.def |
| 27 | +) |
| 28 | + |
| 29 | +add_library(Diligent-SuperResolutionInterface INTERFACE) |
| 30 | +target_link_libraries (Diligent-SuperResolutionInterface INTERFACE Diligent-GraphicsEngineInterface) |
| 31 | +target_include_directories(Diligent-SuperResolutionInterface INTERFACE interface) |
| 32 | + |
| 33 | +add_library(Diligent-SuperResolution-static STATIC |
| 34 | + ${SOURCE} ${INTERFACE} ${INCLUDE} |
| 35 | + readme.md |
| 36 | +) |
| 37 | +add_library(Diligent-SuperResolution-shared SHARED |
| 38 | + readme.md |
| 39 | +) |
| 40 | + |
| 41 | +if((PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS) AND NOT MINGW_BUILD) |
| 42 | + target_sources(Diligent-SuperResolution-shared PRIVATE ${DLL_SOURCE}) |
| 43 | +endif() |
| 44 | + |
| 45 | +target_include_directories(Diligent-SuperResolution-static |
| 46 | +PRIVATE |
| 47 | + include |
| 48 | +) |
| 49 | + |
| 50 | +target_compile_definitions(Diligent-SuperResolution-shared PUBLIC DILIGENT_SUPER_RESOLUTION_SHARED=1) |
| 51 | + |
| 52 | + |
| 53 | +target_link_libraries(Diligent-SuperResolution-static |
| 54 | +PUBLIC |
| 55 | + Diligent-SuperResolutionInterface |
| 56 | +PRIVATE |
| 57 | + Diligent-BuildSettings |
| 58 | + Diligent-Common |
| 59 | +) |
| 60 | + |
| 61 | +if(D3D12_SUPPORTED) |
| 62 | + target_link_libraries(Diligent-SuperResolution-static PRIVATE Diligent-GraphicsEngineD3D12-static) |
| 63 | + target_include_directories(Diligent-SuperResolution-static PRIVATE ../GraphicsEngineD3D12/include) |
| 64 | +endif() |
| 65 | + |
| 66 | +target_link_libraries(Diligent-SuperResolution-shared |
| 67 | +PUBLIC |
| 68 | + Diligent-SuperResolutionInterface |
| 69 | +PRIVATE |
| 70 | + Diligent-BuildSettings |
| 71 | +) |
| 72 | +target_link_whole_archive(Diligent-SuperResolution-shared Diligent-SuperResolution-static) |
| 73 | + |
| 74 | +if(PLATFORM_WIN32) |
| 75 | + # Do not add 'lib' prefix when building with MinGW |
| 76 | + set_target_properties(Diligent-SuperResolution-shared PROPERTIES PREFIX "") |
| 77 | + |
| 78 | + # Set output name to SuperResolution{32|64}{r|d} |
| 79 | + set_dll_output_name(Diligent-SuperResolution-shared SuperResolution) |
| 80 | +else() |
| 81 | + set_target_properties(Diligent-SuperResolution-shared PROPERTIES |
| 82 | + OUTPUT_NAME SuperResolution |
| 83 | + ) |
| 84 | +endif() |
| 85 | + |
| 86 | +if (MINGW_BUILD) |
| 87 | + # Restrict export to GetSuperResolutionFactory |
| 88 | + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/export.map |
| 89 | + "{ global: *GetSuperResolutionFactory*; local: *; };" |
| 90 | + ) |
| 91 | + target_link_options(Diligent-SuperResolution-shared PRIVATE LINKER:--version-script=export.map) |
| 92 | +endif() |
| 93 | + |
| 94 | +source_group("src" FILES ${SOURCE}) |
| 95 | +source_group("include" FILES ${INCLUDE}) |
| 96 | +source_group("interface" FILES ${INTERFACE}) |
| 97 | +source_group("dll" FILES ${DLL_SOURCE}) |
| 98 | + |
| 99 | +set_source_files_properties( |
| 100 | + readme.md PROPERTIES HEADER_FILE_ONLY TRUE |
| 101 | +) |
| 102 | + |
| 103 | +set_target_properties(Diligent-SuperResolution-static Diligent-SuperResolution-shared PROPERTIES |
| 104 | + FOLDER DiligentCore/Graphics |
| 105 | +) |
| 106 | + |
| 107 | +set_common_target_properties(Diligent-SuperResolution-static) |
| 108 | +set_common_target_properties(Diligent-SuperResolution-shared) |
| 109 | + |
| 110 | +if(DILIGENT_INSTALL_CORE) |
| 111 | + install_core_lib(Diligent-SuperResolution-shared) |
| 112 | + install_core_lib(Diligent-SuperResolution-static) |
| 113 | +endif() |
0 commit comments