Skip to content

Commit

Permalink
Merge pull request #283 from pmienk/install-cmake-v3
Browse files Browse the repository at this point in the history
Add cmake builds to CI.
  • Loading branch information
pmienk committed Jul 1, 2022
2 parents ff3573c + 29d0cf8 commit 6fad078
Show file tree
Hide file tree
Showing 4 changed files with 1,435 additions and 126 deletions.
248 changes: 242 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: Continuous Integration Build
on: [ pull_request, push, workflow_dispatch ]

jobs:
verify-installsh:
autotools:

strategy:
fail-fast: false
Expand All @@ -20,6 +20,7 @@ jobs:
- os: ubuntu-latest
cxx: "clang++"
link: "dynamic"
optimization: "size"
assert: "debug"
coverage: "nocov"
boost: "--build-boost"
Expand All @@ -28,11 +29,12 @@ jobs:
cc: "clang"
flags: "-Os -fPIE"
packager: "apt"
packages: "clang"
packages: ""

- os: ubuntu-latest
cxx: "clang++"
link: "static"
optimization: "size"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
Expand All @@ -41,11 +43,12 @@ jobs:
cc: "clang"
flags: "-Os -fPIE"
packager: "apt"
packages: "clang"
packages: ""

- os: ubuntu-latest
cxx: "g++"
link: "dynamic"
optimization: "size"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
Expand All @@ -54,11 +57,12 @@ jobs:
cc: "gcc"
flags: "-Os -fPIE"
packager: "apt"
packages: "gcc"
packages: ""

- os: ubuntu-latest
cxx: "g++"
link: "static"
optimization: "debug"
assert: "ndebug"
coverage: "cov"
boost: "--build-boost"
Expand All @@ -67,11 +71,12 @@ jobs:
cc: "gcc"
flags: "-Og -g --coverage -fPIE"
packager: "apt"
packages: "gcc lcov"
packages: "lcov"

- os: macos-latest
cxx: "clang++"
link: "dynamic"
optimization: "size"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
Expand All @@ -85,6 +90,7 @@ jobs:
- os: macos-latest
cxx: "clang++"
link: "static"
optimization: "size"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
Expand All @@ -95,6 +101,7 @@ jobs:
packager: "brew"
packages: ""


runs-on: ${{ matrix.os }}

env:
Expand Down Expand Up @@ -160,6 +167,11 @@ jobs:
path-to-lcov: "./coverage.info"
github-token: ${{ secrets.github_token }}

- name: Failure display available binaries
if: ${{ failure() }}
run: |
ls -la /usr/bin
- name: Failure display selected compiler version
if: ${{ failure() }}
run: |
Expand Down Expand Up @@ -197,7 +209,231 @@ jobs:
run: |
DYLD_PRINT_LIBRARIES=1 ${{ github.workspace }}/test/.libs/libbitcoin-client-test
verify-sln:
- name: Failure display pkgconfig
if: ${{ failure() }}
run: |
ls ${{ github.workspace }}/prefixenv/lib/pkgconfig/
cat ${{ github.workspace }}/prefixenv/lib/pkgconfig/*.pc
cmake:

strategy:
fail-fast: false

matrix:
include:
- os: ubuntu-latest
cxx: "clang++"
link: "dynamic"
optimization: "size"
assert: "debug"
coverage: "nocov"
boost: "--build-boost"
icu: ""
zmq: "--build-zmq"
cc: "clang"
flags: "-Os -fPIE"
packager: "apt"
packages: ""

- os: ubuntu-latest
cxx: "clang++"
link: "static"
optimization: "size"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
icu: "--build-icu --with-icu"
zmq: "--build-zmq"
cc: "clang"
flags: "-Os -fPIE"
packager: "apt"
packages: ""

- os: ubuntu-latest
cxx: "g++"
link: "dynamic"
optimization: "size"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
icu: ""
zmq: "--build-zmq"
cc: "gcc"
flags: "-Os -fPIE"
packager: "apt"
packages: ""

- os: ubuntu-latest
cxx: "g++"
link: "static"
optimization: "debug"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
icu: "--build-icu --with-icu"
zmq: "--build-zmq"
cc: "gcc"
flags: "-Og -fPIE"
packager: "apt"
packages: ""

- os: macos-latest
cxx: "clang++"
link: "dynamic"
optimization: "size"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
icu: "--build-icu --with-icu"
zmq: "--build-zmq"
cc: "clang"
flags: "-Os -fPIE"
packager: "brew"
packages: ""

- os: macos-latest
cxx: "clang++"
link: "static"
optimization: "size"
assert: "ndebug"
coverage: "nocov"
boost: "--build-boost"
icu: "--build-icu --with-icu"
zmq: "--build-zmq"
cc: "clang"
flags: "-Os -fvisibility=hidden -fPIE"
packager: "brew"
packages: ""


runs-on: ${{ matrix.os }}

env:
CC: '${{ matrix.cc }}'
CXX: '${{ matrix.cxx }}'
CFLAGS: '${{ matrix.flags }}'
CXXFLAGS: '${{ matrix.flags }}'
CI_REPOSITORY: '${{ github.repository }}'

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Prepare toolchain [apt]
if: ${{ matrix.packager == 'apt' }}
run: |
sudo apt-get update
sudo apt-get install git build-essential autoconf automake libtool pkg-config ${{ matrix.packages }}
- name: Prepare toolchain [brew]
if: ${{ matrix.packager == 'brew' }}
run: |
brew install autoconf automake libtool pkg-config ${{ matrix.packages }}
- name: Denormalize parameterization
run: |
if [[ ${{ matrix.packager }} == 'brew' ]]; then
echo "CMAKE_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV
fi
if [[ ${{ matrix.assert }} == 'ndebug' ]]; then
echo "ASSERT_NDEBUG=--enable-ndebug -Denable-ndebug=yes" >> $GITHUB_ENV
else
echo "ASSERT_NDEBUG=--disable-ndebug -Denable-ndebug=no" >> $GITHUB_ENV
fi
if [[ ${{ matrix.link }} == 'dynamic' ]]; then
echo "LINKAGE=--disable-static" >> $GITHUB_ENV
else
echo "LINKAGE=--disable-shared" >> $GITHUB_ENV
fi
if [[ ${{ matrix.link }} == 'dynamic' ]]; then
echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefixenv/lib" >> $GITHUB_ENV
fi
- name: Execute install-cmake.sh
run: >
./install-cmake.sh
--build-dir=${{ github.workspace }}/build
--prefix=${{ github.workspace }}/prefixenv
${{ env.LINKAGE }}
${{ env.ASSERT_NDEBUG }}
${{ matrix.boost }}
${{ matrix.icu }}
${{ matrix.zmq }}
- name: Coveralls Calculation
if: ${{ matrix.coverage == 'cov' }}
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info "/usr/*" "${{ github.workspace }}/prefixenv/*" "${{ github.workspace }}/build/*" "${{ github.workspace }}/examples/*" "${{ github.workspace }}/test/*" --output-file coverage.info
lcov --list coverage.info
- name: Coveralls.io Upload
if: ${{ matrix.coverage == 'cov' }}
uses: coverallsapp/github-action@master
with:
path-to-lcov: "./coverage.info"
github-token: ${{ secrets.github_token }}

- name: Failure display available binaries
if: ${{ failure() }}
run: |
ls -la /usr/bin
- name: Failure display selected compiler version
if: ${{ failure() }}
run: |
${CC} -v
${CXX} -v
- name: Failure display default compiler version
if: ${{ failure() }}
run: |
clang -v
gcc -v
- name: Failure display env
if: ${{ failure() }}
run: |
env
- name: Failure list libdir
if: ${{ failure() }}
run: |
ls -la ${{ github.workspace }}/prefixenv/lib
- name: Failure display boost bootstrap.log [--build-boost]
if: ${{ failure() && (matrix.boost == '--build-boost') }}
run: |
cat ${{ github.workspace }}/build/build-*/bootstrap.log
- name: Failure display otool output
if: ${{ failure() && (matrix.os == 'macos-latest') }}
run: |
otool -L ${{ github.workspace }}/test/.libs/libbitcoin-client-test
- name: Failure display DYLD_PRINT_LIBRARIES
if: ${{ failure() && (matrix.os == 'macos-latest') }}
run: |
DYLD_PRINT_LIBRARIES=1 ${{ github.workspace }}/test/.libs/libbitcoin-client-test
- name: Failure display pkgconfig
if: ${{ failure() }}
run: |
ls ${{ github.workspace }}/prefixenv/lib/pkgconfig/
cat ${{ github.workspace }}/prefixenv/lib/pkgconfig/*.pc
- name: Failure display cmake specific libraries
if: ${{ failure() }}
run: |
ls ${{ github.workspace }}/prefixenv/lib/cmake
- name: Failure display cmake LastTest.log
if: ${{ failure() }}
run: |
cat ${{ github.workspace }}/Testing/Temporary/LastTest.log
msbuild:
strategy:
fail-fast: false

Expand Down
15 changes: 12 additions & 3 deletions builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else ()
set( libdir "\${exec_prefix}/lib" )
set( includedir "\${exec_prefix}/include" )

set( PACKAGE_VERSION "4.0.0" )
set( PACKAGE_VERSION "3.7.0" )
set( VERSION "${PACKAGE_VERSION}" )
endif ()

Expand Down Expand Up @@ -60,6 +60,9 @@ add_compile_options( "-Wno-missing-braces" )
# Ignore comments within comments or commenting of backslash extended lines.
add_compile_options( "-Wno-comment" )

# Suppress warning for copy of implicitly generated copy constructor.
add_compile_options( "-Wno-deprecated-copy" )

# Conflict in stdlib under clang.
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options( "-Wno-mismatched-tags" )
Expand Down Expand Up @@ -91,6 +94,12 @@ if (BUILD_SHARED_LIBS)
add_definitions( -DBOOST_ALL_DYN_LINK )
endif()

if (BUILD_SHARED_LIBS)
set( Boost_USE_STATIC_LIBS "off" )
else()
set( Boost_USE_STATIC_LIBS "on" )
endif()

# Find boost
#------------------------------------------------------------------------------
find_package( Boost 1.72.0 REQUIRED COMPONENTS
Expand All @@ -109,11 +118,11 @@ set( boost_LDFLAGS "-L${Boost_LIBRARY_DIR}" )

# Find bitcoin-system
#------------------------------------------------------------------------------
find_package( Bitcoin-System 4.0.0 REQUIRED )
find_package( Bitcoin-System 3.7.0 REQUIRED )

# Find bitcoin-protocol
#------------------------------------------------------------------------------
find_package( Bitcoin-Protocol 4.0.0 REQUIRED )
find_package( Bitcoin-Protocol 3.7.0 REQUIRED )

# Define project common includes directories
#------------------------------------------------------------------------------
Expand Down

0 comments on commit 6fad078

Please sign in to comment.