Skip to content

Commit 20999cf

Browse files
authored
so (#426)
1 parent 07f06d0 commit 20999cf

5 files changed

Lines changed: 35 additions & 28 deletions

File tree

commandLine/src/addons/ofAddon.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,16 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
546546

547547

548548
}
549-
if(platform == "vs" || platform == "msys2"){
549+
// if(platform == "vs" || platform == "msys2"){
550+
if(platform == "vs" || platform == "msys2"
551+
|| platform == "vscode"
552+
|| platform == "linux"
553+
|| platform == "linux64"
554+
|| platform == "linuxarmv6l"
555+
|| platform == "linuxarmv7l"
556+
|| platform == "linuxaarch64"
557+
){
550558
getDllsRecursively(libsPath, dllsToCopy, platform);
551-
552-
// alert ("ofAddon dllsToCopy", 32);
553-
// for (auto & d : dllsToCopy) {
554-
// cout << d << endl;
555-
// }
556559
}
557560
}
558561

commandLine/src/projects/VSCodeProject.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ void VSCodeProject::addAddon(ofAddon & addon) {
9595
// alert("VSCodeProject::addAddon() " + addon.name, 35);
9696

9797
workspace.addPath(addon.addonPath);
98+
9899
// examples of how to add entries to json arrays
99100
// cppProperties.addToArray("/env/PROJECT_ADDON_INCLUDES", addon.addonPath);
100101
// cppProperties.addToArray("/env/PROJECT_EXTRA_INCLUDES", addon.addonPath);

commandLine/src/projects/baseProject.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,30 @@ void baseProject::addAddon(string addonName){
358358
addInclude(e);
359359
}
360360

361-
361+
// It was part exclusive of visualStudioProject. now it is part of baseProject, so dlls are copied in VSCode project and .so files in linux
362+
for (auto & d : addon.dllsToCopy) {
363+
ofLogVerbose() << "adding addon dlls to bin: " << d;
364+
fs::path from { d };
365+
fs::path to { projectDir / "bin" / from.filename() };
366+
if (from.extension() == ".so") {
367+
fs::path folder { projectDir / "bin" / "libs" };
368+
if (!fs::exists(folder)) {
369+
try {
370+
fs::create_directory(folder);
371+
} catch(fs::filesystem_error& e) {
372+
ofLogError("baseProject::addAddon") << "error creating folder " << folder << e.what();
373+
}
374+
}
375+
// to = projectDir / "bin" / "libs" / from.filename();
376+
to = folder / from.filename();
377+
}
378+
379+
try {
380+
fs::copy_file(from, to, fs::copy_options::overwrite_existing);
381+
} catch(fs::filesystem_error& e) {
382+
ofLogError("baseProject::addAddon") << "error copying template file " << from << endl << "to: " << to << endl << e.what();
383+
}
384+
}
362385

363386
// MARK: - SPECIFIC for each project.
364387
// XCode and VS override the base addAddon. other templates will use baseproject::addAddon(ofAddon...

commandLine/src/projects/visualStudioProject.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -531,26 +531,6 @@ void visualStudioProject::addAddon(ofAddon & addon) {
531531
// addSrc(addon.headersrcFiles[i],addon.filesToFolders[addon.headersrcFiles[i]],C);
532532

533533

534-
for (auto & d : addon.dllsToCopy) {
535-
ofLogVerbose() << "adding addon dlls to bin: " << d;
536-
// fs::path from = addon.addonPath / d;
537-
fs::path from { d };
538-
fs::path to { projectDir / "bin" / from.filename() };
539-
540-
// alert("copy from to " + from.string() + " : " + to.string(), 35);
541-
// alert("addonPath " + addon.addonPath.string(), 36);
542-
// alert("d " + d, 36);
543-
// alert("copy from " + from.string(), 35);
544-
// alert("copy to " + to.string(), 35);
545-
546-
547-
try {
548-
fs::copy_file(from, to, fs::copy_options::overwrite_existing);
549-
} catch(fs::filesystem_error& e) {
550-
ofLogError(LOG_NAME) << "error copying template file " << from << endl << "to: " << to << endl << e.what();
551-
}
552-
}
553-
554534

555535

556536
for (auto & a : addon.cflags) {

commandLine/src/utils/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void getDllsRecursively(const fs::path & path, std::vector < string > & dlls, st
238238
if (!fs::exists(path) || !fs::is_directory(path)) return;
239239

240240
for (const auto & f : dirList(path)) {
241-
if (fs::is_regular_file(f) && f.extension() == ".dll") {
241+
if (fs::is_regular_file(f) && (f.extension() == ".dll" || f.extension() == ".so")) {
242242
dlls.emplace_back(f.string());
243243
}
244244
}

0 commit comments

Comments
 (0)