Skip to content

Conversation

@guillaume-haerinck
Copy link
Contributor

@guillaume-haerinck guillaume-haerinck commented Jul 1, 2025

What does this PR do?

Allow to build several 3p package to the WebAssembly target thanks to emscripten compiler

Related to :

What remains :

  • Emscripten should likely be a 3p-package itself so that users can target WebAssembly without the need of installing emscripten by themself
  • Need to have all 3p required by the engine/game (and not editor) built with emscripten so that we can build the engine/game itself to WebAssembly

How was this PR tested?

Local build on windows.

Setup required for now:

Steps:

  • Clone this repository and 3p-package-script next to each other
  • From the 3p package scripts folder, open a terminal and run python .\build_package.py --search_path ..\..\3p-package-source Lua-5.4.4-rev1-emscripten
  • Build exit successfully
  • Unzip the created package and check that it is correct
  • (near future) Link package against o3de and build tests in webassembly (just need to create a wasm folder in the cloned repo and run emcmake cmake .. -DLY_3RDPARTY_PATH=YOUR_PATH then build the test targets)

Signed-off-by: guillaume-haerinck <[email protected]>

cmake_generate_cmd = [self.cmake_command,
# emcmake self configure the proper environment when targeting WebAssembly
cmake_command = self.cmake_command
Copy link
Contributor Author

@guillaume-haerinck guillaume-haerinck Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure about this approach, we might want to setup the same environment as emcmake is doing in the configure json file. Yet this is the easiest and lowest maintenance path so I let the build system pro decide on what is best

Signed-off-by: guillaume-haerinck <[email protected]>
Signed-off-by: guillaume-haerinck <[email protected]>
Signed-off-by: guillaume-haerinck <[email protected]>
Signed-off-by: guillaume-haerinck <[email protected]>
Signed-off-by: guillaume-haerinck <[email protected]>
Signed-off-by: guillaume-haerinck <[email protected]>
Signed-off-by: guillaume-haerinck <[email protected]>
Signed-off-by: guillaume-haerinck <[email protected]>
@guillaume-haerinck guillaume-haerinck marked this pull request as ready for review July 3, 2025 06:39
@guillaume-haerinck guillaume-haerinck changed the title [WIP] Add support for WebAssembly builds of 3p-packages Add support for WebAssembly builds of some 3p-packages Jul 3, 2025
@guillaume-haerinck guillaume-haerinck requested review from a team July 4, 2025 16:17
@@ -1 +1,2 @@
package-system/Crashpad/add_o3de_handler_extensions.patch eol=lf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gitattributes files can be in any folder, why not put this in a .gitattributes file in the same folder as the file it affects?

"custom_additional_compile_definitions":[
"GTEST_HAS_TR1_TUPLE=0",
"GTEST_OS_SUPPORTS_DEATH_TEST=0"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm under the impression that we now build googletest as an inline fetchcontent build, this package is unused. see Code\Framework\AzTest\3rdParty\Findgoogletest.cmake

"googlebenchmark-1.7.0-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googlebenchmark --platform-name Windows --package-root ../../package-system --clean",
"googletest-1.8.1-rev4-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googletest --platform-name Android --package-root ../../package-system --clean",
"googletest-1.8.1-rev4-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googletest --platform-name Windows --package-root ../../package-system --clean",
"googletest-1.8.1-rev4-emscripten": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googletest --platform-name Emscripten --package-root ../../package-system --clean",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.. you can do this, but the engine doesn't use it.

Signed-off-by: guillaume-haerinck <[email protected]>
@guillaume-haerinck
Copy link
Contributor Author

Noted just updated the files following your feedbacks :)

Signed-off-by: guillaume-haerinck <[email protected]>
@nick-l-o3de
Copy link
Contributor

This looks good, but how do we want to proceed with this, should we keep this alive while the emscripten changes happen on o3de, until its all in, or do you expect no further revisions of this package need be made?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants