How to add additional source folders to an Android project?

As the title asks, how would I add additional source folders to an Android project?

Previously (pre 0.7.4) I would just edit the file Makefile.examples and do the following:

  
SOURCE_DIRS = $(shell find . -maxdepth 1 -mindepth 1 -type d | grep -v "$(SED_EXCLUDE_FROM_SRC)" | sed s/.\\///)  
SOURCE_DIRS += ../MyApp-windows/src  
SOURCE_DIRS += ../MyApp-windows/src/layers  
SOURCE_DIRS += ../MyApp-windows/src/utils  

I am currently using the develop branch from github and it seems like the Android makefiles have been replaced by new *.mk scripts. I’m a bit lost on where to insert my own source directories.

I have my project setup something like this (multiple targets, one shared source folder):

  • D:\projects\openFrameworks\apps\MyApp\MyApp-android
    D:\projects\openFrameworks\apps\MyApp\MyApp-bb10
    D:\projects\openFrameworks\apps\MyApp\MyApp-windows

The directory:

  • D:\projects\openFrameworks\apps\MyApp\MyApp-android\src

is empty and not used.

The Android project should use:

  • D:\projects\openFrameworks\apps\MyApp\MyApp-windows\src

  • D:\projects\openFrameworks\apps\MyApp\MyApp-windows\src\layers

  • D:\projects\openFrameworks\apps\MyApp\MyApp-windows\src\utils

in your config.make in the project you can add a variable:

  
  
USER_SOURCE_DIR=../MyApp-windows/  
  

you’ll also need to add those to your include search path:

  
  
USER_CFLAGS = -I../MyApp-windows/src -I../MyApp-windows/src/layers -I../MyApp-windows/utils  
  

Thanks for your quick response arturo!

Unfortunately that doesn’t seem to work. I did a quick search to see where USER_SOURCE_DIR is used in the makefiles, but I couldn’t find any… perhaps the parameter has been removed?

are you using 0.7.4 or develop, if you are in 0.7.4 it’s there:

https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworksCompiled/project/makefileCommon/Makefile.examples#L67

if you are using develop the name has changed with the new makefiles to:

PROJECT_EXTERNAL_SOURCE_PATHS

the usage is the same except it adds the search paths automatically

I’m using the develop branch from github as I ran into some bugs on the 0.7.4 release. PROJECT_EXTERNAL_SOURCE_PATHS seems to work perfectly (didnt needed to add USER_CFLAGS).

Thanks!