Files

66 lines
3.0 KiB
Diff
Raw Permalink Normal View History

2021-04-16 12:24:59 -04:00
--- source/MaterialXTest/CMakeLists.txt.orig 2021-03-02 12:41:29.000000000 -0500
+++ source/MaterialXTest/CMakeLists.txt 2021-04-14 23:27:01.000000000 -0400
@@ -81,23 +81,51 @@
endif()
endif()
2020-09-15 13:52:25 -04:00
+# Hoist the generation of the reference OSL implementation into the
+# pre-link portion of the CMake build, instead of waiting until after
+# the build completes by using the install() commands (see comment
+# below).
2021-04-16 12:24:59 -04:00
+if(MATERIALX_BUILD_GEN_OSL)
+ add_custom_command(TARGET MaterialXTest PRE_LINK
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/stdlib/reference/osl)
+ add_custom_command(TARGET MaterialXTest PRE_LINK
+ COMMAND ${CMAKE_COMMAND} -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/stdlib/osl/*.h"
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/stdlib/reference/osl)
+endif()
2020-09-15 13:52:25 -04:00
+
2021-04-16 12:24:59 -04:00
+if(MATERIALX_BUILD_GEN_MDL)
+ add_custom_command(TARGET MaterialXTest PRE_LINK
+ COMMAND ${CMAKE_COMMAND} -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../source/MaterialXGenMdl/mdl/"
+ ${CMAKE_CURRENT_BINARY_DIR}/${MATERIALX_INSTALL_MDL_MODULE_PATH}/mdl)
+endif()
+
# TODO: Only do this stuff when it's relevant
2020-09-15 13:52:25 -04:00
add_custom_command(TARGET MaterialXTest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/../../libraries ${CMAKE_CURRENT_BINARY_DIR}/libraries)
2021-04-16 12:24:59 -04:00
-if(MATERIALX_BUILD_GEN_OSL)
- install(DIRECTORY DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/libraries/stdlib/reference/osl)
- install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/stdlib/osl/"
- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/libraries/stdlib/reference/osl
- FILES_MATCHING PATTERN "*.h")
-endif()
2020-09-15 13:52:25 -04:00
-
2021-04-16 12:24:59 -04:00
-if(MATERIALX_BUILD_GEN_MDL)
- install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../source/MaterialXGenMdl/mdl/"
- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${MATERIALX_INSTALL_MDL_MODULE_PATH}/mdl)
-endif()
2020-09-15 13:52:25 -04:00
+# These lines have been removed because they occur way too late. During
+# the MacPorts build process, they get added/copied after the build/
+# directory has already been deleted by the MacPorts build system (which
+# typically occurs at the end of the build phase). This somehow causes
+# them to get generated in a build/ directory inside the destroot tree,
+# which results in the files getting placed into
+# ${destroot}${worksrcpath}/build/libraries, which is not what we want.
2021-04-16 12:24:59 -04:00
+#if(MATERIALX_BUILD_GEN_OSL)
+# install(DIRECTORY DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/libraries/stdlib/reference/osl)
+# install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/stdlib/osl/"
+# DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/libraries/stdlib/reference/osl
+# FILES_MATCHING PATTERN "*.h")
+#endif()
2020-09-15 13:52:25 -04:00
+#
2021-04-16 12:24:59 -04:00
+#if(MATERIALX_BUILD_GEN_MDL)
+# install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../source/MaterialXGenMdl/mdl/"
+# DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${MATERIALX_INSTALL_MDL_MODULE_PATH}/mdl)
+#endif()
2020-09-15 13:52:25 -04:00
add_custom_command(TARGET MaterialXTest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory