Skip to content

Commit 6f8e666

Browse files
wasi toolchain cmake
1 parent 3eda5ee commit 6f8e666

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

wasibuild/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ Makefile
99
*.a
1010
tests
1111
wasi-sdk*
12+
!wasi_toolchain.cmake
13+
CopyOfCMakeCache.txt

wasibuild/build.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@ if [ "$1" == "Release" ]; then
77
EXTRA_CMAKE_C_FLAGS="-Oz"
88
fi
99

10-
cmake -D CMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_FLAGS="--target=wasm32-wasi --sysroot=wasi-sdk-20.0/share/wasi-sysroot $EXTRA_CMAKE_C_FLAGS" -DREGEX_BACKEND=regcomp -DSONAME=OFF -DUSE_HTTPS=OpenSSL -DBUILD_SHARED_LIBS=OFF -DTHREADSAFE=OFF -DUSE_SSH=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=ON ../libgit2
10+
cmake -DCMAKE_TOOLCHAIN_FILE=`pwd`/wasi_toolchain.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_FLAGS="$EXTRA_CMAKE_C_FLAGS" -DREGEX_BACKEND=regcomp -DSONAME=OFF -DUSE_HTTPS=OFF -DBUILD_SHARED_LIBS=OFF -DUSE_THREADS=OFF -DUSE_SSH=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=ON ../libgit2
1111
make lg2 VERBOSE=1
12-
13-
14-
cd /workspaces/wasm-git/wasibuild/src/util && /usr/bin/clang -DOPENSSL_API_COMPAT=0x10100000L -DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\" -DSHA1DC_NO_STANDARD_INCLUDES=1 -I/workspaces/wasm-git/wasibuild/src/util -I/workspaces/wasm-git/wasibuild/include -I/workspaces/wasm-git/libgit2/src/util -I/workspaces/wasm-git/libgit2/include -I/workspaces/wasm-git/libgit2/deps/http-parser -I/workspaces/wasm-git/libgit2/deps/xdiff -I/workspaces/wasm-git/libgit2/deps/ntlmclient -D_GNU_SOURCE -Wall -Wextra -Wdocumentation -Wno-documentation-deprecated-sync -Wno-missing-field-initializers -Wmissing-declarations -Wstrict-aliasing -Wstrict-prototypes -Wdeclaration-after-statement -Wshift-count-overflow -Wunused-const-variable -Wunused-function -Wint-conversion -Wc11-extensions -Wformat -Wformat-security -g -D_DEBUG -O0 -std=gnu90 -o CMakeFiles/util.dir/alloc.c.o -c /workspaces/wasm-git/libgit2/src/util/alloc.c

wasibuild/wasi_toolchain.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SET(CMAKE_C_COMPILER clang)
2+
SET(CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR}/wasi-sdk-20.0/share/wasi-sysroot/)
3+
SET(CMAKE_SYSROOT ${CMAKE_CURRENT_LIST_DIR}/wasi-sdk-20.0/share/wasi-sysroot/)
4+
set(CMAKE_C_FLAGS "--target=wasm32-wasi -D_WASI_EMULATED_MMAN -lwasi-emulated-mman ${CMAKE_C_FLAGS}")
5+
6+
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_SYSROOT}/include")
7+
8+
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
9+
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
10+
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

0 commit comments

Comments
 (0)