@@ -171,6 +171,11 @@ void ofAddon::parseVariableValue(string variable, string value, bool addToValue,
171171 addonRelPath = addonPath;
172172 }
173173
174+ if (variable == " ADDON_ADDITIONAL_LIBS" ) {
175+ additionalLibsFolder.emplace_back (value);
176+ return ;
177+ }
178+
174179 if (variable == " ADDON_DESCRIPTION" ){
175180 addReplaceString (description,value,addToValue);
176181 return ;
@@ -376,111 +381,35 @@ void ofAddon::parseConfig(){
376381 }
377382 }
378383
379- exclude (includePaths,excludeIncludes);
380- exclude (srcFiles, excludeSources);
381- exclude (csrcFiles,excludeSources);
382- exclude (cppsrcFiles,excludeSources);
383- exclude (objcsrcFiles,excludeSources);
384- exclude (headersrcFiles,excludeSources);
385- // exclude(propsFiles, excludeSources);
386- exclude (frameworks, excludeFrameworks);
387- exclude (libs,excludeLibs);
388384
389- ofLogVerbose (" ofAddon" ) << " libs after exclusions " << libs.size ();
390- for (auto & lib: libs){
391- ofLogVerbose (" ofAddon" ) << lib.path ;
392- }
393385}
394386
395-
396- bool ofAddon::fromFS (const fs::path & path, const string & platform){
397- // alert("ofAddon::fromFS path : " + path.string());
398-
399- clear ();
400- this ->platform = platform;
401-
402- addonPath = path;
403- if (isLocalAddon) {
404- name = path.stem ().string ();
405- } else {
406- name = path.filename ().string ();
407- }
408-
409- if (!fs::exists (path)) {
410- return false ;
411- }
412-
413- fs::path srcPath { path / " src" };
414- if (fs::exists (srcPath)) {
415- getFilesRecursively (srcPath, srcFiles);
387+ void ofAddon::parseLibsPath (const fs::path & libsPath, const fs::path & parentFolder) {
388+ // alert ("parseLibsPath " + libsPath.string(), 35);
389+
390+ if (!fs::exists (libsPath)) {
391+ // alert("file not found " + libsPath.string(), 35);
392+ return ;
416393 }
394+
395+ vector <fs::path> libFiles;
417396
418- // MARK: srcFiles to fs::path
419- // not possible today because there are string based exclusion functions
420-
421- fs::path parentFolder = path.parent_path ();
422-
423- for (auto & s : srcFiles) {
424- fs::path sFS { s };
425- fs::path folder;
426- if (isLocalAddon) {
427- // folder = sFS.parent_path();
428- // folder = fs::path { "local_addons" } / sFS.parent_path().filename();
429- folder = fs::path { " local_addons" } / fs::relative (sFS .parent_path (), parentFolder);
430- // alert ("isLocal folder=" + folder.string(), 36);
431- } else {
432- sFS = fixPath (s);
433- s = sFS .string ();
434- folder = fs::relative (sFS .parent_path (), getOFRoot ());
435- }
436- filesToFolders[s] = folder.string ();
397+ getLibsRecursively (libsPath, libFiles, libs, platform);
398+ if (platform == " osx" || platform == " ios" ){
399+ getFrameworksRecursively (libsPath, frameworks, platform);
437400 }
438-
439- if (platform == " vs" || platform == " msys2" ) {
440- // here addonPath is the same as path.
441- getPropsRecursively (addonPath, propsFiles, platform);
401+
402+ if (platform == " vs" || platform == " msys2"
403+ || platform == " vscode"
404+ || platform == " linux"
405+ || platform == " linux64"
406+ || platform == " linuxarmv6l"
407+ || platform == " linuxarmv7l"
408+ || platform == " linuxaarch64"
409+ ) {
410+ getDllsRecursively (libsPath, dllsToCopy, platform);
442411 }
443412
444- // TODO: Remove comments
445- // int i = 0;
446- // for (auto & s : propsFiles) {
447- // fs::path sFS { s };
448- // fs::path folder;
449- // if (isLocalAddon) {
450- // folder = sFS.parent_path();
451- // } else {
452- // folder = fs::relative(sFS.parent_path(), getOFRoot());
453- // }
454- // cout << s << endl;
455- // cout << folder << endl;
456- // propsFiles[i] = folder;
457- // i++;
458- // }
459-
460- fs::path libsPath = path / " libs" ;
461- vector < fs::path > libFiles;
462-
463- // alert ("libsPath " + libsPath.string());
464- if (fs::exists (libsPath)) {
465- // alert ("exists");
466- getLibsRecursively (libsPath, libFiles, libs, platform);
467- if (platform == " osx" || platform == " ios" ){
468- getFrameworksRecursively (libsPath, frameworks, platform);
469-
470-
471- }
472- // if(platform == "vs" || platform == "msys2"){
473- if (platform == " vs" || platform == " msys2"
474- || platform == " vscode"
475- || platform == " linux"
476- || platform == " linux64"
477- || platform == " linuxarmv6l"
478- || platform == " linuxarmv7l"
479- || platform == " linuxaarch64"
480- ){
481- getDllsRecursively (libsPath, dllsToCopy, platform);
482- }
483- }
484413
485414 // TODO: this is not needed even if it is local addon but project is outside OF root path
486415 // Absolute paths will be used in this case too.
@@ -493,7 +422,6 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
493422 }
494423 }
495424
496- // libFiles is fs::path
497425 for (auto & s : libFiles) {
498426 fs::path folder;
499427 if (isLocalAddon) {
@@ -538,9 +466,63 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
538466 filesToFolders[f] = folder.string ();
539467 }
540468 }
469+ }
470+
471+ bool ofAddon::fromFS (const fs::path & path, const string & platform){
472+ // alert("ofAddon::fromFS path : " + path.string());
473+
474+ clear ();
475+ this ->platform = platform;
476+
477+ addonPath = path;
478+ if (isLocalAddon) {
479+ name = path.stem ().string ();
480+ } else {
481+ name = path.filename ().string ();
482+ }
483+
484+ if (!fs::exists (path)) {
485+ return false ;
486+ }
487+
488+ fs::path srcPath { path / " src" };
489+ if (fs::exists (srcPath)) {
490+ getFilesRecursively (srcPath, srcFiles);
491+ }
492+
493+ // MARK: srcFiles to fs::path
494+ // not possible today because there are string based exclusion functions
495+
496+ fs::path parentFolder = path.parent_path ();
497+
498+ for (auto & s : srcFiles) {
499+ fs::path sFS { s };
500+ fs::path folder;
501+ if (isLocalAddon) {
502+ folder = fs::path { " local_addons" } / fs::relative (sFS .parent_path (), parentFolder);
503+ } else {
504+ sFS = fixPath (s);
505+ s = sFS .string ();
506+ folder = fs::relative (sFS .parent_path (), getOFRoot ());
507+ }
508+ filesToFolders[s] = folder.string ();
509+ }
541510
511+ if (platform == " vs" || platform == " msys2" ) {
512+ // here addonPath is the same as path.
513+ getPropsRecursively (addonPath, propsFiles, platform);
514+ }
542515
543516
517+ parseConfig ();
518+
519+ fs::path libsPath = path / " libs" ;
520+ parseLibsPath (libsPath, parentFolder);
521+
522+ for (auto & a : additionalLibsFolder) {
523+ // parseLibsPath(fs::weakly_canonical(path / a), parentFolder);
524+ parseLibsPath ((path / a), parentFolder);
525+ }
544526
545527 // paths that are needed for the includes.
546528 std::list < fs::path > paths;
@@ -569,7 +551,24 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
569551 includePaths.emplace_back (p.string ());
570552 }
571553
572- parseConfig ();
554+
555+
556+
557+ exclude (includePaths, excludeIncludes);
558+ exclude (srcFiles, excludeSources);
559+ exclude (csrcFiles, excludeSources);
560+ exclude (cppsrcFiles, excludeSources);
561+ exclude (objcsrcFiles, excludeSources);
562+ exclude (headersrcFiles, excludeSources);
563+ // exclude(propsFiles, excludeSources);
564+ exclude (frameworks, excludeFrameworks);
565+ exclude (libs, excludeLibs);
566+
567+ ofLogVerbose (" ofAddon" ) << " libs after exclusions " << libs.size ();
568+
569+ for (auto & lib: libs) {
570+ ofLogVerbose (" ofAddon" ) << lib.path ;
571+ }
573572
574573 return true ;
575574}
0 commit comments