oxen-core/cmake
Jason Rhinelander 70b9fed4fd Static builds: make usable binaries from cmake
This adds a static dependency script for libraries like boost, unbound,
etc. to cmake, invokable with:

    cmake .. -DBUILD_STATIC_DEPS=ON

which downloads and builds static versions of all our required
dependencies (boost, unbound, openssl, ncurses, etc.).  It also implies
-DSTATIC=ON to build other vendored deps (like miniupnpc, lokimq) as
static as well.

Unlike the contrib/depends system, this is easier to maintain (one
script using nicer cmake with functions instead of raw Makefile
spaghetti code), and isn't concerned with reproducible builds -- this
doesn't rebuild the compiler, for instance.  It also works with the
existing build system so that it is simply another way to invoke the
cmake build scripts but doesn't require any external tooling.

This works on Linux, Mac, and Windows.

Some random comments on this commit (for preserving history):

- Don't use target_link_libraries on imported targets.  Newer cmake is
fine with it, but Bionic's cmake doesn't like it but seems okay with
setting the properties directly.

- This rebuilds libzmq and libsodium, even though there is some
provision already within loki-core to do so: however, the existing
embedded libzmq fails with the static deps because it uses libzmq's
cmake build script, which relies on pkg-config to find libsodium which
ends up finding the system one (or not finding any), rather than the one
we build with DownloadLibSodium.  Since both libsodium and libzmq are
faily simple builds it seemed easiest to just add them to the cmake
static build rather than trying to shoehorn the current code into the
static build script.

- Half of the protobuf build system ignores CC/CXX just because Google,
and there's no documentation anywhere except for a random closed bug
report about needing to set these other variables (CC_FOR_BUILD,
CXX_FOR_BUILD) instead, but you need to.  Thanks Google.

- The boost build is set to output very little because even the minimum
-d1 output level spams ~15k lines of output just for the headers it
installs.
2020-06-15 12:49:33 -03:00
..
32-bit-toolchain.cmake Static builds: make usable binaries from cmake 2020-06-15 12:49:33 -03:00
64-bit-toolchain.cmake Static builds: make usable binaries from cmake 2020-06-15 12:49:33 -03:00
CheckLinkerFlag.c Add misc hardening flags to the cmake machinery 2017-12-31 14:26:12 +00:00
CheckLinkerFlag.cmake Merge pull request #4425 2018-09-29 22:19:47 +02:00
CheckTrezor.cmake Static builds: make usable binaries from cmake 2020-06-15 12:49:33 -03:00
DownloadLibSodium.cmake Static builds: make usable binaries from cmake 2020-06-15 12:49:33 -03:00
Doxyfile.in Merge commit '94ed562' into LokiMergeUpstream20180821 2018-09-19 14:15:55 +10:00
Doxygen.extra.css.in doxygen files 2015-04-01 19:23:15 +02:00
FindBacktrace.cmake cmake: fix some case of "backtrace lib not found" breaking 2019-05-01 10:11:41 +00:00
FindHIDAPI.cmake Linux: Fix building of static binaries with hw device support 2018-10-06 16:48:14 +02:00
FindLibUSB.cmake build: fix OSX static libusb check and link against static libobjc 2019-07-09 22:13:59 +00:00
FindLibunwind.cmake cmake: link against liblzma when found, for libunwind 2016-12-24 00:00:45 +00:00
FindReadline.cmake Merge commit '8534f71' into LokiMergeUpstream 2018-11-12 14:55:42 +11:00
GenVersion.cmake Move version into top-level CMakeLists.txt 2020-05-03 22:19:51 -03:00
StaticBuild.cmake Static builds: make usable binaries from cmake 2020-06-15 12:49:33 -03:00
Version.cmake Move version into top-level CMakeLists.txt 2020-05-03 22:19:51 -03:00
test-libusb-version.c Update 2019 copyright 2019-03-05 22:05:34 +01:00
test-protobuf.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
test-protobuf.proto build: protobuf dependency fixes, libusb build 2018-12-18 16:50:19 +01:00
test-static-assert.c Update 2019 copyright 2019-03-05 22:05:34 +01:00