Skip to content

Commit 5590f40

Browse files
Small CMake setup improvements (#229)
This commit includes two kinds of changes: 1. It makes various tools (binaryen, wasm-tools, wasmtime, weval, and wizer) that are installed during configuration available to embeddings by moving the variables into the CMake variables cache 2. It changes the OpenSSL configuration to ignore patches that are applied multiple times, making the configuration more robust The latter change is needed in situations where an embedding moves to a different version of StarlingMonkey without deleting the build dir. That causes the OpenSSL config to be reapplied, while the old, already patched, files are kept around.
1 parent 54d73ba commit 5590f40

File tree

6 files changed

+7
-6
lines changed

6 files changed

+7
-6
lines changed

cmake/binaryen.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ endif()
88
set(BINARYEN_URL https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-${BINARYEN_ARCH}-${HOST_OS}.tar.gz)
99
CPMAddPackage(NAME binaryen URL ${BINARYEN_URL} DOWNLOAD_ONLY TRUE)
1010
set(BINARYEN_DIR ${CPM_PACKAGE_binaryen_SOURCE_DIR}/bin)
11-
set(WASM_OPT ${BINARYEN_DIR}/wasm-opt)
11+
set(WASM_OPT ${BINARYEN_DIR}/wasm-opt CACHE FILEPATH "Path to wasm-opt binary")
1212

1313
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cxx-wrapper.in ${CMAKE_BINARY_DIR}/cxx-wrapper)
1414
set(CMAKE_CXX_COMPILER "${CMAKE_BINARY_DIR}/cxx-wrapper")

cmake/openssl.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ ExternalProject_Add(
1818
URL_HASH SHA256=83049d042a260e696f62406ac5c08bf706fd84383f945cf21bd61e9ed95c396e
1919
USES_TERMINAL_DOWNLOAD TRUE
2020
PATCH_COMMAND
21-
patch -d ${OPENSSL_SOURCE_DIR} -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/deps/patches/getuid.patch &&
22-
patch -d ${OPENSSL_SOURCE_DIR} -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/deps/patches/rand.patch
21+
patch -d ${OPENSSL_SOURCE_DIR} -t -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/deps/patches/getuid.patch &&
22+
patch -d ${OPENSSL_SOURCE_DIR} -t -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/deps/patches/rand.patch
2323
CONFIGURE_COMMAND
2424
CC="clang" CFLAGS="--sysroot=${WASI_SDK_PREFIX}/share/wasi-sysroot" ${OPENSSL_SOURCE_DIR}/config
2525
--prefix=${OPENSSL_INSTALL_DIR}

cmake/wasm-tools.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ set(WASM_TOOLS_VERSION 1.0.54)
33
set(WASM_TOOLS_URL https://github.com/bytecodealliance/wasm-tools/releases/download/wasm-tools-${WASM_TOOLS_VERSION}/wasm-tools-${WASM_TOOLS_VERSION}-${HOST_ARCH}-${HOST_OS}.tar.gz)
44
CPMAddPackage(NAME wasm-tools URL ${WASM_TOOLS_URL} DOWNLOAD_ONLY TRUE)
55
set(WASM_TOOLS_DIR ${CPM_PACKAGE_wasm-tools_SOURCE_DIR})
6-
set(WASM_TOOLS_BIN ${WASM_TOOLS_DIR}/wasm-tools)
6+
set(WASM_TOOLS_BIN ${WASM_TOOLS_DIR}/wasm-tools CACHE FILEPATH "Path to wasm-tools binary")

cmake/wasmtime.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ set(WASMTIME_VERSION v29.0.0)
22
set(WASMTIME_URL https://github.com/bytecodealliance/wasmtime/releases/download/${WASMTIME_VERSION}/wasmtime-${WASMTIME_VERSION}-${HOST_ARCH}-${HOST_OS}.tar.xz)
33
CPMAddPackage(NAME wasmtime URL ${WASMTIME_URL} DOWNLOAD_ONLY TRUE)
44
set(WASMTIME_DIR ${CPM_PACKAGE_wasmtime_SOURCE_DIR})
5-
set(WASMTIME ${WASMTIME_DIR}/wasmtime)
5+
set(WASMTIME ${WASMTIME_DIR}/wasmtime CACHE FILEPATH "Path to wasmtime binary")

cmake/weval.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ set(WEVAL_VERSION v0.3.2)
33
set(WEVAL_URL https://github.com/bytecodealliance/weval/releases/download/${WEVAL_VERSION}/weval-${WEVAL_VERSION}-${HOST_ARCH}-${HOST_OS}.tar.xz)
44
CPMAddPackage(NAME weval URL ${WEVAL_URL} DOWNLOAD_ONLY TRUE)
55
set(WEVAL_DIR ${CPM_PACKAGE_weval_SOURCE_DIR})
6-
set(WEVAL_BIN ${WEVAL_DIR}/weval)
6+
set(WEVAL_BIN ${WEVAL_DIR}/weval CACHE FILEPATH "Path to weval binary")

cmake/wizer.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ set(WIZER_VERSION v3.0.1 CACHE STRING "Version of wizer to use")
33
set(WIZER_URL https://github.com/bytecodealliance/wizer/releases/download/${WIZER_VERSION}/wizer-${WIZER_VERSION}-${HOST_ARCH}-${HOST_OS}.tar.xz)
44
CPMAddPackage(NAME wizer URL ${WIZER_URL} DOWNLOAD_ONLY TRUE)
55
set(WIZER_DIR ${CPM_PACKAGE_wizer_SOURCE_DIR})
6+
set(WIZER_BIN ${WIZER_DIR}/wizer CACHE FILEPATH "Path to wizer binary")

0 commit comments

Comments
 (0)