ci: produce online-server-windows artifacts (#120)

This commit is contained in:
Pedro Lara Campos 2024-05-19 12:34:55 -03:00 committed by GitHub
parent 8eaa0462a7
commit db5b890728
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 2 deletions

View File

@ -20,6 +20,8 @@ jobs:
submodules: true
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Create result directory
run: mkdir ${{ runner.temp }}/result
- name: Build Decomp Debug Linux32 GCC
run: nix build -L --no-link --keep-going '.?submodules=1#decomp.debug.native32.gcc'
- name: Build Decomp Debug Linux32 Clang
@ -34,3 +36,11 @@ jobs:
run: nix build -L --no-link --keep-going '.?submodules=1#online-server.release.native32.gcc'
- name: Build Server Release ARM32 GCC
run: nix build -L --no-link --keep-going '.?submodules=1#online-server.release.arm32.gcc'
- name: Build Server Release Mingw2 GCC
run: nix build -L --keep-going '.?submodules=1#online-server.release.mingw32.gcc' -o ${{ runner.temp }}/result/online-server.release.mingw32.gcc
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: online-server-windows
path: |
${{ runner.temp }}/result/online-server.release.mingw32.gcc/bin

View File

@ -16,7 +16,11 @@ set(SOURCES SV_main.c)
add_executable(ctr_srv ${SOURCES})
# Link with the enet library
target_link_libraries(ctr_srv enet)
if (WIN32)
target_link_libraries(ctr_srv enet winmm ws2_32)
else()
target_link_libraries(ctr_srv enet)
endif()
# Compiler options
if(CMAKE_C_COMPILER_ID MATCHES "Clang")

View File

@ -13,6 +13,25 @@ let
mainProgram = if isWindows then "ctr_srv.exe" else "ctr_srv";
path = "mods/Windows/OnlineCTR/Network_PC/Server";
cross-enet =
if isWindows then
enet.overrideAttrs
(previousAttrs: {
nativeBuildInputs = [ cmake ];
installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp libenet.a $out/lib/
runHook postInstall
'';
meta = previousAttrs.meta // { platforms = lib.platforms.all; };
})
else enet;
in
stdenv.mkDerivation (_: {
pname = "CTR-SRV";
@ -24,7 +43,7 @@ stdenv.mkDerivation (_: {
else "source/${path}";
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ enet ];
buildInputs = [ cross-enet ];
# Disables incompatible hardening
hardeningDisable = [ "format" ];