CI: added msys2-clang Windows build

This commit is contained in:
SChernykh 2023-08-15 13:31:28 +02:00
parent 2877e5dfc1
commit 7630c1a883
6 changed files with 54 additions and 12 deletions

View file

@ -191,6 +191,12 @@ jobs:
timeout-minutes: 45
runs-on: windows-latest
strategy:
matrix:
config:
- {c: "gcc", cxx: "g++", linker: ""}
- {c: "clang", cxx: "clang++", linker: "-fuse-ld=lld"}
defaults:
run:
shell: msys2 {0}
@ -205,12 +211,12 @@ jobs:
uses: eine/setup-msys2@v2
with:
update: true
install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake make
install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-cmake make
- name: Build libcurl
run: |
cd external/src/curl
cmake . -G "Unix Makefiles" -DCMAKE_C_FLAGS="-Os" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF
cmake . -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS="-Os" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF
make -j$(nproc)
cd lib && mkdir .libs && cp libcurl.a .libs
@ -219,7 +225,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_C_FLAGS='-Os' -DBUILD_TESTING=OFF
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS='-Os' -DBUILD_TESTING=OFF
make -j$(nproc)
- name: Build libzmq
@ -227,14 +233,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DSTATIC_LIBS=ON
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_CXX_FLAGS='${{ matrix.config.linker }}' -DSTATIC_LIBS=ON
make -j$(nproc)
- name: Build tests
@ -242,7 +248,7 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DSTATIC_LIBS=ON
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_CXX_FLAGS='${{ matrix.config.linker }}' -DSTATIC_LIBS=ON
make -j$(nproc)
- name: Run tests
@ -254,7 +260,7 @@ jobs:
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: p2pool-msys2.exe
name: p2pool-msys2-${{ matrix.config.c }}.exe
path: build/p2pool.exe
build-windows-msbuild:
@ -307,7 +313,7 @@ jobs:
build-macos:
timeout-minutes: 15
timeout-minutes: 20
runs-on: ${{ matrix.os }}
strategy:

24
.github/workflows/source-snapshot.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: source-snapshot
on: [push, pull_request]
jobs:
source-snapshot:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Compress source code
run: |
mkdir build
XZ_OPT=-e9 tar --exclude=".git" --exclude="build" -f build/p2pool.tar.xz -c ../p2pool --xz
- name: Archive source code
uses: actions/upload-artifact@v3
with:
name: p2pool.tar.xz
path: build/p2pool.tar.xz

View file

@ -318,6 +318,8 @@ if (STATIC_BINARY OR STATIC_LIBS)
endif()
endif()
set(STATIC_LIBS "")
if (WITH_RANDOMX)
set(STATIC_LIBS randomx)
endif()
@ -328,7 +330,7 @@ if (STATIC_BINARY OR STATIC_LIBS)
if (WIN32)
set(STATIC_LIBS ${STATIC_LIBS} ws2_32 iphlpapi userenv psapi dnsapi dbghelp)
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
if ((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang))
set(STATIC_LIBS ${STATIC_LIBS} bcrypt)
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)

View file

@ -68,7 +68,12 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
else()
set(GENERAL_FLAGS "-pthread")
endif()
set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
if (NOT DEV_WITH_MSAN)

View file

@ -96,7 +96,7 @@ include_directories(googletest/googletest/include)
if (WIN32)
set(LIBS ${LIBS} ws2_32 iphlpapi userenv psapi dnsapi dbghelp)
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
if ((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang))
set(LIBS ${LIBS} bcrypt)
endif()
add_definitions(-DCURL_STATICLIB)

View file

@ -41,7 +41,12 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Ob1 /Ot /Zi /MT")
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
else()
set(GENERAL_FLAGS "-pthread")
endif()
set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal")
set(OPTIMIZATION_FLAGS "-Ofast -funroll-loops -fmerge-all-constants -flto")