Skip to content

Add macOS (and Linux) build support#3

Merged
dulingzhi merged 6 commits into
masterfrom
copilot/support-osx
Apr 30, 2026
Merged

Add macOS (and Linux) build support#3
dulingzhi merged 6 commits into
masterfrom
copilot/support-osx

Conversation

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor
  • Fix premake5.lua: move architecture 'x86' to Windows-only filter
  • Fix premake5.lua: add macOS/Linux platform defines (PLATFORM_MACOS, PLATFORM_LINUX)
  • Fix premake5.lua: use platform-specific Lua executable name
  • Add init.sh shell script for macOS/Linux users
  • Add GitHub Actions workflow for macOS build
  • Fix src/os_chdir.c: add #include <unistd.h> for chdir() on macOS/Linux
  • Fix src/objediting.cpp: change constexpr char* to constexpr const char* for string literals
  • Add *.o to .gitignore to prevent build artifacts from being committed
  • Fix premake5.lua: move Maps linker flag to Windows-only filter (Apple ld does not support -Map=)
  • Fix bin/build.lua: create output directory before writing generated .lua.cpp/.lua.h files (.build/lua/ didn't exist on macOS/Linux)

Copilot AI linked an issue Apr 30, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add support for macOS Add macOS (and Linux) build support Apr 30, 2026
Copilot AI requested a review from dulingzhi April 30, 2026 10:20
@dulingzhi

Copy link
Copy Markdown
Member

@copilot compile error

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot compile error

Fixed in ffac8f5. Two compile errors were addressed:

  1. src/os_chdir.c: Added #include <unistd.h> in the non-Windows branch — chdir() requires this header on macOS/Linux; without it, modern compilers (Clang and GCC ≥14) error on the implicit function declaration.

  2. src/objediting.cpp: Changed constexpr char*constexpr const char* for the three string literal constants — assigning string literals (type const char[]) to char* is ill-formed in C++11 and is an error in Clang.

@dulingzhi

Copy link
Copy Markdown
Member

@copilot compile error

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot compile error

Fixed in 743c2b7. The macOS build was failing with ld: unknown options: -Map=bin/Release/Lua.map because Apple's linker doesn't support the -Map option (a GNU ld feature). The 'Maps' premake flag that generates it has been moved from the workspace-level flags {} into the filter 'system:Windows' block so it only applies on Windows.

@dulingzhi dulingzhi marked this pull request as ready for review April 30, 2026 12:46
@dulingzhi

Copy link
Copy Markdown
Member

@copilot fix macOS build failed

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix macOS build failed

Fixed in 205d9fe. The macOS build was failing because bin/build.lua tried to write generated files to .build/lua/ before that directory existed — on macOS/Linux the gmake build system doesn't auto-create intermediate output directories the way Windows does. Added mkdir -p (or the Windows equivalent) at the start of main() before the first writeFile call.

@dulingzhi dulingzhi merged commit 0b71038 into master Apr 30, 2026
2 of 5 checks passed
@dulingzhi dulingzhi deleted the copilot/support-osx branch April 30, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support osx

2 participants