Skip to content

Commit d7591f0

Browse files
authored
build: Use generator expressions to find oslc and compile shaders with it (#2026)
Signed-off-by: Alex Fuller <[email protected]>
1 parent 233a54a commit d7591f0

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/shaders/CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
file (GLOB shader_headers "*.h")
22
file (GLOB shader_source "*.osl")
33

4-
# FIXME -- is this really necessary?
5-
if (${CMAKE_GENERATOR} MATCHES "(Visual Studio.*)")
6-
# Work around visual studio outputting oslc.exe in a subfolder
7-
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc"
8-
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/../oslc/${CMAKE_BUILD_TYPE}/oslc.exe" "${CMAKE_CURRENT_BINARY_DIR}/../oslc/"
9-
DEPENDS oslc)
10-
endif ()
11-
12-
134
# Macro to compile a shader with oslc. Syntax is:
145
# oslc_compile (OSL osl_source_file
156
# [ DEPENDS list_of_dependencies ]
@@ -37,7 +28,7 @@ macro (oslc_compile)
3728
endforeach ()
3829
list (APPEND oslc_args "-I${CMAKE_SOURCE_DIR}/src/shaders")
3930
add_custom_command (OUTPUT ${osofile}
40-
COMMAND oslc ${oslc_args} "${oslfile}" -o "${osofile}"
31+
COMMAND $<TARGET_FILE_DIR:oslc>/$<TARGET_FILE_NAME:oslc> ${oslc_args} "${oslfile}" -o "${osofile}"
4132
MAIN_DEPENDENCY ${oslfile}
4233
DEPENDS ${_shader_DEPENDS} "${stdosl_header}" oslc
4334
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}

0 commit comments

Comments
 (0)