Merge pull request #586 from erwincoumans/master
premake: disable linking system OpenGL and X11 by default,
This commit is contained in:
49
build3/Android/jni/Android.mk
Normal file
49
build3/Android/jni/Android.mk
Normal file
@@ -0,0 +1,49 @@
|
||||
LOCAL_PATH := ../../..
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -DUSE_PTHREADS -mfpu=neon -mfloat-abi=softfp -pthread -DSCE_PFX_USE_SIMD_VECTORMATH
|
||||
|
||||
# apply these flags if needed
|
||||
# -ffast-math -funsafe-math-optimizations
|
||||
|
||||
# apply this to disable optimization
|
||||
# TARGET_CFLAGS := $(TARGET_CFLAGS) -O0
|
||||
|
||||
# apply these 2 to turn on assembly output (*.c/*.cpp to *.s file)
|
||||
#compile-cpp-source = $(eval $(call ev-compile-cpp-source,$1,$(1:%$(LOCAL_CPP_EXTENSION)=%.s)))
|
||||
#TARGET_CFLAGS := $(TARGET_CFLAGS) -S
|
||||
|
||||
# Enable or disable NEON. Don't forget to apply, or not apply, -mfpu=neon and -mfloat-abi=softfp
|
||||
# flags in addition, e.g., if this is true both of those need to be included in LOCAL_CFLAGS
|
||||
# to avoid the possibility that ndk-build will "forget" to add them on some files
|
||||
LOCAL_ARM_NEON := true
|
||||
|
||||
TARGET_CFLAGS := $(filter-out -ffpu=vfp,$(TARGET_CFLAGS))
|
||||
|
||||
# setup to build static library
|
||||
LOCAL_MODULE := libBullet
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/src
|
||||
|
||||
#find all the file recursively under jni/
|
||||
FILE_LIST := $(wildcard \
|
||||
$(LOCAL_PATH)/src/LinearMath/*.cpp \
|
||||
$(LOCAL_PATH)/src/Bullet3Common/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletCollision/BroadphaseCollision/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletCollision/CollisionDispatch/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletCollision/CollisionShapes/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletCollision/NarrowPhaseCollision/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletDynamics/ConstraintSolver/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletDynamics/Dynamics/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletDynamics/Featherstone/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletDynamics/MLCPSolvers/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletDynamics/Vehicle/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletDynamics/Character/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletSoftBody/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletInverseDynamics/*.cpp \
|
||||
$(LOCAL_PATH)/src/BulletInverseDynamics/details/*.cpp \
|
||||
)
|
||||
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
7
build3/Android/jni/Application.mk
Normal file
7
build3/Android/jni/Application.mk
Normal file
@@ -0,0 +1,7 @@
|
||||
APP_MODULES := libBullet
|
||||
APP_ABI := armeabi-v7a
|
||||
APP_OPTIM := release
|
||||
|
||||
#We only need STL for placement new (#include <new>)
|
||||
#We don't use STL in Bullet
|
||||
APP_STL := stlport_static
|
||||
@@ -32,7 +32,7 @@
|
||||
links { "OpenGL.framework"}
|
||||
configuration {"not Windows", "not MacOSX"}
|
||||
if os.is("Linux") then
|
||||
if not _OPTIONS["force_dlopen_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
|
||||
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
|
||||
links {"GL"}
|
||||
else
|
||||
print("No GL/gl.h found, using dynamic loading of GL using glew")
|
||||
@@ -56,7 +56,7 @@
|
||||
end
|
||||
if os.is("Linux") then
|
||||
configuration{"Linux"}
|
||||
if not _OPTIONS["force_dlopen_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h") and os.isfile("/usr/include/GL/glew.h")) then
|
||||
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h") and os.isfile("/usr/include/GL/glew.h")) then
|
||||
links {"GLEW"}
|
||||
print ("linking against system GLEW")
|
||||
else
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
function initX11()
|
||||
if os.is("Linux") then
|
||||
if not _OPTIONS["force_dlopen_x11"] and (os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h")) then
|
||||
if _OPTIONS["enable_system_x11"] and (os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h")) then
|
||||
links{"X11","pthread"}
|
||||
else
|
||||
print("No X11/X.h found, using dynamic loading of X11")
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
|
||||
newoption
|
||||
{
|
||||
trigger = "force_dlopen_opengl",
|
||||
description = "Dynamically load OpenGL (instead of static/dynamic linking)"
|
||||
trigger = "enable_system_opengl",
|
||||
description = "Try to link and use the system OpenGL headers version instead of dynamically loading OpenGL (dlopen is default)"
|
||||
}
|
||||
|
||||
newoption
|
||||
{
|
||||
trigger = "force_dlopen_x11",
|
||||
description = "Dynamically load OpenGL (instead of static/dynamic linking)"
|
||||
trigger = "enable_system_x11",
|
||||
description = "Try to link and use system X11 headers instead of dynamically loading X11 (dlopen is default)"
|
||||
}
|
||||
|
||||
newoption
|
||||
@@ -199,6 +199,7 @@
|
||||
include "../examples/ExampleBrowser"
|
||||
include "../examples/OpenGLWindow"
|
||||
include "../examples/ThirdPartyLibs/Gwen"
|
||||
include "../examples/SimpleOpenGL3"
|
||||
|
||||
include "../examples/HelloWorld"
|
||||
include "../examples/BasicDemo"
|
||||
|
||||
@@ -379,14 +379,25 @@ bool UrdfParser::parseLink(UrdfLink& link, TiXmlElement *config, ErrorLogger* lo
|
||||
}
|
||||
} else
|
||||
{
|
||||
logger->reportWarning("No inertial data for link, using mass=1, localinertiadiagonal = 1,1,1, identity local inertial frame");
|
||||
link.m_inertia.m_mass = 1.f;
|
||||
link.m_inertia.m_linkLocalFrame.setIdentity();
|
||||
link.m_inertia.m_ixx = 1.f;
|
||||
link.m_inertia.m_iyy = 1.f;
|
||||
link.m_inertia.m_izz= 1.f;
|
||||
|
||||
logger->reportWarning(link.m_name.c_str());
|
||||
|
||||
if ((strlen(linkName)==5) && (strncmp(linkName, "world", 5))==0)
|
||||
{
|
||||
link.m_inertia.m_mass = 0.f;
|
||||
link.m_inertia.m_linkLocalFrame.setIdentity();
|
||||
link.m_inertia.m_ixx = 0.f;
|
||||
link.m_inertia.m_iyy = 0.f;
|
||||
link.m_inertia.m_izz= 0.f;
|
||||
} else
|
||||
{
|
||||
|
||||
logger->reportWarning("No inertial data for link, using mass=1, localinertiadiagonal = 1,1,1, identity local inertial frame");
|
||||
link.m_inertia.m_mass = 1.f;
|
||||
link.m_inertia.m_linkLocalFrame.setIdentity();
|
||||
link.m_inertia.m_ixx = 1.f;
|
||||
link.m_inertia.m_iyy = 1.f;
|
||||
link.m_inertia.m_izz= 1.f;
|
||||
logger->reportWarning(link.m_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// Multiple Visuals (optional)
|
||||
|
||||
@@ -172,6 +172,8 @@ struct InternalData2
|
||||
XEvent m_xev;
|
||||
GLXFBConfig m_bestFbc;
|
||||
int m_modifierFlags;
|
||||
int m_glWidth;
|
||||
int m_glHeight;
|
||||
|
||||
#ifdef DYNAMIC_LOAD_X11_FUNCTIONS
|
||||
//dynamically load stuff
|
||||
@@ -207,6 +209,9 @@ struct InternalData2
|
||||
InternalData2()
|
||||
:m_dpy(0),
|
||||
m_vi(0),
|
||||
m_modifierFlags(0),
|
||||
m_glWidth(-1),
|
||||
m_glHeight(-1),
|
||||
m_wheelCallback(0),
|
||||
m_mouseMoveCallback(0),
|
||||
m_mouseButtonCallback(0),
|
||||
@@ -929,6 +934,9 @@ void X11OpenGLWindow::pumpMessage()
|
||||
{
|
||||
// printf("@");
|
||||
// fflush(0);
|
||||
m_data->m_glWidth = m_data->m_xev.xconfigure.width;
|
||||
m_data->m_glHeight = m_data->m_xev.xconfigure.height;
|
||||
|
||||
if (m_data->m_resizeCallback)
|
||||
{
|
||||
(*m_data->m_resizeCallback)(m_data->m_xev.xconfigure.width,m_data->m_xev.xconfigure.height);
|
||||
@@ -1031,6 +1039,10 @@ void X11OpenGLWindow::setMouseButtonCallback(b3MouseButtonCallback mouseCallback
|
||||
|
||||
void X11OpenGLWindow::setResizeCallback(b3ResizeCallback resizeCallback)
|
||||
{
|
||||
if (resizeCallback && m_data->m_glWidth>0 && m_data->m_glHeight > 0)
|
||||
{
|
||||
resizeCallback(m_data->m_glWidth, m_data->m_glHeight);
|
||||
}
|
||||
m_data->m_resizeCallback = resizeCallback;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ InternalOpenGL2RenderCallbacks::~InternalOpenGL2RenderCallbacks()
|
||||
|
||||
void InternalOpenGL2RenderCallbacks::display2()
|
||||
{
|
||||
|
||||
assert(glGetError()==GL_NO_ERROR);
|
||||
// glViewport(0,0,10,10);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "OpenGLWindow/SimpleOpenGL3App.h"
|
||||
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
#include "Bullet3Common/b3CommandLineArgs.h"
|
||||
#include "assert.h"
|
||||
@@ -8,6 +9,50 @@
|
||||
char* gVideoFileName = 0;
|
||||
char* gPngFileName = 0;
|
||||
|
||||
static b3WheelCallback sOldWheelCB = 0;
|
||||
static b3ResizeCallback sOldResizeCB = 0;
|
||||
static b3MouseMoveCallback sOldMouseMoveCB = 0;
|
||||
static b3MouseButtonCallback sOldMouseButtonCB = 0;
|
||||
static b3KeyboardCallback sOldKeyboardCB = 0;
|
||||
static b3RenderCallback sOldRenderCB = 0;
|
||||
|
||||
|
||||
void MyWheelCallback(float deltax, float deltay)
|
||||
{
|
||||
if (sOldWheelCB)
|
||||
sOldWheelCB(deltax,deltay);
|
||||
}
|
||||
void MyResizeCallback( float width, float height)
|
||||
{
|
||||
if (sOldResizeCB)
|
||||
sOldResizeCB(width,height);
|
||||
}
|
||||
void MyMouseMoveCallback( float x, float y)
|
||||
{
|
||||
printf("Mouse Move: %f, %f\n", x,y);
|
||||
|
||||
if (sOldMouseMoveCB)
|
||||
sOldMouseMoveCB(x,y);
|
||||
}
|
||||
void MyMouseButtonCallback(int button, int state, float x, float y)
|
||||
{
|
||||
if (sOldMouseButtonCB)
|
||||
sOldMouseButtonCB(button,state,x,y);
|
||||
}
|
||||
|
||||
|
||||
void MyKeyboardCallback(int keycode, int state)
|
||||
{
|
||||
//keycodes are in examples/CommonInterfaces/CommonWindowInterface.h
|
||||
//for example B3G_ESCAPE for escape key
|
||||
//state == 1 for pressed, state == 0 for released.
|
||||
// use app->m_window->isModifiedPressed(...) to check for shift, escape and alt keys
|
||||
printf("MyKeyboardCallback received key:%c in state %d\n",keycode,state);
|
||||
if (sOldKeyboardCB)
|
||||
sOldKeyboardCB(keycode,state);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
b3CommandLineArgs myArgs(argc,argv);
|
||||
@@ -17,8 +62,20 @@ int main(int argc, char* argv[])
|
||||
app->m_instancingRenderer->getActiveCamera()->setCameraDistance(13);
|
||||
app->m_instancingRenderer->getActiveCamera()->setCameraPitch(0);
|
||||
app->m_instancingRenderer->getActiveCamera()->setCameraTargetPosition(0,0,0);
|
||||
sOldKeyboardCB = app->m_window->getKeyboardCallback();
|
||||
app->m_window->setKeyboardCallback(MyKeyboardCallback);
|
||||
sOldMouseMoveCB = app->m_window->getMouseMoveCallback();
|
||||
app->m_window->setMouseMoveCallback(MyMouseMoveCallback);
|
||||
sOldMouseButtonCB = app->m_window->getMouseButtonCallback();
|
||||
app->m_window->setMouseButtonCallback(MyMouseButtonCallback);
|
||||
sOldWheelCB = app->m_window->getWheelCallback();
|
||||
app->m_window->setWheelCallback(MyWheelCallback);
|
||||
sOldResizeCB = app->m_window->getResizeCallback();
|
||||
app->m_window->setResizeCallback(MyResizeCallback);
|
||||
|
||||
|
||||
assert(glGetError()==GL_NO_ERROR);
|
||||
|
||||
assert(glGetError()==GL_NO_ERROR);
|
||||
|
||||
myArgs.GetCmdLineArgument("mp4_file",gVideoFileName);
|
||||
if (gVideoFileName)
|
||||
|
||||
Reference in New Issue
Block a user