Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addons parsing improvement (dont merge yet) #578

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
a3681b2
marking virtual override, set several functions in baseProject as pur…
roymacdonald Sep 16, 2024
b371258
baseProject some functions now are pureabstract and have const refere…
roymacdonald Sep 16, 2024
af588f4
changing method to identify local addons
roymacdonald Sep 16, 2024
db2ac57
adding virtual functions for the parsing and processing of each of th…
roymacdonald Sep 17, 2024
8b462cd
correctly saving and loading addon_config
roymacdonald Sep 17, 2024
8abbe8a
using correct relative paths
roymacdonald Sep 17, 2024
4a75fa6
corrected adddon Relative Path.
roymacdonald Sep 23, 2024
351bc84
moved redundant code into single function for adding elements to file…
roymacdonald Sep 23, 2024
cae1fe0
fixing libraries paths even when it is a local_addon.
roymacdonald Sep 23, 2024
4662abc
cleanup + comments
roymacdonald Sep 23, 2024
47373ed
comments
roymacdonald Sep 23, 2024
f0538d2
setting fs::current_path( to project's path so the paths are relative…
roymacdonald Sep 23, 2024
92bd210
encapsulating ofAddon loading.
roymacdonald Sep 24, 2024
06695f2
updating use of ofAddon.
roymacdonald Sep 24, 2024
7113d7c
fixes to getFolderUUID so it properly handles local addons
roymacdonald Sep 24, 2024
e0860d1
Horrible hack to properly parse libs and frameworks on when these use…
roymacdonald Sep 24, 2024
b22c01c
Merge branch 'openframeworks:master' into addonsParsingImprovement
roymacdonald Sep 25, 2024
87c6fe6
dont remove comments from the addons in addons.make file
roymacdonald Sep 25, 2024
26160d3
added json output for ofAddon class. moslty for development debugging…
roymacdonald Sep 25, 2024
c254a2c
removed some alerts
roymacdonald Sep 25, 2024
a525826
removing duplicates
roymacdonald Sep 26, 2024
df54108
changing LibraryBinary from struct to class
roymacdonald Sep 26, 2024
bb6b022
remove unnecesary alert
roymacdonald Sep 26, 2024
1677f28
Removed noARC flag as it is being added improperly to some objc files.
roymacdonald Sep 29, 2024
6b32307
ofAddon: removed fromFS function and parsing name before normalizing …
roymacdonald Sep 29, 2024
ebc0a3f
removing redundant virtual declaration of functions that already have…
roymacdonald Oct 3, 2024
abe0e5b
Update defines.h
dimitre Oct 7, 2024
a136c43
adding addon stuff in virtual functions
Oct 10, 2024
082bbda
srcType to string
Oct 10, 2024
cf7d4b8
Moved a lot of redundant code into virtual function
Oct 10, 2024
d9f7018
removed ofRelativeToOFPATH which was useless
Oct 10, 2024
f42d113
made a single function from to almost identical ones
Oct 10, 2024
382a587
removing a lot of redundat code and properly overriding funcs
Oct 10, 2024
d506085
alerts and etc.
Oct 10, 2024
35663f4
cleanup
Oct 10, 2024
f2bd861
fixed typo
Oct 10, 2024
c941406
removed unneded func override
Oct 10, 2024
3c87dd9
removed const from a bunc of functions
Oct 10, 2024
490bbf1
fix typo
Oct 10, 2024
47325ff
using at instead of []
Oct 10, 2024
631f4c6
dont remove path variable if not found so the IDE/compiler deals with it
Oct 10, 2024
6c246c7
cleanup
Oct 10, 2024
15db750
keeping include paths that have some sort of system variable
Oct 10, 2024
d9f71f6
disabling fixSlashOrder
Oct 10, 2024
61a771e
Merge branch 'addonsParsingImprovement' of github.com:roymacdonald/pr…
Oct 10, 2024
e8b4ab5
visualStudioProject: added addCompileOption function to remove a lot …
Oct 14, 2024
f543c4d
visualStudioProject: removed some dev console printing.
Oct 14, 2024
2a73311
visualStudioProject: fixed function name typo
Oct 14, 2024
bdd200d
commandLine: dont parse addons.make if there are addons passed as arg…
Oct 14, 2024
39ee9b7
frontEnd: getCurrentPlatform() returnis windows instead of vs when on…
Oct 14, 2024
a97352e
commenting out printing
Oct 14, 2024
e89d817
templated removeDuplicates function
roymacdonald Oct 22, 2024
b4aab46
LibraryBinary: parses its own path and sets its arch and target. Func…
roymacdonald Oct 22, 2024
57a19aa
reworked getLibsRecursively
roymacdonald Oct 22, 2024
6b2b641
removing duplicate libs, adding libs to projectFolders. apply exclude…
roymacdonald Oct 22, 2024
315f9c2
xcodeProj. adding Dylib with folder
roymacdonald Oct 22, 2024
ac763b5
added missing include
roymacdonald Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
313 changes: 212 additions & 101 deletions commandLine/src/addons/ofAddon.cpp

Large diffs are not rendered by default.

25 changes: 21 additions & 4 deletions commandLine/src/addons/ofAddon.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <iostream>
#include <filesystem>


namespace fs = of::filesystem;
using std::string;
using std::vector;
Expand Down Expand Up @@ -121,9 +122,10 @@ class ofAddon {
ofAddon() = default;
ofAddon(const ofAddon& other);


bool fromFS(const fs::path & path, const string & platform);
void parseLibsPath(const fs::path & path, const fs::path & parentFolder);
static string cleanName(const string& name);

bool load(string addonName, const fs::path& projectDir, const string& targetPlatform);



// void fromXML(string installXmlName);
Expand Down Expand Up @@ -175,8 +177,17 @@ class ofAddon {
bool operator <(const ofAddon & addon) const{
return addon.name < name;
}

string addonMakeName;



private:


// bool fromFS();
void parseLibsPath(const fs::path & path, const fs::path & parentFolder);

void addToFolder(const fs::path& path, const fs::path & parentFolder);

string currentParseState { "" };
string emptyString = { "" };
Expand Down Expand Up @@ -227,4 +238,10 @@ class ofAddon {
return fs::path("");
}
}

#ifdef OFADDON_OUTPUT_JSON_DEBUG
public:

NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(ofAddon, additionalLibsFolder, libFiles, filesToFolders, srcFiles, csrcFiles, cppsrcFiles, headersrcFiles, objcsrcFiles, propsFiles, libs, dllsToCopy, includePaths, libsPaths, dependencies, cflags, cppflags, ldflags, pkgConfigLibs, frameworks, xcframeworks, data, defines, definesCMAKE, name, addonPath, description, author, tags, url, pathToOF, pathToProject, isLocalAddon, addonMakeName, currentParseState, platform, excludeLibs, excludeSources, excludeIncludes, excludeFrameworks, excludeXCFrameworks)
#endif
};
6 changes: 5 additions & 1 deletion commandLine/src/defines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#define OFPROJECTGENERATOR_MAJOR_VERSION "0"
#define OFPROJECTGENERATOR_MINOR_VERSION "78"
#define OFPROJECTGENERATOR_MINOR_VERSION "79"
#define OFPROJECTGENERATOR_PATCH_VERSION "0"

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


// Uncomment this line to generate a json file with all the data parsed and contained on each ofAddon instance. This is only for development debugging.
//#define OFADDON_OUTPUT_JSON_DEBUG
13 changes: 8 additions & 5 deletions commandLine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bool busingEnvVar;
bool bVerbose;
bool bAddonsPassedIn;
bool bForce; // force even if things like ofRoot seem wrong of if update folder looks wonky
pgMode mode; // what mode are we in?
pgMode mode; // what mode are we in? //mode is never set to anything else. this is unnecesary.
bool bRecursive; // do we recurse in update mode?
bool bHelpRequested; // did we request help?
bool bListTemplates; // did we request help?
Expand Down Expand Up @@ -685,11 +685,14 @@ int main(int argc, char ** argv) {
// ofLogNotice() << "project path is: [" << projectPath << "]";
auto project = getTargetProject(t);
project->create(projectPath, templateName);
project->parseAddons();

for (auto & addon : addons) {
project->addAddon(addon);
if(bAddonsPassedIn){
for (auto & addon : addons) {
project->addAddon(addon);
}
}else{
project->parseAddons();
}

for (auto & s : srcPaths) {
project->addSrcRecursively(s);
}
Expand Down
6 changes: 3 additions & 3 deletions commandLine/src/projects/CBLinuxProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class CBLinuxProject: public CBWinProject {
public:
CBLinuxProject(const std::string & target) : CBWinProject(target) {};

bool createProjectFile();
void addInclude(const fs::path & includeName){};
void addLibrary(const LibraryBinary & lib){};
virtual bool createProjectFile() override;
virtual void addInclude(const fs::path & includeName) override{};
virtual void addLibrary(const LibraryBinary & lib)override{};

static std::string LOG_NAME;
};
19 changes: 13 additions & 6 deletions commandLine/src/projects/CBWinProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ class CBWinProject: public baseProject {
public:
CBWinProject(const std::string & target) : baseProject(target) {};

bool createProjectFile();
bool loadProjectFile();
bool saveProjectFile();
bool createProjectFile() override;
bool loadProjectFile() override;
bool saveProjectFile() override;

void addSrc(const fs::path & srcName, const fs::path & folder, SrcType type=DEFAULT);
void addInclude(const fs::path & includeName);
void addLibrary(const LibraryBinary & lib);
void addSrc(const fs::path & srcName, const fs::path & folder, SrcType type=DEFAULT) override;
void addInclude(const fs::path & includeName) override;
void addLibrary(const LibraryBinary & lib) override;

void addLDFLAG(const std::string& ldflag, LibType libType = RELEASE_LIB) override {}
void addCFLAG(const std::string& cflag, LibType libType = RELEASE_LIB) override {}
void addCPPFLAG(const std::string& cppflag, LibType libType = RELEASE_LIB) override {}
void addAfterRule(const std::string& script) override {}
void addDefine(const std::string& define, LibType libType = RELEASE_LIB) override {}


static std::string LOG_NAME;
};
25 changes: 16 additions & 9 deletions commandLine/src/projects/VSCodeProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@ class VSCodeProject: public baseProject {
public:
VSCodeProject(const std::string & target) : baseProject(target) {};

bool createProjectFile();
bool loadProjectFile();
bool saveProjectFile();

void addSrc(const fs::path & srcName, const fs::path & folder, SrcType type=DEFAULT);
void addInclude(const fs::path & includeName);
void addLibrary(const LibraryBinary & lib);

void addAddon(ofAddon & addon);
bool createProjectFile() override;
bool loadProjectFile() override;
bool saveProjectFile() override;

void addSrc(const fs::path & srcName, const fs::path & folder, SrcType type=DEFAULT) override;
void addInclude(const fs::path & includeName) override;
void addLibrary(const LibraryBinary & lib) override;

void addLDFLAG(const std::string& ldflag, LibType libType = RELEASE_LIB) override {}
void addCFLAG(const std::string& cflag, LibType libType = RELEASE_LIB) override {}
void addCPPFLAG(const std::string& cppflag, LibType libType = RELEASE_LIB) override {}
void addAfterRule(const std::string& script) override {}
void addDefine(const std::string& define, LibType libType = RELEASE_LIB) override {}


void addAddon(ofAddon & addon) ;

static std::string LOG_NAME;

Expand Down
20 changes: 14 additions & 6 deletions commandLine/src/projects/android2024.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ class android2024Project : public baseProject {
public:
android2024Project(const std::string & target);

bool createProjectFile();
void addInclude(const fs::path & includeName){}
void addLibrary(const LibraryBinary & lib){}
void addSrc(const fs::path & srcFile, const fs::path & folder, SrcType type=DEFAULT){};
bool loadProjectFile() { return false; };
bool saveProjectFile(){ return false; };
bool createProjectFile() override;
void addInclude(const fs::path & includeName) override {}
void addLibrary(const LibraryBinary & lib) override {}
void addSrc(const fs::path & srcFile, const fs::path & folder, SrcType type=DEFAULT) override {};
void addLDFLAG(const std::string& ldflag, LibType libType = RELEASE_LIB) override {}
void addCFLAG(const std::string& cflag, LibType libType = RELEASE_LIB) override {}
void addCPPFLAG(const std::string& cppflag, LibType libType = RELEASE_LIB) override {}
void addAfterRule(const std::string& script) override {}
void addDefine(const std::string& define, LibType libType = RELEASE_LIB) override {}



bool loadProjectFile() override { return false; };
bool saveProjectFile() override { return false; };
static std::string LOG_NAME;
};
19 changes: 13 additions & 6 deletions commandLine/src/projects/androidStudioProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ class AndroidStudioProject : public baseProject {
public:
AndroidStudioProject(const std::string & target);

bool createProjectFile();
void addInclude(const fs::path & includeName){}
void addLibrary(const LibraryBinary & lib){}
void addSrc(const fs::path & srcFile, const fs::path & folder, SrcType type=DEFAULT){};
bool loadProjectFile() { return false; };
bool saveProjectFile(){ return false; };
bool createProjectFile() override;
void addInclude(const fs::path & includeName) override {}
void addLibrary(const LibraryBinary & lib) override {}
void addSrc(const fs::path & srcFile, const fs::path & folder, SrcType type=DEFAULT) override {};
void addLDFLAG(const std::string& ldflag, LibType libType = RELEASE_LIB) override {}
void addCFLAG(const std::string& cflag, LibType libType = RELEASE_LIB) override {}
void addCPPFLAG(const std::string& cppflag, LibType libType = RELEASE_LIB) override {}
void addAfterRule(const std::string& script) override {}
void addDefine(const std::string& define, LibType libType = RELEASE_LIB) override {}


bool loadProjectFile() override { return false; };
bool saveProjectFile() override { return false; };
static std::string LOG_NAME;
};
Loading