mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-09 00:00:18 +00:00
Add CMake Config
This commit is contained in:
parent
c92d7b9a82
commit
ee4d4e9f60
@ -853,3 +853,32 @@ endif()
|
||||
if (NOT NO_DOC)
|
||||
add_subdirectory(documentation)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.2)
|
||||
#
|
||||
# CMake Config.
|
||||
#
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
configure_package_config_file(
|
||||
opensubdiv-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
|
||||
)
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config-version.cmake
|
||||
VERSION ${OSD_SONAME}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
install(EXPORT opensubdiv-targets
|
||||
NAMESPACE OpenSubdiv::
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
|
||||
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opensubdiv-config-version.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
|
||||
)
|
||||
endif()
|
@ -68,4 +68,4 @@ target_link_libraries(dxPtexViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS dxPtexViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS dxPtexViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -62,4 +62,4 @@ target_link_libraries(dxViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS dxViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS dxViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -67,4 +67,4 @@ target_link_libraries(farViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS farViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS farViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -61,4 +61,4 @@ target_link_libraries(glEvalLimit
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS glEvalLimit DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS glEvalLimit EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -61,4 +61,4 @@ target_link_libraries(glFVarViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS glFVarViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS glFVarViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -63,7 +63,7 @@ target_link_libraries(glImaging
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS glImaging DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS glImaging EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
||||
if (NOT NO_GLTESTS)
|
||||
add_test(glImaging ${EXECUTABLE_OUTPUT_PATH}/glImaging -w test -l 3 -s 256 256 -a)
|
||||
|
@ -61,4 +61,4 @@ target_link_libraries(glPaintTest
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS glPaintTest DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS glPaintTest EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -66,4 +66,4 @@ target_link_libraries(glPtexViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS glPtexViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS glPtexViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -61,4 +61,4 @@ target_link_libraries(glShareTopology
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS glShareTopology DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS glShareTopology EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -52,4 +52,4 @@ target_link_libraries(glStencilViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS glStencilViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS glStencilViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -62,4 +62,4 @@ target_link_libraries(glViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS glViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS glViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -117,4 +117,4 @@ target_link_libraries(mtlPtexViewer
|
||||
)
|
||||
|
||||
|
||||
install(TARGETS mtlPtexViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS mtlPtexViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -112,4 +112,4 @@ target_link_libraries(mtlViewer
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS mtlViewer DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS mtlViewer EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
6
opensubdiv-config.cmake.in
Normal file
6
opensubdiv-config.cmake.in
Normal file
@ -0,0 +1,6 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(OpenSubdiv_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
|
||||
set_and_check(OpenSubdiv_LIB_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/opensubdiv-targets.cmake")
|
@ -145,7 +145,7 @@ if (NOT NO_LIB)
|
||||
${PLATFORM_CPU_LIBRARIES}
|
||||
)
|
||||
|
||||
install( TARGETS osd_static_cpu DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
install( TARGETS osd_static_cpu EXPORT opensubdiv-targets DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
|
||||
if( OSD_GPU )
|
||||
# this macro uses FindCUDA.cmake to compile .cu kernel files
|
||||
@ -163,7 +163,7 @@ if (NOT NO_LIB)
|
||||
${PLATFORM_CPU_LIBRARIES} ${PLATFORM_GPU_LIBRARIES}
|
||||
)
|
||||
|
||||
install( TARGETS osd_static_gpu DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
install( TARGETS osd_static_gpu EXPORT opensubdiv-targets DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
endif()
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ if (NOT NO_LIB)
|
||||
${PLATFORM_CPU_LIBRARIES}
|
||||
)
|
||||
|
||||
install( TARGETS osd_dynamic_cpu LIBRARY DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
install( TARGETS osd_dynamic_cpu EXPORT opensubdiv-targets LIBRARY DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
|
||||
#---------------------------------------------------
|
||||
if( OSD_GPU )
|
||||
@ -233,7 +233,7 @@ if (NOT NO_LIB)
|
||||
${PLATFORM_CPU_LIBRARIES} ${PLATFORM_GPU_LIBRARIES}
|
||||
)
|
||||
|
||||
install( TARGETS osd_dynamic_gpu LIBRARY DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
install( TARGETS osd_dynamic_gpu EXPORT opensubdiv-targets LIBRARY DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
endif()
|
||||
|
||||
endif()
|
||||
@ -295,7 +295,7 @@ if (NOT NO_LIB)
|
||||
${PLATFORM_CPU_LIBRARIES} ${PLATFORM_GPU_LIBRARIES}
|
||||
)
|
||||
|
||||
install( TARGETS osd_static_framework
|
||||
install( TARGETS osd_static_framework EXPORT opensubdiv-targets
|
||||
LIBRARY DESTINATION "${CMAKE_LIBDIR_BASE}"
|
||||
FRAMEWORK DESTINATION "${CMAKE_LIBDIR_BASE}"
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INCDIR_BASE}"
|
||||
@ -343,7 +343,7 @@ if (NOT NO_LIB)
|
||||
${PLATFORM_CPU_LIBRARIES} ${PLATFORM_GPU_LIBRARIES}
|
||||
)
|
||||
|
||||
install( TARGETS osd_dynamic_framework
|
||||
install( TARGETS osd_dynamic_framework EXPORT opensubdiv-targets
|
||||
FRAMEWORK DESTINATION "${CMAKE_LIBDIR_BASE}"
|
||||
LIBRARY DESTINATION "${CMAKE_LIBDIR_BASE}"
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INCDIR_BASE}"
|
||||
|
@ -32,5 +32,5 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||
osd_add_executable(stringify "opensubdiv/tools"
|
||||
main.cpp
|
||||
)
|
||||
install(TARGETS stringify DESTINATION ${CMAKE_BINDIR_BASE})
|
||||
install(TARGETS stringify EXPORT opensubdiv-targets DESTINATION ${CMAKE_BINDIR_BASE})
|
||||
endif()
|
||||
|
@ -42,7 +42,7 @@ osd_add_executable(far_perf "regression"
|
||||
$<TARGET_OBJECTS:regression_common_obj>
|
||||
)
|
||||
|
||||
install(TARGETS far_perf DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS far_perf EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
||||
add_test(far_perf ${EXECUTABLE_OUTPUT_PATH}/far_regression)
|
||||
|
||||
|
@ -40,7 +40,7 @@ osd_add_executable(far_regression "regression"
|
||||
$<TARGET_OBJECTS:regression_common_obj>
|
||||
)
|
||||
|
||||
install(TARGETS far_regression DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS far_regression EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
||||
add_test(far_regression ${EXECUTABLE_OUTPUT_PATH}/far_regression)
|
||||
|
||||
|
@ -49,5 +49,5 @@ osd_add_executable(hbr_baseline "regression"
|
||||
$<TARGET_OBJECTS:regression_common_obj>
|
||||
)
|
||||
|
||||
install(TARGETS hbr_baseline DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS hbr_regression DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS hbr_baseline EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS hbr_regression EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
@ -47,7 +47,7 @@ target_link_libraries(osd_regression
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS osd_regression DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
install(TARGETS osd_regression EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}")
|
||||
|
||||
if (NOT NO_GLTESTS)
|
||||
add_test(osd_regression ${EXECUTABLE_OUTPUT_PATH}/osd_regression)
|
||||
|
@ -30,5 +30,5 @@ osd_add_executable(hbr_tutorial_0 "tutorials/hbr"
|
||||
${SOURCE_FILES}
|
||||
)
|
||||
|
||||
install(TARGETS hbr_tutorial_0 DESTINATION "${CMAKE_BINDIR_BASE}/tutorials")
|
||||
install(TARGETS hbr_tutorial_0 EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}/tutorials")
|
||||
|
||||
|
@ -30,5 +30,5 @@ osd_add_executable(hbr_tutorial_1 "tutorials/hbr"
|
||||
${SOURCE_FILES}
|
||||
)
|
||||
|
||||
install(TARGETS hbr_tutorial_1 DESTINATION "${CMAKE_BINDIR_BASE}/tutorials")
|
||||
install(TARGETS hbr_tutorial_1 EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}/tutorials")
|
||||
|
||||
|
@ -30,5 +30,5 @@ osd_add_executable(hbr_tutorial_2 "tutorials/hbr"
|
||||
${SOURCE_FILES}
|
||||
)
|
||||
|
||||
install(TARGETS hbr_tutorial_2 DESTINATION "${CMAKE_BINDIR_BASE}/tutorials")
|
||||
install(TARGETS hbr_tutorial_2 EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}/tutorials")
|
||||
|
||||
|
@ -35,5 +35,5 @@ target_link_libraries(osd_tutorial_0
|
||||
osd_static_cpu
|
||||
)
|
||||
|
||||
install(TARGETS osd_tutorial_0 DESTINATION "${CMAKE_BINDIR_BASE}/tutorials")
|
||||
install(TARGETS osd_tutorial_0 EXPORT opensubdiv-targets DESTINATION "${CMAKE_BINDIR_BASE}/tutorials")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user