ci: add GitHub actions for Linux and Windows builds

We build a "static" binary for Windows now to avoid distributing the
dependencies as DLLs.
This commit is contained in:
Matthias Schiffer 2021-12-19 23:12:25 +01:00
parent 37340926f4
commit 00b93c507d
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
5 changed files with 151 additions and 0 deletions

View file

View file

@ -0,0 +1,22 @@
set(TARGET x86_64-w64-mingw32)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.github/toolchains/${TARGET})
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSROOT /usr/${TARGET})
set(CMAKE_C_COMPILER ${TARGET}-gcc)
set(CMAKE_CXX_COMPILER ${TARGET}-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/lib/pkgconfig:${CMAKE_SYSROOT}/share/pkgconfig)
set(ENV{PKG_CONFIG_PATH} $ENV{PKG_CONFIG_LIBDIR})
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_EXE_LINKER_FLAGS "-static")

View file

@ -0,0 +1,5 @@
# Hack: The toolchain file is evaluated too early to set the library suffixes, so we use a wrapper
# around FindPkgConfig set it right before we search for libraries.
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
include(${CMAKE_ROOT}/Modules/FindPkgConfig.cmake)