-
Notifications
You must be signed in to change notification settings - Fork 810
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
PhysX Emscripten WebAssembly build target #238
Open
prestomation
wants to merge
2
commits into
NVIDIAGameWorks:4.1
Choose a base branch
from
prestomation:emscripten
base: 4.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<preset name="emscripten" comment="Emscripten web build PhysX SDK general settings"> | ||
<platform targetPlatform="emscripten" compiler="emscripten" /> | ||
<CMakeSwitches> | ||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="False" comment="Generate the snippets" /> | ||
<cmakeSwitch name="PX_BUILDSAMPLES" value="False" comment="Generate the samples" /> | ||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" /> | ||
</CMakeSwitches> | ||
<CMakeParams> | ||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/emscripten/PhysX" comment="Install path relative to PhysX SDK root" /> | ||
</CMakeParams> | ||
</preset> |
59 changes: 59 additions & 0 deletions
59
physx/documentation/platformreadme/emscripten/readme_emscripten.html
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,59 @@ | ||
<html> | ||
|
||
<head> | ||
<meta http-equiv="Content-Type" | ||
content="text/html; charset=iso-8859-1"> | ||
<title>NVIDIA PhysX SDK for Emscripten ReadMe</title> | ||
<link rel="stylesheet" href="stylesheet.css" type="text/css"> | ||
</head> | ||
|
||
<body> | ||
<h1 style="TEXT-ALIGN: center">NVIDIA<sup>®</sup> PhysX<sup>®</sup> SDK for Emscripten/Web ReadMe</h1> | ||
|
||
<blockquote> | ||
<h4>Location of Binaries:</h4> | ||
<ul> | ||
<li>SDK libraries: bin/physx.wasm</li> | ||
</ul> | ||
|
||
<h4>Required packages to generate projects:</h4> | ||
<ul> | ||
<li>CMake, minimum version 3.12 (can be acquired: sudo apt-get install cmake or sudo pip install cmake)</li> | ||
<li>Python, minimum version 2.7</li> | ||
<li>emsdk, tested on version 1.38.31</li> | ||
</ul> | ||
|
||
<h4>Generating Makefiles:</h4> | ||
<ul> | ||
<li>Makefiles are generated through a script in physx root directory: generate_projects.sh. source emsdk_env.sh before generating or building the project </li> | ||
<li>Script generate_projects.sh expects a preset name as a parameter, if a parameter is not provided it does list the available presets and you can select one.</li> | ||
<li>Supported presets for web platform are: emscripten.</li> | ||
<li>Generated solutions are in folder compiler/emscripten-debug, compiler/emscripten-checked, compiler/emscripten-profile, compiler/emscripten-release.</li> | ||
</ul> | ||
|
||
<h4>Building SDK:</h4> | ||
<ul> | ||
<li>Makefiles are in compiler/emscripten-debug etc</li> | ||
<li>Clean solution: make clean</li> | ||
<li>Build solution: make</li> | ||
</ul> | ||
|
||
<h4>PhysX GPU Acceleration:</h4> | ||
<ul> | ||
<li>GPU Acceleration is not available on web platforms</li> | ||
</ul> | ||
|
||
<h4>PhysX Snippets and Samples:</h4> | ||
<ul> | ||
<li>Snippets and Samples currently do not build in emscripten</li> | ||
</ul> | ||
|
||
This build type generates physx.wasm and physx.js files using the emscripten toolchain. | ||
|
||
</blockquote> | ||
|
||
<p><br> | ||
Copyright (c) 2008-2019 NVIDIA Corporation, 2701 San Thomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. <A href="http://www.nvidia.com">www.nvidia.com</A> | ||
</p> | ||
</body> | ||
</html> |
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,99 @@ | ||
## | ||
## Redistribution and use in source and binary forms, with or without | ||
## modification, are permitted provided that the following conditions | ||
## are met: | ||
## * Redistributions of source code must retain the above copyright | ||
## notice, this list of conditions and the following disclaimer. | ||
## * Redistributions in binary form must reproduce the above copyright | ||
## notice, this list of conditions and the following disclaimer in the | ||
## documentation and/or other materials provided with the distribution. | ||
## * Neither the name of NVIDIA CORPORATION nor the names of its | ||
## contributors may be used to endorse or promote products derived | ||
## from this software without specific prior written permission. | ||
## | ||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY | ||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
## | ||
## Copyright (c) 2018-2019 NVIDIA Corporation. All rights reserved. | ||
|
||
STRING(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) | ||
|
||
SET(CLANG_WARNINGS "-ferror-limit=0 -Wall -Wextra -Werror -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-gnu-anonymous-struct -Wno-undef -Wno-unused-function -Wno-nested-anon-types -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-invalid-noreturn -Wno-return-type-c-linkage -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-unused-local-typedef -Wno-old-style-cast -Wno-newline-eof -Wno-unused-private-field -Wno-format-nonliteral -Wno-implicit-fallthrough -Wno-undefined-reinterpret-cast -Wno-disabled-macro-expansion -Wno-zero-as-null-pointer-constant -Wno-shadow -Wno-unknown-warning-option -Wno-atomic-implicit-seq-cst -Wno-extra-semi-stmt -Wno-dollar-in-identifier-extension -Wno-alloca -Wno-anon-enum-enum-conversion -Wno-dtor-name") | ||
SET(CMAKE_STATIC_LIBRARY_PREFIX "") | ||
|
||
SET(PHYSX_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-exceptions -ffunction-sections -fdata-sections -fstrict-aliasing ${CLANG_WARNINGS}" CACHE INTERNAL "PhysX CXX") | ||
|
||
SET(CMAKE_CXX_FLAGS ${PHYSX_CXX_FLAGS}) | ||
|
||
SET(PHYSX_EMSCRIPTEN_COMPILE_DEFS "${CUDA_FLAG};${PHYSX_AUTOBUILD}" CACHE INTERNAL "Base PhysX preprocessor definitions") | ||
|
||
SET(PHYSX_EMSCRIPTEN_DEBUG_COMPILE_DEFS "NDEBUG;PX_DEBUG=1;PX_CHECKED=1;${NVTX_FLAG};PX_SUPPORT_PVD=1" CACHE INTERNAL "Debug PhysX preprocessor definitions") | ||
SET(PHYSX_EMSCRIPTEN_CHECKED_COMPILE_DEFS "NDEBUG;PX_CHECKED=1;${NVTX_FLAG};PX_SUPPORT_PVD=1" CACHE INTERNAL "Checked PhysX preprocessor definitions") | ||
SET(PHYSX_EMSCRIPTEN_PROFILE_COMPILE_DEFS "NDEBUG;PX_PROFILE=1;${NVTX_FLAG};PX_SUPPORT_PVD=1" CACHE INTERNAL "Profile PhysX preprocessor definitions") | ||
SET(PHYSX_EMSCRIPTEN_RELEASE_COMPILE_DEFS "NDEBUG;PX_SUPPORT_PVD=0" CACHE INTERNAL "Release PhysX preprocessor definitions") | ||
|
||
# TODO: Turn on SIMD | ||
ADD_DEFINITIONS(-DPX_SIMD_DISABLED) | ||
|
||
|
||
# We need to output .bc files instead of .a files for our emscripten build | ||
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".bc") | ||
SET(CMAKE_AR "emcc") | ||
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> -o <TARGET> <LINK_FLAGS> <OBJECTS>") | ||
|
||
|
||
|
||
|
||
|
||
INCLUDE(PhysXFoundation.cmake) | ||
INCLUDE(LowLevel.cmake) | ||
INCLUDE(LowLevelAABB.cmake) | ||
INCLUDE(LowLevelDynamics.cmake) | ||
INCLUDE(PhysX.cmake) | ||
INCLUDE(PhysXCharacterKinematic.cmake) | ||
INCLUDE(PhysXCommon.cmake) | ||
INCLUDE(PhysXCooking.cmake) | ||
INCLUDE(PhysXExtensions.cmake) | ||
INCLUDE(PhysXVehicle.cmake) | ||
INCLUDE(SceneQuery.cmake) | ||
INCLUDE(SimulationController.cmake) | ||
INCLUDE(FastXml.cmake) | ||
INCLUDE(PhysXPvdSDK.cmake) | ||
INCLUDE(PhysXTask.cmake) | ||
INCLUDE(emscripten/PhysXWebBindings.cmake) | ||
|
||
# Set folder PhysX SDK to all common SDK source projects | ||
SET_PROPERTY(TARGET PhysX PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXCharacterKinematic PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXCommon PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXCooking PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXExtensions PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXVehicle PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET LowLevel PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET LowLevelAABB PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET LowLevelDynamics PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET SceneQuery PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET SimulationController PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET FastXml PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXPvdSDK PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXTask PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXFoundation PROPERTY FOLDER "PhysX SDK") | ||
SET_PROPERTY(TARGET PhysXWebBindings PROPERTY FOLDER "PhysX SDK") | ||
|
||
SET(PHYSXDISTRO_LIBS PhysXFoundation PhysX PhysXCharacterKinematic PhysXPvdSDK PhysXCommon PhysXCooking PhysXExtensions PhysXVehicle PhysXWebBindings) | ||
|
||
INSTALL( | ||
TARGETS ${PHYSXDISTRO_LIBS} | ||
EXPORT PhysXSDK | ||
DESTINATION $<$<CONFIG:debug>:${PX_ROOT_LIB_DIR}/debug>$<$<CONFIG:release>:${PX_ROOT_LIB_DIR}/release>$<$<CONFIG:checked>:${PX_ROOT_LIB_DIR}/checked>$<$<CONFIG:profile>:${PX_ROOT_LIB_DIR}/profile> | ||
) | ||
|
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,43 @@ | ||
## | ||
## Redistribution and use in source and binary forms, with or without | ||
## modification, are permitted provided that the following conditions | ||
## are met: | ||
## * Redistributions of source code must retain the above copyright | ||
## notice, this list of conditions and the following disclaimer. | ||
## * Redistributions in binary form must reproduce the above copyright | ||
## notice, this list of conditions and the following disclaimer in the | ||
## documentation and/or other materials provided with the distribution. | ||
## * Neither the name of NVIDIA CORPORATION nor the names of its | ||
## contributors may be used to endorse or promote products derived | ||
## from this software without specific prior written permission. | ||
## | ||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY | ||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
## | ||
## Copyright (c) 2018-2019 NVIDIA Corporation. All rights reserved. | ||
|
||
# | ||
# Build FastXml | ||
# | ||
|
||
# Use generator expressions to set config specific preprocessor definitions | ||
SET(FASTXML_COMPILE_DEFS | ||
# Common to all configurations | ||
${PHYSX_EMSCRIPTEN_COMPILE_DEFS}; | ||
|
||
$<$<CONFIG:debug>:${PHYSX_EMSCRIPTEN_DEBUG_COMPILE_DEFS};> | ||
$<$<CONFIG:checked>:${PHYSX_EMSCRIPTEN_CHECKED_COMPILE_DEFS};> | ||
$<$<CONFIG:profile>:${PHYSX_EMSCRIPTEN_PROFILE_COMPILE_DEFS};> | ||
$<$<CONFIG:release>:${PHYSX_EMSCRIPTEN_RELEASE_COMPILE_DEFS};> | ||
) | ||
|
||
SET(FASTXML_LIBTYPE OBJECT) |
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,67 @@ | ||
## | ||
## Redistribution and use in source and binary forms, with or without | ||
## modification, are permitted provided that the following conditions | ||
## are met: | ||
## * Redistributions of source code must retain the above copyright | ||
## notice, this list of conditions and the following disclaimer. | ||
## * Redistributions in binary form must reproduce the above copyright | ||
## notice, this list of conditions and the following disclaimer in the | ||
## documentation and/or other materials provided with the distribution. | ||
## * Neither the name of NVIDIA CORPORATION nor the names of its | ||
## contributors may be used to endorse or promote products derived | ||
## from this software without specific prior written permission. | ||
## | ||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY | ||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
## | ||
## Copyright (c) 2018-2019 NVIDIA Corporation. All rights reserved. | ||
|
||
# | ||
# Build LowLevel | ||
# | ||
|
||
|
||
SET(LOWLEVEL_PLATFORM_INCLUDES | ||
${PHYSX_SOURCE_DIR}/Common/src/linux | ||
${PHYSX_SOURCE_DIR}/LowLevel/software/include/linux | ||
${PHYSX_SOURCE_DIR}/LowLevelDynamics/include/linux | ||
${PHYSX_SOURCE_DIR}/LowLevel/common/include/pipeline/linux | ||
) | ||
|
||
SET(LOWLEVEL_COMPILE_DEFS | ||
# Common to all configurations | ||
${PHYSX_EMSCRIPTEN_COMPILE_DEFS};PX_PHYSX_STATIC_LIB | ||
) | ||
|
||
IF(PX_GENERATE_GPU_STATIC_LIBRARIES) | ||
SET(LOWLEVEL_GPU_LIBTYPE_DEFS | ||
PX_PHYSX_GPU_STATIC; | ||
) | ||
ENDIF() | ||
|
||
SET(LOWLEVEL_COMPILE_DEFS | ||
# Common to all configurations | ||
${PHYSX_EMSCRIPTEN_COMPILE_DEFS};PX_PHYSX_STATIC_LIB;${LOWLEVEL_GPU_LIBTYPE_DEFS} | ||
|
||
$<$<CONFIG:debug>:${PHYSX_EMSCRIPTEN_DEBUG_COMPILE_DEFS};> | ||
$<$<CONFIG:checked>:${PHYSX_EMSCRIPTEN_CHECKED_COMPILE_DEFS};> | ||
$<$<CONFIG:profile>:${PHYSX_EMSCRIPTEN_PROFILE_COMPILE_DEFS};> | ||
$<$<CONFIG:release>:${PHYSX_EMSCRIPTEN_RELEASE_COMPILE_DEFS};> | ||
) | ||
|
||
SET(LOWLEVEL_PLATFORM_LINK_FLAGS " ") | ||
|
||
SET(LOWLEVEL_LIBTYPE OBJECT) | ||
|
||
# NOTE: Is this a UE4 specific change? | ||
# enable -fPIC so we can link static libs with the editor | ||
#SET_TARGET_PROPERTIES(LowLevel PROPERTIES POSITION_INDEPENDENT_CODE TRUE) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this is not required anymore since 2.0.x emscripten