Fix dawn/node build with make
make, unlike ninja, will not create output directories prior to running commands. Have idlgen create the output directories before attempting to generate the files. Clean up the generated directory structure. Piggyback off the existing DAWN_BUILD_GEN_DIR variable instead of starting a new gen directory at <build>/<subdir>/<gen>/<subdir>. Add Kokoro tests for building dawn node. Change-Id: Ic079ee96f4beaa1f9c3da98495bed6757f557839 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88447 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
4e98fb0bd8
commit
d6bc9c21ba
|
@ -90,7 +90,7 @@ status "Checking for CRLF"
|
||||||
./tools/check-no-crlf
|
./tools/check-no-crlf
|
||||||
|
|
||||||
status "Fetching dependencies"
|
status "Fetching dependencies"
|
||||||
cp scripts/standalone.gclient .gclient
|
cp scripts/standalone-with-node.gclient .gclient
|
||||||
with_retry gclient sync
|
with_retry gclient sync
|
||||||
|
|
||||||
status "Linting"
|
status "Linting"
|
||||||
|
@ -161,6 +161,12 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then
|
||||||
cmake --build . -- --jobs=$(nproc)
|
cmake --build . -- --jobs=$(nproc)
|
||||||
hide_cmds
|
hide_cmds
|
||||||
|
|
||||||
|
status "Re-building dawn in '${BUILD_DIR}' with dawn/node enabled"
|
||||||
|
show_cmds
|
||||||
|
cmake ${SRC_DIR} ${CMAKE_FLAGS} ${COMMON_CMAKE_FLAGS} -DDAWN_BUILD_NODE_BINDINGS=1 -DDAWN_ENABLE_PIC=1 -DDAWN_USE_X11=OFF
|
||||||
|
cmake --build . -- --jobs=$(nproc)
|
||||||
|
hide_cmds
|
||||||
|
|
||||||
status "Running tint_unittests"
|
status "Running tint_unittests"
|
||||||
show_cmds
|
show_cmds
|
||||||
./tint_unittests
|
./tint_unittests
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
set(GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/gen")
|
set(DAWN_NODE_GEN_DIR "${DAWN_BUILD_GEN_DIR}/node")
|
||||||
set(IDLGEN_TOOL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tools/src/cmd/idlgen")
|
set(IDLGEN_TOOL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tools/src/cmd/idlgen")
|
||||||
|
|
||||||
# idlgen() is a function that uses the tools/cmd/idlgen/main.go tool to generate
|
# idlgen() is a function that uses the tools/cmd/idlgen/main.go tool to generate
|
||||||
# code from an IDL file and template.
|
# code from an IDL file and template.
|
||||||
|
@ -75,7 +75,7 @@ target_include_directories(dawn_node PRIVATE
|
||||||
"${CMAKE_SOURCE_DIR}"
|
"${CMAKE_SOURCE_DIR}"
|
||||||
"${DAWN_THIRD_PARTY_DIR}"
|
"${DAWN_THIRD_PARTY_DIR}"
|
||||||
"${NODE_API_HEADERS_DIR}/include"
|
"${NODE_API_HEADERS_DIR}/include"
|
||||||
"${GEN_DIR}"
|
"${DAWN_NODE_GEN_DIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# To reduce the build dependencies for compiling the dawn.node targets, we do
|
# To reduce the build dependencies for compiling the dawn.node targets, we do
|
||||||
|
@ -92,14 +92,14 @@ string(REGEX MATCHALL "napi_[a-z0-9_]*" NAPI_SYMBOLS "${NAPI_SYMBOLS_JS_CONTENT}
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# Generate the NapiSymbols.def file from the Napi symbol list
|
# Generate the NapiSymbols.def file from the Napi symbol list
|
||||||
set(NAPI_SYMBOLS_DEF "${GEN_DIR}/NapiSymbols.def")
|
set(NAPI_SYMBOLS_DEF "${DAWN_NODE_GEN_DIR}/NapiSymbols.def")
|
||||||
list(TRANSFORM NAPI_SYMBOLS PREPEND " ")
|
list(TRANSFORM NAPI_SYMBOLS PREPEND " ")
|
||||||
list(TRANSFORM NAPI_SYMBOLS APPEND "\n")
|
list(TRANSFORM NAPI_SYMBOLS APPEND "\n")
|
||||||
string(REPLACE ";" "" NAPI_SYMBOLS "${NAPI_SYMBOLS}")
|
string(REPLACE ";" "" NAPI_SYMBOLS "${NAPI_SYMBOLS}")
|
||||||
string(PREPEND NAPI_SYMBOLS "LIBRARY node.exe\nEXPORTS\n")
|
string(PREPEND NAPI_SYMBOLS "LIBRARY node.exe\nEXPORTS\n")
|
||||||
file(GENERATE OUTPUT "${NAPI_SYMBOLS_DEF}" CONTENT "${NAPI_SYMBOLS}")
|
file(GENERATE OUTPUT "${NAPI_SYMBOLS_DEF}" CONTENT "${NAPI_SYMBOLS}")
|
||||||
# Generate the NapiSymbols.lib from the NapiSymbols.def file
|
# Generate the NapiSymbols.lib from the NapiSymbols.def file
|
||||||
set(NAPI_SYMBOLS_LIB "${GEN_DIR}/NapiSymbols.lib")
|
set(NAPI_SYMBOLS_LIB "${DAWN_NODE_GEN_DIR}/NapiSymbols.lib")
|
||||||
# Resolve path to lib.exe
|
# Resolve path to lib.exe
|
||||||
get_filename_component(VS_BIN_DIR "${CMAKE_LINKER}" DIRECTORY)
|
get_filename_component(VS_BIN_DIR "${CMAKE_LINKER}" DIRECTORY)
|
||||||
set(LIB_EXE "${VS_BIN_DIR}/lib.exe")
|
set(LIB_EXE "${VS_BIN_DIR}/lib.exe")
|
||||||
|
@ -116,7 +116,7 @@ if (WIN32)
|
||||||
target_link_libraries(dawn_node "${NAPI_SYMBOLS_LIB}")
|
target_link_libraries(dawn_node "${NAPI_SYMBOLS_LIB}")
|
||||||
else()
|
else()
|
||||||
# Generate the NapiSymbols.h file from the Napi symbol list
|
# Generate the NapiSymbols.h file from the Napi symbol list
|
||||||
set(NAPI_SYMBOLS_H "${GEN_DIR}/NapiSymbols.h")
|
set(NAPI_SYMBOLS_H "${DAWN_NODE_GEN_DIR}/NapiSymbols.h")
|
||||||
list(TRANSFORM NAPI_SYMBOLS PREPEND "NAPI_SYMBOL(")
|
list(TRANSFORM NAPI_SYMBOLS PREPEND "NAPI_SYMBOL(")
|
||||||
list(TRANSFORM NAPI_SYMBOLS APPEND ")\n")
|
list(TRANSFORM NAPI_SYMBOLS APPEND ")\n")
|
||||||
string(REPLACE ";" "" NAPI_SYMBOLS "${NAPI_SYMBOLS}")
|
string(REPLACE ";" "" NAPI_SYMBOLS "${NAPI_SYMBOLS}")
|
||||||
|
|
|
@ -73,7 +73,7 @@ target_include_directories(dawn_node_binding
|
||||||
"${CMAKE_SOURCE_DIR}"
|
"${CMAKE_SOURCE_DIR}"
|
||||||
"${DAWN_THIRD_PARTY_DIR}"
|
"${DAWN_THIRD_PARTY_DIR}"
|
||||||
"${NODE_API_HEADERS_DIR}/include"
|
"${NODE_API_HEADERS_DIR}/include"
|
||||||
"${GEN_DIR}"
|
"${DAWN_NODE_GEN_DIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(dawn_node_binding
|
target_link_libraries(dawn_node_binding
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Paths to generated files
|
# Paths to generated files
|
||||||
set(INTEROP_GEN_DIR "${GEN_DIR}/src/dawn/node/interop")
|
set(INTEROP_GEN_DIR "${DAWN_NODE_GEN_DIR}/src/dawn/node/interop")
|
||||||
set(INTEROP_WEBGPU_H "${INTEROP_GEN_DIR}/WebGPU.h")
|
set(INTEROP_WEBGPU_H "${INTEROP_GEN_DIR}/WebGPU.h")
|
||||||
set(INTEROP_WEBGPU_CPP "${INTEROP_GEN_DIR}/WebGPU.cpp")
|
set(INTEROP_WEBGPU_CPP "${INTEROP_GEN_DIR}/WebGPU.cpp")
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ target_include_directories(dawn_node_interop
|
||||||
"${CMAKE_SOURCE_DIR}"
|
"${CMAKE_SOURCE_DIR}"
|
||||||
"${DAWN_THIRD_PARTY_DIR}"
|
"${DAWN_THIRD_PARTY_DIR}"
|
||||||
"${NODE_API_HEADERS_DIR}/include"
|
"${NODE_API_HEADERS_DIR}/include"
|
||||||
"${GEN_DIR}"
|
"${DAWN_NODE_GEN_DIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(dawn_node_interop
|
target_link_libraries(dawn_node_interop
|
||||||
|
|
|
@ -65,6 +65,10 @@ func run() error {
|
||||||
// Open up the output file
|
// Open up the output file
|
||||||
out := os.Stdout
|
out := os.Stdout
|
||||||
if outputPath != "" {
|
if outputPath != "" {
|
||||||
|
dir := filepath.Dir(outputPath)
|
||||||
|
if err := os.MkdirAll(dir, 0777); err != nil {
|
||||||
|
return fmt.Errorf("failed to create output directory '%v'", dir)
|
||||||
|
}
|
||||||
file, err := os.Create(outputPath)
|
file, err := os.Create(outputPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open output file '%v'", outputPath)
|
return fmt.Errorf("failed to open output file '%v'", outputPath)
|
||||||
|
|
Loading…
Reference in New Issue