# Included after the original OpenUSD module declarations. Derive both the # linker inputs and CPython registrations from exactly the wrappers built. if(NOT PXR_WEB_STATIC_PYTHON) return() endif() if(NOT EMSCRIPTEN OR BUILD_SHARED_LIBS) message(FATAL_ERROR "PXR_WEB_STATIC_PYTHON requires the static Emscripten build") endif() get_property(modules GLOBAL PROPERTY PXR_WEB_PYTHON_MODULES) set(header "#pragma once\n#include \n") set(registrations "") set(libraries "get_filename_component(_pxr_web_root \"\${CMAKE_CURRENT_LIST_DIR}/..\" ABSOLUTE)\nset(WEB_USD_PYTHON_LIBRARIES)\n") foreach(module IN LISTS modules) string(REPLACE "|" ";" fields "${module}") list(GET fields 0 package) list(GET fields 1 wrapper) string(APPEND header "extern \"C\" PyObject *PyInit_${wrapper}();\n") string(APPEND registrations " if (PyImport_AppendInittab(\"pxr.${package}.${wrapper}\", PyInit_${wrapper}) < 0) return -1;\n") string(APPEND libraries "list(APPEND WEB_USD_PYTHON_LIBRARIES \"\${_pxr_web_root}/lib/python/pxr/${package}/${wrapper}${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n") endforeach() string(APPEND header "inline int web_engine_register_usd_python()\n{\n${registrations} return 0;\n}\n") file(GENERATE OUTPUT "${PROJECT_BINARY_DIR}/web_engine_usd_python.hh" CONTENT "${header}") file(GENERATE OUTPUT "${PROJECT_BINARY_DIR}/webengine-pxr.cmake" CONTENT "${libraries}") install(FILES "${PROJECT_BINARY_DIR}/web_engine_usd_python.hh" DESTINATION include) install(FILES "${PROJECT_BINARY_DIR}/webengine-pxr.cmake" DESTINATION cmake)