forked from wasmerio/wasmer-c-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
26 lines (22 loc) · 1.01 KB
/
CMakeLists.txt
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
cmake_minimum_required (VERSION 2.6)
project (WasmerCApiExample)
add_executable(wasmer-c-api-example wasmer-c-api-example.c)
include(ExternalProject)
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/rust-build)
ExternalProject_Add(
wasmer-runtime-c-api
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build
GIT_REPOSITORY https://github.com/wasmerio/wasmer.git
GIT_TAG master
CONFIGURE_COMMAND ""
BUILD_COMMAND cargo build -p wasmer-runtime-c-api
COMMAND cargo build -p wasmer-runtime-c-api
BINARY_DIR "${CMAKE_SOURCE_DIR}/rust-build/src/wasmer-runtime-c-api/"
INSTALL_COMMAND ""
LOG_BUILD ON)
add_dependencies(wasmer-c-api-example wasmer-runtime-c-api)
set(WASMER_LIB "${CMAKE_SOURCE_DIR}/rust-build/src/wasmer-runtime-c-api/target/debug/libwasmer_runtime_c_api${CMAKE_SHARED_LIBRARY_SUFFIX}")
if(NOT WASMER_LIB)
message(FATAL_ERROR "wasmer library not found")
endif()
target_link_libraries(wasmer-c-api-example general ${WASMER_LIB})