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
9266d5db
Verified
Commit
9266d5db
authored
Oct 03, 2020
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: import tanakh/cmdline
parent
fc366fb6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
4 deletions
+130
-4
CMakeLists.txt
CMakeLists.txt
+1
-0
cmdline.cmake
cmake/cmdline.cmake
+26
-0
CMakeLists.txt
src/CMakeLists.txt
+17
-1
pisn.cpp
src/pisn.cpp
+43
-0
snpi.cpp
src/snpi.cpp
+43
-3
No files found.
CMakeLists.txt
View file @
9266d5db
...
@@ -22,6 +22,7 @@ find_package(Threads)
...
@@ -22,6 +22,7 @@ find_package(Threads)
include
(
ExternalProject
)
include
(
ExternalProject
)
include
(
cmake/boost.cmake
)
include
(
cmake/boost.cmake
)
include
(
cmake/binaryen.cmake
)
include
(
cmake/binaryen.cmake
)
include
(
cmake/cmdline.cmake
)
include
(
cmake/fmt.cmake
)
include
(
cmake/fmt.cmake
)
include
(
cmake/googletest.cmake
)
include
(
cmake/googletest.cmake
)
...
...
cmake/cmdline.cmake
0 → 100644
View file @
9266d5db
ExternalProject_Add
(
cmdline
GIT_REPOSITORY
"https://github.com/tanakh/cmdline.git"
GIT_TAG
"master"
PREFIX
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmdline"
SOURCE_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmdline/src"
BINARY_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmdline/build"
STAMP_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmdline/stamp"
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
UPDATE_COMMAND
""
INSTALL_COMMAND
""
TEST_COMMAND
""
)
ExternalProject_Get_Property
(
cmdline source_dir
)
ExternalProject_Get_Property
(
cmdline binary_dir
)
add_library
(
cmdline::cmdline INTERFACE IMPORTED
)
make_directory
(
"
${
source_dir
}
"
)
# To suppress non-exist directory warnings
target_include_directories
(
cmdline::cmdline INTERFACE
"
${
source_dir
}
"
)
add_dependencies
(
cmdline::cmdline cmdline
)
src/CMakeLists.txt
View file @
9266d5db
add_executable
(
snpi snpi.cpp
)
add_executable
(
snpi
snpi.cpp
)
target_link_libraries
(
snpi
cmdline::cmdline
fmtlib::fmt
)
add_executable
(
pisn
pisn.cpp
)
target_link_libraries
(
pisn
cmdline::cmdline
fmtlib::fmt
)
src/pisn.cpp
0 → 100644
View file @
9266d5db
#include <fmt/printf.h>
#include "cmdline.h"
namespace
{
const
std
::
string
program_name
=
"pisn"
;
const
std
::
string
version
=
"0.1.0"
;
}
// namespace
int
main
(
int
argc
,
char
*
argv
[])
{
cmdline
::
parser
options
{};
options
.
add
(
"help"
,
'h'
,
"Print help message"
);
options
.
add
(
"version"
,
'v'
,
"Print version"
);
options
.
add
<
std
::
string
>
(
"method"
,
'm'
,
"Embedding method (function-ordering)"
,
true
,
""
,
cmdline
::
oneof
<
std
::
string
>
(
"function-ordering"
));
options
.
add
<
std
::
size_t
>
(
"chunk-size"
,
'c'
,
"Chunk size [2~20]"
,
false
,
20
,
cmdline
::
range
<
std
::
size_t
>
(
2
,
20
));
options
.
set_program_name
(
program_name
);
options
.
footer
(
"filename"
);
// Parse command line arguments.
// Exit the program if help flag is specified or arguments are invalid.
options
.
parse_check
(
argc
,
argv
);
if
(
options
.
exist
(
"version"
))
{
// Show the program version.
fmt
::
print
(
"{} v{}
\n
"
,
program_name
,
version
);
std
::
exit
(
EXIT_SUCCESS
);
}
if
(
options
.
rest
().
empty
())
{
// No input file specified.
fmt
::
print
(
std
::
cerr
,
"no input file
\n
"
);
fmt
::
print
(
std
::
cerr
,
"{}"
,
options
.
usage
());
std
::
exit
(
EXIT_FAILURE
);
}
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"
);
(
void
)
chunk_size
;
}
src/snpi.cpp
View file @
9266d5db
#include <iostream>
#include <fmt/printf.h>
#include "cmdline.h"
int
main
([[
maybe_unused
]]
int
argc
,
[[
maybe_unused
]]
char
*
argv
[])
{
namespace
{
std
::
cout
<<
"snpi"
<<
std
::
endl
;
const
std
::
string
program_name
=
"snpi"
;
const
std
::
string
version
=
"0.1.0"
;
}
// namespace
int
main
(
int
argc
,
char
*
argv
[])
{
cmdline
::
parser
options
{};
options
.
add
(
"help"
,
'h'
,
"Print help message"
);
options
.
add
(
"version"
,
'v'
,
"Print version"
);
options
.
add
<
std
::
string
>
(
"output"
,
'o'
,
"Output filename"
,
true
);
options
.
add
<
std
::
string
>
(
"method"
,
'm'
,
"Embedding method (function-ordering)"
,
true
,
""
,
cmdline
::
oneof
<
std
::
string
>
(
"function-ordering"
));
options
.
add
<
std
::
size_t
>
(
"chunk-size"
,
'c'
,
"Chunk size [2~20]"
,
false
,
20
,
cmdline
::
range
<
std
::
size_t
>
(
2
,
20
));
options
.
set_program_name
(
program_name
);
options
.
footer
(
"filename"
);
// Parse command line arguments.
// Exit the program if help flag is specified or arguments are invalid.
options
.
parse_check
(
argc
,
argv
);
if
(
options
.
exist
(
"version"
))
{
// Show the program version.
fmt
::
print
(
"{} v{}
\n
"
,
program_name
,
version
);
std
::
exit
(
EXIT_SUCCESS
);
}
if
(
options
.
rest
().
empty
())
{
// No input file specified.
fmt
::
print
(
std
::
cerr
,
"no input file
\n
"
);
fmt
::
print
(
std
::
cerr
,
"{}"
,
options
.
usage
());
std
::
exit
(
EXIT_FAILURE
);
}
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"
);
(
void
)
chunk_size
;
}
}
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