Commit Graph

44 Commits

Author SHA1 Message Date
Jason Rhinelander
c5faa86926 cmake refactor
Refactors many things in cmake to improve and simplify:

- don't use variable indirection for target names; target names are
*already* a variable of sorts.  (e.g. ${UTIL_LIB} is now just
lokinet-util).  cmake/basic_definitions.cmake is now gone.

- fix LTO enabling to use the standard cmake (3.9+) LTO mechanism rather
than shoving a bunch of flag hacks through link_libraries and
add_compile_options.  This also now enables LTO when building a shared
library (because previously the -flto hacks were only turned on in the
static code for some reason).

- build liblokinet as *either* shared library or static library, but not
both.  Building both makes things more complicated because they had
different names (lokinet-shared or lokinet-static) and seems pointless:
you generally want one or the other.  Now there is just the liblokinet
target, which will be shared or static depending on the value of
BUILD_SHARED_LIBS.

- Simplify lokinet-cryptography AVX2 code: just build *one* library, and
add in the additional AVX2 files when possible, rather than building two
and needing to merge them.

- Compress STATIC_LINK and STATIC_LINK_RUNTIME into just STATIC_LINK.
It makes no sense to use one of these (_RUNTIME) on Windows and the
other on non-Windows when they appear to try to do the same thing.

- remove a bunch of annotations from `endif(FOO)` -> `endif()`.

- move all the tuntap compilation code (including OS-specific source
file selection) into vendor/CMakeLists.txt and build tuntap as an
intermediate OBJECT library rather than keeping a global variable in 5
different files.

- move release motto define to root cmake; it made no sense being
duplicated in both unix.cmake and win32.cmake

- fix add_log_tag to not stomp on any existing source compile flags with
its definition.  Also use proper compile definition property instead of
cramming it into compile flags.

- make optimization/linker flags less hacky.  There's no reason for us
to force particular optimization flags because the cmake build type
already does that (e.g. -DCMAKE_BUILD_TYPE=Release does -O3).  Not doing
that also silences a bunch of cmake warnings because it thinks "-O0 -g3"
etc.  are link libraries (which is reasonable: that's what the code was
telling cmake they are).

- sets the default build type to RelWithDebInfo which gives us `-O2 -g`
if you don't specify a build type.

- Move PIC up (so that the things loaded in unix.cmake, notably libuv,
have it set).

- Add a custom `curl` interface library that carries the correct link
target and include paths for curl (system or bundled).
2020-05-17 23:31:23 -03:00
Jeff Becker
64157d5d44 track libcurl and libuv with cmake, add libuv submodule 2020-05-17 14:53:28 -03:00
Jeff Becker
abc1f67430
check for std::optional as macos can be broke af sometimes 2020-05-15 09:40:24 -04:00
Jeff Becker
5a24d2deef
add check for std::filesystem 2020-05-15 09:32:24 -04:00
Jason Rhinelander
1697bf90fe C++17
Compiles with C++17, replaces ghc::filesystem with std::filesystem,
nonstd::optional with std::optional, and llarp::string_view with
std::string_view.
2020-05-01 17:43:27 -03:00
Jason Rhinelander
3048ccf3f8 Set -mmacosx-version-min the cmake way 2020-04-21 20:01:24 -03:00
Jeff Becker
7455a1956d
make apple builds build for older versions and embrace the bitrot 2020-04-06 08:44:35 -04:00
despair
8a27e3972d
we need XPG7 on netbsd 2020-02-25 15:48:53 -06:00
Jeff Becker
da5eb913e9
use proper cmake call 2020-01-07 18:14:26 -05:00
Jeff Becker
fde0ca374f
i hate curl 2020-01-07 18:14:25 -05:00
Jeff Becker
336a748695
make it build in normal mode too 2020-01-07 18:14:25 -05:00
Jeff Becker
80cbddde7b
fixups for review 2020-01-07 18:14:25 -05:00
Jeff Becker
2ce592e4af
static link with docs 2020-01-07 18:14:25 -05:00
Ryan Tharp
20ce679c3a macos release needs the include path 2019-12-23 07:15:51 +00:00
Ryan Tharp
b21b0b49d0 support LIBCURL_ROOT, disable LIBUV includes 2019-12-23 06:55:02 +00:00
Stephen Shelton
332f33b049 Remove FS_LIB conditionals 2019-12-12 12:58:46 -07:00
Stephen Shelton
5ce260fce1 Use vendored fs::filesystem on all platforms 2019-12-12 12:29:03 -07:00
Jason Rhinelander
8d2c22fc72 Replace cppbackport with ghc-filesystem
From https://github.com/gulrak/filesystem which is more up-to-date and
looks better maintained than cppbackport.
2019-12-06 20:41:22 -04:00
Michael
77b4efd78b
fixup ios 2019-10-07 00:52:04 +01:00
Michael
fadedb4a7b
Distinct ios build 2019-09-30 09:59:34 +01:00
Jeff
35230adbe5
Merge pull request #833 from majestrate/gut-utp-2019-09-19
remove libutp and all such code related to utp
2019-09-19 16:48:36 -04:00
jeff
1853b28590 remove libutp and all such code related to utp 2019-09-19 11:36:05 -04:00
Michael
6719a1790c
Statically link releases 2019-09-18 21:33:08 +01:00
Rick V
5ecc76a332
if cppbackport is built, make that consistent too 2019-09-03 08:02:32 -05:00
Rick V
89f92d3aed
new cmake module 2019-09-03 08:02:32 -05:00
Rick V
4246caf8a1
add build option for constrained node ops and make sure everything is now target-optimised in all configurations (allows debugging on the target using the debug build config)
link libatomic if we're targeting 486

link libatomic.a if we're targeting windows

idk what the hell MSVC does for -arch:IA32

we already set the c++14 flag early on

strip target selection flags from MSVC builds and clang-cl

c++14 does not propagate to compile tests
2019-09-03 08:02:04 -05:00
Rick V
b3a975ff8e
sun fix
fix testing on sun
2019-08-27 06:53:08 -05:00
Michael
e7c48e57e9
Fix on compilers which aren't C++11 by default 2019-08-18 22:54:33 +00:00
Michael
7dfbb41e0d
Find libatomic fix cmake magics 2019-08-17 13:20:16 +01:00
Rick V
3782479276
fix sun 2019-08-01 21:39:49 -05:00
Jeff Becker
43cb62af16
fix android compile, have makefile pull in libuv for cmake on android 2019-07-24 11:25:40 -04:00
Michael
82958de2d7
Tidy up cmake files 2019-07-22 00:58:45 +01:00
Michael
2cc180b6a4
Add FindLibUV and migrate 2019-07-13 14:06:34 +01:00
Michael
2acb163083
Fix llvm 8 build 2019-07-06 14:46:25 +01:00
Michael
80d1e4aef9
Add in-source version of std::filesystem::permissions 2019-07-02 00:01:25 +01:00
Michael
59e8a7316f
Revert "Merge pull request #668 from michael-loki/remove_cppbackport"
This reverts commit 33142d5005, reversing
changes made to 408a652a01.
2019-07-01 10:33:03 +01:00
Michael
07377b8d5f
Find libuv for Ryan 2019-06-28 12:08:43 +01:00
Michael
1639c58cb6
Remove cppbackport from vendor dir 2019-06-27 16:25:44 +01:00
Jeff Becker
c63dbe7e48
fix freebsd build 2019-06-25 09:51:17 -04:00
Jeff Becker
e265661adb
try fixing issue number 17 (not done) 2019-06-24 12:48:48 -04:00
Rick V
68862cc830
we libuv now 2019-06-13 21:21:44 -05:00
Rick V
271cfcb64e
remove all disused platform-specific event loops
(cherry picked from commit 94d00a169ba7934ef719cc38fe0ca1eff8e1b675)
2019-06-13 21:02:57 -05:00
Michael
8c570653ee
Refactor top level cmake file into multiple components 2019-04-30 00:48:48 +01:00
Michael
0b4d787042
More work on router docker image
- Multi-stage docker build (final image only 15MB!)
- Build in release mode
    - Fix bug with release mode
    - Fix compiler being dumb AF
    - Disable FORTIFY for now
- Enable LTO when making a staticly linked release
- Fix some gcc specific warnings
- Refactor cmake stuff into multiple files
2019-04-28 17:04:52 +01:00