diff --git a/.circleci/script_desktop.sh b/.circleci/script_desktop.sh index e506b7fc..7165d67a 100644 --- a/.circleci/script_desktop.sh +++ b/.circleci/script_desktop.sh @@ -1,13 +1,13 @@ # run desktop builds -cmake . -DCMAKE_BUILD_TYPE=Coverage -DBUILD_TESTING=OFF +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Coverage -DBUILD_TESTING=OFF cmake --build . -# disable build examples until breaking changes are committed so the example can pull them in # build examples -#cd ./examples/cmake_example -#cmake . -#cmake --build . +cd ../examples/cmake_example +./build.sh # run Gtest -# cd ../../ +cd ../../build ./test/Ark-Cpp-Client-tests diff --git a/.gitignore b/.gitignore index 526301c0..800d0673 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /.history /.vs /bin +build /lib /_Base /CMakeFiles @@ -22,15 +23,11 @@ /test/.vscode /test/lib/readme.txt .DS_Store -/src/Ark-Cpp-Client-lib.dir -/src/CMakeFiles -/src/cmake_install.cmake /src/Ark-Cpp-Client-lib.vcxproj.filters /src/Ark-Cpp-Client-lib.vcxproj /src/Ark-Cpp-Client-lib.sln /src/ALL_BUILD.vcxproj.filters /src/ALL_BUILD.vcxproj -/test/Ark-Cpp-Client-tests.dir /Win32 /test/NightlyMemoryCheck.vcxproj.filters /test/NightlyMemoryCheck.vcxproj @@ -38,14 +35,8 @@ /test/Nightly.vcxproj /test/Experimental.vcxproj.filters /test/Experimental.vcxproj -/test/DartConfiguration.tcl -/test/CTestTestfile.cmake /test/Continuous.vcxproj.filters /test/Continuous.vcxproj -/test/cmake_install.cmake -/test/CMakeFiles/generate.stamp.depend -/test/CMakeFiles/generate.stamp -/test/CMakeFiles /test/Ark-Cpp-Client-tests.vcxproj.filters /test/Ark-Cpp-Client-tests.vcxproj /test/Ark-Cpp-Client-tests.sln @@ -54,31 +45,18 @@ /_3rdParty /ZERO_CHECK.vcxproj.filters /ZERO_CHECK.vcxproj -/cmake_install.cmake -/CMakeCache.txt /Ark-Cpp-Client.sln /ALL_BUILD.vcxproj.filters /ALL_BUILD.vcxproj /src/Win32 -/test/Debug -/src/Debug -/test/Release -/src/Release -/examples/cmake_example/CMakeFiles -/examples/cmake_example/CMakeCache.txt -/examples/cmake_example/Win32/ /examples/cmake_example/_3rdParty -/examples/cmake_example/lib/Debug /examples/cmake_example/bin -/examples/cmake_example/Cpp-Client-Example.dir /examples/cmake_example/ZERO_CHECK.vcxproj.filters /examples/cmake_example/ZERO_CHECK.vcxproj /examples/cmake_example/Cpp-Client-Example.vcxproj.filters /examples/cmake_example/Cpp-Client-Example.vcxproj /examples/cmake_example/Cpp-Client-Example.sln -/examples/cmake_example/cmake_install.cmake /examples/cmake_example/ALL_BUILD.vcxproj.filters /examples/cmake_example/ALL_BUILD.vcxproj /examples/cmake_example/Win32 -/examples/cmake_example/Debug compile_commands.json diff --git a/build.cmd b/build.cmd new file mode 100644 index 00000000..c11f29f2 --- /dev/null +++ b/build.cmd @@ -0,0 +1,6 @@ +rmdir /S /Q build +mkdir build +cd build +cmake .. +cmake --build . +cd .. diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..a29521ca --- /dev/null +++ b/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +rm -dfr build +mkdir build +cd build +cmake .. +cmake --build . diff --git a/docs/INSTALL_OS.md b/docs/INSTALL_OS.md index 73ba248c..56f2a2bd 100644 --- a/docs/INSTALL_OS.md +++ b/docs/INSTALL_OS.md @@ -17,9 +17,15 @@ or using # ### make and build -**`cd` into `.../cpp-client/`** -then run the following command combo: -`cmake . && cmake --build .` +**For Linux/Mac** +> `./build.sh` + +**For Windows** +> `./build.cmd` ### run tests -`./bin/Ark-Cpp-Client-tests` +**For Linux/Mac** +> `./run_tests.sh` + +**For Windows** +> `./run_tests.cmd` diff --git a/examples/cmake_example/.gitmodules b/examples/cmake_example/.gitmodules deleted file mode 100644 index 458f10ec..00000000 --- a/examples/cmake_example/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "lib/cpp-client"] - path = lib/cpp-client - url = https://github.com/ArkEcosystem/cpp-client.git diff --git a/examples/cmake_example/CMakeLists.txt b/examples/cmake_example/CMakeLists.txt index b549ccc2..d9fafffd 100644 --- a/examples/cmake_example/CMakeLists.txt +++ b/examples/cmake_example/CMakeLists.txt @@ -1,12 +1,10 @@ cmake_minimum_required(VERSION 3.2) -# clone submodules -execute_process( - COMMAND git submodule update --init --recursive - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -) - -add_subdirectory(lib/cpp-client) +# clone submodules - Uncomment when used outside of the Ark cpp-crypto source tree +#execute_process( +# COMMAND git submodule update --init --recursive +# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} +#) project(Cpp-Client-Example) @@ -25,6 +23,8 @@ if (MSVC) #set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") endif() +add_subdirectory(lib/cpp-client/src) + set(SOURCE_FILES main.cpp) add_executable(${PROJECT_NAME} ${SOURCE_FILES}) diff --git a/examples/cmake_example/build.cmd b/examples/cmake_example/build.cmd new file mode 100644 index 00000000..1224556a --- /dev/null +++ b/examples/cmake_example/build.cmd @@ -0,0 +1,12 @@ +rmdir /S /Q build +mkdir build +cd build + +REM Mimic submodule process by copying cpp-client src into the expected directory +REM git doesn't like nested .gitmodule files +rmdir /S /Q ..\lib\cpp-client\ +mkdir ..\lib\cpp-client\ +xcopy /E /Y /H /R ..\..\..\src ..\lib\cpp-client\ + +cmake .. +cmake --build . diff --git a/examples/cmake_example/build.sh b/examples/cmake_example/build.sh new file mode 100755 index 00000000..5af1675c --- /dev/null +++ b/examples/cmake_example/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +rm -dfr build +mkdir build +cd build + +# Mimic submodule process by copying cpp-client src into the expected directory +# git doesn't like nested .gitmodule files +rm -dfr ../lib/cpp-client/ +mkdir ../lib/cpp-client/ +cp -R ../../../src ../lib/cpp-client/ + +cmake .. +cmake --build . diff --git a/examples/cmake_example/lib/put-cpp-client-folder-here b/examples/cmake_example/lib/submodule-cpp-client-folder-here similarity index 100% rename from examples/cmake_example/lib/put-cpp-client-folder-here rename to examples/cmake_example/lib/submodule-cpp-client-folder-here diff --git a/examples/cmake_example/main.cpp b/examples/cmake_example/main.cpp index c9879500..0470200f 100644 --- a/examples/cmake_example/main.cpp +++ b/examples/cmake_example/main.cpp @@ -37,8 +37,10 @@ int main(int argc, char* argv[]) { // NOLINT std::cout << "Response for votes 'a3b890d25824eba36dfc2a5956590c68101378211dab216ae92c123ab1ba4b67':\n"; std::cout << vote << "\n\n"; - const auto walletsSearch = connection.api.wallets.search( - {"username", "genesis_1"}); + const std::map body_parameters = { + {"username", "genesis_1"} + }; + const auto walletsSearch = connection.api.wallets.search(body_parameters); std::cout << "Response for wallet search 'username=genesis_1':\n"; std::cout << walletsSearch << std::endl; diff --git a/run_tests.cmd b/run_tests.cmd new file mode 100644 index 00000000..3d388d7c --- /dev/null +++ b/run_tests.cmd @@ -0,0 +1,2 @@ +call build.cmd +.\build\test\Debug\Ark-Cpp-Client-tests diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 00000000..3a07c1c9 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +./build.sh +chmod +x ./build/test/Ark-Cpp-Client-tests +./build/test/Ark-Cpp-Client-tests