-
Couldn't load subscription status.
- Fork 27
Add support for WebAssembly builds of some 3p-packages #284
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
base: main
Are you sure you want to change the base?
Changes from 11 commits
37beef1
580bf3b
67a7eb3
f0fd55c
2b3ba33
7868a25
76b444c
2ce13f9
1968001
c0ace28
630f851
68dae32
41ca648
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 |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| package-system/Crashpad/add_o3de_handler_extensions.patch eol=lf | ||
| package-system/zlib/emscripten-alias-fix.patch eol=lf | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,6 +175,11 @@ jobs: | |
| if: runner.os == 'Windows' | ||
| uses: ilammy/[email protected] | ||
|
|
||
| - name: Setup Emscripten | ||
| uses: mymindstorm/setup-emsdk@v14 | ||
| with: | ||
| version: 4.0.10 | ||
|
|
||
| - name: Setup NDK | ||
| env: | ||
| ANDROID_NDK_VERSION: 25.1.8937393 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,7 @@ | |
| for situations where the generator does not support multiple configs) the key can contain the | ||
| suffix of the configuration name (cmake_generate_args_debug, cmake_generate_args_release). | ||
| For common args that should apply to every config, see cmake_generate_args_common above. | ||
| Note : If your Target Platform is Emscripten, the generate call is wrapped by emcmake utility | ||
|
|
||
| * cmake_build_args : Additional build args to pass to cmake during the cmake build command | ||
|
|
||
|
|
@@ -191,6 +192,9 @@ | |
|
|
||
| """ | ||
|
|
||
| # The platform used to target WebAssembly | ||
| EMSCRIPTEN_PLATFORM = 'Emscripten' | ||
|
|
||
| # The current path of this script, expected to be under '3rdPartySource/Scripts' | ||
| CURRENT_PATH = pathlib.Path(os.path.dirname(__file__)).resolve() | ||
|
|
||
|
|
@@ -746,7 +750,12 @@ def build_and_install_cmake(self): | |
| if self.package_info.cmake_src_subfolder: | ||
| cmakelists_folder = cmakelists_folder / self.package_info.cmake_src_subfolder | ||
|
|
||
| cmake_generate_cmd = [self.cmake_command, | ||
| # emcmake self configure the proper environment when targeting WebAssembly | ||
| cmake_command = self.cmake_command | ||
|
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. 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 |
||
| if self.package_info.platform_name == EMSCRIPTEN_PLATFORM: | ||
| cmake_command = 'emcmake ' + self.cmake_command | ||
|
|
||
| cmake_generate_cmd = [cmake_command, | ||
| '-S', str(cmakelists_folder.resolve()), | ||
| '-B', str(self.build_folder.name)] | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| @rem # | ||
| @rem # Copyright (c) Contributors to the Open 3D Engine Project. | ||
| @rem # For complete copyright and license terms please see the LICENSE at the root of this distribution. | ||
| @rem # | ||
| @rem # SPDX-License-Identifier: Apache-2.0 OR MIT | ||
| @rem # | ||
| @rem # | ||
|
|
||
| exit /b 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,9 @@ | |
| "package_license_file":"LICENSE", | ||
| "cmake_find_template":"Findgoogletest.cmake.template", | ||
| "cmake_find_target":"Findgoogletest.cmake", | ||
| "cmake_generate_args_common": [ | ||
| "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" | ||
| ], | ||
| "Platforms":{ | ||
| "Windows":{ | ||
| "Windows":{ | ||
|
|
@@ -59,6 +62,19 @@ | |
| "custom_additional_libraries":[ | ||
|
|
||
| ] | ||
| }, | ||
| "Emscripten": { | ||
| "cmake_generate_args" : [ | ||
| "-G", | ||
| "Ninja", | ||
| "-DCMAKE_CXX_FLAGS=\"-fPIC\"", | ||
| "-DCMAKE_CXX_STANDARD=17", | ||
| "-DCMAKE_BUILD_TYPE=Release" | ||
| ], | ||
| "custom_additional_compile_definitions":[ | ||
| "GTEST_HAS_TR1_TUPLE=0", | ||
| "GTEST_OS_SUPPORTS_DEATH_TEST=0" | ||
| ] | ||
|
||
| } | ||
| }, | ||
| "Darwin":{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| index 0fe939d..0cce489 100644 | ||
| --- a/CMakeLists.txt | ||
| +++ b/CMakeLists.txt | ||
| @@ -201,7 +201,7 @@ endif() | ||
|
|
||
| if(UNIX) | ||
| # On unix-like platforms the library is almost always called libz | ||
| - set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) | ||
| + set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z) | ||
| if(NOT APPLE) | ||
| set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") | ||
| endif() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,17 +16,20 @@ | |
| "DirectXShaderCompilerDxc-1.7.2308-o3de-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Windows --package-root ../../package-system --clean", | ||
| "expat-2.4.2-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Android --package-root ../../package-system/expat/temp --clean", | ||
| "expat-2.4.2-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Windows --package-root ../../package-system/expat/temp --clean", | ||
| "expat-2.4.2-rev2-emscripten": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Emscripten --package-root ../../package-system/expat/temp --clean", | ||
| "freetype-2.11.1-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Android --package-root ../../package-system/freetype/temp --clean", | ||
| "freetype-2.11.1-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Windows --package-root ../../package-system/freetype/temp --clean", | ||
| "googlebenchmark-1.7.0-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googlebenchmark --platform-name Android --package-root ../../package-system --clean", | ||
| "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", | ||
|
||
| "ISPCTexComp-36b80aa-rev1-windows": "package-system/ISPCTexComp/build_package_image.py", | ||
| "libsamplerate-0.2.1-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libsamplerate --platform-name Android --package-root ../../package-system --custom-toolchain-file ../../Scripts/cmake/Platform/Android/Toolchain_android.cmake --clean", | ||
| "libsamplerate-0.2.1-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libsamplerate --platform-name Windows --package-root ../../package-system --clean", | ||
| "Lua-5.4.4-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Lua --platform-name Android --package-root ../../package-system/Lua/temp --clean", | ||
| "Lua-5.4.4-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Lua --platform-name Windows --package-root ../../package-system/Lua/temp --clean", | ||
| "Lua-5.4.4-rev1-emscripten": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Lua --platform-name Emscripten --package-root ../../package-system/Lua/temp --clean", | ||
| "lz4-1.9.4-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/lz4 --platform-name Android --package-root ../../package-system/lz4/temp --clean", | ||
| "lz4-1.9.4-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/lz4 --platform-name Windows --package-root ../../package-system/lz4/temp --clean", | ||
| "mcpp-2.7.2_az.2-rev1-windows": "package-system/mcpp/get_and_build_mcpp.py mcpp-2.7.2_az.2-rev1", | ||
|
|
@@ -62,6 +65,7 @@ | |
| "vulkan-validationlayers-1.3.261-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/vulkan-validationlayers --platform-name Windows --package-root ../../package-system --clean", | ||
| "vulkan-validationlayers-1.3.261-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/vulkan-validationlayers --platform-name Android --package-root ../../package-system --clean", | ||
| "zlib-1.2.11-rev5-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Android --package-root ../../package-system --clean", | ||
| "zlib-1.2.11-rev5-emscripten": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Emscripten --package-root ../../package-system --clean", | ||
| "zlib-1.2.11-rev5-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Windows --package-root ../../package-system --clean" | ||
| }, | ||
| "build_from_folder": { | ||
|
|
@@ -81,13 +85,15 @@ | |
| "d3dx12-headers-rev1-windows": "package-system/d3dx12-windows", | ||
| "expat-2.4.2-rev2-android": "package-system/expat/temp/expat-android", | ||
| "expat-2.4.2-rev2-windows": "package-system/expat/temp/expat-windows", | ||
| "expat-2.4.2-rev2-emscripten": "package-system/expat/temp/expat-emscripten", | ||
| "freetype-2.11.1-rev1-android": "package-system/freetype/temp/freetype-android", | ||
| "freetype-2.11.1-rev1-windows": "package-system/freetype/temp/freetype-windows", | ||
| "glad-2.0.0-beta-rev2-multiplatform": "package-system/glad-multiplatform", | ||
| "googlebenchmark-1.7.0-rev2-android": "package-system/googlebenchmark-android", | ||
| "googlebenchmark-1.7.0-rev1-windows": "package-system/googlebenchmark-windows", | ||
| "googletest-1.8.1-rev4-android": "package-system/googletest-android", | ||
| "googletest-1.8.1-rev4-windows": "package-system/googletest-windows", | ||
| "googletest-1.8.1-rev4-emscripten": "package-system/googletest-emscripten", | ||
| "hdf5-1.0.11-rev2-multiplatform": "package-system/hdf5-multiplatform", | ||
| "ISPCTexComp-36b80aa-rev1-windows": "package-system/ISPCTexComp-windows", | ||
| "libsamplerate-0.2.1-rev2-android": "package-system/libsamplerate-android", | ||
|
|
@@ -96,6 +102,7 @@ | |
| "lz4-1.9.4-rev1-windows": "package-system/lz4/temp/lz4-windows", | ||
| "Lua-5.4.4-rev1-android": "package-system/Lua/temp/Lua-android", | ||
| "Lua-5.4.4-rev1-windows": "package-system/Lua/temp/Lua-windows", | ||
| "Lua-5.4.4-rev1-emscripten": "package-system/Lua/temp/Lua-emscripten", | ||
| "lux_core-2.2-rev5-multiplatform": "package-system/luxcore-multiplatform", | ||
| "mcpp-2.7.2_az.2-rev1-windows": "package-system/mcpp-windows", | ||
| "md5-2.0-multiplatform": "package-system/md5-multiplatform", | ||
|
|
@@ -135,6 +142,7 @@ | |
| "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform", | ||
| "zlib-1.2.11-rev5-android": "package-system/zlib-android", | ||
| "zlib-1.2.11-rev5-windows": "package-system/zlib-windows", | ||
| "zlib-1.2.11-rev5-emscripten": "package-system/zlib-emscripten", | ||
| "zstd-1.35-multiplatform": "package-system/zstd-multiplatform" | ||
| } | ||
| } | ||
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.
.gitattributes files can be in any folder, why not put this in a
.gitattributesfile in the same folder as the file it affects?