Skip to content

Commit

Permalink
Merge pull request AntelopeIO#1 from cipherbytes/gax/develop
Browse files Browse the repository at this point in the history
rename contract develop tools
  • Loading branch information
sirius4galaxy authored Sep 6, 2023
2 parents a346a75 + 429d0cb commit 5237ae5
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 102 deletions.
4 changes: 2 additions & 2 deletions examples/hello/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

- Additions to cmake should be done to the CMakeLists.txt in the './src' directory and not in the top level CMakeLists.txt

-- How to build with cdt-cpp --
-- How to build with gax-cpp --
- cd into the 'build' directory
- run the command 'cdt-cpp -abigen ../src/hello.cpp -o hello.wasm -I ../include/'
- run the command 'gax-cpp -abigen ../src/hello.cpp -o hello.wasm -I ../include/'

- After build -
- The built smart contract is in the 'build' directory
Expand Down
4 changes: 2 additions & 2 deletions examples/multi_index_example/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

- Additions to CMake should be done to the CMakeLists.txt in the './src' directory and not in the top level CMakeLists.txt

-- How to build with cdt-cpp --
-- How to build with gax-cpp --
- cd into the 'build' directory
- run the command 'cdt-cpp -abigen ../src/multi_index_example.cpp -o multi_index_example.wasm -I ../include/'
- run the command 'gax-cpp -abigen ../src/multi_index_example.cpp -o multi_index_example.wasm -I ../include/'

- After build -
- The built smart contract is in the 'build' directory
Expand Down
4 changes: 2 additions & 2 deletions examples/multi_index_large/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

- Additions to CMake should be done to the CMakeLists.txt in the './src' directory and not in the top level CMakeLists.txt

-- How to build with cdt-cpp --
-- How to build with gax-cpp --
- cd into the 'build' directory
- run the command 'cdt-cpp -abigen ../src/multi_index_large.cpp -o multi_index_large.wasm -I ../include/'
- run the command 'gax-cpp -abigen ../src/multi_index_large.cpp -o multi_index_large.wasm -I ../include/'

- After build -
- The built smart contract is in the 'build' directory
Expand Down
4 changes: 2 additions & 2 deletions examples/send_inline/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

- Additions to CMake should be done to the CMakeLists.txt in the './src' directory and not in the top level CMakeLists.txt

-- How to build with cdt-cpp --
-- How to build with gax-cpp --
- cd into the 'build' directory
- run the command 'cdt-cpp -abigen ../src/send_inline.cpp -o send_inline.wasm -I ../include/ -I ../../hello/include/'
- run the command 'gax-cpp -abigen ../src/send_inline.cpp -o send_inline.wasm -I ../include/ -I ../../hello/include/'

- After build -
- The built smart contract is in the 'build' directory
Expand Down
4 changes: 2 additions & 2 deletions examples/singleton_example/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

- Additions to CMake should be done to the CMakeLists.txt in the './src' directory and not in the top level CMakeLists.txt

-- How to build with cdt-cpp --
-- How to build with gax-cpp --
- cd into the 'build' directory
- run the command 'cdt-cpp -abigen ../src/singleton_example.cpp -o singleton_example.wasm -I ../include/'
- run the command 'gax-cpp -abigen ../src/singleton_example.cpp -o singleton_example.wasm -I ../include/'

- After build -
- The built smart contract is in the 'build' directory
Expand Down
8 changes: 4 additions & 4 deletions modules/CDTWasmToolchain.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ set(CMAKE_CXX_COMPILER_WORKS 1)
set(CDT_VERSION "@VERSION_FULL@")
set(WASMSDK_VERSION "@VERSION_FULL@")

set(CMAKE_C_COMPILER "@CDT_ROOT_DIR@/bin/cdt-cc")
set(CMAKE_CXX_COMPILER "@CDT_ROOT_DIR@/bin/cdt-cpp")
set(CMAKE_ASM_COMPILER "@CDT_ROOT_DIR@/bin/cdt-cc")
set(CMAKE_C_COMPILER "@CDT_ROOT_DIR@/bin/gax-cc")
set(CMAKE_CXX_COMPILER "@CDT_ROOT_DIR@/bin/gax-cpp")
set(CMAKE_ASM_COMPILER "@CDT_ROOT_DIR@/bin/gax-cc")

set(CMAKE_C_FLAGS "-O3")
set(CMAKE_CXX_FLAGS "-O3")
set(CMAKE_ASM_FLAGS "-fnative -fasm")

set(WASM_LINKER "@CDT_ROOT_DIR@/bin/cdt-ld")
set(WASM_LINKER "@CDT_ROOT_DIR@/bin/gax-ld")

set(CMAKE_C_LINK_EXECUTABLE "${WASM_LINKER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_LINK_EXECUTABLE "${WASM_LINKER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
Expand Down
30 changes: 15 additions & 15 deletions modules/InstallCDT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ macro( cdt_libraries_install)
endmacro( cdt_libraries_install )

cdt_clang_install_and_symlink(llvm-ranlib cdt-ranlib)
cdt_clang_install_and_symlink(llvm-ar cdt-ar)
cdt_clang_install_and_symlink(llvm-nm cdt-nm)
cdt_clang_install_and_symlink(llvm-objcopy cdt-objcopy)
cdt_clang_install_and_symlink(llvm-objdump cdt-objdump)
cdt_clang_install_and_symlink(llvm-readobj cdt-readobj)
cdt_clang_install_and_symlink(llvm-readelf cdt-readelf)
cdt_clang_install_and_symlink(llvm-strip cdt-strip)
cdt_clang_install_and_symlink(llvm-ar gax-ar)
cdt_clang_install_and_symlink(llvm-nm gax-nm)
cdt_clang_install_and_symlink(llvm-objcopy gax-objcopy)
cdt_clang_install_and_symlink(llvm-objdump gax-objdump)
cdt_clang_install_and_symlink(llvm-readobj gax-readobj)
cdt_clang_install_and_symlink(llvm-readelf gax-readelf)
cdt_clang_install_and_symlink(llvm-strip gax-strip)

cdt_clang_install(opt)
cdt_clang_install(llc)
Expand All @@ -66,14 +66,14 @@ cdt_clang_install(ld64.lld)
cdt_clang_install(clang-9)
cdt_clang_install(wasm-ld)

cdt_tool_install_and_symlink(eosio-pp cdt-pp)
cdt_tool_install_and_symlink(eosio-wast2wasm cdt-wast2wasm)
cdt_tool_install_and_symlink(eosio-wasm2wast cdt-wasm2wast)
cdt_tool_install_and_symlink(cdt-cc cdt-cc)
cdt_tool_install_and_symlink(cdt-cpp cdt-cpp)
cdt_tool_install_and_symlink(cdt-ld cdt-ld)
cdt_tool_install_and_symlink(cdt-abidiff cdt-abidiff)
cdt_tool_install_and_symlink(cdt-init cdt-init)
cdt_tool_install_and_symlink(gax-pp cdt-pp)
cdt_tool_install_and_symlink(gax-wast2wasm cdt-wast2wasm)
cdt_tool_install_and_symlink(gax-wasm2wast cdt-wasm2wast)
cdt_tool_install_and_symlink(gax-cc gax-cc)
cdt_tool_install_and_symlink(gax-cpp gax-cpp)
cdt_tool_install_and_symlink(gax-ld gax-ld)
cdt_tool_install_and_symlink(gax-abidiff gax-abidiff)
cdt_tool_install_and_symlink(gax-init gax-init)
cdt_tool_install_and_symlink(antler-proj antler-proj)

cdt_clang_install(../lib/LLVMEosioApply${CMAKE_SHARED_LIBRARY_SUFFIX})
Expand Down
34 changes: 17 additions & 17 deletions scripts/generate_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,23 @@ create_symlink() {
ln -sf ../${SUBPREFIX}/bin/$1 ${PREFIX}/bin/$2 || exit 1
}

create_symlink cdt-cc cdt-cc
create_symlink cdt-cpp cdt-cpp
create_symlink cdt-ld cdt-ld
create_symlink eosio-pp eosio-pp
create_symlink cdt-init cdt-init
create_symlink eosio-wasm2wast eosio-wasm2wast
create_symlink eosio-wast2wasm eosio-wast2wasm
create_symlink eosio-wasm2wast cdt-wasm2wast
create_symlink eosio-wast2wasm cdt-wast2wasm
create_symlink cdt-ar cdt-ar
create_symlink cdt-abidiff cdt-abidiff
create_symlink cdt-nm cdt-nm
create_symlink cdt-objcopy cdt-objcopy
create_symlink cdt-objdump cdt-objdump
create_symlink cdt-ranlib cdt-ranlib
create_symlink cdt-readelf cdt-readelf
create_symlink cdt-strip cdt-strip
create_symlink gax-cc gax-cc
create_symlink gax-cpp gax-cpp
create_symlink gax-ld gax-ld
create_symlink gax-pp gax-pp
create_symlink gax-init gax-init
create_symlink gax-wasm2wast gax-wasm2wast
create_symlink gax-wast2wasm gax-wast2wasm
create_symlink gax-wasm2wast cdt-wasm2wast
create_symlink gax-wast2wasm cdt-wast2wasm
create_symlink gax-ar gax-ar
create_symlink gax-abidiff gax-abidiff
create_symlink gax-nm gax-nm
create_symlink gax-objcopy gax-objcopy
create_symlink gax-objdump gax-objdump
create_symlink gax-ranlib gax-ranlib
create_symlink gax-readelf gax-readelf
create_symlink gax-strip gax-strip
create_symlink antler-proj antler-proj
create_symlink antler-proj cdt-proj

Expand Down
12 changes: 6 additions & 6 deletions tests/unit/version_tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -eo pipefail
# The purpose of this test is to ensure that the output of the "cdt-cpp --version" command matches the version string defined by our CMake files
echo '##### cdt-cpp Version Label Test #####'
# The purpose of this test is to ensure that the output of the "gax-cpp --version" command matches the version string defined by our CMake files
echo '##### gax-cpp Version Label Test #####'
# orient ourselves
[[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)"
echo "Using BUILD_ROOT=\"$BUILD_ROOT\"."
Expand All @@ -12,19 +12,19 @@ if [[ -z "$EXPECTED" ]]; then
else
export VERSION="$1"
fi
export EXPECTED="cdt-cpp version $VERSION"
export EXPECTED="gax-cpp version $VERSION"
fi
if [[ -z "$EXPECTED" ]]; then
echo "Missing version input."
exit 1
fi
echo "Expecting \"$EXPECTED\"..."
# get cdt-cpp version
ACTUAL=$($BUILD_ROOT/bin/cdt-cpp --version)
# get gax-cpp version
ACTUAL=$($BUILD_ROOT/bin/gax-cpp --version)
EXIT_CODE=$?
# verify 0 exit code explicitly
if [[ $EXIT_CODE -ne 0 ]]; then
echo "cdt-cpp produced non-zero exit code \"$EXIT_CODE\"."
echo "gax-cpp produced non-zero exit code \"$EXIT_CODE\"."
exit $EXIT_CODE
fi
# test version
Expand Down
6 changes: 3 additions & 3 deletions tools/abidiff/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cdt-abidiff.cpp.in ${CMAKE_BINARY_DIR}/cdt-abidiff.cpp)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cdt-abidiff.cpp.in ${CMAKE_BINARY_DIR}/gax-abidiff.cpp)

add_tool(cdt-abidiff)
add_tool(gax-abidiff)

set_target_properties(cdt-abidiff PROPERTIES LINK_FLAGS "-Wl,-rpath,\"\\$ORIGIN/../lib\"")
set_target_properties(gax-abidiff PROPERTIES LINK_FLAGS "-Wl,-rpath,\"\\$ORIGIN/../lib\"")
6 changes: 3 additions & 3 deletions tools/abidiff/cdt-abidiff.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ class abidiff {
int main(int argc, const char **argv) {

cl::SetVersionPrinter([](llvm::raw_ostream& os) {
os << "cdt-abidiff version " << "${VERSION_FULL}" << "\n";
os << "gax-abidiff version " << "${VERSION_FULL}" << "\n";
});
cl::OptionCategory cat("cdt-abidiff", "generates an abi from C++ project input");
cl::OptionCategory cat("gax-abidiff", "generates an abi from C++ project input");

cl::opt<std::string> input_filename1(
cl::Positional,
Expand All @@ -311,7 +311,7 @@ int main(int argc, const char **argv) {
cl::Required,
cl::cat(cat));

cl::ParseCommandLineOptions(argc, argv, std::string("cdt-abidiff"));
cl::ParseCommandLineOptions(argc, argv, std::string("gax-abidiff"));
try {
abidiff diff(input_filename1, input_filename2);
diff.diff();
Expand Down
12 changes: 6 additions & 6 deletions tools/cc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cdt-cc.cpp.in ${CMAKE_BINARY_DIR}/cdt-cc.cpp)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cdt-cc.cpp.in ${CMAKE_BINARY_DIR}/gax-cc.cpp)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cdt-cpp.cpp.in ${CMAKE_BINARY_DIR}/cdt-cpp.cpp)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cdt-cpp.cpp.in ${CMAKE_BINARY_DIR}/gax-cpp.cpp)

add_tool(cdt-cc)
add_tool(cdt-cpp)
add_tool(gax-cc)
add_tool(gax-cpp)

set_target_properties(cdt-cc PROPERTIES LINK_FLAGS "-Wl,-rpath,\"\\$ORIGIN/../lib\"")
set_target_properties(cdt-cpp PROPERTIES LINK_FLAGS "-Wl,-rpath,\"\\$ORIGIN/../lib\"")
set_target_properties(gax-cc PROPERTIES LINK_FLAGS "-Wl,-rpath,\"\\$ORIGIN/../lib\"")
set_target_properties(gax-cpp PROPERTIES LINK_FLAGS "-Wl,-rpath,\"\\$ORIGIN/../lib\"")
6 changes: 3 additions & 3 deletions tools/cc/cdt-cc.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using namespace clang::tooling;
using namespace llvm;

#define COMPILER_NAME "cdt-cc"
#define COMPILER_NAME "gax-cc"
#include <compiler_options.hpp>

int main(int argc, const char **argv) {
Expand All @@ -34,7 +34,7 @@ int main(int argc, const char **argv) {
Options opts = CreateOptions();

if (opts.abigen) {
llvm::outs() << "Warning, ABI generation is only available with cdt-abigen or cdt-cpp\n";
llvm::outs() << "Warning, ABI generation is only available with cdt-abigen or gax-cpp\n";
}

std::vector<std::string> outputs;
Expand Down Expand Up @@ -73,7 +73,7 @@ int main(int argc, const char **argv) {
for (auto input : outputs) {
new_opts.insert(new_opts.begin(), input);
}
if (!eosio::cdt::environment::exec_subprogram("cdt-ld", new_opts)) {
if (!eosio::cdt::environment::exec_subprogram("gax-ld", new_opts)) {
for (auto input : outputs) {
llvm::sys::fs::remove(input);
}
Expand Down
6 changes: 3 additions & 3 deletions tools/cc/cdt-cpp.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using namespace clang::tooling;
using namespace llvm;

#define CPP_COMP 1
#define COMPILER_NAME "cdt-cpp"
#define COMPILER_NAME "gax-cpp"
#include <compiler_options.hpp>

#include <set>
Expand All @@ -43,7 +43,7 @@ void handle_empty_abigen(const std::string& contract_name, bool has_o_opt, bool

void generate(const std::vector<std::string>& base_options, std::string input, std::string contract_name, const std::vector<std::string>& resource_paths, const std::pair<int, int>& abi_version, bool abigen, bool suppress_ricardian_warning, bool has_o_opt, bool has_contract_opt, bool warn_action_read_only) {
std::vector<std::string> options;
options.push_back("cdt-cpp");
options.push_back("gax-cpp");
options.push_back(input); // don't remove oddity of CommonOptionsParser?
options.push_back(input);
options.push_back("--");
Expand Down Expand Up @@ -187,7 +187,7 @@ int main(int argc, const char **argv) {
new_opts.insert(new_opts.begin(), input);
}

if (!eosio::cdt::environment::exec_subprogram("cdt-ld", new_opts)) {
if (!eosio::cdt::environment::exec_subprogram("gax-ld", new_opts)) {
for (auto input : outputs) {
llvm::sys::fs::remove(input);
}
Expand Down
24 changes: 12 additions & 12 deletions tools/external/wabt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -295,22 +295,22 @@ if (NOT EMSCRIPTEN)
DEPENDS ${name}
)
endfunction()
wabt_executable(eosio-pp src/tools/postpass.cc)
add_custom_command( TARGET eosio-pp POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
add_custom_command( TARGET eosio-pp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio-pp> ${CMAKE_BINARY_DIR}/bin/ )
wabt_executable(gax-pp src/tools/postpass.cc)
add_custom_command( TARGET gax-pp POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
add_custom_command( TARGET gax-pp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gax-pp> ${CMAKE_BINARY_DIR}/bin/ )

# wat2wasm
wabt_executable(eosio-wast2wasm src/tools/wat2wasm.cc)
add_custom_command( TARGET eosio-wast2wasm POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
add_custom_command( TARGET eosio-wast2wasm POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio-wast2wasm> ${CMAKE_BINARY_DIR}/bin/ )
wabt_executable(gax-wast2wasm src/tools/wat2wasm.cc)
add_custom_command( TARGET gax-wast2wasm POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
add_custom_command( TARGET gax-wast2wasm POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gax-wast2wasm> ${CMAKE_BINARY_DIR}/bin/ )

# wast2json
wabt_executable(wast2json src/tools/wast2json.cc)

# wasm2wat
wabt_executable(eosio-wasm2wast src/tools/wasm2wat.cc)
add_custom_command( TARGET eosio-wasm2wast POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
add_custom_command( TARGET eosio-wasm2wast POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio-wasm2wast> ${CMAKE_BINARY_DIR}/bin/ )
wabt_executable(gax-wasm2wast src/tools/wasm2wat.cc)
add_custom_command( TARGET gax-wasm2wast POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
add_custom_command( TARGET gax-wasm2wast POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gax-wasm2wast> ${CMAKE_BINARY_DIR}/bin/ )

# wasm2c
wabt_executable(wasm2c
Expand Down Expand Up @@ -401,9 +401,9 @@ if (NOT EMSCRIPTEN)

# install
#install(TARGETS ${WABT_EXECUTABLES} DESTINATION bin)
#install(TARGETS eosio-wast2wasm DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
#install(TARGETS eosio-wasm2wast DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
#install(TARGETS eosio-pp DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
#install(TARGETS gax-wast2wasm DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
#install(TARGETS gax-wasm2wast DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
#install(TARGETS gax-pp DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})

else ()
# emscripten stuff
Expand Down
2 changes: 1 addition & 1 deletion tools/external/wabt/src/tools/postpass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static std::unique_ptr<FileStream> s_log_stream;
static const char s_description[] =
R"( Read a file in the WebAssembly binary format, strip bss or any data segment that is only initialized to zeros, and other post processing.
$ eosio-pp test.wasm -o test.stripped.wasm
$ gax-pp test.wasm -o test.stripped.wasm
# or original replacement
$ wasm2wat test.wasm
Expand Down
6 changes: 3 additions & 3 deletions tools/include/compiler_options.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ static cl::opt<std::string> imports_opt(
cl::Hidden,
cl::cat(LD_CAT));
static cl::opt<std::string> pp_path_opt(
"eosio-pp-dir",
cl::desc("Set the directory for eosio-pp"),
"gax-pp-dir",
cl::desc("Set the directory for gax-pp"),
cl::Hidden,
cl::cat(LD_CAT));
static cl::opt<bool> use_rt_opt(
Expand Down Expand Up @@ -392,7 +392,7 @@ struct Options {
bool abigen;
bool suppress_ricardian_warning;
bool pp_only;
std::string eosio_pp_dir;
std::string gax_pp_dir;
std::string abigen_output;
std::string abigen_contract;
std::vector<std::string> comp_options;
Expand Down
6 changes: 3 additions & 3 deletions tools/init/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cdt-init.cpp ${CMAKE_BINARY_DIR}/cdt-init.cpp @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cdt-init.cpp ${CMAKE_BINARY_DIR}/gax-init.cpp @ONLY)

add_tool(cdt-init)
add_tool(gax-init)

set_target_properties(cdt-init PROPERTIES LINK_FLAGS "-Wl,-rpath,\"\\$ORIGIN/../lib\"")
set_target_properties(gax-init PROPERTIES LINK_FLAGS "-Wl,-rpath,\"\\$ORIGIN/../lib\"")
Loading

0 comments on commit 5237ae5

Please sign in to comment.