-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
49 lines (37 loc) · 1.07 KB
/
Copy pathCMakeLists.txt
File metadata and controls
49 lines (37 loc) · 1.07 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
cmake_minimum_required(VERSION 3.8)
# https://lld.llvm.org/WebAssembly.html
# Give the project a name
project(wasm-example)
# Use CMake build FetchContent
include(FetchContent)
# Report the version of CMake
message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
# Make FETCHCONTENT_QUIET false so it's verbose
Set(FETCHCONTENT_QUIET FALSE)
# The dependencies
FetchContent_Declare(
serverless-sdk
GIT_REPOSITORY https://github.com/edgeMicroservice/wasm-serverless-cpp-sdk.git
GIT_TAG v2.0.0
GIT_PROGRESS TRUE
)
# Make dependencies avaiable
FetchContent_MakeAvailable(serverless-sdk)
# Create the WASM binary
add_executable(${PROJECT_NAME})
#Set targets
target_sources(${PROJECT_NAME}
PRIVATE
${CMAKE_SOURCE_DIR}/src/main.cpp
)
# Disable C++ exceptions, and set the filename extension to .wasnm
set_target_properties(${PROJECT_NAME}
PROPERTIES COMPILE_FLAGS "-fno-exceptions"
SUFFIX ".wasm"
)
# Allow undefined
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--allow-undefined")
# Link to WASM server library
target_link_libraries(${PROJECT_NAME}
wasm-serverless
)