Skip to content

Commit

Permalink
added win64 workflow (test)
Browse files Browse the repository at this point in the history
  • Loading branch information
afwbkbc committed Jul 8, 2024
1 parent 9ceadc0 commit b180818
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 67 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/buildall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: GLSMAC autobuild

on:
push:
branches: [ "stable" ]
pull_request:
branches: [ "stable" ]

jobs:

prepare:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.id }}
ver: ${{ steps.info.outputs.ver }}
sha: ${{ steps.info.outputs.sha }}
steps:
- uses: benjlevesque/short-sha@v2.1
id: short-sha
with:
length: 7
- uses: dev-drprasad/delete-older-releases@v0.2.0
with:
keep_latest: 4
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: info
id: info
env:
ver: v0.3
sha: ${{ steps.short-sha.outputs.sha }}
run: |
echo ${{ env.ver }} ${{ env.sha }}
echo "ver=${{ env.ver }}" >> $GITHUB_OUTPUT
echo "sha=${{ env.sha }}" >> $GITHUB_OUTPUT
- name: create-release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.info.outputs.ver }}-${{ steps.info.outputs.sha }}
release_name: ${{ steps.info.outputs.ver }}-${{ steps.info.outputs.sha }}
draft: false
prerelease: false


build_linux:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install_dependencies
run: |
sudo apt-get update
sudo apt-get install libfreetype-dev libsdl2-dev libsdl2-image-dev libglu-dev libglew-dev libossp-uuid-dev libyaml-cpp-dev
- name: prepare
run: |
mkdir build
- name: cmake
working-directory: ./build
run: cmake -DCMAKE_BUILD_TYPE=Portable64 ..
- name: make
working-directory: ./build
run: make
- name: data
working-directory: ./build
run: mv ../GLSMAC_data bin/
- name: pack
working-directory: ./build
run: tar -C bin -zcvf GLSMAC.tar.gz GLSMAC GLSMAC_data
- name: publish
uses: actions/upload-artifact@v3
with:
name: GLSMAC-linux64-bin
path: |
./build/GLSMAC.tar.gz
- name: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.upload_url }}
asset_path: ./build/GLSMAC.tar.gz
asset_name: GLSMAC-${{ needs.prepare.outputs.ver }}-linux64-${{ needs.prepare.outputs.sha }}.tar.gz
asset_content_type: application/gzip


build_windows:
needs: [prepare]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: install_dependencies
run: |
choco install ninja
- name: prepare
run: |
mkdir build
- name: cmake
working-directory: ./build
run: cmake -G Ninja -DCMAKE_BUILD_TYPE=Portable64 -DVENDORED_DEPENDENCIES=1 ..
- name: make
working-directory: ./build
run: ninja
- name: data
working-directory: ./build
run: mv ../GLSMAC_data bin/
- name: pack
working-directory: ./build/bin
run: Compress-Archive -Path GLSMAC.exe,GLSMAC_data -Destination ../GLSMAC.zip
- name: publish
uses: actions/upload-artifact@v3
with:
name: GLSMAC-windows64-bin
path: |
./build/GLSMAC.zip
- name: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.upload_url }}
asset_path: ./build/GLSMAC.zip
asset_name: GLSMAC-${{ needs.prepare.outputs.ver }}-win64-${{ needs.prepare.outputs.sha }}.zip
asset_content_type: application/gzip
66 changes: 0 additions & 66 deletions .github/workflows/c-cpp.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ INCLUDE_DIRECTORIES( "src" )
IF ( VISUAL_STUDIO ) # (Provided in CMakePresets)
ADD_COMPILE_DEFINITIONS( _ITERATOR_DEBUG_LEVEL=0 )
ADD_COMPILE_DEFINITIONS( VISUAL_STUDIO )
ELSEIF ( WIN32 ) # probably mingw or github runner
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PRIVATE wsock32 )
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PRIVATE ws2_32 )
# TARGET_LINK_OPTIONS( ${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++ -static-winpthread )
TARGET_LINK_OPTIONS( ${PROJECT_NAME} PRIVATE -static )
ENDIF ()

# needed for some uncommon IDE and OS combinations
Expand Down
4 changes: 3 additions & 1 deletion src/env/Win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#if !defined(NOMINMAX)
#define NOMINMAX
#endif
#define WIN32_LEAN_AND_MEAN

#define _WINSOCKAPI_
#define _WINSOCKAPI_
#include <WinSock2.h> // TODO: check if compiles with mingw
#include <windows.h>

Expand Down

0 comments on commit b180818

Please sign in to comment.