From a822f0b585d20fbd391fadddb210926fa7ff78ed Mon Sep 17 00:00:00 2001 From: Viacheslav Rudkovskyi Date: Tue, 20 Aug 2024 11:39:04 +0300 Subject: [PATCH] Revert "Merge branch 'master' into RVA/NLIC-2466/Fix-(make-stable)-C++-client-tests-and-add-bundle-shop-token-example" This reverts commit b9751ca7ba4459a995a3574df67ff7e65a504e6e, reversing changes made to 9486731a84d2afaace9c0c44296cd769d1d1bc35. --- .github/workflows/netlicesning-client-ci.yml | 8 +--- .gitignore | 2 +- CMakeLists.txt | 8 ++-- README.md | 43 +++----------------- include/netlicensing/mapper.h | 2 - tests/run_tests.cc | 2 +- 6 files changed, 13 insertions(+), 52 deletions(-) diff --git a/.github/workflows/netlicesning-client-ci.yml b/.github/workflows/netlicesning-client-ci.yml index e449b87..a0b821f 100644 --- a/.github/workflows/netlicesning-client-ci.yml +++ b/.github/workflows/netlicesning-client-ci.yml @@ -21,17 +21,13 @@ jobs: apt-get update apt-get upgrade -y - name: Install required dependencies - run: apt-get install -y git g++ cmake libcurl4-openssl-dev libboost-all-dev + run: apt-get install -y git g++ cmake libcurl4-openssl-dev - name: Build with CMake run: | mkdir build cd build - cmake .. -DBUILD_TESTS=yes + cmake .. make - - name: Run tests - run: | - cd tests - ./run_tests - name: Run Demo App run: | cd build diff --git a/.gitignore b/.gitignore index 54a723e..5d2db92 100644 --- a/.gitignore +++ b/.gitignore @@ -37,5 +37,5 @@ # Generated and working files and directories tests/run_tests -build* +build .vscode diff --git a/CMakeLists.txt b/CMakeLists.txt index 25de769..b055260 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") find_package(CURL REQUIRED) if (BUILD_TESTS) - set(Boost_USE_STATIC_LIBS ON) - find_package(Boost 1.40 REQUIRED unit_test_framework) + set(Boost_USE_STATIC_LIBS ON) + find_package(Boost 1.40 REQUIRED unit_test_framework) endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -22,7 +22,7 @@ set(LIBS ${LIBS} ${CURL_LIBRARIES} ${JSONCPP_LIBRARIES}) set(BUILD_SHARED_LIBS OFF) add_definitions(-DCURL_STATICLIB) -if (UNIX) +if(UNIX) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x") endif() @@ -37,7 +37,7 @@ target_link_libraries(netlicensing ${LIBS}) # demo client file(GLOB client_demo_headers client_demo/${db2lp_component}/*h) file(GLOB client_demo_sources client_demo/${db2lp_component}/*cc) -add_executable(netlicensing-client-demo ${client_demo_headers} ${client_demo_sources}) +add_executable(netlicensing-client-demo ${client_demo_headers} ${client_demo_sources} ) target_link_libraries(netlicensing-client-demo netlicensing ${LIBS}) if (BUILD_TESTS) diff --git a/README.md b/README.md index 86fecc9..d786b7d 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,9 @@ C++ wrapper for Labs64 NetLicensing [RESTful API](https://netlicensing.io/wiki/r Visit Labs64 NetLicensing at https://netlicensing.io ## Dependencies -1. C++11 toolset + STL -2. cmake -3. [libcurl](https://github.com/curl/curl) (with libcurl's transitive dependencies) -4. [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (included) -5. [boost](https://www.boost.org/) (optional, needed for unit tests) - +1. C++11 STL +2. [libcurl](https://github.com/curl/curl) (with libcurl's transitive dependencies) +3. [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (included) ## Compatibility @@ -35,7 +32,6 @@ Windows 10 | Visual studio 14 2015 x86 - x64 Windows 10 | Visual studio 15 2017 x86 - x64 macOS Mojave | Xcode 10.1 - ## Windows build ### Build curl @@ -62,14 +58,12 @@ macOS Mojave | Xcode 10.1 (replace `-G` argument with your actual version / platform, see [`cmake` documentation](https://cmake.org/cmake/help/latest/)) 5. Open solution created in `NetLicensingClient-cpp\build` directory in Visual Studio and build the library and demo client. - ## Linux build ### Build NetLincesing-cpp 1. Download the latest release and unpack to `NetLicensingClient-cpp` (or checkout [master](https://github.com/Labs64/NetLicensingClient-cpp.git) to build the latest development version) -2. Install **libcurl** (for development, including C headers and libraries). E.g. in **Ubuntu**: - ```sudo apt-get install libcurl4-openssl-dev``` -3. Install **boost**: ```sudo apt-get install libboost-all-dev``` +2. Install **curl** (for development, including C headers and libraries). E.g. in **Ubuntu**: + ```sudo apt-get install libcurl4-openssl``` 3. In the `NetLicensingClient-cpp` directory create `build/` subdirectory 4. Execute: ``` @@ -83,33 +77,6 @@ macOS Mojave | Xcode 10.1 Unit tests require [**Boost**](https://www.boost.org) Unit Test Framework. To build project with the unit tests activated add cmake option `-DBUILD_TESTS=yes`. The tests must be executed from `tests/` subdirectory on Linux or `tests\Debug\` on Windows in order to properly locate the JSON files with test data. -## Linux build using docker - -_TODO: full description_ - -1. Prepare container - - Image: ubuntu:22.04 - - apt-get update - - apt-get install cmake g++ libcurl4-openssl-dev libboost-all-dev - -2. Map `NetLicensingClient-cpp` or clone it inside the container - -3. Build as described in [Linux Build](#linux-build) - - -## MacOS build - -_TODO: full description_ - -1. Prepare environment: - - Install XCode 10.1+ - - Install `homebrew` - - `libcurl` is provided - - `brew install cmake boost` - -2. Build as described in [Linux Build](#linux-build) - - ## Execution environment **libcurl** dynamic library should be either installed system-wide or otherwise available for the loading at run-time (typically located in the same directory as your executable) diff --git a/include/netlicensing/mapper.h b/include/netlicensing/mapper.h index 4eece17..3fdd172 100644 --- a/include/netlicensing/mapper.h +++ b/include/netlicensing/mapper.h @@ -18,8 +18,6 @@ #include "netlicensing/transaction.h" #include "netlicensing/licensing_model.h" #include "netlicensing/bundle.h" -#include "netlicensing/license_type.h" -#include "netlicensing/license_template.h" namespace netlicensing { diff --git a/tests/run_tests.cc b/tests/run_tests.cc index 05ce836..47761d9 100644 --- a/tests/run_tests.cc +++ b/tests/run_tests.cc @@ -75,7 +75,7 @@ class TestObserver { BOOST_AUTO_TEST_SUITE(test_mapper) BOOST_AUTO_TEST_CASE(initial_test) { - std::string str = read_whole_file("product.json"); + std::string str = read_whole_file("../json/product.json"); BOOST_REQUIRE(!str.empty()); Json::Value root; Json::Reader reader;