Commit ea02a066 authored by nagayama15's avatar nagayama15

Fix cmake.

parent 7df9d048
......@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0.0)
project(wasm-watermarker VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_FLAGS "-std=c++2a -Wall -Wextra -Werror -pedantic -fconcepts")
set(CMAKE_CXX_FLAGS "-std=c++17 -Wall -Wextra -Werror -pedantic -fconcepts")
set(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0 -pg")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -march=native")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g3 -Og -pg")
......
......@@ -4,18 +4,27 @@ ExternalProject_Add(
PREFIX binaryen
INSTALL_COMMAND ""
TEST_COMMAND ""
LOG_DOWNLOAD ON
CMAKE_ARGS -DBUILD_STATIC_LIB=1
CMAKE_ARGS
-DBUILD_STATIC_LIB=ON
-DCMAKE_BUILD_TYPE=Release
)
ExternalProject_Get_Property(binaryen source_dir)
ExternalProject_Get_Property(binaryen binary_dir)
add_library(binaryen_wasm STATIC IMPORTED)
add_dependencies(binaryen_wasm binaryen)
file(MAKE_DIRECTORY ${source_dir}/src)
set_target_properties(binaryen_wasm
add_library(libbinaryen STATIC IMPORTED)
add_dependencies(libbinaryen binaryen)
set_target_properties(libbinaryen
PROPERTIES
IMPORTED_LOCATION ${binary_dir}/lib/libwasm.a
IMPORTED_LOCATION ${binary_dir}/lib/libbinaryen.a
INTERFACE_INCLUDE_DIRECTORIES ${source_dir}/src
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libwasm.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libir.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libcfg.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libpasses.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libsupport.a
INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/libasmjs.a
)
......@@ -3,5 +3,5 @@ add_executable(kyut
)
target_link_libraries(kyut
binaryen_wasm
libbinaryen
)
#include <iostream>
#include <wasm-io.h>
int main(int argc, char *argv[]) {
try {
for (int i = 0; i < argc; i++) {
std::cout << argv[i] << std::endl;
if (argc != 3) {
std::cerr << "WebAssembly digital watermarker." << std::endl;
std::cerr << "usage: kyut <input file> <watermark>" << std::endl;
return 1;
}
wasm::Module module;
wasm::ModuleReader{}.readBinary(argv[1], module);
} catch (const std::exception &e) {
std::cerr << e.what() << '\n';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment