Skip to content

Commit

Permalink
Merge branch 'main' into python_packaging
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Stone <[email protected]>
  • Loading branch information
jstone-lucasfilm authored Aug 17, 2023
2 parents 6b4db09 + 19eb023 commit a1c783e
Show file tree
Hide file tree
Showing 13 changed files with 228 additions and 104 deletions.
34 changes: 34 additions & 0 deletions cmake/modules/MaterialXVersion.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

#define MATERIALX_FILEVERSION @MATERIALX_MAJOR_VERSION@,@MATERIALX_MINOR_VERSION@,@MATERIALX_BUILD_VERSION@,0
#define MATERIALX_FILEVERSION_STR "@MATERIALX_MAJOR_VERSION@.@MATERIALX_MINOR_VERSION@.@[email protected]\0"
#define MATERIALX_FILENAME_STR "@[email protected]\0"

1 VERSIONINFO
FILEVERSION MATERIALX_FILEVERSION
PRODUCTVERSION MATERIALX_FILEVERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileVersion", MATERIALX_FILEVERSION_STR
VALUE "LegalCopyright", "Apache License 2.0\0"
VALUE "OriginalFilename", MATERIALX_FILENAME_STR
VALUE "ProductName", "MaterialX\0"
VALUE "ProductVersion", MATERIALX_FILEVERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
24 changes: 16 additions & 8 deletions source/MaterialXCore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
set(MATERIALX_MODULE_NAME MaterialXCore)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Generated.h.in ${CMAKE_CURRENT_BINARY_DIR}/Generated.h)

file(GLOB materialx_source "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
file(GLOB materialx_headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_BINARY_DIR}/*.h")

add_library(MaterialXCore ${materialx_source} ${materialx_headers})
add_library(${MATERIALX_MODULE_NAME} ${materialx_source} ${materialx_headers})

add_definitions(-DMATERIALX_CORE_EXPORTS)

# Create version resource
if(MATERIALX_BUILD_SHARED_LIBS AND MSVC)
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/MaterialXVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
target_sources(${MATERIALX_MODULE_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

set_target_properties(
MaterialXCore PROPERTIES
OUTPUT_NAME MaterialXCore${MATERIALX_LIBNAME_SUFFIX}
${MATERIALX_MODULE_NAME} PROPERTIES
OUTPUT_NAME ${MATERIALX_MODULE_NAME}${MATERIALX_LIBNAME_SUFFIX}
COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS}"
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}")

target_link_libraries(
MaterialXCore
${MATERIALX_MODULE_NAME}
${CMAKE_DL_LIBS})

target_include_directories(MaterialXCore
target_include_directories(${MATERIALX_MODULE_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../>
Expand All @@ -28,15 +36,15 @@ target_include_directories(MaterialXCore
${EXTERNAL_INCLUDE_DIRS})

if(NOT SKBUILD)
install(TARGETS MaterialXCore
install(TARGETS ${MATERIALX_MODULE_NAME}
EXPORT MaterialX
ARCHIVE DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
LIBRARY DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
RUNTIME DESTINATION bin)

install(FILES ${materialx_headers}
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/MaterialXCore/)
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/${MATERIALX_MODULE_NAME}/)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/MaterialXCore.pdb"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${MATERIALX_MODULE_NAME}.pdb"
DESTINATION "${MATERIALX_INSTALL_LIB_PATH}/" OPTIONAL)
endif()
24 changes: 16 additions & 8 deletions source/MaterialXFormat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,53 @@
set(MATERIALX_MODULE_NAME MaterialXFormat)

file(GLOB_RECURSE materialx_source "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
file(GLOB_RECURSE materialx_headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h*")

assign_source_group("Source Files" ${materialx_source})
assign_source_group("Header Files" ${materialx_headers})

add_library(MaterialXFormat ${materialx_source} ${materialx_headers})
add_library(${MATERIALX_MODULE_NAME} ${materialx_source} ${materialx_headers})

add_definitions(-DMATERIALX_FORMAT_EXPORTS)

# Create version resource
if(MATERIALX_BUILD_SHARED_LIBS AND MSVC)
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/MaterialXVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
target_sources(${MATERIALX_MODULE_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

set_target_properties(
MaterialXFormat PROPERTIES
OUTPUT_NAME MaterialXFormat${MATERIALX_LIBNAME_SUFFIX}
${MATERIALX_MODULE_NAME} PROPERTIES
OUTPUT_NAME ${MATERIALX_MODULE_NAME}${MATERIALX_LIBNAME_SUFFIX}
COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS}"
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
INSTALL_RPATH "${MATERIALX_SAME_DIR_RPATH}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}")

target_link_libraries(
MaterialXFormat
${MATERIALX_MODULE_NAME}
MaterialXCore
${CMAKE_DL_LIBS})

target_include_directories(MaterialXFormat
target_include_directories(${MATERIALX_MODULE_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
$<INSTALL_INTERFACE:${MATERIALX_INSTALL_INCLUDE_PATH}>
PRIVATE
${EXTERNAL_INCLUDE_DIRS})

if(NOT SKBUILD)
install(TARGETS MaterialXFormat
install(TARGETS ${MATERIALX_MODULE_NAME}
EXPORT MaterialX
ARCHIVE DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
LIBRARY DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
RUNTIME DESTINATION bin)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/MaterialXFormat/ MESSAGE_NEVER
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/${MATERIALX_MODULE_NAME}/ MESSAGE_NEVER
FILES_MATCHING PATTERN "*.h*")

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/MaterialXFormat.pdb"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${MATERIALX_MODULE_NAME}.pdb"
DESTINATION "${MATERIALX_INSTALL_LIB_PATH}/" OPTIONAL)
endif()
24 changes: 16 additions & 8 deletions source/MaterialXGenGlsl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,54 @@
set(MATERIALX_MODULE_NAME MaterialXGenGlsl)

file(GLOB_RECURSE materialx_source "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
file(GLOB_RECURSE materialx_headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h*")

assign_source_group("Source Files" ${materialx_source})
assign_source_group("Header Files" ${materialx_headers})

add_library(MaterialXGenGlsl ${materialx_source} ${materialx_headers})
add_library(${MATERIALX_MODULE_NAME} ${materialx_source} ${materialx_headers})

add_definitions(-DMATERIALX_GENGLSL_EXPORTS)

# Create version resource
if(MATERIALX_BUILD_SHARED_LIBS AND MSVC)
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/MaterialXVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
target_sources(${MATERIALX_MODULE_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

set_target_properties(
MaterialXGenGlsl PROPERTIES
OUTPUT_NAME MaterialXGenGlsl${MATERIALX_LIBNAME_SUFFIX}
${MATERIALX_MODULE_NAME} PROPERTIES
OUTPUT_NAME ${MATERIALX_MODULE_NAME}${MATERIALX_LIBNAME_SUFFIX}
COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS}"
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
INSTALL_RPATH "${MATERIALX_SAME_DIR_RPATH}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}")

target_link_libraries(
MaterialXGenGlsl
${MATERIALX_MODULE_NAME}
MaterialXGenShader
MaterialXCore
${CMAKE_DL_LIBS})

target_include_directories(MaterialXGenGlsl
target_include_directories(${MATERIALX_MODULE_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
$<INSTALL_INTERFACE:${MATERIALX_INSTALL_INCLUDE_PATH}>
PRIVATE
${EXTERNAL_INCLUDE_DIRS})

if(NOT SKBUILD)
install(TARGETS MaterialXGenGlsl
install(TARGETS ${MATERIALX_MODULE_NAME}
EXPORT MaterialX
ARCHIVE DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
LIBRARY DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
RUNTIME DESTINATION bin)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/MaterialXGenGlsl/ MESSAGE_NEVER
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/${MATERIALX_MODULE_NAME}/ MESSAGE_NEVER
FILES_MATCHING PATTERN "*.h*")

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/MaterialXGenGlsl.pdb"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${MATERIALX_MODULE_NAME}.pdb"
DESTINATION "${MATERIALX_INSTALL_LIB_PATH}/" OPTIONAL)
endif()
24 changes: 16 additions & 8 deletions source/MaterialXGenMdl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
set(MATERIALX_MODULE_NAME MaterialXGenMdl)

file(GLOB_RECURSE materialx_source "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
file(GLOB_RECURSE materialx_headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h*")

assign_source_group("Source Files" ${materialx_source})
assign_source_group("Header Files" ${materialx_headers})

add_library(MaterialXGenMdl ${materialx_source} ${materialx_headers})
add_library(${MATERIALX_MODULE_NAME} ${materialx_source} ${materialx_headers})

add_definitions(-DMATERIALX_GENMDL_EXPORTS)

# Create version resource
if(MATERIALX_BUILD_SHARED_LIBS AND MSVC)
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/MaterialXVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
target_sources(${MATERIALX_MODULE_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

set_target_properties(
MaterialXGenMdl PROPERTIES
OUTPUT_NAME MaterialXGenMdl${MATERIALX_LIBNAME_SUFFIX}
${MATERIALX_MODULE_NAME} PROPERTIES
OUTPUT_NAME ${MATERIALX_MODULE_NAME}${MATERIALX_LIBNAME_SUFFIX}
COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS}"
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
INSTALL_RPATH "${MATERIALX_SAME_DIR_RPATH}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}")

target_link_libraries(
MaterialXGenMdl
${MATERIALX_MODULE_NAME}
MaterialXGenShader
MaterialXCore
${CMAKE_DL_LIBS})

target_include_directories(MaterialXGenMdl
target_include_directories(${MATERIALX_MODULE_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
$<INSTALL_INTERFACE:${MATERIALX_INSTALL_INCLUDE_PATH}>
PRIVATE
${EXTERNAL_INCLUDE_DIRS})

if(NOT SKBUILD)
install(TARGETS MaterialXGenMdl
install(TARGETS ${MATERIALX_MODULE_NAME}
EXPORT MaterialX
ARCHIVE DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
LIBRARY DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
RUNTIME DESTINATION bin)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/MaterialXGenMdl/ MESSAGE_NEVER
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/${MATERIALX_MODULE_NAME}/ MESSAGE_NEVER
FILES_MATCHING PATTERN "*.h*")

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mdl
DESTINATION "${MATERIALX_INSTALL_MDL_MODULE_PATH}")

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/MaterialXGenMdl.pdb"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${MATERIALX_MODULE_NAME}.pdb"
DESTINATION "${MATERIALX_INSTALL_LIB_PATH}/" OPTIONAL)
endif()
24 changes: 16 additions & 8 deletions source/MaterialXGenMsl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,54 @@
set(MATERIALX_MODULE_NAME MaterialXGenMsl)

file(GLOB_RECURSE materialx_source "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
file(GLOB_RECURSE materialx_headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h*")

assign_source_group("Source Files" ${materialx_source})
assign_source_group("Header Files" ${materialx_headers})

add_library(MaterialXGenMsl ${materialx_source} ${materialx_headers})
add_library(${MATERIALX_MODULE_NAME} ${materialx_source} ${materialx_headers})

add_definitions(-DMATERIALX_GENMSL_EXPORTS)

# Create version resource
if(MATERIALX_BUILD_SHARED_LIBS AND MSVC)
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/MaterialXVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
target_sources(${MATERIALX_MODULE_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

set_target_properties(
MaterialXGenMsl PROPERTIES
OUTPUT_NAME MaterialXGenMsl${MATERIALX_LIBNAME_SUFFIX}
${MATERIALX_MODULE_NAME} PROPERTIES
OUTPUT_NAME ${MATERIALX_MODULE_NAME}${MATERIALX_LIBNAME_SUFFIX}
COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS}"
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
INSTALL_RPATH "${MATERIALX_SAME_DIR_RPATH}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}")

target_link_libraries(
MaterialXGenMsl
${MATERIALX_MODULE_NAME}
MaterialXGenShader
MaterialXCore
${CMAKE_DL_LIBS})

target_include_directories(MaterialXGenMsl
target_include_directories(${MATERIALX_MODULE_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
$<INSTALL_INTERFACE:${MATERIALX_INSTALL_INCLUDE_PATH}>
PRIVATE
${EXTERNAL_INCLUDE_DIRS})

if(NOT SKBUILD)
install(TARGETS MaterialXGenMsl
install(TARGETS ${MATERIALX_MODULE_NAME}
EXPORT MaterialX
ARCHIVE DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
LIBRARY DESTINATION ${MATERIALX_INSTALL_LIB_PATH}
RUNTIME DESTINATION bin)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/MaterialXGenMsl/ MESSAGE_NEVER
DESTINATION ${MATERIALX_INSTALL_INCLUDE_PATH}/${MATERIALX_MODULE_NAME}/ MESSAGE_NEVER
FILES_MATCHING PATTERN "*.h*")

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/MaterialXGenMsl.pdb"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${MATERIALX_MODULE_NAME}.pdb"
DESTINATION "${MATERIALX_INSTALL_LIB_PATH}/" OPTIONAL)
endif()
Loading

0 comments on commit a1c783e

Please sign in to comment.