Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update build to be out of source #115

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .circleci/script_desktop.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 1 addition & 23 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.history
/.vs
/bin
build
/lib
/_Base
/CMakeFiles
Expand All @@ -22,30 +23,20 @@
/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
/test/Nightly.vcxproj.filters
/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
Expand All @@ -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
6 changes: 6 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rmdir /S /Q build
mkdir build
cd build
cmake ..
cmake --build .
cd ..
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

rm -dfr build
mkdir build
cd build
cmake ..
cmake --build .
14 changes: 10 additions & 4 deletions docs/INSTALL_OS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
3 changes: 0 additions & 3 deletions examples/cmake_example/.gitmodules

This file was deleted.

14 changes: 7 additions & 7 deletions examples/cmake_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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})
Expand Down
12 changes: 12 additions & 0 deletions examples/cmake_example/build.cmd
Original file line number Diff line number Diff line change
@@ -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 .
14 changes: 14 additions & 0 deletions examples/cmake_example/build.sh
Original file line number Diff line number Diff line change
@@ -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 .
6 changes: 4 additions & 2 deletions examples/cmake_example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, std::string> 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;

Expand Down
2 changes: 2 additions & 0 deletions run_tests.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
call build.cmd
.\build\test\Debug\Ark-Cpp-Client-tests
5 changes: 5 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

./build.sh
chmod +x ./build/test/Ark-Cpp-Client-tests
./build/test/Ark-Cpp-Client-tests