Skip to content

Commit e26fae1

Browse files
authored
Local addons ok (#595)
* local addons changes * fix for recursive PG missing source files * update config.make, cpp version * now PG can add .storyboards from src folders adding correctly to copy bundle resources
1 parent 0d8b8d2 commit e26fae1

File tree

9 files changed

+229
-213
lines changed

9 files changed

+229
-213
lines changed

commandLine/config.make

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
################################################################################
77
# OF ROOT
88
# The location of your root openFrameworks installation
9-
# (default) OF_ROOT = ../../..
9+
# (default) OF_ROOT = ../../..
1010
################################################################################
1111
OF_ROOT = ../../..
1212

1313
################################################################################
1414
# PROJECT ROOT
1515
# The location of the project - a starting place for searching for files
1616
# (default) PROJECT_ROOT = . (this directory)
17-
#
17+
#
1818
################################################################################
1919
# PROJECT_ROOT = .
2020

2121
################################################################################
2222
# PROJECT SPECIFIC CHECKS
23-
# This is a project defined section to create internal makefile flags to
24-
# conditionally enable or disable the addition of various features within
23+
# This is a project defined section to create internal makefile flags to
24+
# conditionally enable or disable the addition of various features within
2525
# this makefile. For instance, if you want to make changes based on whether
26-
# GTK is installed, one might test that here and create a variable to check.
26+
# GTK is installed, one might test that here and create a variable to check.
2727
################################################################################
2828
# None
2929
APPNAME = projectGenerator
@@ -33,23 +33,23 @@ PROJECT_AFTER_OSX="if test -f \"$TARGET_BUILD_DIR/projectGenerator\"; then rm \"
3333
################################################################################
3434
# PROJECT EXTERNAL SOURCE PATHS
3535
# These are fully qualified paths that are not within the PROJECT_ROOT folder.
36-
# Like source folders in the PROJECT_ROOT, these paths are subject to
36+
# Like source folders in the PROJECT_ROOT, these paths are subject to
3737
# exlclusion via the PROJECT_EXLCUSIONS list.
3838
#
39-
# (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
39+
# (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
4040
#
4141
# Note: Leave a leading space when adding list items with the += operator
4242
################################################################################
43-
# PROJECT_EXTERNAL_SOURCE_PATHS =
43+
# PROJECT_EXTERNAL_SOURCE_PATHS =
4444

4545
################################################################################
4646
# PROJECT EXCLUSIONS
47-
# These makefiles assume that all folders in your current project directory
47+
# These makefiles assume that all folders in your current project directory
4848
# and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations
49-
# to look for source code. The any folders or files that match any of the
49+
# to look for source code. The any folders or files that match any of the
5050
# items in the PROJECT_EXCLUSIONS list below will be ignored.
5151
#
52-
# Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
52+
# Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
5353
# string unless teh user adds a wildcard (%) operator to match subdirectories.
5454
# GNU make only allows one wildcard for matching. The second wildcard (%) is
5555
# treated literally.
@@ -75,45 +75,45 @@ PROJECT_AFTER_OSX="if test -f \"$TARGET_BUILD_DIR/projectGenerator\"; then rm \"
7575
# Note: Leave a leading space when adding list items with the += operator
7676
################################################################################
7777

78-
# Currently, shared libraries that are needed are copied to the
78+
# Currently, shared libraries that are needed are copied to the
7979
# $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to
80-
# add a runtime path to search for those shared libraries, since they aren't
80+
# add a runtime path to search for those shared libraries, since they aren't
8181
# incorporated directly into the final executable application binary.
8282
# TODO: should this be a default setting?
8383
# PROJECT_LDFLAGS=-Wl,-rpath=./libs
8484

8585
################################################################################
8686
# PROJECT DEFINES
87-
# Create a space-delimited list of DEFINES. The list will be converted into
87+
# Create a space-delimited list of DEFINES. The list will be converted into
8888
# CFLAGS with the "-D" flag later in the makefile.
8989
#
9090
# (default) PROJECT_DEFINES = (blank)
9191
#
9292
# Note: Leave a leading space when adding list items with the += operator
9393
################################################################################
94-
# PROJECT_DEFINES =
94+
# PROJECT_DEFINES =
9595

9696
################################################################################
9797
# PROJECT CFLAGS
98-
# This is a list of fully qualified CFLAGS required when compiling for this
99-
# project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
98+
# This is a list of fully qualified CFLAGS required when compiling for this
99+
# project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
100100
# defined in your platform specific core configuration files. These flags are
101-
# presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
101+
# presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
102102
#
103103
# (default) PROJECT_CFLAGS = (blank)
104104
#
105-
# Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
106-
# your platform specific configuration file will be applied by default and
105+
# Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
106+
# your platform specific configuration file will be applied by default and
107107
# further flags here may not be needed.
108108
#
109109
# Note: Leave a leading space when adding list items with the += operator
110110
################################################################################
111-
# PROJECT_CFLAGS =
111+
# PROJECT_CFLAGS =
112112

113113
################################################################################
114114
# PROJECT OPTIMIZATION CFLAGS
115-
# These are lists of CFLAGS that are target-specific. While any flags could
116-
# be conditionally added, they are usually limited to optimization flags.
115+
# These are lists of CFLAGS that are target-specific. While any flags could
116+
# be conditionally added, they are usually limited to optimization flags.
117117
# These flags are added BEFORE the PROJECT_CFLAGS.
118118
#
119119
# PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets.
@@ -124,15 +124,15 @@ PROJECT_AFTER_OSX="if test -f \"$TARGET_BUILD_DIR/projectGenerator\"; then rm \"
124124
#
125125
# (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank)
126126
#
127-
# Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
128-
# PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
129-
# file will be applied by default and further optimization flags here may not
127+
# Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
128+
# PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
129+
# file will be applied by default and further optimization flags here may not
130130
# be needed.
131131
#
132132
# Note: Leave a leading space when adding list items with the += operator
133133
################################################################################
134134
PROJECT_OPTIMIZATION_CFLAGS_RELEASE = -O3
135-
# PROJECT_OPTIMIZATION_CFLAGS_DEBUG =
135+
# PROJECT_OPTIMIZATION_CFLAGS_DEBUG =
136136

137137
################################################################################
138138
# PROJECT COMPILERS
@@ -141,8 +141,8 @@ PROJECT_OPTIMIZATION_CFLAGS_RELEASE = -O3
141141
# (default) PROJECT_CC = (blank)
142142
# Note: Leave a leading space when adding list items with the += operator
143143
################################################################################
144-
# PROJECT_CXX =
145-
# PROJECT_CC =
144+
# PROJECT_CXX =
145+
# PROJECT_CC =
146146

147147

148148
#PLATFORM_CORE_EXCLUSIONS += ../../../libs/openFrameworks/utils
@@ -179,11 +179,3 @@ PLATFORM_CORE_EXCLUSIONS += ../../../libs/fmod%
179179

180180
# inside ofImage inside ofUtils
181181
#PLATFORM_CORE_EXCLUSIONS += ../../../libs/uriparser%
182-
183-
export OF_NO_FMOD=1
184-
export USER_PREPROCESSOR_DEFINITIONS="OF_NO_FMOD=1"
185-
export LIB_FMOD=""
186-
187-
# Uncomment/comment below to switch between C++11 and C++17 ( or newer ). On macOS C++17 needs 10.15 or above.
188-
export MAC_OS_MIN_VERSION = 10.15
189-
export MAC_OS_CPP_VER = -std=c++17

commandLine/src/addons/ofAddon.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ bool ofAddon::load(string addonName, const fs::path& projectDir, const string& t
886886
// we want to set addonMakeName before cleaning the addon name, so it is preserved in the exact same way as it was passed, and the addons.make file can be (re)constructed properly
887887
this->addonMakeName = addonName;
888888

889-
addonName = cleanName(addonName);
889+
// addonName = cleanName(addonName);
890890

891891
if(addonName.empty()){
892892
ofLogError("baseProject::addAddon") << "cant add addon with empty name";
@@ -899,7 +899,12 @@ bool ofAddon::load(string addonName, const fs::path& projectDir, const string& t
899899
//A local addon is not restricted to one that lives in folder with the name local_addons, should be any valid addon on the filesystem.
900900
//Parsing will generate the correct path to both OF and the project.
901901
//Everything else should be treated exactly in the same way, regardless of it being local or not.
902-
if(addonName[0] == '.' && fs::exists( ofFilePath::join(projectDir, addonName))){
902+
903+
fs::path localAddon { addonName };
904+
905+
if (localAddon.has_parent_path() && fs::exists(projectDir / addonName)) {
906+
907+
// if(addonName[0] == '.' && fs::exists( ofFilePath::join(projectDir, addonName))){
903908

904909
this->addonPath = normalizePath(ofFilePath::join(projectDir, addonName));
905910
this->isLocalAddon = true;

commandLine/src/defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define OFPROJECTGENERATOR_MAJOR_VERSION "0"
2-
#define OFPROJECTGENERATOR_MINOR_VERSION "86"
2+
#define OFPROJECTGENERATOR_MINOR_VERSION "88"
33
#define OFPROJECTGENERATOR_PATCH_VERSION "0"
44

55
#define PG_VERSION (OFPROJECTGENERATOR_MAJOR_VERSION "." OFPROJECTGENERATOR_MINOR_VERSION "." OFPROJECTGENERATOR_PATCH_VERSION)

commandLine/src/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ void recursiveUpdate(const fs::path & path, const string & target) {
304304
}
305305
}
306306

307-
fs::current_path(path);
308307
updateProject(path, target, false);
309308
}
310309
}

commandLine/src/projects/baseProject.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,14 @@ bool baseProject::create(const fs::path & _path, string templateName){
220220

221221
// CWD is already on projectDir. so with this we get relative paths
222222
getFilesRecursively("src", fileNames);
223-
223+
224224
std::sort(fileNames.begin(), fileNames.end(), [](const fs::path & a, const fs::path & b) {
225225
return a.string() < b.string();
226226
});
227+
228+
// FIXME: I think we should remove this logic and remove the files from default project.
229+
// only the files present are added to the project
230+
227231
for (const auto & f : fileNames) {
228232
if (f != "src/ofApp.cpp" &&
229233
f != "src/ofApp.h" &&
@@ -302,12 +306,13 @@ bool baseProject::isAddonInCache(const string & addonPath, const string platform
302306
return addonsCache[platform].find(addonPath) != addonsCache[platform].end();
303307
}
304308

305-
void baseProject::addAddon(const std::string& _addonName){
309+
void baseProject::addAddon(const std::string & _addonName){
306310
ofLogVerbose("baseProject::addAddon") << _addonName;
307311
// alert( "baseProject::addAddon " + _addonName );
308312

309-
auto addonName = ofAddon::cleanName(_addonName);
310-
313+
// auto addonName = ofAddon::cleanName(_addonName);
314+
auto addonName = _addonName;
315+
311316

312317
// FIXME : not target, yes platform.
313318
//#ifdef TARGET_WIN32

commandLine/src/projects/visualStudioProject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ void visualStudioProject::appendFilter(string folderName){
214214

215215

216216
void visualStudioProject::addSrc(const fs::path & srcFile, const fs::path & folder, SrcType type){
217-
// alert("addSrc file: " + srcFile.string(), 35);
218-
// alert("addSrc folder: " + folder.string(), 35);
217+
// alert("addSrc file: " + srcFile.string() + " folder: " + folder.string(), 35);
219218

220219
// I had an empty ClCompile field causing errors
221220
if (srcFile.empty()) {
@@ -239,6 +238,7 @@ void visualStudioProject::addSrc(const fs::path & srcFile, const fs::path & fold
239238
for (std::size_t i = 0; i < folderSubNames.size(); i++){
240239
if (i != 0) folderName += "\\";
241240
folderName += folderSubNames[i];
241+
// alert("appendFilter: " + folderName, 34);
242242
appendFilter(folderName);
243243
}
244244

0 commit comments

Comments
 (0)