Commit 5baa09bc authored by nagayama15's avatar nagayama15

add: Add the entry point

parent 986d23dd
cmake_minimum_required(VERSION 3.0.0)
project(wasm-watermarker VERSION 0.1.0 LANGUAGES C CXX)
set(CMAKE_CXX_FLAGS "-std=c++17 -Wall -Wextra -Werror -pedantic")
set(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -Og")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif (NOT CMAKE_BUILD_TYPE)
find_package(Threads REQUIRED)
find_package(Boost REQUIRED)
include(ExternalProject)
include(cmake/binaryen.cmake)
include(cmake/fmt.cmake)
include_directories(
${Boost_INCLUDE_DIR}
src
)
add_subdirectory(src)
......@@ -10,7 +10,7 @@ OS: Ubuntu 18.04
Compilers: GCC, Clang, emcc
Libraries: Binaryen 1.38.30
Libraries: Boost, Binaryen 1.38.30
## 命名規約
......
ExternalProject_Add(
binaryen
URL https://github.com/WebAssembly/binaryen/archive/1.38.32.tar.gz
PREFIX binaryen
INSTALL_COMMAND ""
TEST_COMMAND ""
CMAKE_ARGS
-DBUILD_STATIC_LIB=ON
-DCMAKE_BUILD_TYPE=Release
)
ExternalProject_Get_Property(binaryen source_dir)
ExternalProject_Get_Property(binaryen binary_dir)
file(MAKE_DIRECTORY ${source_dir}/src)
add_library(binaryen::binaryen STATIC IMPORTED)
add_dependencies(binaryen::binaryen binaryen)
set(binaryen_LIBS
${binary_dir}/lib/libwasm.a
${binary_dir}/lib/libasmjs.a
${binary_dir}/lib/libpasses.a
${binary_dir}/lib/libcfg.a
${binary_dir}/lib/libir.a
${binary_dir}/lib/libemscripten-optimizer.a
${binary_dir}/lib/libsupport.a
${binary_dir}/lib/libwasm.a
Threads::Threads
)
set_target_properties(binaryen::binaryen
PROPERTIES
IMPORTED_LOCATION ${binary_dir}/lib/libpasses.a
INTERFACE_INCLUDE_DIRECTORIES ${source_dir}/src
INTERFACE_LINK_LIBRARIES "${binaryen_LIBS}"
)
ExternalProject_Add(
fmt
URL https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz
PREFIX fmt
INSTALL_COMMAND ""
TEST_COMMAND ""
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DFMT_DOC=OFF
-DFMT_TEST=OFF
)
ExternalProject_Get_Property(fmt source_dir)
ExternalProject_Get_Property(fmt binary_dir)
file(MAKE_DIRECTORY ${source_dir}/include)
add_library(fmt::fmt STATIC IMPORTED)
add_dependencies(fmt::fmt fmt)
set_target_properties(fmt::fmt
PROPERTIES
IMPORTED_LOCATION ${binary_dir}/libfmt.a
INTERFACE_INCLUDE_DIRECTORIES ${source_dir}/include
)
# add_library(kthr
# )
# target_link_libraries(kthr
# binaryen::binaryen
# fmt::fmt
# )
add_executable(kyut
kyut.cpp
)
target_link_libraries(kyut
fmt::fmt
)
#include <fmt/printf.h>
int main() {
fmt::print("Hello, {}\n", "kyut");
}
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