forked from PixarAnimationStudios/OpenUSD
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
80 lines (68 loc) · 1.86 KB
/
Copy pathCMakeLists.txt
File metadata and controls
80 lines (68 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
set(PXR_PREFIX jsBindings)
set(PXR_PACKAGE jsBindings)
if (NOT EMSCRIPTEN)
return()
endif()
set(BINDINGS_NAME "jsBindings")
set(RESOURCE_PARAMETERS "")
list(APPEND RESOURCE_PARAMETERS "--preload-file ${PROJECT_BINARY_DIR}/plugins_plugInfo.json@/usd/plugInfo.json")
if(PXR_WASM_NODE)
list(TRANSFORM RESOURCE_PARAMETERS REPLACE "-preload" "-embed")
endif()
pxr_cpp_bin(${BINDINGS_NAME}
LIBRARIES
usd
usdLux
usdGeom
usdUtils
sdf
tf
${RESOURCE_PARAMETERS}
)
target_compile_options(${BINDINGS_NAME} PRIVATE "SHELL:-lembind")
target_link_options(${BINDINGS_NAME} PRIVATE "SHELL:-sEXPORT_NAME=getUsdModule -sMODULARIZE=1 -lembind --pre-js ${CMAKE_SOURCE_DIR}/js/prejs.js")
set_target_properties(${BINDINGS_NAME}
PROPERTIES
SUFFIX ".js"
)
set(BUILD_FILES
${CMAKE_CURRENT_BINARY_DIR}/${BINDINGS_NAME}.js
${CMAKE_CURRENT_BINARY_DIR}/${BINDINGS_NAME}.wasm
${CMAKE_SOURCE_DIR}/js/test.html
)
if(NOT PXR_WASM_NODE)
list(APPEND BUILD_FILES "${CMAKE_CURRENT_BINARY_DIR}/${BINDINGS_NAME}.data")
endif()
install(
FILES
${BUILD_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
# Install files for npm package
# ================
# REVISIT: This install DESTINATION appears to be cluttering the source folders
# Resulting and intermediate files should go into the target build folders
# under ${CMAKE_INSTALL_PREFIX}
# ================
install(
FILES
${BUILD_FILES}
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../js/bindings/${CMAKE_BUILD_TYPE}
)
#[[
# Create ES6 module - TBD
install(
CODE
"execute_process(
COMMAND
${CMAKE_COMMAND}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-P
${CMAKE_CURRENT_LIST_DIR}/create_es6_module.cmake
)"
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/usd.js
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
]]