forked from DiligentGraphics/DiligentTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (57 loc) · 2.86 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required (VERSION 3.6)
file(RELATIVE_PATH DILIGENT_TOOLS_DIR "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS OR PLATFORM_LINUX OR PLATFORM_MACOS OR PLATFORM_IOS OR PLATFORM_TVOS OR PLATFORM_EMSCRIPTEN)
option(DILIGENT_INSTALL_TOOLS "Install DiligentTool module headers and libraries" ON)
else()
set(DILIGENT_INSTALL_TOOLS OFF)
endif()
option(DILIGENT_NO_RENDER_STATE_PACKAGER "Do not build Render State Packager" OFF)
# Clear the list
set(DILIGENT_TOOLS_INSTALL_LIBS_LIST "" CACHE INTERNAL "Diligent tools libraries installation list")
function(install_tools_lib _TARGET)
get_target_relative_dir(${_TARGET} TARGET_RELATIVE_PATH)
get_target_property(TARGET_TYPE ${_TARGET} TYPE)
if(TARGET_TYPE STREQUAL STATIC_LIBRARY)
list(APPEND DILIGENT_TOOLS_INSTALL_LIBS_LIST ${_TARGET})
set(DILIGENT_TOOLS_INSTALL_LIBS_LIST ${DILIGENT_TOOLS_INSTALL_LIBS_LIST} CACHE INTERNAL "Diligent tools libraries installation list")
elseif(TARGET_TYPE STREQUAL SHARED_LIBRARY)
install(TARGETS ${_TARGET}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/${DILIGENT_TOOLS_DIR}/$<CONFIG>"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${DILIGENT_TOOLS_DIR}/$<CONFIG>"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/${DILIGENT_TOOLS_DIR}/$<CONFIG>"
)
if (DILIGENT_INSTALL_PDB)
install(FILES $<TARGET_PDB_FILE:${_TARGET}> DESTINATION "${CMAKE_INSTALL_BINDIR}/${DILIGENT_TOOLS_DIR}/$<CONFIG>" OPTIONAL)
endif()
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/interface")
install(DIRECTORY interface
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${TARGET_RELATIVE_PATH}/"
)
endif()
endfunction()
add_subdirectory(ThirdParty)
add_subdirectory(TextureLoader)
add_subdirectory(AssetLoader)
add_subdirectory(Imgui)
add_subdirectory(NativeApp)
if((PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS) AND GL_SUPPORTED)
add_subdirectory(HLSL2GLSLConverter)
endif()
add_subdirectory(RenderStateNotation)
if((PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS) AND ARCHIVER_SUPPORTED AND NOT DILIGENT_NO_RENDER_STATE_PACKAGER)
add_subdirectory(RenderStatePackager)
endif()
add_subdirectory(Tests)
# Installation instructions
if(DILIGENT_INSTALL_TOOLS)
install_combined_static_lib(
"${CMAKE_STATIC_LIBRARY_PREFIX}DiligentTools${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${DILIGENT_TOOLS_INSTALL_LIBS_LIST}"
DiligentTools-static # Custom target name
DiligentTools # Folder
"${CMAKE_INSTALL_LIBDIR}/${DILIGENT_TOOLS_DIR}/$<CONFIG>" # Install destination
)
endif()
# Create a custom target to run source code formatting validation command
add_format_validation_target(DiligentTools "${CMAKE_CURRENT_SOURCE_DIR}" DiligentTools)