Skip to content

Commit

Permalink
physx build system refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Sep 19, 2023
1 parent cd0b421 commit 37da8cc
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 84 deletions.
28 changes: 2 additions & 26 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
mkdir plugins
mkdir projects\3rdparty
mkdir projects\itch_io
mkdir external\physx\lib\vs2017\win64\release_static
- name: fetch procedural geometry plugin
working-directory: plugins
Expand Down Expand Up @@ -47,33 +46,10 @@ jobs:
run: |
git.exe clone --depth=1 https://github.com/nem0/PhysX.git physx
- name: create physx solution
working-directory: projects\3rdparty\PhysX\physx
run: |
./generate_projects.bat lumix_vc17win64_static
- name: build physx
working-directory: projects\3rdparty\PhysX\physx
shell: cmd
run: |
"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/MSBuild.exe" compiler\vc17win64\PhysXSDK.sln /p:Configuration=Release /p:Platform=x64
- name: deploy physx
working-directory: projects
run: |
copy 3rdparty\PhysX\physx\bin\win.x86_64.vc141.md\release\PhysXCharacterKinematic_static_64.lib ..\external\physx\lib\vs2017\win64\release_static\
copy 3rdparty\PhysX\physx\bin\win.x86_64.vc141.md\release\PhysXCommon_static_64.lib ..\external\physx\lib\vs2017\win64\release_static\
copy 3rdparty\PhysX\physx\bin\win.x86_64.vc141.md\release\PhysXCooking_static_64.lib ..\external\physx\lib\vs2017\win64\release_static\
copy 3rdparty\PhysX\physx\bin\win.x86_64.vc141.md\release\PhysXExtensions_static_64.lib ..\external\physx\lib\vs2017\win64\release_static\
copy 3rdparty\PhysX\physx\bin\win.x86_64.vc141.md\release\PhysXFoundation_static_64.lib ..\external\physx\lib\vs2017\win64\release_static\
copy 3rdparty\PhysX\physx\bin\win.x86_64.vc141.md\release\PhysXPvdSDK_static_64.lib ..\external\physx\lib\vs2017\win64\release_static\
copy 3rdparty\PhysX\physx\bin\win.x86_64.vc141.md\release\PhysXVehicle_static_64.lib ..\external\physx\lib\vs2017\win64\release_static\
copy 3rdparty\PhysX\physx\bin\win.x86_64.vc141.md\release\PhysX_static_64.lib ..\external\physx\lib\vs2017\win64\release_static\
- name: make dx11 project
working-directory: projects
run: |
./genie.exe --with-app --static-physx vs2022
./genie.exe --force-build-physx --with-app vs2022
- name: get butler
working-directory: projects
Expand Down Expand Up @@ -106,7 +82,7 @@ jobs:
- name: make gl project with plugins
working-directory: projects
run: |
./genie.exe --static-physx --nodx --with-app vs2022
./genie.exe --force-build-physx --nodx --with-app vs2022
- name: build gl engine
working-directory: projects
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
105 changes: 47 additions & 58 deletions projects/genie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ local base_plugins = {}
local plugin_creators = {}
local embed_resources = false
local force_build_luau = false
local force_build_physx = false
build_studio_callbacks = {}
build_app_callbacks = {}

Expand Down Expand Up @@ -73,11 +74,6 @@ newoption {
description = "Plugins are dynamic libraries."
}

newoption {
trigger = "static-physx",
description = "Linked physx static lib."
}

newoption {
trigger = "embed-resources",
description = "Embed resources (shaders, ...) in executable"
Expand Down Expand Up @@ -158,10 +154,19 @@ newoption {
description = "Add Luau project to solution. Do not use the prebuilt library."
}

newoption {
trigger = "force-build-physx",
description = "Add PhysX project to solution. Do not use the prebuilt library."
}

if _OPTIONS["force-build-luau"] then
force_build_luau = true
end

if _OPTIONS["force-build-physx"] then
force_build_physx = true
end

if _OPTIONS["plugins"] then
plugins = string.explode( _OPTIONS["plugins"], ",")
end
Expand Down Expand Up @@ -314,40 +319,10 @@ end

function linkPhysX()
if has_plugin("physics") then
if _OPTIONS["static-physx"] then
configuration { "x64", "vs20*" }
links {
"PhysXCharacterKinematic_static_64",
"PhysXCommon_static_64",
"PhysXCooking_static_64",
"PhysXExtensions_static_64",
"PhysXFoundation_static_64",
"PhysXPvdSDK_static_64",
"PhysXVehicle_static_64",
"PhysX_static_64"
}
configuration { "linux" }
libdirs {"../external/physx/lib/linux64_gmake/release"}
links {
"PhysX_static_64",
"PhysXCharacterKinematic_static_64",
"PhysXCommon_static_64",
"PhysXCooking_static_64",
"PhysXExtensions_static_64",
"PhysXFoundation_static_64",
"PhysXPvdSDK_static_64",
--"PhysXTask_static_64",
"PhysXVehicle_static_64",
--"SceneQuery_static_64",
--"SimulationController_static_64"
}

configuration {}
libdirs {"../external/physx/lib/" .. binary_api_dir .. "/win64/release_static"}
defines {
"PX_PHYSX_CHARACTER_STATIC_LIB",
"PX_PHYSX_STATIC_LIB"
}
if force_build_physx then
configuration { "vs20*" }
links { "PhysX" }
defines { "PX_PHYSX_STATIC_LIB", "PX_PHYSX_CHARACTER_STATIC_LIB" }
else
configuration { "x64", "vs20*" }
links {
Expand All @@ -368,7 +343,7 @@ function linkPhysX()
"SimulationController_static_64"
}
configuration { "linux" }
libdirs {"../external/physx/lib/linux64_gmake/release"}
libdirs {"../external/physx/lib/linux"}
links {
"PhysX_static_64",
"PhysXCharacterKinematic_static_64",
Expand All @@ -383,13 +358,8 @@ function linkPhysX()
--"SimulationController_static_64"
}

configuration { "Debug" }
libdirs {"../external/physx/lib/" .. binary_api_dir .. "/win64/release"}

configuration { "RelWithDebInfo" }
libdirs {"../external/physx/lib/" .. binary_api_dir .. "/win64/release"}

configuration {}
libdirs {"../external/physx/lib/win"}
defines {"PX_PHYSX_CHARACTER_STATIC_LIB"}
end
end
Expand Down Expand Up @@ -547,23 +517,23 @@ if has_plugin("physics") then
project "physics"
libType()

if _OPTIONS["static-physx"] then
if force_build_physx then
defines { "LUMIX_STATIC_PHYSX" }
else
configuration { "vs*" }
files { "../external/physx/dll/vs2017/win64/release/PhysXCommon_64.dll" }
files { "../external/physx/dll/vs2017/win64/release/PhysXCooking_64.dll" }
files { "../external/physx/dll/vs2017/win64/release/PhysXFoundation_64.dll" }
files { "../external/physx/dll/vs2017/win64/release/PhysX_64.dll" }
copy { "../external/physx/dll/vs2017/win64/release/PhysXCommon_64.dll" }
copy { "../external/physx/dll/vs2017/win64/release/PhysXCooking_64.dll" }
copy { "../external/physx/dll/vs2017/win64/release/PhysXFoundation_64.dll" }
copy { "../external/physx/dll/vs2017/win64/release/PhysX_64.dll" }
configuration {}
end

files { "../src/physics/**.h", "../src/physics/**.cpp" }

configuration { "vs*" }
files { "../external/physx/dll/vs2017/win64/release/PhysXCommon_64.dll" }
files { "../external/physx/dll/vs2017/win64/release/PhysXCooking_64.dll" }
files { "../external/physx/dll/vs2017/win64/release/PhysXFoundation_64.dll" }
files { "../external/physx/dll/vs2017/win64/release/PhysX_64.dll" }
copy { "../external/physx/dll/vs2017/win64/release/PhysXCommon_64.dll" }
copy { "../external/physx/dll/vs2017/win64/release/PhysXCooking_64.dll" }
copy { "../external/physx/dll/vs2017/win64/release/PhysXFoundation_64.dll" }
copy { "../external/physx/dll/vs2017/win64/release/PhysX_64.dll" }
configuration {}

includedirs { "../external/physx/include/" }
defines { "BUILDING_PHYSICS" }
links { "engine", "editor", "renderer" }
Expand Down Expand Up @@ -1005,6 +975,25 @@ if build_studio then
defaultConfigurations()
end

if force_build_physx == true then
if os.isdir("3rdparty/physx") then
project "PhysX"
kind "StaticLib"
files { "3rdparty/physx/physx/source/**.cpp", "3rdparty/physx/physx/include/**.h", "3rdparty/physx/pxshared/**.h" }
removefiles { "**/unix/*", "3rdparty/physx/**/linux/*" }
includedirs { "3rdparty/physx/physx/include"
, "3rdparty/physx/pxshared/include"
, "3rdparty/physx/physx/source/**"
}
defines { "NDEBUG", "PX_PHYSX_STATIC_LIB", "_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS", "PX_COOKING" }
flags { "OptimizeSize", "ReleaseRuntime" }

configuration { "windows" }
targetdir "../external/physx/lib/win"
else
printf("--force-build-physx used but PhysX source code not found")
end
end

if force_build_luau == true then
if os.isdir("3rdparty/luau") then
Expand Down

0 comments on commit 37da8cc

Please sign in to comment.