Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wasm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
wasm-watermarker
Commits
bdf62cf6
Verified
Commit
bdf62cf6
authored
Oct 03, 2020
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(cmd): read input wasm files
parent
9266d5db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
5 deletions
+27
-5
CMakeLists.txt
CMakeLists.txt
+1
-1
CMakeLists.txt
src/CMakeLists.txt
+2
-0
pisn.cpp
src/pisn.cpp
+12
-2
snpi.cpp
src/snpi.cpp
+12
-2
No files found.
CMakeLists.txt
View file @
bdf62cf6
cmake_minimum_required
(
VERSION 3.0.0
)
set
(
CMAKE_CXX_FLAGS
"-std=c++
2a
-Wall -Wextra -Werror -pedantic"
)
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
"-g3 -Og"
)
...
...
src/CMakeLists.txt
View file @
bdf62cf6
...
...
@@ -4,6 +4,7 @@ add_executable(snpi
target_link_libraries
(
snpi
cmdline::cmdline
binaryen::binaryen
fmtlib::fmt
)
...
...
@@ -13,5 +14,6 @@ add_executable(pisn
target_link_libraries
(
pisn
cmdline::cmdline
binaryen::binaryen
fmtlib::fmt
)
src/pisn.cpp
View file @
bdf62cf6
#include <fmt/printf.h>
#include "cmdline.h"
#include "wasm-io.h"
namespace
{
const
std
::
string
program_name
=
"pisn"
;
...
...
@@ -37,7 +38,16 @@ int main(int argc, char* argv[]) {
const
auto
input
=
options
.
rest
()[
0
];
const
auto
method
=
options
.
get
<
std
::
string
>
(
"method"
);
const
auto
chunk_size
=
options
.
get
<
std
::
size_t
>
(
"chunk-size"
);
[[
maybe_unused
]]
const
auto
chunk_size
=
options
.
get
<
std
::
size_t
>
(
"chunk-size"
);
(
void
)
chunk_size
;
try
{
wasm
::
Module
module
{};
wasm
::
ModuleReader
{}.
read
(
input
,
module
);
}
catch
(
const
std
::
exception
&
e
)
{
fmt
::
print
(
std
::
cerr
,
"error: {}
\n
"
,
e
.
what
());
std
::
exit
(
EXIT_FAILURE
);
}
catch
(
const
wasm
::
ParseException
&
e
)
{
e
.
dump
(
std
::
cerr
);
std
::
exit
(
EXIT_FAILURE
);
}
}
src/snpi.cpp
View file @
bdf62cf6
#include <fmt/printf.h>
#include "cmdline.h"
#include "wasm-io.h"
namespace
{
const
std
::
string
program_name
=
"snpi"
;
...
...
@@ -39,7 +40,16 @@ int main(int argc, char* argv[]) {
const
auto
input
=
options
.
rest
()[
0
];
const
auto
output
=
options
.
get
<
std
::
string
>
(
"output"
);
const
auto
method
=
options
.
get
<
std
::
string
>
(
"method"
);
const
auto
chunk_size
=
options
.
get
<
std
::
size_t
>
(
"chunk-size"
);
[[
maybe_unused
]]
const
auto
chunk_size
=
options
.
get
<
std
::
size_t
>
(
"chunk-size"
);
(
void
)
chunk_size
;
try
{
wasm
::
Module
module
{};
wasm
::
ModuleReader
{}.
read
(
input
,
module
);
}
catch
(
const
std
::
exception
&
e
)
{
fmt
::
print
(
std
::
cerr
,
"error: {}
\n
"
,
e
.
what
());
std
::
exit
(
EXIT_FAILURE
);
}
catch
(
const
wasm
::
ParseException
&
e
)
{
e
.
dump
(
std
::
cerr
);
std
::
exit
(
EXIT_FAILURE
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment