premake4 add option --enable_static_vr_plugin to statically link the VR sync plugin

fix texture caching from previous commit (what happened there?)
This commit is contained in:
erwincoumans
2017-10-25 10:00:45 -07:00
parent 9385f36505
commit 6a9300809d
9 changed files with 71 additions and 9 deletions

View File

@@ -45,6 +45,13 @@
description = "Try to link and use system X11 headers instead of dynamically loading X11 (dlopen is default)" description = "Try to link and use system X11 headers instead of dynamically loading X11 (dlopen is default)"
} }
newoption
{
trigger = "enable_static_vr_plugin",
description = "Statically link vr plugin (in examples/SharedMemory/plugins/vrSyncPlugin)"
}
newoption newoption
{ {
trigger = "noopengl3", trigger = "noopengl3",
@@ -276,6 +283,11 @@ end
if not _OPTIONS["glfw_lib_name"] then if not _OPTIONS["glfw_lib_name"] then
_OPTIONS["glfw_lib_name"] = default_glfw_lib_name _OPTIONS["glfw_lib_name"] = default_glfw_lib_name
end end
if (_OPTIONS["enable_static_vr_plugin"]) then
defines("STATIC_LINK_VR_PLUGIN")
end
newoption newoption
{ {
trigger = "glfw_include_dir", trigger = "glfw_include_dir",

View File

@@ -17,7 +17,8 @@ del tmp1234.txt
cd build3 cd build3
premake4 --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010
premake4 --double --midi --enable_static_vr_plugin --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010
#premake4 --serial --audio --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010 #premake4 --serial --audio --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010

View File

@@ -175,6 +175,11 @@ if (hasCL and findOpenGL3()) then
"../OpenCL/rigidbody/GpuRigidBodyDemo.cpp", "../OpenCL/rigidbody/GpuRigidBodyDemo.cpp",
} }
end end
if (_OPTIONS["enable_static_vr_plugin"]) then
files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
if os.is("Linux") then if os.is("Linux") then
initX11() initX11()
end end

View File

@@ -65,9 +65,9 @@ int loadAndRegisterMeshFromFile2(const std::string& fileName, CommonRenderInterf
{ {
int textureIndex = -1; int textureIndex = -1;
if (meshData.m_textureImage) if (meshData.m_textureImage1)
{ {
textureIndex = renderer->registerTexture(meshData.m_textureImage,meshData.m_textureWidth,meshData.m_textureHeight); textureIndex = renderer->registerTexture(meshData.m_textureImage1,meshData.m_textureWidth,meshData.m_textureHeight);
} }
shapeId = renderer->registerShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0], shapeId = renderer->registerShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0],
@@ -77,7 +77,10 @@ int loadAndRegisterMeshFromFile2(const std::string& fileName, CommonRenderInterf
B3_GL_TRIANGLES, B3_GL_TRIANGLES,
textureIndex); textureIndex);
delete meshData.m_gfxShape; delete meshData.m_gfxShape;
delete meshData.m_textureImage; if (!meshData.m_isCached)
{
delete meshData.m_textureImage1;
}
} }
return shapeId; return shapeId;
} }

View File

@@ -169,9 +169,9 @@ TinyRendererSetup::TinyRendererSetup(struct GUIHelperInterface* gui)
{ {
int textureIndex = -1; int textureIndex = -1;
if (meshData.m_textureImage) if (meshData.m_textureImage1)
{ {
textureIndex = m_guiHelper->getRenderInterface()->registerTexture(meshData.m_textureImage,meshData.m_textureWidth,meshData.m_textureHeight); textureIndex = m_guiHelper->getRenderInterface()->registerTexture(meshData.m_textureImage1,meshData.m_textureWidth,meshData.m_textureHeight);
} }
shapeId = m_guiHelper->getRenderInterface()->registerShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0], shapeId = m_guiHelper->getRenderInterface()->registerShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0],
@@ -205,7 +205,7 @@ TinyRendererSetup::TinyRendererSetup(struct GUIHelperInterface* gui)
ob->registerMeshShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0], ob->registerMeshShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0],
meshData.m_gfxShape->m_numvertices, meshData.m_gfxShape->m_numvertices,
indices, indices,
meshData.m_gfxShape->m_numIndices,color, meshData.m_textureImage,meshData.m_textureWidth,meshData.m_textureHeight); meshData.m_gfxShape->m_numIndices,color, meshData.m_textureImage1,meshData.m_textureWidth,meshData.m_textureHeight);
ob->m_localScaling.setValue(scaling[0],scaling[1],scaling[2]); ob->m_localScaling.setValue(scaling[0],scaling[1],scaling[2]);
@@ -214,7 +214,10 @@ TinyRendererSetup::TinyRendererSetup(struct GUIHelperInterface* gui)
delete meshData.m_gfxShape; delete meshData.m_gfxShape;
delete meshData.m_textureImage; if (!meshData.m_isCached)
{
delete meshData.m_textureImage1;
}
} }
} }
} }

View File

@@ -197,6 +197,11 @@ if not _OPTIONS["no-enet"] then
"MinitaurSetup.h", "MinitaurSetup.h",
myfiles myfiles
} }
if (_OPTIONS["enable_static_vr_plugin"]) then
files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
if os.is("Linux") then if os.is("Linux") then
initX11() initX11()
end end
@@ -280,6 +285,11 @@ project ("App_VRGloveHandSimulator")
"b3RobotSimulatorClientAPI.h", "b3RobotSimulatorClientAPI.h",
myfiles myfiles
} }
if (_OPTIONS["enable_static_vr_plugin"]) then
files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
if os.is("Linux") then if os.is("Linux") then
initX11() initX11()
end end

View File

@@ -104,11 +104,16 @@ myfiles =
} }
files { files {
myfiles, myfiles,
"main.cpp", "main.cpp",
} }
if (_OPTIONS["enable_static_vr_plugin"]) then
files {"plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
files { files {
"../MultiThreading/b3ThreadSupportInterface.cpp", "../MultiThreading/b3ThreadSupportInterface.cpp",
@@ -202,6 +207,10 @@ files {
"../ExampleBrowser/GL_ShapeDrawer.cpp", "../ExampleBrowser/GL_ShapeDrawer.cpp",
"../ExampleBrowser/CollisionShape2TriangleMesh.cpp", "../ExampleBrowser/CollisionShape2TriangleMesh.cpp",
} }
if (_OPTIONS["enable_static_vr_plugin"]) then
files {"plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
if os.is("Linux") then initX11() end if os.is("Linux") then initX11() end
@@ -353,6 +362,10 @@ if os.is("Windows") then
"../ThirdPartyLibs/openvr/samples/shared/pathtools.h", "../ThirdPartyLibs/openvr/samples/shared/pathtools.h",
"../ThirdPartyLibs/openvr/samples/shared/Vectors.h", "../ThirdPartyLibs/openvr/samples/shared/Vectors.h",
} }
if (_OPTIONS["enable_static_vr_plugin"]) then
files {"plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
if os.is("Windows") then if os.is("Windows") then
configuration {"x32"} configuration {"x32"}
libdirs {"../ThirdPartyLibs/openvr/lib/win32"} libdirs {"../ThirdPartyLibs/openvr/lib/win32"}

View File

@@ -156,6 +156,11 @@ if not _OPTIONS["no-enet"] then
"../../examples/MultiThreading/b3ThreadSupportInterface.cpp", "../../examples/MultiThreading/b3ThreadSupportInterface.cpp",
} }
if (_OPTIONS["enable_static_plugins"]) then
files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
includedirs { includedirs {
_OPTIONS["python_include_dir"], _OPTIONS["python_include_dir"],
} }

View File

@@ -227,6 +227,10 @@ project ("Test_PhysicsServerLoopBack")
"../../examples/ThirdPartyLibs/stb_image/stb_image.cpp", "../../examples/ThirdPartyLibs/stb_image/stb_image.cpp",
} }
if (_OPTIONS["enable_static_plugins"]) then
files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
project ("Test_PhysicsServerDirect") project ("Test_PhysicsServerDirect")
language "C++" language "C++"
@@ -306,7 +310,9 @@ project ("Test_PhysicsServerLoopBack")
"../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp", "../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
"../../examples/ThirdPartyLibs/stb_image/stb_image.cpp", "../../examples/ThirdPartyLibs/stb_image/stb_image.cpp",
} }
if (_OPTIONS["enable_static_plugins"]) then
files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
project ("Test_PhysicsServerInProcessExampleBrowser") project ("Test_PhysicsServerInProcessExampleBrowser")
@@ -414,6 +420,10 @@ project ("Test_PhysicsServerInProcessExampleBrowser")
"../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp", "../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
"../../examples/ThirdPartyLibs/stb_image/stb_image.cpp", "../../examples/ThirdPartyLibs/stb_image/stb_image.cpp",
} }
if (_OPTIONS["enable_static_vr_plugin"]) then
files {"../../examples/SharedMemory/plugins/vrSyncPlugin/vrSyncPlugin.cpp"}
end
if os.is("Linux") then if os.is("Linux") then
initX11() initX11()
end end