Skip to content

Commit

Permalink
Version information for MaterialX dlls (#1447)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinbhat authored Aug 17, 2023
1 parent c34a106 commit 19eb023
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,40 +1,48 @@
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}/../>
$<INSTALL_INTERFACE:${MATERIALX_INSTALL_INCLUDE_PATH}>
PRIVATE
${EXTERNAL_INCLUDE_DIRS})

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)
24 changes: 16 additions & 8 deletions source/MaterialXFormat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
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})

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)
24 changes: 16 additions & 8 deletions source/MaterialXGenGlsl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,52 @@
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})

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)
24 changes: 16 additions & 8 deletions source/MaterialXGenMdl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
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})

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)
24 changes: 16 additions & 8 deletions source/MaterialXGenMsl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,52 @@
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})

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)
24 changes: 16 additions & 8 deletions source/MaterialXGenOsl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,53 @@
set(MATERIALX_MODULE_NAME MaterialXGenOsl)

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(MaterialXGenOsl ${materialx_source} ${materialx_headers})
add_library(${MATERIALX_MODULE_NAME} ${materialx_source} ${materialx_headers})

add_definitions(-DMATERIALX_GENOSL_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(
MaterialXGenOsl PROPERTIES
OUTPUT_NAME MaterialXGenOsl${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(
MaterialXGenOsl
${MATERIALX_MODULE_NAME}
MaterialXGenShader
MaterialXCore
${CMAKE_DL_LIBS})

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

install(TARGETS MaterialXGenOsl
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}/MaterialXGenOsl/ 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}/MaterialXGenOsl.pdb"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${MATERIALX_MODULE_NAME}.pdb"
DESTINATION "${MATERIALX_INSTALL_LIB_PATH}/" OPTIONAL)

Loading

0 comments on commit 19eb023

Please sign in to comment.