Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

first working version on OF007

  • Loading branch information...
commit 2d78cefbd187797e6e27453d9ef68cf458097776 1 parent 9a001d9
Francesco authored
465 Makefile
... ... @@ -0,0 +1,465 @@
  1 +# openFrameworks universal makefile
  2 +#
  3 +# make help : shows this message
  4 +# make Debug: makes the application with debug symbols
  5 +# make Release: makes the app with optimizations
  6 +# make: the same as make Release
  7 +# make CleanDebug: cleans the Debug target
  8 +# make CleanRelease: cleans the Release target
  9 +# make clean: cleans everything
  10 +#
  11 +#
  12 +# this should work with any OF app, just copy any example
  13 +# change the name of the folder and it should compile
  14 +# only .cpp support, don't use .c files
  15 +# it will look for files in any folder inside the application
  16 +# folder except that in the EXCLUDE_FROM_SOURCE variable
  17 +# it doesn't autodetect include paths yet
  18 +# add the include paths in the USER_CFLAGS variable
  19 +# using the gcc syntax: -Ipath
  20 +#
  21 +# to add addons to your application, edit the addons.make file
  22 +# in this directory and add the names of the addons you want to
  23 +# include
  24 +#
  25 +# edit the following vars to customize the makefile
  26 +
  27 +include config.make
  28 +
  29 +ifeq ($(findstring Android,$(MAKECMDGOALS)),Android)
  30 + include $(OF_ROOT)/libs/openFrameworksCompiled/project/android/paths.make
  31 + ARCH = android
  32 + ifeq ($(shell uname),Darwin)
  33 + HOST_PLATFORM = darwin-x86
  34 + else
  35 + HOST_PLATFORM = linux-x86
  36 + endif
  37 +endif
  38 +
  39 +ifeq ($(ARCH),android)
  40 + COMPILER_OPTIMIZATION = $(ANDROID_COMPILER_OPTIMIZATION)
  41 + NDK_PLATFORM = android-8
  42 +else
  43 + COMPILER_OPTIMIZATION = $(USER_COMPILER_OPTIMIZATION)
  44 +endif
  45 +
  46 +
  47 +
  48 +
  49 +# you shouldn't modify anything below this line
  50 +
  51 +
  52 +SHELL = /bin/sh
  53 +ifneq ($(ARCH),android)
  54 + CXX = g++
  55 + ARCH = $(shell uname -m)
  56 + ifeq ($(ARCH),x86_64)
  57 + LIBSPATH=linux64
  58 + else
  59 + LIBSPATH=linux
  60 + endif
  61 +else
  62 + ifeq ($(findstring Release_arm7,$(MAKECMDGOALS)),Release_arm7)
  63 + LIBSPATH =android/armeabi-v7a
  64 + else
  65 + LIBSPATH =android/armeabi
  66 + endif
  67 + TOOLCHAIN=arm-linux-androideabi-4.4.3
  68 + TOOLCHAIN_PATH=$(NDK_ROOT)/toolchains/$(TOOLCHAIN)/prebuilt/$(HOST_PLATFORM)/bin/
  69 + ANDROID_PREFIX=arm-linux-androideabi-
  70 + CC=$(NDK_ROOT)/toolchains/$(TOOLCHAIN)/prebuilt/$(HOST_PLATFORM)/bin/$(ANDROID_PREFIX)gcc
  71 + CXX=$(NDK_ROOT)/toolchains/$(TOOLCHAIN)/prebuilt/$(HOST_PLATFORM)/bin/$(ANDROID_PREFIX)g++
  72 + AR=$(NDK_ROOT)/toolchains/$(TOOLCHAIN)/prebuilt/$(HOST_PLATFORM)/bin/$(ANDROID_PREFIX)ar
  73 + SYSROOT=$(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/
  74 + CFLAGS += -nostdlib --sysroot=$(SYSROOT) -fno-short-enums
  75 + CFLAGS += -I"$(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/usr/include" -I"$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/include/" -I"$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"
  76 + CFLAGS += -DANDROID
  77 +endif
  78 +
  79 +NODEPS = clean
  80 +SED_EXCLUDE_FROM_SRC = $(shell echo $(EXCLUDE_FROM_SOURCE) | sed "s/,\(.*\)/,\1,/g" | sed "s/\([^,]*\),/ .\/\1%/g")
  81 +ALL_SOURCES_DIRS = $(shell find . -type d)
  82 +SOURCE_DIRS = $(filter-out $(SED_EXCLUDE_FROM_SRC), $(ALL_SOURCES_DIRS))
  83 +SOURCES = $(shell find $(SOURCE_DIRS) -maxdepth 1 -mindepth 1 -name "*.cpp" -or -name "*.c" -or -name "*.cc")
  84 +OBJFILES = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(patsubst %.cc,%.o,$(SOURCES))))
  85 +
  86 +ifneq (,$(USER_SOURCE_DIR))
  87 + USER_SOURCES = $(shell find $(USER_SOURCE_DIR) -name "*.cpp" -or -name "*.c" -or -name "*.cc")
  88 + USER_OBJFILES = $(subst $(USER_SOURCE_DIR)/, ,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(patsubst %.cc,%.o,$(USER_SOURCES)))))
  89 +endif
  90 +
  91 +APPNAME = $(shell basename `pwd`)
  92 +CORE_INCLUDES = $(shell find $(OF_ROOT)/libs/openFrameworks/ -type d)
  93 +CORE_INCLUDE_FLAGS = $(addprefix -I,$(CORE_INCLUDES))
  94 +INCLUDES = $(shell find $(OF_ROOT)/libs/*/include -type d | grep -v glu | grep -v quicktime | grep -v poco)
  95 +INCLUDES_FLAGS = $(addprefix -I,$(INCLUDES))
  96 +INCLUDES_FLAGS += -I$(OF_ROOT)/libs/poco/include
  97 +ifeq ($(ARCH),android)
  98 + INCLUDES_FLAGS += -I$(OF_ROOT)/libs/glu/include_android
  99 +else
  100 + INCLUDES_FLAGS += -I$(OF_ROOT)/libs/glu/include
  101 + INCLUDES_FLAGS += $(shell pkg-config glew gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 libudev --cflags)
  102 + #check if gtk exists and add it
  103 + GTK = $(shell pkg-config gtk+-2.0 --exists; echo $$?)
  104 + ifeq ($(GTK),0)
  105 + CFLAGS += $(shell pkg-config gtk+-2.0 --cflags) -DOF_USING_GTK
  106 + SYSTEMLIBS += $(shell pkg-config gtk+-2.0 --libs)
  107 + endif
  108 +
  109 + #check if mpg123 exists and add it
  110 + MPG123 = $(shell pkg-config libmpg123 --exists; echo $$?)
  111 + ifeq ($(MPG123),0)
  112 + CFLAGS += -DOF_USING_MPG123
  113 + SYSTEMLIBS += -lmpg123
  114 + endif
  115 +endif
  116 +LIB_STATIC = $(shell ls $(OF_ROOT)/libs/*/lib/$(LIBSPATH)/*.a 2> /dev/null | grep -v openFrameworksCompiled | grep -v Poco)
  117 +LIB_SHARED = $(shell ls $(OF_ROOT)/libs/*/lib/$(LIBSPATH)/*.so 2> /dev/null | grep -v openFrameworksCompiled | sed "s/.*\\/lib\([^/]*\)\.so/-l\1/")
  118 +LIB_STATIC += $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoNet.a $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoXML.a $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoUtil.a $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoFoundation.a
  119 +LIB_PATHS_FLAGS = $(shell ls -d $(OF_ROOT)/libs/*/lib/$(LIBSPATH) | sed "s/\(\.*\)/-L\1/")
  120 +
  121 +CFLAGS += -Wall -fexceptions
  122 +CFLAGS += -I.
  123 +CFLAGS += $(INCLUDES_FLAGS)
  124 +CFLAGS += $(CORE_INCLUDE_FLAGS)
  125 +
  126 +
  127 +
  128 +ifeq ($(ARCH),android)
  129 + LDFLAGS = --sysroot=$(SYSROOT) -nostdlib -L"$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi"
  130 + SYSTEMLIBS += -lstdc++ -lsupc++ -lgcc -lz -lGLESv1_CM -llog -ldl -lm -lc
  131 +else
  132 + LDFLAGS = -Wl,-rpath=./libs
  133 + SYSTEMLIBS += $(shell pkg-config jack glew gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 gstreamer-app-0.10 libudev cairo --libs)
  134 + SYSTEMLIBS += -lglut -lGL -lasound -lopenal -lsndfile -lvorbis -lFLAC -logg -lfreeimage -lGLU
  135 +endif
  136 +
  137 +
  138 +ifeq ($(findstring addons.make,$(wildcard *.make)),addons.make)
  139 + ifneq ($(ARCH),android)
  140 + ADDONS = $(shell cat addons.make | grep -v ofxAndroid)
  141 + else
  142 + ADDONS = $(shell cat addons.make)
  143 + endif
  144 +
  145 + ifneq ($(strip $(ADDONS)),)
  146 + ADDONS_REL_DIRS = $(addsuffix /src, $(ADDONS))
  147 + ADDONS_LIBS_REL_DIRS = $(addsuffix /libs, $(ADDONS))
  148 + ADDONS_DIRS = $(addprefix $(OF_ROOT)/addons/, $(ADDONS_REL_DIRS) )
  149 + ADDONS_LIBS_DIRS = $(addprefix $(OF_ROOT)/addons/, $(ADDONS_LIBS_REL_DIRS) )
  150 + ADDONS_BIN_LIBS_DIRS = $(addsuffix /*/lib/$(LIBSPATH), $(ADDONS_LIBS_DIRS) )
  151 +
  152 + ADDONS_INCLUDES = $(ADDONS_DIRS)
  153 + ADDONS_INCLUDES = $(ADDONS_LIBS_DIRS)
  154 + ADDONS_INCLUDES += $(shell find $(ADDONS_DIRS) -type d 2> /dev/null)
  155 + ADDONS_INCLUDES += $(shell find $(ADDONS_LIBS_DIRS) -type d 2> /dev/null)
  156 + ADDONSCFLAGS = $(addprefix -I,$(ADDONS_INCLUDES))
  157 +
  158 + ifeq ($(findstring libsorder.make,$(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null)),libsorder.make)
  159 + ADDONS_LIBS_W_ORDER = $(shell cat $(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null))
  160 + EXCLUDE_LIBS_FILTER = $(addprefix %,$(addsuffix .a,$(ADDONS_LIBS_W_ORDER)))
  161 + ADDONS_LIBS_STATICS = $(filter-out $(EXCLUDE_LIBS_FILTER), $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.a))
  162 + ADDONS_LIBS_STATICS += $(addprefix -l, $(ADDONS_LIBS_W_ORDER))
  163 + ADDONS_LIBS_STATICS += $(addprefix -L, $(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null | sed s/libsorder.make//g))
  164 + else
  165 + ADDONS_LIBS_STATICS = $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.a 2> /dev/null)
  166 + endif
  167 +
  168 + ADDONS_LIBS_SHARED = $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.so 2> /dev/null)
  169 + ADDONSLIBS = $(ADDONS_LIBS_STATICS)
  170 + ADDONSLIBS += $(ADDONS_LIBS_SHARED)
  171 +
  172 +
  173 + ADDONS_SOURCES = $(shell find $(ADDONS_DIRS) -name "*.cpp" -or -name "*.c" 2> /dev/null)
  174 + ADDONS_SOURCES += $(shell find $(ADDONS_LIBS_DIRS) -name "*.cpp" -or -name "*.c" -or -name "*.cc" 2>/dev/null)
  175 + ADDONS_OBJFILES = $(subst $(OF_ROOT)/, ,$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(ADDONS_SOURCES)))))
  176 + endif
  177 +endif
  178 +
  179 +
  180 +ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug)
  181 + TARGET_CFLAGS = -g
  182 + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworksDebug.a
  183 + TARGET_NAME = Debug
  184 +endif
  185 +
  186 +ifeq ($(findstring Release,$(MAKECMDGOALS)),Release)
  187 + TARGET_CFLAGS = $(COMPILER_OPTIMIZATION)
  188 + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworks.a
  189 + TARGET_NAME = Release
  190 +endif
  191 +
  192 +ifeq ($(ARCH),android)
  193 + ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug)
  194 + TARGET = libs/armeabi/libOFAndroidApp.so
  195 + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworksDebug.a
  196 + LDFLAGS += -Wl,--fix-cortex-a8 -shared
  197 + USER_LIBS = $(USER_LIBS_ARM)
  198 + endif
  199 +
  200 + ifeq ($(findstring Release,$(MAKECMDGOALS)),Release)
  201 + TARGET = libs/armeabi/libOFAndroidApp.so
  202 + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks.a
  203 + LDFLAGS += -Wl,--fix-cortex-a8 -shared
  204 + USER_LIBS = $(USER_LIBS_ARM)
  205 + endif
  206 +
  207 + ifeq ($(findstring Release_arm7,$(MAKECMDGOALS)),Release_arm7)
  208 + TARGET_NAME = Release_arm7
  209 + TARGET_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mthumb
  210 + TARGET = libs/armeabi-v7a/libOFAndroidApp.so
  211 + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks_arm7.a
  212 + USER_LIBS = $(USER_LIBS_ARM7)
  213 + endif
  214 +
  215 + ifeq ($(findstring Release_neon,$(MAKECMDGOALS)),Release_neon)
  216 + TARGET_NAME = Release_neon
  217 + TARGET_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
  218 + TARGET = libs/armeabi-v7a/libOFAndroidApp_neon.so
  219 + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks_neon.a
  220 + USER_LIBS = $(USER_LIBS_NEON)
  221 + endif
  222 +
  223 + ifeq ($(findstring TestLink,$(MAKECMDGOALS)),TestLink)
  224 + TARGET_NAME = Debug
  225 + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworksDebug.a
  226 + LDFLAGS += -Wl,--entry=main,--fix-cortex-a8
  227 + BIN_NAME = $(APPNAME)
  228 + TARGET = obj/$(BIN_NAME)
  229 + USER_LIBS = $(USER_LIBS_ARM)
  230 + endif
  231 +else
  232 + ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug)
  233 + BIN_NAME = $(APPNAME)_debug
  234 + TARGET = bin/$(BIN_NAME)
  235 + endif
  236 +
  237 + ifeq ($(findstring Release,$(MAKECMDGOALS)),Release)
  238 + BIN_NAME = $(APPNAME)
  239 + TARGET = bin/$(BIN_NAME)
  240 + endif
  241 +
  242 + ifeq ($(MAKECMDGOALS),)
  243 + TARGET_NAME = Release
  244 + BIN_NAME = $(APPNAME)
  245 + TARGET = bin/$(BIN_NAME)
  246 + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworks.a
  247 + endif
  248 +endif
  249 +
  250 +ifeq ($(MAKECMDGOALS),clean)
  251 + TARGET = bin/$(APPNAME)_debug bin/$(APPNAME)
  252 + TARGET_NAME = Release
  253 +endif
  254 +
  255 +
  256 +OBJ_OUTPUT = obj/$(ARCH)$(TARGET_NAME)/
  257 +CLEANTARGET = clean$(TARGET_NAME)
  258 +
  259 +OBJS = $(addprefix $(OBJ_OUTPUT), $(OBJFILES))
  260 +DEPFILES = $(patsubst %.o,%.d,$(OBJS))
  261 +
  262 +USER_OBJS = $(addprefix $(OBJ_OUTPUT), $(USER_OBJFILES))
  263 +DEPFILES += $(patsubst %.o,%.d,$(USER_OBJS))
  264 +
  265 +ifeq ($(findstring addons.make,$(wildcard *.make)),addons.make)
  266 + ADDONS_OBJS = $(addprefix $(OBJ_OUTPUT), $(ADDONS_OBJFILES))
  267 + DEPFILES += $(patsubst %.o,%.d,$(ADDONS_OBJS))
  268 +endif
  269 +
  270 +.PHONY: Debug Release all after afterDebugAndroid afterReleaseAndroid
  271 +
  272 +Release: $(TARGET) after
  273 +
  274 +Debug: $(TARGET) after
  275 +
  276 +all:
  277 + $(MAKE) Release
  278 +
  279 +DebugAndroid: $(TARGET)
  280 +
  281 +ReleaseAndroid: $(TARGET)
  282 +
  283 +Release_arm7Android: $(TARGET)
  284 +
  285 +Release_neonAndroid: $(TARGET) afterReleaseAndroid
  286 +
  287 +TestLinkAndroid: $(TARGET) afterDebugAndroid
  288 +
  289 +AndroidDebug:
  290 + $(MAKE) DebugAndroid
  291 + $(MAKE) TestLinkAndroid
  292 +
  293 +AndroidRelease:
  294 + $(MAKE) ReleaseAndroid
  295 + $(MAKE) Release_arm7Android
  296 + $(MAKE) Release_neonAndroid
  297 +
  298 +
  299 +#This rule does the compilation
  300 +#$(OBJS): $(SOURCES)
  301 +$(OBJ_OUTPUT)%.o: %.cpp
  302 + @echo "compiling object for: " $<
  303 + mkdir -p $(@D)
  304 + $(CXX) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
  305 +
  306 +$(OBJ_OUTPUT)%.o: %.c
  307 + @echo "compiling object for: " $<
  308 + mkdir -p $(@D)
  309 + $(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
  310 +
  311 +$(OBJ_OUTPUT)%.o: %.cc
  312 + @echo "compiling object for: " $<
  313 + mkdir -p $(@D)
  314 + $(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
  315 +
  316 +$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.cpp
  317 + @echo "compiling addon object for" $<
  318 + mkdir -p $(@D)
  319 + $(CXX) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $<
  320 +
  321 +$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.c
  322 + @echo "compiling addon object for" $<
  323 + mkdir -p $(@D)
  324 + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $<
  325 +
  326 +$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.cc
  327 + @echo "compiling addon object for" $<
  328 + mkdir -p $(@D)
  329 + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $<
  330 +
  331 +$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.c
  332 + @echo "compiling object for: " $<
  333 + mkdir -p $(@D)
  334 + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
  335 +
  336 +$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.cc
  337 + @echo "compiling object for: " $<
  338 + mkdir -p $(@D)
  339 + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
  340 +
  341 +$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.cpp
  342 + @echo "compiling object for: " $<
  343 + mkdir -p $(@D)
  344 + $(CXX) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $<
  345 +
  346 +$(TARGET): $(OBJS) $(ADDONS_OBJS) $(USER_OBJS) $(TARGET_LIBS) $(LIB_STATIC) Makefile
  347 + @echo 'linking $(TARGET) $(SOURCE_DIRS)'
  348 + mkdir -p $(@D)
  349 + $(CXX) -o $@ $(OBJS) $(ADDONS_OBJS) $(USER_OBJS) $(LDFLAGS) $(USER_LDFLAGS) $(TARGET_LIBS) $(ADDONSLIBS) $(USER_LIBS) $(LIB_STATIC) $(LIB_PATHS_FLAGS) $(LIB_SHARED) $(SYSTEMLIBS)
  350 +
  351 +-include $(DEPFILES)
  352 +
  353 +.PHONY: clean cleanDebug cleanRelease CleanAndroid
  354 +clean:
  355 + rm -rf $(OBJ_OUTPUT)
  356 + rm -f $(TARGET)
  357 + rm -r bin/libs
  358 +
  359 +$(CLEANTARGET):
  360 + rm -rf $(OBJ_OUTPUT)
  361 + rm -f $(TARGET)
  362 + rm -rf bin/libs
  363 +
  364 +CleanAndroid:
  365 + rm -Rf obj
  366 + rm -f libs/armeabi-v7a/libOFAndroidApp.so
  367 + rm -f libs/armeabi/libOFAndroidApp.so
  368 + rm -f obj/$(APPNAME)
  369 +
  370 +
  371 +afterDebugAndroid:$(TARGET)
  372 + @if [ -d libs/armeabi-v7a ]; then rm -r libs/armeabi-v7a; fi
  373 +
  374 + @cp $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver libs/armeabi
  375 +
  376 + #create gdb.setup for armeabi
  377 + @echo "set solib-search-path $(PWD)/obj/local/armeabi:$(PWD)/libs/armeabi" > libs/armeabi/gdb.setup
  378 + @echo "directory $(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/usr/include" >> libs/armeabi/gdb.setup
  379 + @echo "directory $(PWD)/src" >> libs/armeabi/gdb.setup
  380 + @echo "directory $(NDK_ROOT)/sources/cxx-stl/system" >> libs/armeabi/gdb.setup
  381 + @echo "directory $(PWD)/libs/armeabi" >> libs/armeabi/gdb.setup
  382 + @echo "" >> libs/armeabi/gdb.setup
  383 +
  384 + @if [ ! -d jni ]; then mkdir jni; fi
  385 + @echo "APP_ABI := armeabi" > jni/Application.mk
  386 + @echo "#LOCAL_MODULE := OFAndroidApp" > jni/Android.mk
  387 +
  388 +afterReleaseAndroid:$(TARGET)
  389 + @if [ -f obj/$(BIN_NAME) ]; then rm obj/$(BIN_NAME); fi
  390 +
  391 + @cp $(OF_ROOT)/libs/openFrameworksCompiled/project/android/libneondetection.so libs/armeabi-v7a/
  392 + @cp $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver libs/armeabi-v7a
  393 +
  394 + #create gdb.setup for armeabi-v7a
  395 + @echo "set solib-search-path $(PWD)/obj/local/armeabi-v7a:$(PWD)/libs/armeabi-v7a" > libs/armeabi-v7a/gdb.setup
  396 + @echo "directory $(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/usr/include" >> libs/armeabi-v7a/gdb.setup
  397 + @echo "directory $(PWD)/src" >> libs/armeabi-v7a/gdb.setup
  398 + @echo "directory $(NDK_ROOT)/sources/cxx-stl/system" >> libs/armeabi-v7a/gdb.setup
  399 + @echo "directory $(PWD)/libs/armeabi-v7a" >> libs/armeabi-v7a/gdb.setup
  400 + @echo "" >> libs/armeabi-v7a/gdb.setup
  401 +
  402 + @if [ ! -d jni ]; then mkdir jni; fi
  403 + @echo "APP_ABI := armeabi armeabi-v7a" > jni/Application.mk
  404 + @echo "#LOCAL_MODULE := OFAndroidApp" > jni/Android.mk
  405 +
  406 +RESNAME=$(shell echo $(APPNAME)Resources | tr '[A-Z]' '[a-z]')
  407 +
  408 +AndroidInstall:
  409 + if [ -d "bin/data" ]; then \
  410 + mkdir -p res/raw; \
  411 + rm res/raw/$(RESNAME).zip; \
  412 + cd bin/data; \
  413 + zip -r ../../res/raw/$(RESNAME).zip *; \
  414 + cd ../..; \
  415 + fi
  416 + if [ -f obj/$(BIN_NAME) ]; then rm obj/$(BIN_NAME); fi
  417 + #touch AndroidManifest.xml
  418 + $(SDK_ROOT)/tools/android update project --target $(NDK_PLATFORM) --path $(PROJECT_PATH)
  419 + ant debug
  420 + cp bin/OFActivity-debug.apk bin/$(APPNAME).apk
  421 + #if [ "$(shell $(SDK_ROOT)/platform-tools/adb get-state)" = "device" ]; then
  422 + $(SDK_ROOT)/platform-tools/adb install -r bin/$(APPNAME).apk;
  423 + #fi
  424 + $(SDK_ROOT)/platform-tools/adb shell am start -a android.intent.action.MAIN -n cc.openframeworks.$(APPNAME)/cc.openframeworks.$(APPNAME).OFActivity
  425 +
  426 +
  427 +after:$(TARGET)
  428 + cp -r $(OF_ROOT)/export/$(LIBSPATH)/libs bin/
  429 + @echo
  430 + @echo " compiling done"
  431 + @echo " to launch the application"
  432 + @echo
  433 + @echo " cd bin"
  434 + @echo " ./$(BIN_NAME)"
  435 + @echo
  436 +
  437 +
  438 +.PHONY: help
  439 +help:
  440 + @echo
  441 + @echo openFrameworks universal makefile
  442 + @echo
  443 + @echo targets:
  444 + @echo "make Debug: builds the application with debug symbols"
  445 + @echo "make Release: builds the app with optimizations"
  446 + @echo "make: = make Release"
  447 + @echo "make all: = make Release"
  448 + @echo "make CleanDebug: cleans the Debug target"
  449 + @echo "make CleanRelease: cleans the Release target"
  450 + @echo "make clean: cleans everything"
  451 + @echo
  452 + @echo this should work with any OF app, just copy any example
  453 + @echo change the name of the folder and it should compile
  454 + @echo "only .cpp support, don't use .c files"
  455 + @echo it will look for files in any folder inside the application
  456 + @echo folder except that in the EXCLUDE_FROM_SOURCE variable.
  457 + @echo "it doesn't autodetect include paths yet"
  458 + @echo "add the include paths editing the var USER_CFLAGS"
  459 + @echo at the beginning of the makefile using the gcc syntax:
  460 + @echo -Ipath
  461 + @echo
  462 + @echo to add addons to your application, edit the addons.make file
  463 + @echo in this directory and add the names of the addons you want to
  464 + @echo include
  465 + @echo
13 lpmt_linux64.cbp
@@ -5,7 +5,7 @@
5 5 <Option title="projection_mapping" />
6 6 <Option pch_mode="2" />
7 7 <Option compiler="gcc" />
8   - <Option virtualFolders="addons/;src/;addons/ofxMSAInteractiveObject/src/;addons/ofxSimpleGuiToo/src/Controls/;addons/ofxSimpleGuiToo/src/;addons/ofxXmlSettings/libs/;addons/ofxXmlSettings/src/;addons/ofxFBOTexture/;addons/ofxFBOTexture/src/;addons/ofxShader/;addons/ofxShader/src/;" />
  8 + <Option virtualFolders="addons/;src/;addons/ofxMSAInteractiveObject/src/;addons/ofxSimpleGuiToo/src/Controls/;addons/ofxSimpleGuiToo/src/;addons/ofxXmlSettings/libs/;addons/ofxXmlSettings/src/;" />
9 9 <Build>
10 10 <Target title="Debug">
11 11 <Option output="bin/$(PROJECT_NAME)_debug" prefix_auto="1" extension_auto="1" />
@@ -78,6 +78,9 @@
78 78 <Add directory="../../../libs/glew/include/GL" />
79 79 <Add directory="../../../libs/openFrameworks/gl" />
80 80 <Add directory="../../../libs/kiss/include" />
  81 + <Add directory="../../../libs/cairo/include/cairo" />
  82 + <Add directory="../../../libs/tess2/include" />
  83 + <Add directory="../../../libs/tess2/Sources" />
81 84 </Compiler>
82 85 <Linker>
83 86 <Add library="fmodex" />
@@ -101,6 +104,8 @@
101 104 <Add library="openal" />
102 105 <Add library="sndfile" />
103 106 <Add library="../../../libs/kiss/lib/linux64/libkiss.a" />
  107 + <Add library="cairo" />
  108 + <Add library="../../../libs/tess2/lib/linux64/libtess2.a" />
104 109 <Add directory="../../../libs/freetype/lib/linux64" />
105 110 <Add directory="../../../libs/FreeImage/lib/linux64" />
106 111 <Add directory="../../../libs/rtAudio/lib/linux64" />
@@ -249,12 +254,6 @@
249 254 <Unit filename="src/quad.h">
250 255 <Option virtualFolder="src/" />
251 256 </Unit>
252   - <Unit filename="src/shaderChromakey.cpp">
253   - <Option virtualFolder="src/" />
254   - </Unit>
255   - <Unit filename="src/shaderChromakey.h">
256   - <Option virtualFolder="src/" />
257   - </Unit>
258 257 <Unit filename="src/testApp.cpp">
259 258 <Option virtualFolder="src/" />
260 259 </Unit>
18 src/quad.cpp
... ... @@ -1,5 +1,10 @@
1 1 #include "quad.h"
2 2
  3 +#include <sys/types.h>
  4 +#include <dirent.h>
  5 +#include <errno.h>
  6 +#include <vector>
  7 +#include <string>
3 8
4 9 // a func for reading a dir content to a vector of strings
5 10 int quad::getdir (string dir, vector<string> &files)
@@ -219,7 +224,7 @@
219 224 if (videoBg) {
220 225 string videoName = videos[bgVideo];
221 226 if (videoName != loadedVideo) {
222   - if (video.bLoaded) { video.closeMovie(); }
  227 + if (video.isLoaded()) { video.closeMovie(); }
223 228 video.loadMovie("video/"+videoName);
224 229 videoWidth = video.width;
225 230 videoHeight = video.height;
@@ -237,7 +242,8 @@
237 242 else {
238 243 video.setLoopState(OF_LOOP_NONE);
239 244 }
240   - video.idleMovie();
  245 +
  246 + if (video.isLoaded()) { video.idleMovie(); }
241 247
242 248 // video greenscreen stuff
243 249 if (videoGreenscreen) {
@@ -468,11 +474,11 @@
468 474 ofNoFill();
469 475 if (isSetup)
470 476 {
471   - ofSetColor(borderColor);
  477 + ofSetHexColor(borderColor);
472 478 ofRect(0, 0, ofGetWidth(), ofGetHeight());
473 479 // draws helper grid on active quad
474 480 if (borderColor == 0xFFFFFF) {
475   - ofSetColor(0x444444);
  481 + ofSetHexColor(0x444444);
476 482 ofLine(0,ofGetHeight()/2,ofGetWidth(),ofGetHeight()/2);
477 483 ofLine(ofGetWidth()/2,0,ofGetWidth()/2,ofGetHeight());
478 484 ofLine(ofGetWidth()/2,0,ofGetWidth()/2-20,20);
@@ -488,9 +494,9 @@
488 494
489 495 // writes quad number with a dropback shadow in the middle of quad - KEEP IT AT LAST POSITION IN draw()
490 496 if (isSetup) {
491   - ofSetColor(0x000000);
  497 + ofSetHexColor(0x000000);
492 498 ttf.drawString("quad n. "+ofToString(quadNumber), ofGetWidth()/2, ofGetHeight()/2);
493   - ofSetColor(0xFFFFFF);
  499 + ofSetHexColor(0xFFFFFF);
494 500 ttf.drawString("quad n. "+ofToString(quadNumber), (ofGetWidth()/2)-4, (ofGetHeight()/2)-4);
495 501 }
496 502
18 src/quad.h
@@ -36,15 +36,15 @@ class quad
36 36 ball balls[80];
37 37
38 38 int borderColor;
39   - ofColor bgColor;
40   - ofColor secondColor;
41   - ofColor startColor;
42   - ofColor endColor;
43   - ofColor transColor;
44   - ofColor imgColorize;
45   - ofColor videoColorize;
46   - ofColor camColorize;
47   - ofColor colorGreenscreen;
  39 + ofFloatColor bgColor;
  40 + ofFloatColor secondColor;
  41 + ofFloatColor startColor;
  42 + ofFloatColor endColor;
  43 + ofFloatColor transColor;
  44 + ofFloatColor imgColorize;
  45 + ofFloatColor videoColorize;
  46 + ofFloatColor camColorize;
  47 + ofFloatColor colorGreenscreen;
48 48
49 49 int bgAlpha;
50 50
9 src/testApp.cpp
@@ -214,6 +214,8 @@ void testApp::setup()
214 214 void testApp::update()
215 215 {
216 216 // grabs video frame from camera and passes pixels to quads
  217 +
  218 + if (camGrabber.getHeight() > 0){ // isLoaded check
217 219 camGrabber.grabFrame();
218 220 if (camGrabber.isFrameNew())
219 221 {
@@ -233,6 +235,7 @@ void testApp::update()
233 235 }
234 236 }
235 237 }
  238 + }
236 239
237 240
238 241 // sets default window background, grey in setup mode and black in projection mode
@@ -270,7 +273,7 @@ void testApp::draw()
270 273 if (snapshotOn)
271 274 {
272 275 ofEnableAlphaBlending();
273   - ofSetColor(0xFFFFFF);
  276 + ofSetHexColor(0xFFFFFF);
274 277 snapshotTexture.draw(0,0,ofGetWidth(),ofGetHeight());
275 278 ofDisableAlphaBlending();
276 279 }
@@ -291,7 +294,7 @@ void testApp::draw()
291 294 // in setup mode writes the number of active quad at the bottom of the window
292 295 if (isSetup)
293 296 {
294   - ofSetColor(0xFFFFFF);
  297 + ofSetHexColor(0xFFFFFF);
295 298 ttf.drawString("active quad: "+ofToString(activeQuad), 30, ofGetHeight()-25);
296 299 }
297 300
@@ -554,7 +557,7 @@ void testApp::keyPressed(int key)
554 557 if (quads[i].initialized)
555 558 {
556 559 // resets video to start ing point
557   - if (quads[i].videoBg && quads[i].video.bLoaded)
  560 + if (quads[i].videoBg && quads[i].video.isLoaded())
558 561 {
559 562 quads[i].video.setPosition(0.0);
560 563 }

0 comments on commit 2d78cef

Please sign in to comment.
Something went wrong with that request. Please try again.