fix(ci): missing uv.h header during compilation (#3)
This commit is contained in:
+40
-31
@@ -13,16 +13,18 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-libuv:
|
||||
build-libuv-linux:
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
LIBUV_REF: 'v1.44.2'
|
||||
CC: "clang-14"
|
||||
CXX: "clang++-14"
|
||||
steps:
|
||||
- name: Checkout repository with submodules
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Linux dependencies
|
||||
shell: bash
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
@@ -31,42 +33,49 @@ jobs:
|
||||
libc6-dev libc6-dev-i386 linux-libc-dev \
|
||||
linux-libc-dev:i386 lib32z1-dev ${{ env.CC }}
|
||||
|
||||
- name: Select compiler
|
||||
shell: bash
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
run: |
|
||||
echo "CC=${{ env.CC }}" >> $GITHUB_ENV
|
||||
echo "CXX=${{ env.CXX }}" >> $GITHUB_ENV
|
||||
${{ env.CC }} --version
|
||||
${{ env.CXX }} --version
|
||||
|
||||
- name: Checkout libuv
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: libuv/libuv
|
||||
ref: ${{ env.LIBUV_REF }}
|
||||
path: libuv
|
||||
submodules: recursive
|
||||
|
||||
- name: Build libuv
|
||||
- name: Build and install libuv (Linux x86)
|
||||
working-directory: libuv
|
||||
run: |
|
||||
bash autogen.sh
|
||||
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" --disable-shared --enable-static
|
||||
make -j 8
|
||||
./configure --prefix="$(pwd)/dist" --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" --disable-shared --enable-static
|
||||
make -j8
|
||||
make install
|
||||
|
||||
- name: Upload libuv
|
||||
- name: Upload libuv Linux Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: libuv
|
||||
include-hidden-files: true
|
||||
path: libuv
|
||||
if-no-files-found: error
|
||||
name: libuv-linux
|
||||
path: libuv/dist
|
||||
retention-days: 1
|
||||
|
||||
build-libuv-windows:
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Checkout repository with submodules
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build and install libuv (Windows x86)
|
||||
shell: cmd
|
||||
working-directory: libuv
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -A Win32 -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -DCMAKE_INSTALL_PREFIX=..\dist
|
||||
cmake --build . --config Release --target install
|
||||
|
||||
- name: Upload libuv Windows Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: libuv-windows
|
||||
path: libuv/dist
|
||||
retention-days: 1
|
||||
|
||||
build-release-extension:
|
||||
uses: srcdslab/ci-workflows/.github/workflows/shared_build_release_am_extension.yml@v1
|
||||
needs: build-libuv
|
||||
needs: [build-libuv-linux, build-libuv-windows]
|
||||
with:
|
||||
sdks: "sdk2013"
|
||||
artifact-path: "."
|
||||
artifact-path: "libuv/dist"
|
||||
submodules: "recursive"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
[submodule "sm-ext-common"]
|
||||
path = sm-ext-common
|
||||
url = https://github.com/srcdslab/sm-ext-common
|
||||
[submodule "libuv"]
|
||||
path = libuv
|
||||
url = https://github.com/libuv/libuv.git
|
||||
|
||||
Submodule
+1
Submodule libuv added at 9d51562c10
+57
-16
@@ -1,4 +1,3 @@
|
||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||
import os
|
||||
|
||||
projectName = 'AsyncSocket'
|
||||
@@ -7,9 +6,13 @@ project = builder.LibraryProject(projectName)
|
||||
project.sources += [
|
||||
os.path.join(Extension.ext_root, 'src', 'extension.cpp'),
|
||||
os.path.join(Extension.ext_root, 'src', 'context.cpp'),
|
||||
os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp')
|
||||
os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp'),
|
||||
]
|
||||
|
||||
# Include header path directly from submodule
|
||||
libuv_inc = os.path.join(Extension.ext_root, 'libuv', 'include')
|
||||
libuv_root = os.path.join(Extension.ext_root, 'libuv')
|
||||
|
||||
for sdk_name in Extension.sdks:
|
||||
sdk = Extension.sdks[sdk_name]
|
||||
if sdk['name'] in ['mock']:
|
||||
@@ -19,23 +22,61 @@ for sdk_name in Extension.sdks:
|
||||
if not cxx.target.arch in sdk['platforms'][cxx.target.platform]:
|
||||
continue
|
||||
|
||||
binary = Extension.HL2ExtConfig(project, builder, cxx, projectName + '.ext', sdk)
|
||||
binary = Extension.HL2ExtConfig(
|
||||
project, builder, cxx, projectName + '.ext', sdk
|
||||
)
|
||||
|
||||
# Include uv.h path
|
||||
binary.compiler.cxxincludes += [libuv_inc]
|
||||
|
||||
# Platform-specific linking
|
||||
if cxx.target.platform == 'windows':
|
||||
binary.compiler.linkflags += ['ws2_32.lib']
|
||||
|
||||
libuv_root = os.path.join(Extension.ext_root, 'libuv')
|
||||
binary.compiler.cxxincludes += [
|
||||
os.path.join(libuv_root, 'include'),
|
||||
]
|
||||
|
||||
# TODO: add proper linux support for x64
|
||||
if cxx.target.arch in ['x86'] and cxx.target.platform in ['linux']:
|
||||
binary.compiler.linkflags += [
|
||||
os.path.join(libuv_root, '.libs', 'libuv.a'),
|
||||
'ws2_32.lib',
|
||||
'iphlpapi.lib',
|
||||
'userenv.lib',
|
||||
'dbghelp.lib',
|
||||
'synchronization.lib', # Fixes WaitOnAddress / WakeByAddressSingle
|
||||
]
|
||||
# TODO: add proper windows support for libuv
|
||||
if cxx.target.platform in ['windows']:
|
||||
binary.compiler.linkflags += ['/FORCE:UNRESOLVED']
|
||||
|
||||
# Candidates where actions/download-artifact might unpack libuv.lib
|
||||
win_candidates = [
|
||||
os.path.join(libuv_root, 'dist', 'lib', 'libuv.lib'),
|
||||
os.path.join(libuv_root, 'dist', 'libuv-windows', 'lib', 'libuv.lib'),
|
||||
os.path.join(libuv_root, 'dist', 'Release', 'libuv.lib'),
|
||||
os.path.join(Extension.ext_root, 'libuv.lib'),
|
||||
]
|
||||
|
||||
found_win_lib = None
|
||||
for cand in win_candidates:
|
||||
if os.path.exists(cand):
|
||||
found_win_lib = cand
|
||||
break
|
||||
|
||||
if found_win_lib:
|
||||
binary.compiler.linkflags += [found_win_lib]
|
||||
else:
|
||||
binary.compiler.linkflags += ['libuv.lib']
|
||||
|
||||
elif cxx.target.platform == 'linux':
|
||||
if cxx.target.arch == 'x86':
|
||||
# Candidates where actions/download-artifact might unpack libuv.a
|
||||
linux_candidates = [
|
||||
os.path.join(libuv_root, 'dist', 'lib', 'libuv.a'),
|
||||
os.path.join(libuv_root, 'dist', 'libuv-linux', 'lib', 'libuv.a'),
|
||||
os.path.join(libuv_root, 'dist', '.libs', 'libuv.a'),
|
||||
os.path.join(Extension.ext_root, 'libuv.a'),
|
||||
]
|
||||
|
||||
found_linux_lib = None
|
||||
for cand in linux_candidates:
|
||||
if os.path.exists(cand):
|
||||
found_linux_lib = cand
|
||||
break
|
||||
|
||||
if found_linux_lib:
|
||||
binary.compiler.linkflags += [found_linux_lib]
|
||||
else:
|
||||
binary.compiler.linkflags += ['-luv']
|
||||
|
||||
Extension.extensions += builder.Add(project)
|
||||
|
||||
Reference in New Issue
Block a user