jvcleave / ofxImGui

Use ImGui in openFrameworks
296 stars 124 forks source link

compilation errors on EngineGLFW in Android Studio #11

Open brucelane opened 8 years ago

brucelane commented 8 years ago

on my fork of your repo I had to delete EngineGLFW.h and EngineGLFW.cpp. it's not a good practice, I know! I tryed to #define TARGET_OPENGLES 1 but those files where still compiling...

jvcleave commented 8 years ago

Yeah - OF basically tries to compile everything in the src folder.

#if !defined(TARGET_RASPBERRY_PI) was working for the RPI - you may want to try TARGET_ANDROID

OF provides a way to exclude via a addon_config.mk file like this one but it wasn't working for me - need to figure it out

https://github.com/openframeworks/openFrameworks/blob/master/addons/ofxOpenCv/addon_config.mk

eKABIA commented 8 years ago

I tryed several things like:

if !defined(TARGET_ANDROID)

ifndef TARGET_ANDROID

with no success I'm still searching (sorry it's Bruce under my colleague Edouard account!)

eKABIA commented 8 years ago

it seems TARGET_ANDROID is not defined, because if I put #ifdef TARGET_ANDROID (or #ifdef whatever) EngineGLFW are not compiled!

funny thing, TARGET_ANDROID in defined in main.cpp as I have this snippet in main.cpp:

ifdef TARGET_ANDROID

include

//======================================================================== extern "C"{ void Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jobject thiz ){ main(); } }

endif

eKABIA commented 8 years ago

adding PROJECT_DEFINES = TARGET_ANDROID in config.make solves the problem.

then in EngineGLFW.*:

if !defined(TARGET_RASPBERRY_PI) && !defined(TARGET_ANDROID)

prisonerjohn commented 7 years ago

Just encountered a similar issue and had to add the following at the top of the file.

#include "ofConstants.h"

This ensures that the TARGET_XXX definitions are set before trying to use them. See https://github.com/jvcleave/ofxImGui/blob/master/src/EngineGLFW.h#L3-L4