oxen-core/.travis.yml
Jason Rhinelander 5b97ff6e9c cmake modernization
The archaic (i.e. decade old) cmake usage here really got in the way of
trying to properly use newer libraries (like lokimq), so this undertakes
overhauling it considerably to make it much more sane (and significantly
reduce the size).

I left more of the architecture-specific bits in the top-level
CMakeLists.txt intact; most of the efforts here are about properly
loading dependencies, specifying dependencies and avoiding a whole pile
of cmake antipatterns.

This bumps the required cmake version to 3.5, which is what xenial comes
with.

- extensive use of interface libraries to include libraries,
definitions, and include paths

- use Boost::whatever instead of ${Boost_WHATEVER_LIBRARY}.  The
interface targets are (again) much better as they also give you any
needed include or linking flags without needing to worry about them.

- don't list header files when building things.  This has *never* been
correct cmake usage (cmake has always known how to wallet_rpc_headers
the headers that .cpp files include to know about build changes).

- remove the loki_add_library monstrosity; it breaks target names and
makes compiling less efficient because the author couldn't figure out
how to link things together.

- make loki_add_executable take the output filename, and set the output
path to bin/ and install to bin because *every single usage* of
loki_add_executable was immediately followed by setting the output
filename and setting the output path to bin/ and installing to bin.

- move a bunch of crap that is only used in one particular
src/whatever/CMakeLists.txt into that particular CMakeLists.txt instead
of the top level CMakeLists.txt (or src/CMakeLists.txt).

- Remove a bunch of redundant dependencies; most of them look like they
were just copy-and-pasted in, and many more aren't needed (since they
are implied by the PUBLIC linking of other dependencies).

- Removed `die` since it just does a FATAL_ERROR, but adds color (which
is useless since CMake already makes FATAL_ERRORs perfectly visible).

- Change the way LOKI_DAEMON_AND_WALLET_ONLY works to just change the
make targets to daemon and simplewallet rather than changing the build
process (this should make it faster, too, since there are various other
things that will be excluded).
2020-03-06 00:36:57 -04:00

88 lines
3.3 KiB
YAML

language: cpp
dist: bionic
cache:
ccache: true
timeout: 600
directories:
- $HOME/Library/Caches/Homebrew
env:
global:
- CCACHE_COMPRESS=1
- GCC_COLORS=\
os: linux
addons:
apt:
packages: [libboost-chrono-dev, libboost-date-time-dev, libboost-filesystem-dev, libboost-locale-dev,
libboost-thread-dev, libboost-serialization-dev, libboost-program-options-dev, libboost-regex-dev,
libboost-system-dev, libssl-dev, libzmq3-dev, libunbound-dev, libevent-dev, libsodium-dev, libreadline-dev,
libldns-dev, libgtest-dev, libhidapi-dev, libusb-1.0-0-dev, libprotobuf-dev, protobuf-compiler,
libminiupnpc-dev, python3, pkg-config, ccache]
homebrew:
update: true
packages: [cmake, ccache, zeromq, boost, openssl@1.1, unbound, miniupnpc, libsodium, readline, ldns, hidapi, libusb, pkg-config]
jobs:
include:
- name: "bionic"
env: BUILD_TESTS=1
- name: "bionic/clang"
compiler: clang
- name: "bionic/debug"
env: CMAKE_BUILD_TYPE=Debug
- name: "xenial"
dist: xenial
- name: "macOS 10.14"
os: osx
osx_image: xcode11.2
- name: "macOS 10.13"
os: osx
osx_image: xcode9.3
- arch: arm64
- arch: s390x
- arch: ppc64le
- name: "Windows cross-compile"
addons:
apt:
packages: [g++-mingw-w64-x86-64, qttools5-dev-tools, python3]
before_script:
- export HOST=x86_64-w64-mingw32
- sudo update-alternatives --set $HOST-g++ $(which $HOST-g++-posix)
- sudo update-alternatives --set $HOST-gcc $(which $HOST-gcc-posix)
- make -j2 -C contrib/depends HOST=$HOST NO_QT=1
- export CMAKE_OPTS="-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/contrib/depends/$HOST/share/toolchain.cmake"
- export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/contrib/depends/$HOST/lib
fast_finish: true
allow_failures:
- name: "Windows cross-compile"
- arch: ppc64le
before_script:
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH" PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"; fi
- if [ "${TRAVIS_COMPILER}" = "clang" ] && ! [ -e /usr/lib/ccache/clang ]; then sudo ln -s ../../bin/ccache /usr/lib/ccache/clang; sudo ln -s ../../bin/ccache /usr/lib/ccache/clang++; fi
- echo $TRAVIS_COMMIT_RANGE
- git log --format=fuller -1
script:
- mkdir build
- cd build
- if [ -z "$CMAKE_BUILD_TYPE" ]; then CMAKE_BUILD_TYPE=Release; fi
- CMAKE_OPTS="$CMAKE_OPTS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE"
- if [ -n "$BUILD_TESTS" ]; then CMAKE_OPTS="$CMAKE_OPTS -DBUILD_TESTS=$BUILD_TESTS"; fi
- cmake $CMAKE_OPTS ..
- |
set -e
if [ -z "$TRAVIS_CPU_ARCH" ] || [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
make -j2
else
# The wallet code is too bloated to be compiled at -j2 with only 4GB ram, so do the huge ones
# at -j1 and the rest at -j2.
#
make -j1 rpc wallet # core_rpc_server.cpp and wallet2.cpp are hogs
make -j2 daemon device_trezor # covers most things
make -j1 wallet_rpc_server # another hog, which depends on much of the above
make -j2 # everything else
fi
- if [ -n "$RUN_TESTS" ]; then make ARGS="-E libwallet_api_tests" test; fi
before_cache:
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew cleanup; fi