Skip to content

Commit 8cbf486

Browse files
lostmanrossberg
authored andcommitted
Update CMake files (#11)
1 parent c0dc258 commit 8cbf486

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

example/CMakeLists.txt

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
1+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
22

3-
add_executable (hello hello.c)
4-
target_include_directories(hello PRIVATE ${V8_INCLUDE})
5-
target_link_libraries (hello ${V8_LIBS} wasm_v8 pthread)
63
configure_file(${V8V8}/out.gn/x64.release/natives_blob.bin
74
${CMAKE_CURRENT_BINARY_DIR}/natives_blob.bin
85
COPYONLY)
96
configure_file(${V8V8}/out.gn/x64.release/snapshot_blob.bin
107
${CMAKE_CURRENT_BINARY_DIR}/snapshot_blob.bin
118
COPYONLY)
9+
10+
function(example name source)
11+
add_executable (${name} ${source})
12+
target_include_directories(${name} PRIVATE ${V8_INCLUDE})
13+
target_link_libraries (${name} ${V8_LIBS} wasm_v8 pthread)
14+
endfunction(example)
15+
16+
example(callback callback.c)
17+
example(hello hello.c)
18+
example(trap trap.c)
19+
20+
example(callback_cpp callback.cc)
21+
example(hello_cpp hello.cc)
22+
example(trap_cpp trap.cc)

include/wasm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ own wasm_store_t* wasm_store_new(wasm_engine_t*);
145145
///////////////////////////////////////////////////////////////////////////////
146146
// Type Representations
147147

148-
// Tyoe atributes
148+
// Type attributes
149149

150150
typedef enum wasm_mutability_t {
151151
WASM_CONST,

src/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
1+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fPIC")
22

3-
add_library(wasm_v8 STATIC wasm-v8-lowlevel.cc wasm-bin.cc wasm-v8.cc wasm-bin.hh wasm-v8-lowlevel.hh)
3+
add_library(wasm_v8 SHARED wasm-bin.cc wasm-c.cc wasm-v8.cc wasm-bin.hh)
44
target_include_directories(wasm_v8 PRIVATE ${V8_INCLUDE} ${V8V8}/out.gn/x64.release/gen ${V8V8}/src)
55
target_link_libraries (wasm_v8 ${V8_LIBS})

0 commit comments

Comments
 (0)