Commit 95c21ab3 authored by mercury233's avatar mercury233 Committed by GitHub

add linux build (#735)

parent bc80cecf
...@@ -7,7 +7,7 @@ on: ...@@ -7,7 +7,7 @@ on:
branches: [ "master" ] branches: [ "master" ]
jobs: jobs:
build: build-windows:
runs-on: windows-2022 runs-on: windows-2022
steps: steps:
...@@ -16,24 +16,27 @@ jobs: ...@@ -16,24 +16,27 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Download dependencies - name: Download lua
run: | id: lua
bash -c " \ uses: mercury233/action-cache-download-file@v1.0.0
curl -Z --retry 5 --connect-timeout 30 --location \ with:
--create-dirs --output-dir temp --remote-name-all \ url: https://www.lua.org/ftp/lua-5.4.7.tar.gz
https://www.lua.org/ftp/lua-5.4.7.tar.gz \
https://github.com/premake/premake-core/releases/download/v5.0.0-beta5/premake-5.0.0-beta5-windows.zip \
; exit 0"
- name: Lua - name: Lua
run: | run: |
tar -xzf temp/lua-5.4.7.tar.gz tar -xzf ${{ steps.lua.outputs.filepath }}
move lua-5.4.7 lua move lua-5.4.7 lua
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/premake/premake-core/releases/download/v5.0.0-beta5/premake-5.0.0-beta5-windows.zip
- name: Premake - name: Premake
run: | run: |
mkdir premake-5 mkdir premake-5
tar -C premake-5 -xzf temp/premake-5.0.0-beta5-windows.zip tar -C premake-5 -xzf ${{ steps.premake.outputs.filepath }}
copy premake\lua.lua lua\premake5.lua copy premake\lua.lua lua\premake5.lua
copy premake\dll.lua dll.lua copy premake\dll.lua dll.lua
.\premake-5\premake5.exe vs2022 --file=dll.lua .\premake-5\premake5.exe vs2022 --file=dll.lua
...@@ -41,14 +44,18 @@ jobs: ...@@ -41,14 +44,18 @@ jobs:
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2 uses: microsoft/setup-msbuild@v2
- name: Build - name: Build x32
run: | run: |
msbuild build\ocgcoredll.sln /t:Build /p:"Configuration=Release;Platform=Win32" msbuild build\ocgcoredll.sln /t:Build /p:"Configuration=Release;Platform=Win32"
- name: Build x64
run: |
msbuild build\ocgcoredll.sln /t:Build /p:"Configuration=Release;Platform=x64" msbuild build\ocgcoredll.sln /t:Build /p:"Configuration=Release;Platform=x64"
- name: Upload build artifacts - name: Upload build artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ocgcore-windows
path: | path: |
build\bin\x32\Release\ocgcore.dll build\bin\x32\Release\ocgcore.dll
build\bin\x64\Release\ocgcore.dll build\bin\x64\Release\ocgcore.dll
...@@ -63,3 +70,63 @@ jobs: ...@@ -63,3 +70,63 @@ jobs:
title: "Development Build" title: "Development Build"
files: | files: |
build/bin/x64/Release/ocgcore.dll build/bin/x64/Release/ocgcore.dll
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.lua.org/ftp/lua-5.4.7.tar.gz
- name: Lua
run: |
tar -xzf ${{ steps.lua.outputs.filepath }}
mv lua-5.4.7 lua
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/premake/premake-core/releases/download/v5.0.0-beta5/premake-5.0.0-beta5-linux.tar.gz
- name: Premake
run: |
mkdir premake-5
tar -C premake-5 -xzf ${{ steps.premake.outputs.filepath }}
cp premake/lua.lua lua/premake5.lua
cp premake/dll.lua dll.lua
chmod +x premake-5/premake5
./premake-5/premake5 gmake --file=dll.lua
- name: Build x32
run: |
cd build
make -j 4 config=release_x32
cd ..
- name: Build x64
run: |
cd build
make -j 4 config=release_x64
cd ..
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ocgcore-linux
path: |
build/bin/x32/Release/libocgcore.so
build/bin/x64/Release/libocgcore.so
...@@ -12,6 +12,7 @@ end ...@@ -12,6 +12,7 @@ end
workspace "ocgcoredll" workspace "ocgcoredll"
location "build" location "build"
language "C++" language "C++"
cppdialect "C++14"
configurations { "Release", "Debug" } configurations { "Release", "Debug" }
platforms { "x32", "x64" } platforms { "x32", "x64" }
...@@ -47,6 +48,19 @@ workspace "ocgcoredll" ...@@ -47,6 +48,19 @@ workspace "ocgcoredll"
buildoptions { "/utf-8" } buildoptions { "/utf-8" }
defines { "_CRT_SECURE_NO_WARNINGS" } defines { "_CRT_SECURE_NO_WARNINGS" }
filter "not action:vs*"
buildoptions { }
filter "system:bsd"
defines { "LUA_USE_POSIX" }
filter "system:macosx"
defines { "LUA_USE_MACOSX" }
filter "system:linux"
defines { "LUA_USE_LINUX" }
buildoptions { "-fPIC" }
filter {} filter {}
include(LUA_DIR) include(LUA_DIR)
......
...@@ -22,3 +22,4 @@ project "lua" ...@@ -22,3 +22,4 @@ project "lua"
filter "system:linux" filter "system:linux"
defines { "LUA_USE_LINUX" } defines { "LUA_USE_LINUX" }
buildoptions { "-fPIC" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment