Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: macOS Build

on: [push]

jobs:
build:
runs-on: macos-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Install premake5
run: brew install premake

- name: Run Premake
run: premake5 gmake2

- name: Build
run: make config=release -C .build

- name: Deploy
uses: softprops/action-gh-release@v0.1.7
if: startsWith(github.ref, 'refs/tags/v')
with:
files: .build/bin/Release/ObjEditing
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.build/
*.o
6 changes: 6 additions & 0 deletions bin/build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ local function generateAPI(file, name)
end

local function main(input, output)
if package.config:sub(1, 1) == '\\' then
os.execute('if not exist "' .. output:gsub('/', '\\') .. '" mkdir "' .. output:gsub('/', '\\') .. '"')
else
os.execute('mkdir -p "' .. output .. '"')
end

local filePath = input:match('src/lua/(.+)$')
local fileName = input:match('/([^/]+)$')
local funcName = generateFuncName(filePath)
Expand Down
8 changes: 8 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
cd "$(dirname "$0")"

if [ -f "bin/premake5" ]; then
bin/premake5 gmake2
else
premake5 gmake2
fi
11 changes: 8 additions & 3 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ workspace 'ObjEditing'
configurations { 'Debug', 'Release' }
location '.build'
symbols 'Full'
architecture 'x86'
startproject 'ObjEditing'
flags {
'MultiProcessorCompile',
'Maps',
}

filter 'system:Windows'
architecture 'x86'
systemversion 'latest'
characterset 'MBCS'
staticruntime 'On'
defines { 'WIN32', '_WINDOWS' }
flags { 'Maps' }
filter 'configurations:Debug'
defines { '_DEBUG' }
filter 'configurations:Release'
Expand Down Expand Up @@ -70,6 +70,10 @@ project 'ObjEditing'

filter 'system:Windows'
defines { 'PLATFORM_WINDOWS' }
filter 'system:macosx'
defines { 'PLATFORM_MACOS' }
filter 'system:linux'
defines { 'PLATFORM_LINUX' }

filter 'files:**.lua'
buildmessage 'Compiling %{file.name}'
Expand Down Expand Up @@ -136,7 +140,8 @@ do -- for lua
end

function generateBuildLuaCommand(_ENV)
local lua = path.join(cfg.buildtarget.directory, 'Lua.exe')
local luaExe = os.target() == 'windows' and 'Lua.exe' or 'Lua'
local lua = path.join(cfg.buildtarget.directory, luaExe)
local script = path.join(_MAIN_SCRIPT_DIR, 'bin/build.lua')
local out = getGeneratedDir(_ENV)

Expand Down
6 changes: 3 additions & 3 deletions src/objediting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include "luaapi.h"
#include "luasource.h"

constexpr char* CMDLINE_MAP = "map";
constexpr char* CMDLINE_OUTPUT = "output";
constexpr char* CMDLINE_DUMP_TO_SCRIPT = "dump";
constexpr const char* CMDLINE_MAP = "map";
constexpr const char* CMDLINE_OUTPUT = "output";
constexpr const char* CMDLINE_DUMP_TO_SCRIPT = "dump";

static void RegisterTo(lua_State* L, lua_CFunction f, const char* table, const char* name)
{
Expand Down
2 changes: 2 additions & 0 deletions src/os_chdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#if PLATFORM_WINDOWS
#include "Windows.h"
#define PATH_MAX 4096
#else
#include <unistd.h>
#endif

int do_chdir(lua_State* L, const char* path)
Expand Down
Loading