Skip to content

Commit 916a166

Browse files
Moved generated shaders to build tree (close #453)
1 parent b75adfc commit 916a166

4 files changed

Lines changed: 28 additions & 1460 deletions

File tree

Graphics/HLSL2GLSLConverterLib/CMakeLists.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ set(SOURCE
2020

2121
set(GLSL_DEFINITIONS include/GLSLDefinitions.h)
2222

23+
set(GENERATED_SHADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/GeneratedShaders)
24+
file(MAKE_DIRECTORY ${GENERATED_SHADERS_DIR})
25+
2326
# We must use the full path, otherwise the build system will not be able to properly detect
2427
# changes and shader conversion custom command will run every time
25-
set(GLSL_DEFINITIONS_INC ${CMAKE_CURRENT_SOURCE_DIR}/include/GLSLDefinitions_inc.h)
28+
set(GLSL_DEFINITIONS_INC ${GENERATED_SHADERS_DIR}/GLSLDefinitions_inc.h)
2629
set_source_files_properties(${GLSL_DEFINITIONS_INC} PROPERTIES GENERATED TRUE)
2730

2831
add_library(Diligent-HLSL2GLSLConverterLib STATIC
@@ -39,6 +42,7 @@ PUBLIC
3942
interface
4043
PRIVATE
4144
include
45+
${GENERATED_SHADERS_DIR}
4246
)
4347

4448
target_link_libraries(Diligent-HLSL2GLSLConverterLib
@@ -51,23 +55,19 @@ PUBLIC
5155
Diligent-GraphicsEngineInterface
5256
)
5357

54-
if(NOT "${FILE2STRING_PATH}" STREQUAL "")
55-
find_package(Python3 REQUIRED)
56-
add_custom_command(OUTPUT ${GLSL_DEFINITIONS_INC} # We must use full path here!
57-
COMMAND ${Python3_EXECUTABLE} ${FILE2STRING_PATH} ${GLSL_DEFINITIONS} include/GLSLDefinitions_inc.h
58-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
59-
MAIN_DEPENDENCY ${GLSL_DEFINITIONS}
60-
COMMENT "Processing GLSLDefinitions.h"
61-
VERBATIM
62-
)
63-
else()
64-
message(WARNING "File2String utility is currently unavailable on this host system. This is not an issue unless you modify GLSLDefinitions.h file")
65-
endif()
58+
find_package(Python3 REQUIRED)
59+
add_custom_command(OUTPUT ${GLSL_DEFINITIONS_INC} # We must use full path here!
60+
COMMAND ${Python3_EXECUTABLE} ${FILE2STRING_PATH} ${GLSL_DEFINITIONS} ${GLSL_DEFINITIONS_INC}
61+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
62+
MAIN_DEPENDENCY ${GLSL_DEFINITIONS}
63+
COMMENT "Processing GLSLDefinitions.h"
64+
VERBATIM
65+
)
6666

6767
source_group("src" FILES ${SOURCE})
6868
source_group("include" FILES ${INCLUDE})
6969
source_group("interface" FILES ${INTERFACE})
70-
source_group("generated" FILES include/GLSLDefinitions_inc.h)
70+
source_group("generated" FILES ${GLSL_DEFINITIONS_INC})
7171

7272
set_target_properties(Diligent-HLSL2GLSLConverterLib PROPERTIES
7373
FOLDER DiligentCore/Graphics

0 commit comments

Comments
 (0)