-
-
Notifications
You must be signed in to change notification settings - Fork 618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Emscripten system and emcc toolset support. #2376
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- | ||
-- emcc.lua | ||
-- Emscripten emcc toolset. | ||
-- Copyright (c) 2024 Premake project | ||
-- | ||
|
||
local p = premake | ||
local clang = p.tools.clang | ||
|
||
p.tools.emcc = table.deepcopy(clang, {}) | ||
local emcc = p.tools.emcc | ||
|
||
emcc.tools = { | ||
cc = "emcc", | ||
cxx = "em++", | ||
ar = "emar" | ||
} | ||
|
||
function emcc.gettoolname(cfg, tool) | ||
return emcc.tools[tool] | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
-- | ||
-- tests/test_emcc.lua | ||
-- Automated test suite for the emcc toolset interface. | ||
-- Copyright (c) 2024 Premake project | ||
-- | ||
|
||
local p = premake | ||
local suite = test.declare("tools_emcc") | ||
|
||
local emcc = p.tools.emcc | ||
|
||
|
||
-- | ||
-- Setup/teardown | ||
-- | ||
|
||
local wks, prj, cfg | ||
|
||
function suite.setup() | ||
wks, prj = test.createWorkspace() | ||
system "emscripten" | ||
end | ||
|
||
local function prepare() | ||
cfg = test.getconfig(prj, "Debug") | ||
end | ||
|
||
|
||
-- | ||
-- Check the selection of tools based on the target system. | ||
-- | ||
|
||
function suite.tools_onDefault() | ||
system "emscripten" | ||
prepare() | ||
test.isequal("wasm32", cfg.architecture) | ||
test.isequal("emcc", emcc.gettoolname(cfg, "cc")) | ||
test.isequal("em++", emcc.gettoolname(cfg, "cxx")) | ||
test.isequal("emar", emcc.gettoolname(cfg, "ar")) | ||
end | ||
|
||
function suite.tools_onWASM64() | ||
system "emscripten" | ||
architecture "WASM64" | ||
prepare() | ||
test.isequal("wasm64", cfg.architecture) | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ If no system is specified, Premake will identify and target the current operatin | |
* aix | ||
* android | ||
* bsd | ||
* [emscripten](https://emscripten.org/) | ||
* [haiku](http://www.haiku-os.org) | ||
* ios | ||
* linux | ||
|
@@ -23,6 +24,8 @@ If no system is specified, Premake will identify and target the current operatin | |
* windows | ||
* xbox360 | ||
|
||
To note: `emscripten` at the moment is only supported for the `gmake` and `gmake2` actions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For uniformity with the rest of the docs, use a separate "Availability" header and make any notes beneath that. See https://raw.githubusercontent.com/premake/premake-core/refs/heads/master/website/docs/debugformat.md There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty sure that others values are not cross-generator neither. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably clean them up at some point, then. |
||
|
||
### Applies To ### | ||
|
||
Project configurations. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why it's marking this as many changed lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's due to formatting to make the table look nicer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/me dislikes vertical alignment in general :-)
BTW, second&third columns are not aligned correctly.