Commit 9cf35632 authored by nagayama15's avatar nagayama15

📥 Add fmt

parent 93c8247b
......@@ -14,6 +14,7 @@ endif (NOT CMAKE_BUILD_TYPE)
include(ExternalProject)
include(cmake/binaryen.cmake)
include(cmake/fmt.cmake)
include_directories(
src
......
ExternalProject_Add(
fmt
URL https://github.com/fmtlib/fmt/archive/5.3.0.zip
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(libfmt STATIC IMPORTED)
add_dependencies(libfmt fmt)
set_target_properties(libfmt
PROPERTIES
IMPORTED_LOCATION ${binary_dir}/libfmt.a
INTERFACE_INCLUDE_DIRECTORIES ${source_dir}/include
)
......@@ -4,6 +4,7 @@ add_executable(kyut
target_link_libraries(kyut
libbinaryen
libfmt
)
if (WIN32)
......
#include <iostream>
#include <cstdio>
#include <fmt/format.h>
#include <wasm-io.h>
int main(int argc, char *argv[]) {
try {
if (argc != 3) {
std::cerr << "WebAssembly digital watermarker." << std::endl;
std::cerr << "usage: kyut <input file> <watermark>" << std::endl;
fmt::print(stderr,
"WebAssembly digital watermarker.\n"
"usage: kyut <input file> <watermark>\n");
return 1;
}
......@@ -14,7 +16,7 @@ int main(int argc, char *argv[]) {
wasm::Module module;
wasm::ModuleReader{}.readBinary(argv[1], module);
} catch (const std::exception &e) {
std::cerr << e.what() << '\n';
fmt::print(stderr, "error: {}\n", e.what());
return 1;
}
......
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