move build to build3 to avoid naming conflict with Bullet 2.x
fix build error in BasicGpuDemo Thanks to joen66 for the report here: https://github.com/erwincoumans/bullet3/issues/5
This commit is contained in:
7
build3/bin2cpp.bat
Normal file
7
build3/bin2cpp.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
rem @echo off
|
||||
|
||||
|
||||
premake4 --file=bin2cpp.lua --binfile="../btgui/FontFiles/OpenSans.ttf" --cppfile="../btgui/FontFiles/OpenSans.cpp" --stringname="OpenSansData" bin2cpp
|
||||
|
||||
pause
|
||||
48
build3/bin2cpp.lua
Normal file
48
build3/bin2cpp.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
function convertFile(filenameIn, filenameOut, stringname)
|
||||
print("\nfilenameOut = " .. filenameOut)
|
||||
local f = assert(io.open(filenameIn, "rb"))
|
||||
|
||||
local fw = io.open(filenameOut,"w")
|
||||
fw:write(string.format("char %s[]={", stringname))
|
||||
local block = 10
|
||||
while true do
|
||||
local bytes = f:read(block)
|
||||
if not bytes then break end
|
||||
for b in string.gfind(bytes, ".") do
|
||||
fw:write(string.format("char(%u),", string.byte(b)))
|
||||
end
|
||||
--io.write(string.rep(" ", block - string.len(bytes) + 1))
|
||||
--io.write(string.gsub(bytes, "%c", "."), "\n")
|
||||
fw:write(string.format("\n"))
|
||||
end
|
||||
fw:write(string.format("\n};"))
|
||||
|
||||
end
|
||||
|
||||
|
||||
newoption {
|
||||
trigger = "binfile",
|
||||
value = "binpath",
|
||||
description = "full path to the binary input file"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "cppfile",
|
||||
value = "path",
|
||||
description = "full path to the cpp output file"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "stringname",
|
||||
value = "var",
|
||||
description = "name of the variable name in the cppfile that contains the binary data"
|
||||
}
|
||||
|
||||
newaction {
|
||||
trigger = "bin2cpp",
|
||||
description = "convert binary file into cpp source",
|
||||
execute = function ()
|
||||
convertFile( _OPTIONS["binfile"] , _OPTIONS["cppfile"], _OPTIONS["stringname"])
|
||||
|
||||
end
|
||||
}
|
||||
36
build3/findDirectX11.lua
Normal file
36
build3/findDirectX11.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
function findDirectX11()
|
||||
local dx11path = os.getenv("DXSDK_DIR")
|
||||
if (dx11path) then
|
||||
local filepath = string.format("%s%s",dx11path,"Include/D3D11.h")
|
||||
headerdx11 = io.open(filepath, "r")
|
||||
if (headerdx11) then
|
||||
printf("Found DX11: '%s'", filepath)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function initDirectX11()
|
||||
configuration {}
|
||||
|
||||
local dx11path = os.getenv("DXSDK_DIR")
|
||||
defines { "ADL_ENABLE_DX11"}
|
||||
includedirs {"$(DXSDK_DIR)/include"}
|
||||
|
||||
configuration "x32"
|
||||
libdirs {"$(DXSDK_DIR)/Lib/x86"}
|
||||
configuration "x64"
|
||||
libdirs {"$(DXSDK_DIR)/Lib/x64"}
|
||||
configuration {}
|
||||
links {"d3dcompiler",
|
||||
"dxerr",
|
||||
"dxguid",
|
||||
"d3dx9",
|
||||
"d3d9",
|
||||
"winmm",
|
||||
"comctl32",
|
||||
"d3dx11"
|
||||
}
|
||||
return true
|
||||
end
|
||||
175
build3/findOpenCL.lua
Normal file
175
build3/findOpenCL.lua
Normal file
@@ -0,0 +1,175 @@
|
||||
|
||||
function findOpenCL_clew()
|
||||
return true;
|
||||
end
|
||||
|
||||
function findOpenCL_Apple()
|
||||
if os.is("macosx") then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function findOpenCL_AMD()
|
||||
local amdopenclpath = os.getenv("AMDAPPSDKROOT")
|
||||
if (amdopenclpath) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function findOpenCL_NVIDIA()
|
||||
local nvidiaopenclpath = os.getenv("CUDA_PATH")
|
||||
if (nvidiaopenclpath) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function findOpenCL_Intel()
|
||||
if os.is("Windows") then
|
||||
local intelopenclpath = os.getenv("INTELOCLSDKROOT")
|
||||
if (intelopenclpath) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if os.is("Linux") then
|
||||
local intelsdk = io.open("/usr/include/CL/opencl.h","r")
|
||||
if (intelsdk) then
|
||||
return true;
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function initOpenCL_clew()
|
||||
configuration{}
|
||||
includedirs {
|
||||
projectRootDir .. "src/clew"
|
||||
}
|
||||
defines {"B3_USE_CLEW"}
|
||||
files {
|
||||
projectRootDir .. "src/clew/clew.c",
|
||||
projectRootDir .. "src/clew/clew.h"
|
||||
}
|
||||
if os.is("Linux") then
|
||||
links {"dl"}
|
||||
end
|
||||
end
|
||||
|
||||
function initOpenCL_Apple()
|
||||
configuration{}
|
||||
includedirs {
|
||||
"/System/Library/Frameworks/OpenCL.framework"
|
||||
}
|
||||
libdirs "/System/Library/Frameworks/OpenCL.framework"
|
||||
links
|
||||
{
|
||||
"OpenCL.framework"
|
||||
}
|
||||
end
|
||||
|
||||
function initOpenCL_AMD()
|
||||
configuration {}
|
||||
local amdopenclpath = os.getenv("AMDAPPSDKROOT")
|
||||
if (amdopenclpath) then
|
||||
defines { "ADL_ENABLE_CL" , "CL_PLATFORM_AMD"}
|
||||
includedirs {
|
||||
"$(AMDAPPSDKROOT)/include"
|
||||
}
|
||||
configuration "x32"
|
||||
libdirs {"$(AMDAPPSDKROOT)/lib/x86"}
|
||||
configuration "x64"
|
||||
libdirs {"$(AMDAPPSDKROOT)/lib/x86_64"}
|
||||
configuration {}
|
||||
links {"OpenCL"}
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
function initOpenCL_NVIDIA()
|
||||
configuration {}
|
||||
local nvidiaopenclpath = os.getenv("CUDA_PATH")
|
||||
if (nvidiaopenclpath) then
|
||||
defines { "ADL_ENABLE_CL" , "CL_PLATFORM_NVIDIA"}
|
||||
includedirs {
|
||||
"$(CUDA_PATH)/include"
|
||||
}
|
||||
configuration "x32"
|
||||
libdirs {"$(CUDA_PATH)/lib/Win32"}
|
||||
configuration "x64"
|
||||
libdirs {"$(CUDA_PATH)/lib/x64"}
|
||||
configuration {}
|
||||
links {"OpenCL"}
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function initOpenCL_Intel()
|
||||
configuration {}
|
||||
if os.is("Windows") then
|
||||
local intelopenclpath = os.getenv("INTELOCLSDKROOT")
|
||||
if (intelopenclpath) then
|
||||
defines { "ADL_ENABLE_CL" , "CL_PLATFORM_INTEL"}
|
||||
includedirs {
|
||||
"$(INTELOCLSDKROOT)/include"
|
||||
}
|
||||
configuration "x32"
|
||||
libdirs {"$(INTELOCLSDKROOT)/lib/x86"}
|
||||
configuration "x64"
|
||||
libdirs {"$(INTELOCLSDKROOT)/lib/x64"}
|
||||
configuration {}
|
||||
links {"OpenCL"}
|
||||
return true
|
||||
end
|
||||
end
|
||||
if os.is("Linux") then
|
||||
defines { "ADL_ENABLE_CL" , "CL_PLATFORM_INTEL"}
|
||||
configuration {}
|
||||
links {"OpenCL"}
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function findOpenCL (vendor )
|
||||
if vendor=="clew" then
|
||||
return findOpenCL_clew()
|
||||
end
|
||||
if vendor=="AMD" then
|
||||
return findOpenCL_AMD()
|
||||
end
|
||||
if vendor=="NVIDIA" then
|
||||
return findOpenCL_NVIDIA()
|
||||
end
|
||||
if vendor=="Intel" then
|
||||
return findOpenCL_Intel()
|
||||
end
|
||||
if vendor=="Apple" then
|
||||
return findOpenCL_Apple()
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function initOpenCL ( vendor )
|
||||
if vendor=="clew" then
|
||||
initOpenCL_clew()
|
||||
end
|
||||
if vendor=="AMD" then
|
||||
initOpenCL_AMD()
|
||||
end
|
||||
if vendor=="NVIDIA" then
|
||||
return initOpenCL_NVIDIA()
|
||||
end
|
||||
if vendor=="Intel" then
|
||||
initOpenCL_Intel()
|
||||
end
|
||||
if vendor=="Apple" then
|
||||
return initOpenCL_Apple()
|
||||
end
|
||||
end
|
||||
|
||||
51
build3/findOpenGLGlewGlut.lua
Normal file
51
build3/findOpenGLGlewGlut.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
function initOpenGL()
|
||||
configuration {}
|
||||
configuration {"Windows"}
|
||||
links {"opengl32","glu32"}
|
||||
configuration {"MacOSX"}
|
||||
links { "OpenGL.framework"}
|
||||
configuration {"not Windows", "not MacOSX"}
|
||||
links {"GL"}
|
||||
configuration{}
|
||||
end
|
||||
|
||||
function initGlut()
|
||||
configuration {}
|
||||
if os.is("Windows") then
|
||||
configuration {"Windows"}
|
||||
includedirs {
|
||||
projectRootDir .. "btgui/OpenGLWindow/Glut"
|
||||
}
|
||||
libdirs { projectRootDir .. "btgui/OpenGLWindow/Glut"}
|
||||
configuration {"Windows", "x32"}
|
||||
links {"glut32"}
|
||||
configuration {"Windows", "x64"}
|
||||
links {"glut64"}
|
||||
end
|
||||
|
||||
configuration {"MacOSX"}
|
||||
links { "Glut.framework" }
|
||||
configuration {"Linux"}
|
||||
links {"glut","GLU"}
|
||||
configuration{}
|
||||
end
|
||||
|
||||
function initGlew()
|
||||
configuration {}
|
||||
if os.is("Windows") then
|
||||
configuration {"Windows"}
|
||||
defines { "GLEW_STATIC"}
|
||||
includedirs {
|
||||
projectRootDir .. "btgui/OpenGLWindow/GlewWindows"
|
||||
}
|
||||
files { projectRootDir .. "btgui/OpenGLWindow/GlewWindows/glew.c"}
|
||||
end
|
||||
if os.is("Linux") then
|
||||
links{"GLEW"}
|
||||
end
|
||||
configuration{}
|
||||
end
|
||||
|
||||
|
||||
|
||||
BIN
build3/premake4.exe
Normal file
BIN
build3/premake4.exe
Normal file
Binary file not shown.
157
build3/premake4.lua
Normal file
157
build3/premake4.lua
Normal file
@@ -0,0 +1,157 @@
|
||||
|
||||
solution "0MySolution"
|
||||
|
||||
-- Multithreaded compiling
|
||||
if _ACTION == "vs2010" or _ACTION=="vs2008" then
|
||||
buildoptions { "/MP" }
|
||||
end
|
||||
|
||||
act = ""
|
||||
|
||||
if _ACTION then
|
||||
act = _ACTION
|
||||
end
|
||||
|
||||
|
||||
newoption
|
||||
{
|
||||
trigger = "ios",
|
||||
description = "Enable iOS target (requires xcode4)"
|
||||
}
|
||||
|
||||
newoption
|
||||
{
|
||||
trigger = "bullet2gpu",
|
||||
description = "Enable Bullet 2.x GPU using b3GpuDynamicsWorld bridge to Bullet 3.x"
|
||||
}
|
||||
|
||||
newoption
|
||||
{
|
||||
trigger = "enet",
|
||||
description = "Enable enet NAT punchthrough test"
|
||||
}
|
||||
|
||||
configurations {"Release", "Debug"}
|
||||
configuration "Release"
|
||||
flags { "Optimize", "EnableSSE","StaticRuntime", "NoMinimalRebuild", "FloatFast"}
|
||||
configuration "Debug"
|
||||
defines {"_DEBUG=1"}
|
||||
flags { "Symbols", "StaticRuntime" , "NoMinimalRebuild", "NoEditAndContinue" ,"FloatFast"}
|
||||
|
||||
if os.is("Linux") then
|
||||
if os.is64bit() then
|
||||
platforms {"x64"}
|
||||
else
|
||||
platforms {"x32"}
|
||||
end
|
||||
else
|
||||
platforms {"x32", "x64"}
|
||||
end
|
||||
|
||||
configuration {"x32"}
|
||||
targetsuffix ("_" .. act)
|
||||
configuration "x64"
|
||||
targetsuffix ("_" .. act .. "_64" )
|
||||
configuration {"x64", "debug"}
|
||||
targetsuffix ("_" .. act .. "_x64_debug")
|
||||
configuration {"x64", "release"}
|
||||
targetsuffix ("_" .. act .. "_x64_release" )
|
||||
configuration {"x32", "debug"}
|
||||
targetsuffix ("_" .. act .. "_debug" )
|
||||
|
||||
configuration{}
|
||||
|
||||
postfix=""
|
||||
|
||||
if _ACTION == "xcode4" then
|
||||
if _OPTIONS["ios"] then
|
||||
postfix = "ios";
|
||||
xcodebuildsettings
|
||||
{
|
||||
'CODE_SIGN_IDENTITY = "iPhone Developer"',
|
||||
"SDKROOT = iphoneos",
|
||||
'ARCHS = "armv7"',
|
||||
'TARGETED_DEVICE_FAMILY = "1,2"',
|
||||
'VALID_ARCHS = "armv7"',
|
||||
}
|
||||
else
|
||||
xcodebuildsettings
|
||||
{
|
||||
'ARCHS = "$(ARCHS_STANDARD_32_BIT) $(ARCHS_STANDARD_64_BIT)"',
|
||||
'VALID_ARCHS = "x86_64 i386"',
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
flags { "NoRTTI", "NoExceptions"}
|
||||
defines { "_HAS_EXCEPTIONS=0" }
|
||||
targetdir "../bin"
|
||||
location("./" .. act .. postfix)
|
||||
|
||||
|
||||
projectRootDir = os.getcwd() .. "/../"
|
||||
print("Project root directroy: " .. projectRootDir);
|
||||
|
||||
dofile ("findOpenCL.lua")
|
||||
dofile ("findDirectX11.lua")
|
||||
dofile ("findOpenGLGlewGlut.lua")
|
||||
|
||||
language "C++"
|
||||
|
||||
|
||||
|
||||
if not _OPTIONS["ios"] then
|
||||
-- include "../demo/gpudemo"
|
||||
-- include "../btgui/MidiTest"
|
||||
-- include "../opencl/vector_add_simplified"
|
||||
-- include "../opencl/vector_add"
|
||||
include "../btgui/Gwen"
|
||||
include "../btgui/GwenOpenGLTest"
|
||||
include "../test/clew"
|
||||
include "../Demos3/GpuGuiInitialize"
|
||||
include "../test/OpenCL/BasicInitialize"
|
||||
-- include "../test/OpenCL/BroadphaseCollision"
|
||||
-- include "../test/OpenCL/NarrowphaseCollision"
|
||||
include "../test/OpenCL/ParallelPrimitives"
|
||||
include "../test/OpenCL/RadixSortBenchmark"
|
||||
include "../test/OpenCL/BitonicSort"
|
||||
|
||||
include "../src/Bullet3Dynamics"
|
||||
include "../src/Bullet3Common"
|
||||
include "../src/Bullet3Geometry"
|
||||
include "../src/Bullet3Collision"
|
||||
include "../src/Bullet3Serialize/Bullet2FileLoader"
|
||||
|
||||
include "../src/Bullet3OpenCL"
|
||||
include "../Demos3/GpuDemos"
|
||||
|
||||
|
||||
-- include "../demo/gpu_initialize"
|
||||
-- include "../opencl/lds_bank_conflict"
|
||||
-- include "../opencl/reduce"
|
||||
-- include "../btgui/OpenGLTrueTypeFont"
|
||||
-- include "../btgui/OpenGLWindow"
|
||||
-- include "../demo/ObjLoader"
|
||||
|
||||
|
||||
-- include "../test/b3DynamicBvhBroadphase"
|
||||
|
||||
if _OPTIONS["enet"] then
|
||||
include "../btgui/enet"
|
||||
include "../test/enet/server"
|
||||
include "../test/enet/client"
|
||||
end
|
||||
|
||||
|
||||
if _OPTIONS["bullet2gpu"] then
|
||||
include "../src/LinearMath"
|
||||
include "../src/BulletCollision"
|
||||
include "../src/BulletDynamics"
|
||||
include "../src/BulletSoftBody"
|
||||
include "../Demos/HelloWorld"
|
||||
|
||||
include "../Demos3"
|
||||
end
|
||||
|
||||
end
|
||||
BIN
build3/premake4_linux
Executable file
BIN
build3/premake4_linux
Executable file
Binary file not shown.
BIN
build3/premake4_linux64
Executable file
BIN
build3/premake4_linux64
Executable file
Binary file not shown.
BIN
build3/premake4_osx
Executable file
BIN
build3/premake4_osx
Executable file
Binary file not shown.
31
build3/stringify.bat
Normal file
31
build3/stringify.bat
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
rem @echo off
|
||||
|
||||
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/RadixSort32Kernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/RadixSort32KernelsCL.h" --stringname="radixSort32KernelsCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernelsCL.h" --stringname="boundSearchKernelsCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanKernelsCL.h" --stringname="prefixScanKernelsCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/FillKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/FillKernelsCL.h" --stringname="fillKernelsCL" stringify
|
||||
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sap.cl" --headerfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapKernels.h" --stringname="sapCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapFast.cl" --headerfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapFastKernels.h" --stringname="sapFastCL" stringify
|
||||
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/sat.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satKernels.h" --stringname="satKernelsCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.h" --stringname="satClipKernelsCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/primitiveContacts.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/primitiveContacts.h" --stringname="primitiveContactsKernelsCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/bvhTraversal.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/bvhTraversal.h" --stringname="bvhTraversalKernelCL" stringify
|
||||
|
||||
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/integrateKernel.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/integrateKernel.h" --stringname="integrateKernelCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/updateAabbsKernel.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/updateAabbsKernel.h" --stringname="updateAabbsKernelCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/solverSetup.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup.h" --stringname="solverSetupCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/solverSetup2.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup2.h" --stringname="solverSetup2CL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/batchingKernels.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernels.h" --stringname="batchingKernelsCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/batchingKernelsNew.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernelsNew.h" --stringname="batchingKernelsNewCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/solverUtils.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverUtils.h" --stringname="solverUtilsCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/solveContact.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solveContact.h" --stringname="solveContactCL" stringify
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody/kernels/solveFriction.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solveFriction.h" --stringname="solveFrictionCL" stringify
|
||||
|
||||
premake4 --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/Raycast/kernels/rayCastKernels.cl" --headerfile="../src/Bullet3OpenCL/Raycast/kernels/rayCastKernels.h" --stringname="rayCastKernelCL" stringify
|
||||
|
||||
pause
|
||||
79
build3/stringifyKernel.lua
Normal file
79
build3/stringifyKernel.lua
Normal file
@@ -0,0 +1,79 @@
|
||||
|
||||
|
||||
function stringifyKernel(filenameIn, filenameOut, kernelMethod)
|
||||
local BUFSIZE = 1024*1024 -- 1MB
|
||||
local f = io.open(filenameIn,"r");
|
||||
local fw = io.open(filenameOut,"w");
|
||||
fw:write("//this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project\n")
|
||||
fw:write("static const char* " .. kernelMethod .. "= \\\n")
|
||||
local cc, lc, wc = 0, 0, 0 -- char, line, and word counts
|
||||
while true do
|
||||
local lines, rest = f:read(BUFSIZE, "*line")
|
||||
if not lines then break end
|
||||
|
||||
local i = 0
|
||||
local startpos = 0
|
||||
local slen = string.len(lines)
|
||||
local endpos = 0
|
||||
while true do
|
||||
i = string.find(lines, "\n", i+1) -- find 'next' newline
|
||||
if i == nil then
|
||||
endpos = slen
|
||||
else
|
||||
endpos = i
|
||||
end
|
||||
oneline = string.sub(lines,startpos,endpos)
|
||||
oneline = string.gsub(oneline,"\n","")
|
||||
oneline = string.gsub(oneline,"\"","\\\"");
|
||||
oneline = '\"' .. oneline .. '\\n\"'
|
||||
oneline = string.gsub(oneline,"\\\\n","")
|
||||
oneline = oneline .. "\n"
|
||||
--print(oneline)
|
||||
fw:write(oneline)
|
||||
if i == nil then break end
|
||||
startpos = i+1
|
||||
end
|
||||
|
||||
if rest then lines = lines .. rest .. '\n' end
|
||||
cc = cc + string.len(lines)
|
||||
-- count words in the chunk
|
||||
local _,t = string.gsub(lines, "%S+", "")
|
||||
wc = wc + t
|
||||
-- count newlines in the chunk
|
||||
_,t = string.gsub(lines, "\n", "\n")
|
||||
lc = lc + t
|
||||
end
|
||||
--print("stringified " .. filenameIn .. " into " .. filenameOut .. " processed " .. lc .. " lines")
|
||||
print(filenameIn .. " (" .. lc .. " lines)")
|
||||
|
||||
f:close()
|
||||
fw:write(";\n")
|
||||
fw:close()
|
||||
end
|
||||
|
||||
newoption {
|
||||
trigger = "kernelfile",
|
||||
value = "kernelpath",
|
||||
description = "full path to the kernel source input file"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "headerfile",
|
||||
value = "path",
|
||||
description = "full path to the header output file"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "stringname",
|
||||
value = "var",
|
||||
description = "name of the kernel string variable"
|
||||
}
|
||||
|
||||
newaction {
|
||||
trigger = "stringify",
|
||||
description = "stringify kernels source code into strings",
|
||||
execute = function ()
|
||||
stringifyKernel( _OPTIONS["kernelfile"] , _OPTIONS["headerfile"], _OPTIONS["stringname"])
|
||||
|
||||
end
|
||||
}
|
||||
26
build3/stringify_linux.sh
Executable file
26
build3/stringify_linux.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/RadixSort32Kernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/RadixSort32KernelsCL.h" --stringname="radixSort32KernelsCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernelsCL.h" --stringname="boundSearchKernelsCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanKernelsCL.h" --stringname="prefixScanKernelsCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/FillKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/FillKernelsCL.h" --stringname="fillKernelsCL" stringify
|
||||
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sap.cl" --headerfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapKernels.h" --stringname="sapCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapFast.cl" --headerfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapFastKernels.h" --stringname="sapFastCL" stringify
|
||||
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/sat.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satKernels.h" --stringname="satKernelsCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.h" --stringname="satClipKernelsCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/primitiveContacts.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/primitiveContacts.h" --stringname="primitiveContactsKernelsCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/bvhTraversal.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/bvhTraversal.h" --stringname="bvhTraversalKernelCL" stringify
|
||||
|
||||
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/integrateKernel.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/integrateKernel.h" --stringname="integrateKernelCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/updateAabbsKernel.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/updateAabbsKernel.h" --stringname="updateAabbsKernelCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup.h" --stringname="solverSetupCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup2.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup2.h" --stringname="solverSetup2CL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernels.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernels.h" --stringname="batchingKernelsCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernelsNew.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernelsNew.h" --stringname="batchingKernelsNewCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverUtils.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverUtils.h" --stringname="solverUtilsCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solveContact.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solveContact.h" --stringname="solveContactCL" stringify
|
||||
./premake4_linux --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solveFriction.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solveFriction.h" --stringname="solveFrictionCL" stringify
|
||||
|
||||
26
build3/stringify_osx.sh
Executable file
26
build3/stringify_osx.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/RadixSort32Kernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/RadixSort32KernelsCL.h" --stringname="radixSort32KernelsCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/BoundSearchKernelsCL.h" --stringname="boundSearchKernelsCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanKernelsCL.h" --stringname="prefixScanKernelsCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/FillKernels.cl" --headerfile="../src/Bullet3OpenCL/ParallelPrimitives/kernels/FillKernelsCL.h" --stringname="fillKernelsCL" stringify
|
||||
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sap.cl" --headerfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapKernels.h" --stringname="sapCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapFast.cl" --headerfile="../src/Bullet3OpenCL/BroadphaseCollision/kernels/sapFastKernels.h" --stringname="sapFastCL" stringify
|
||||
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/sat.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satKernels.h" --stringname="satKernelsCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/satClipHullContacts.h" --stringname="satClipKernelsCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/primitiveContacts.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/primitiveContacts.h" --stringname="primitiveContactsKernelsCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/bvhTraversal.cl" --headerfile="../src/Bullet3OpenCL/NarrowphaseCollision/kernels/bvhTraversal.h" --stringname="bvhTraversalKernelCL" stringify
|
||||
|
||||
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/integrateKernel.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/integrateKernel.h" --stringname="integrateKernelCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/updateAabbsKernel.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/updateAabbsKernel.h" --stringname="updateAabbsKernelCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup.h" --stringname="solverSetupCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup2.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverSetup2.h" --stringname="solverSetup2CL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernels.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernels.h" --stringname="batchingKernelsCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernelsNew.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/batchingKernelsNew.h" --stringname="batchingKernelsNewCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solverUtils.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solverUtils.h" --stringname="solverUtilsCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solveContact.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solveContact.h" --stringname="solveContactCL" stringify
|
||||
./premake4_osx --file=stringifyKernel.lua --kernelfile="../src/Bullet3OpenCL/RigidBody//kernels/solveFriction.cl" --headerfile="../src/Bullet3OpenCL/RigidBody//kernels/solveFriction.h" --stringname="solveFrictionCL" stringify
|
||||
|
||||
6
build3/vs2010.bat
Normal file
6
build3/vs2010.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
rem premake4 --with-pe vs2010
|
||||
premake4 vs2010
|
||||
|
||||
mkdir vs2010\cache
|
||||
pause
|
||||
6
build3/vs2010_bullet2gpu.bat
Normal file
6
build3/vs2010_bullet2gpu.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
rem premake4 --with-pe vs2010
|
||||
premake4 --bullet2gpu vs2010
|
||||
|
||||
mkdir vs2010\cache
|
||||
pause
|
||||
4
build3/xcode.command
Executable file
4
build3/xcode.command
Executable file
@@ -0,0 +1,4 @@
|
||||
|
||||
cd `dirname $0`
|
||||
./premake4_osx xcode4
|
||||
|
||||
Reference in New Issue
Block a user