diff --git a/.travis.yml b/.travis.yml index c5a90977b..a6a47146a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,42 +12,46 @@ matrix: dist: xenial env: DOCKER_FILE=docker/router.Dockerfile services: docker - # - os: linux - # dist: xenial - # compiler: gcc - # env: BUILD_TYPE=Release - # - os: linux - # dist: xenial - # compiler: clang - # env: BUILD_TYPE=Debug - # - os: linux - # dist: xenial - # compiler: clang - # env: BUILD_TYPE=Release - # - os: osx - # osx_image: xcode10.2 - # compiler: gcc - # env: BUILD_TYPE=Debug - # - os: osx - # osx_image: xcode10.2 - # compiler: gcc - # env: BUILD_TYPE=Release - # - os: osx - # osx_image: xcode10.2 - # env: BUILD_TYPE=Debug PATH="/usr/local/opt/ccache/libexec:$PATH" - # - os: osx - # osx_image: xcode10.2 - # env: BUILD_TYPE=Release PATH="/usr/local/opt/ccache/libexec:$PATH" - # - os: osx - # osx_image: xcode11 - # env: BUILD_TYPE=Release PATH="/usr/local/opt/ccache/libexec:$PATH" - # - os: osx - # osx_image: xcode10.2 - # env: BUILD_TYPE=Release PATH="/usr/local/opt/ccache/libexec:$PATH" CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ - # - os: windows - # env: BUILD_TYPE=Debug - # - os: windows - # env: BUILD_TYPE=Release + - os: linux + dist: xenial + compiler: gcc + env: MAKE_TARGET=windows BUILD_TYPE=Release + - os: linux + dist: xenial + compiler: gcc + env: BUILD_TYPE=Release + - os: linux + dist: xenial + compiler: clang + env: BUILD_TYPE=Debug + - os: linux + dist: xenial + compiler: clang + env: BUILD_TYPE=Release + - os: osx + osx_image: xcode10.2 + compiler: gcc + env: BUILD_TYPE=Debug + - os: osx + osx_image: xcode10.2 + compiler: gcc + env: BUILD_TYPE=Release + - os: osx + osx_image: xcode10.2 + env: BUILD_TYPE=Debug PATH="/usr/local/opt/ccache/libexec:$PATH" + - os: osx + osx_image: xcode10.2 + env: BUILD_TYPE=Release PATH="/usr/local/opt/ccache/libexec:$PATH" + - os: osx + osx_image: xcode11 + env: BUILD_TYPE=Release PATH="/usr/local/opt/ccache/libexec:$PATH" + - os: osx + osx_image: xcode10.2 + env: BUILD_TYPE=Release PATH="/usr/local/opt/ccache/libexec:$PATH" CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ + - os: windows + env: BUILD_TYPE=Debug + - os: windows + env: BUILD_TYPE=Release env: global: @@ -62,9 +66,13 @@ addons: - cmake - curl - docker-ce + - g++-mingw-w64 + - g++-mingw-w64-x86-64 + - gcc-mingw-w64-base - git - libcap-dev - libuv1-dev + - mingw-w64 mingw-w64-common - ninja-build homebrew: packages: @@ -89,7 +97,7 @@ script: elif [[ ! -z $DOCKER_FILE ]]; then docker build -f $DOCKER_FILE .; else - make test; + make ${MAKE_TARGET:-test}; fi after_script: diff --git a/Makefile b/Makefile index f77cd4603..97fba09a2 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ CMAKE_GEN ?= Unix Makefiles ifdef NINJA - MAKE = $(NINJA) -k0 + MAKE = $(NINJA) CMAKE_GEN = Ninja endif diff --git a/cmake/win32.cmake b/cmake/win32.cmake index 760209fa6..384d42130 100644 --- a/cmake/win32.cmake +++ b/cmake/win32.cmake @@ -6,10 +6,11 @@ enable_language(RC) set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lshlwapi") set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -add_compile_options(/EHca /arch:AVX2 /MD) -add_definitions(-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING) -if(NOT MSVC_VERSION) +if(MSVC_VERSION) + add_compile_options(/EHca /arch:AVX2 /MD) + add_definitions(-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING) +else() add_compile_options($<$:-Wno-bad-function-cast>) add_compile_options($<$:-Wno-cast-function-type>) # unlike unix where you get a *single* compiler ID string in .comment diff --git a/contrib/cross/mingw.cmake b/contrib/cross/mingw.cmake index 17c52b2d0..e31fea485 100644 --- a/contrib/cross/mingw.cmake +++ b/contrib/cross/mingw.cmake @@ -1,5 +1,6 @@ set(CMAKE_SYSTEM_NAME Windows) set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) +set(TOOLCHAIN_SUFFIX posix) add_definitions("-DWINNT_CROSS_COMPILE") @@ -14,12 +15,14 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # cross compilers to use if($ENV{COMPILER} MATCHES "clang") -set(USING_CLANG ON) -set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-clang) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-clang++) + set(USING_CLANG ON) + set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-clang) + set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-clang++) else() -set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) + set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-${TOOLCHAIN_SUFFIX}) + set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-${TOOLCHAIN_SUFFIX}) + add_compile_options("-Wa,-mbig-obj") + set(FS_LIB stdc++fs) endif() set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) diff --git a/docker/debian-windows.Dockerfile b/docker/debian-windows.Dockerfile new file mode 100644 index 000000000..500b2ecc5 --- /dev/null +++ b/docker/debian-windows.Dockerfile @@ -0,0 +1,10 @@ +FROM debian:stable + +RUN apt update && \ + apt install -y build-essential cmake git libcap-dev curl ninja-build libuv1-dev g++-mingw-w64 gcc-mingw-w64-base g++-mingw-w64-x86-64 mingw-w64 mingw-w64-common + +WORKDIR /src/ + +COPY . /src/ + +RUN make windows NINJA=ninja diff --git a/llarp/util/fs.hpp b/llarp/util/fs.hpp index bf598fdfd..d242bda73 100644 --- a/llarp/util/fs.hpp +++ b/llarp/util/fs.hpp @@ -8,10 +8,7 @@ #define PATH_SEP "/" #endif -#ifdef WIN32 -#include -namespace fs = std::filesystem; -#elif defined(LOKINET_USE_CPPBACKPORT) +#if defined(LOKINET_USE_CPPBACKPORT) #include namespace fs = cpp17::filesystem; #else diff --git a/llarp/util/threading.hpp b/llarp/util/threading.hpp index 6b885f175..fb3608171 100644 --- a/llarp/util/threading.hpp +++ b/llarp/util/threading.hpp @@ -5,7 +5,7 @@ #include #include -#ifdef WIN32 +#if defined(WIN32) && !defined(__GNUC__) #include using pid_t = int; #else diff --git a/vendor/abseil-cpp/absl/synchronization/internal/waiter.h b/vendor/abseil-cpp/absl/synchronization/internal/waiter.h index 4daf09382..80c58b325 100644 --- a/vendor/abseil-cpp/absl/synchronization/internal/waiter.h +++ b/vendor/abseil-cpp/absl/synchronization/internal/waiter.h @@ -19,7 +19,7 @@ #include "absl/base/config.h" #ifdef _WIN32 -#include +#include #else #include #endif @@ -131,12 +131,12 @@ class Waiter { std::atomic wakeup_count_; #else - #error Unknown ABSL_WAITER_MODE +#error Unknown ABSL_WAITER_MODE #endif }; } // namespace synchronization_internal -} // inline namespace lts_2018_12_18 +} // namespace lts_2018_12_18 } // namespace absl #endif // ABSL_SYNCHRONIZATION_INTERNAL_WAITER_H_