forked from Samsung/walrus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update to use v0.0.21 uvwasi instead of dangling commit * revise cmake build for WASI Signed-off-by: HyukWoo Park <[email protected]>
- Loading branch information
1 parent
bc7b090
commit a7c581f
Showing
7 changed files
with
113 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Submodule uvwasi
deleted from
de39e5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
cmake_minimum_required(VERSION 3.11) | ||
project ( | ||
uvwasi | ||
DESCRIPTION "WASI syscall API built atop libuv" | ||
VERSION 0.0.21 | ||
LANGUAGES C | ||
) | ||
|
||
set(UVWASI_DIR ${PROJECT_SOURCE_DIR}/uvwasi) | ||
|
||
# Point CMake at any custom modules we may ship | ||
list(APPEND CMAKE_MODULE_PATH "${UVWASI_DIR}/cmake") | ||
|
||
# This can be a commit hash or tag | ||
set(LIBUV_VERSION v1.44.2) | ||
|
||
include(CMakeDependentOption) | ||
cmake_dependent_option(UVWASI_BUILD_TESTS | ||
"Build the unit tests when uvwasi is the root project" ON | ||
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF) | ||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out) | ||
|
||
if (UVWASI_BUILD_X86) | ||
# set x86 build flag | ||
set (CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -m32) | ||
endif() | ||
|
||
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU") | ||
list(APPEND uvwasi_cflags -fvisibility=hidden --std=gnu89) | ||
list(APPEND uvwasi_cflags -Wall -Wsign-compare -Wextra -Wstrict-prototypes) | ||
list(APPEND uvwasi_cflags -Wno-unused-parameter) | ||
endif() | ||
|
||
if(APPLE) | ||
set(CMAKE_MACOSX_RPATH ON) | ||
endif() | ||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
list(APPEND uvwasi_defines _GNU_SOURCE _POSIX_C_SOURCE=200112) | ||
endif() | ||
|
||
#find_package(LIBUV QUIET) | ||
#if(LIBUV_FOUND) | ||
# include_directories(${LIBUV_INCLUDE_DIR}) | ||
#else() | ||
include(FetchContent) | ||
## https://libuv.org | ||
FetchContent_Declare( | ||
libuv | ||
GIT_REPOSITORY https://github.com/libuv/libuv.git | ||
GIT_TAG ${LIBUV_VERSION}) | ||
|
||
FetchContent_GetProperties(libuv) | ||
if(NOT libuv_POPULATED) | ||
FetchContent_Populate(libuv) | ||
include_directories("${libuv_SOURCE_DIR}/include") | ||
add_subdirectory(${libuv_SOURCE_DIR} ${libuv_BINARY_DIR} EXCLUDE_FROM_ALL) | ||
endif() | ||
set(LIBUV_INCLUDE_DIR ${libuv_SOURCE_DIR}/include) | ||
set(LIBUV_LIBRARIES uv_a) | ||
#endif() | ||
|
||
## uvwasi source code files. | ||
set(uvwasi_sources | ||
${UVWASI_DIR}/src/clocks.c | ||
${UVWASI_DIR}/src/fd_table.c | ||
${UVWASI_DIR}/src/path_resolver.c | ||
${UVWASI_DIR}/src/poll_oneoff.c | ||
${UVWASI_DIR}/src/sync_helpers.c | ||
${UVWASI_DIR}/src/uv_mapping.c | ||
${UVWASI_DIR}/src/uvwasi.c | ||
${UVWASI_DIR}/src/wasi_rights.c | ||
${UVWASI_DIR}/src/wasi_serdes.c | ||
) | ||
|
||
# ASAN Support | ||
option(ASAN "Enable code asan" OFF) | ||
if(ASAN AND CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang") | ||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") | ||
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") | ||
endif() | ||
|
||
## Static library target. | ||
add_library(uvwasi_a STATIC ${uvwasi_sources}) | ||
target_compile_definitions(uvwasi_a PRIVATE ${uvwasi_defines}) | ||
target_compile_options(uvwasi_a PRIVATE ${uvwasi_cflags}) | ||
target_include_directories(uvwasi_a PUBLIC ${UVWASI_DIR}/include ${LIBUV_INCLUDE_DIR}) | ||
target_link_libraries(uvwasi_a PRIVATE ${LIBUV_LIBRARIES}) | ||
|
||
message(STATUS "summary of uvwasi build options: | ||
Install prefix: ${CMAKE_INSTALL_PREFIX} | ||
Target system: ${CMAKE_SYSTEM_NAME} | ||
Compiler: | ||
C compiler: ${CMAKE_C_COMPILER} | ||
CFLAGS: ${CMAKE_C_FLAGS_${_build_type}} ${CMAKE_C_FLAGS} | ||
LibUV libraries: ${LIBUV_LIBRARIES} | ||
LibUV includes: ${LIBUV_INCLUDE_DIR} | ||
Debug logging: ${UVWASI_DEBUG_LOG} | ||
Code coverage: ${CODE_COVERAGE} | ||
ASAN: ${ASAN} | ||
Build tests: ${UVWASI_BUILD_TESTS} | ||
") |