-
-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Emscripten system and emcc toolset support. (#2376)
* Add Emscripten system and emcc toolset support. * Add system docs.
- Loading branch information
Showing
12 changed files
with
140 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters