diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e8c5b02ed3..9d273706cc 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -207,40 +207,70 @@ jobs: [ ! -d "build/src/tests/googletest-src" ] cmake-system-sexpp: + name: system-sexpp, sexpp shared libs ${{ matrix.sexpp_shared_libs }}, rnp shared libs ${{ matrix.rnp_shared_libs }} runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'skip ci')" timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + sexpp_shared_libs: [ 'on' ] + rnp_shared_libs: ['on'] + steps: - - name: Checkout + - name: Install dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install cmake libjson-c-dev libbotan-2-dev asciidoctor + + - name: Checkout sexpp uses: actions/checkout@v3 with: - fetch-depth: 1 - submodules: true + repository: rnpgp/sexpp + path: sexpp - - name: Install dependencies + - name: Configure sexpp run: | - sudo apt-get -y update - sudo apt-get -y install cmake libjson-c-dev libbotan-2-dev asciidoctor googletest + echo CORES="$(nproc --all)" >> $GITHUB_ENV + cmake -S sexpp -B sexpp/build \ + -DCMAKE_BUILD_TYPE=Release \ + -DDOWNLOAD_GTEST=ON \ + -DBUILD_SHARED_LIBS=${{ matrix.sexpp_shared_libs}} + + - name: Build sexpp + run: cmake --build sexpp/build --parallel ${{ env.CORES }} + + - name: Install sexpp + run: sudo cmake --install sexpp/build + + - name: Clean sexpp + run: rm -rf sexpp + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 1 + submodules: false - name: Configure run: | - echo CORES="$(nproc --all)" >> $GITHUB_ENV - cmake -B build -DBUILD_SHARED_LIBS=ON \ - -DCRYPTO_BACKEND=botan \ - -DDOWNLOAD_GTEST=OFF \ - -DSYSTEM_SEXPP=ON \ - -DCMAKE_BUILD_TYPE=Release . - + cmake -B build \ + -DBUILD_SHARED_LIBS=${{ matrix.rnp_shared_libs }} \ + -DCRYPTO_BACKEND=botan \ + -DDOWNLOAD_GTEST=ON \ + -DSYSTEM_LIBSEXPP=ON \ + -DCMAKE_BUILD_TYPE=Release . + - name: Build run: cmake --build build --parallel ${{ env.CORES }} - + - name: Test run: | mkdir -p "build/Testing/Temporary" cp "cmake/CTestCostData.txt" "build/Testing/Temporary" export PATH="$PWD/build/src/lib:$PATH" ctest --parallel ${{ env.CORES }} --test-dir build -C Debug --output-on-failure - + package-source: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'skip ci')" diff --git a/CMakeLists.txt b/CMakeLists.txt index 5310bb112e..d649275402 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ option(ENABLE_COVERAGE "Enable code coverage testing.") option(ENABLE_SANITIZERS "Enable ASan and other sanitizers.") option(ENABLE_FUZZERS "Enable fuzz targets.") option(DOWNLOAD_GTEST "Download Googletest" On) -option(SYSTEM_LIBSEXP "Use system sexp library" OFF) +option(SYSTEM_LIBSEXPP "Use system sexpp library" OFF) # crypto components function(tristate_feature_auto NAME DESCRIPTION) @@ -184,11 +184,14 @@ if (ENABLE_FUZZERS) endif() add_subdirectory(src/common) -if (SYSTEM_LIBSEXP) +if (SYSTEM_LIBSEXPP) find_package(PkgConfig) - pkg_check_modules(REQUIRED sexpp>=0.8.5) -else (SYSTEM_LIBSEXP) -# force static libsexpp + pkg_check_modules(REQUIRED sexpp>=0.8.7) +else (SYSTEM_LIBSEXPP) +# If we use system libsexpp is not used we build sexpp static library +# If librnp is shared, libsexpp.a is a transient artifact which is hidden from +# the end user. +# If librnp is static we install libsexpp.a aside set(SAVED_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) set(WITH_SEXP_CLI OFF) @@ -196,7 +199,7 @@ else (SYSTEM_LIBSEXP) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME development) add_subdirectory(src/libsexpp EXCLUDE_FROM_ALL) set(BUILD_SHARED_LIBS ${SAVED_BUILD_SHARED_LIBS}) -endif (SYSTEM_LIBSEXP) +endif (SYSTEM_LIBSEXPP) add_subdirectory(src/lib) add_subdirectory(src/rnp) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index d21ba7b679..19059c2fae 100755 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -431,8 +431,8 @@ endif() # On Unix like systems we will build/install/pack either shared library librnp.so or static librnp.a # On Windows we will build/install/pack either dynamic and import libraries rnp.dll, rnp.lib or static library rnp-static.lib -# If a client application uses shared rnp library, sexp is statically linked to librnp.so and libsexp.a is not installed -# If a client application uses static rnp library, it still needs libsexp.a and it is installed +# If a client application uses shared rnp library, sexpp is statically linked to librnp.so and libsexpp.a is not installed +# If a client application uses static rnp library, it still needs libsexpp.a and it is installed if (BUILD_SHARED_LIBS) install(TARGETS librnp @@ -455,13 +455,23 @@ if (BUILD_SHARED_LIBS) ) endif(WIN32) else(BUILD_SHARED_LIBS) -# static libraries only - install(TARGETS librnp sexpp +# static libraries +# install libsexpp unless system-installed libsexpp is used + if (SYSTEM_LIBSEXPP) + install(TARGETS librnp + EXPORT rnp-targets + ARCHIVE + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT development + ) + else (SYSTEM_LIBSEXPP) + install(TARGETS librnp sexpp EXPORT rnp-targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT development - ) + ) + endif (SYSTEM_LIBSEXPP) endif(BUILD_SHARED_LIBS) # install headers