Skip to content

Commit 07d96b2

Browse files
authored
DLLs path fix (#417)
1 parent 6122d22 commit 07d96b2

5 files changed

Lines changed: 39 additions & 14 deletions

File tree

commandLine/src/addons/ofAddon.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ void ofAddon::addReplaceString(string & variable, string value, bool addToVariab
149149
}
150150

151151
void ofAddon::addReplaceStringVector(std::vector<string> & variable, string value, string prefix, bool addToVariable){
152+
153+
// alert("addReplaceStringVector val=" + value + " : prefix=" + prefix, (value == prefix) ? 33 : 32);
154+
if (value == prefix) return;
155+
152156
vector<string> values;
153157
if(value.find("\"")!=string::npos){
154158
values = ofSplitString(value,"\"",true,true);
@@ -467,7 +471,7 @@ void ofAddon::parseConfig(){
467471

468472

469473
bool ofAddon::fromFS(const fs::path & path, const string & platform){
470-
// alert("ofAddon::fromFS path : " + path.string());
474+
// alert("ofAddon::fromFS path : " + path.string());
471475

472476
clear();
473477
this->platform = platform;
@@ -500,7 +504,7 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
500504
// folder = sFS.parent_path();
501505
// folder = fs::path { "local_addons" } / sFS.parent_path().filename();
502506
folder = fs::path { "local_addons" } / fs::relative(sFS.parent_path(), parentFolder);
503-
// alert ("isLocal folder=" + folder.string(), 36);
507+
// alert ("isLocal folder=" + folder.string(), 36);
504508
} else {
505509
sFS = fixPath(s);
506510
s = sFS.string();
@@ -544,6 +548,11 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
544548
}
545549
if(platform == "vs" || platform == "msys2"){
546550
getDllsRecursively(libsPath, dllsToCopy, platform);
551+
552+
// alert ("ofAddon dllsToCopy", 32);
553+
// for (auto & d : dllsToCopy) {
554+
// cout << d << endl;
555+
// }
547556
}
548557
}
549558

commandLine/src/main.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ bool isGoodOFPath(const fs::path & path) {
206206

207207

208208
void updateProject(const fs::path & path, ofTargetPlatform target, bool bConsiderParameterAddons = true) {
209-
// alert("updateProject " + path.string() , 34);
209+
//alert("updateProject " + path.string() , 34);
210210
// bConsiderParameterAddons = do we consider that the user could call update with a new set of addons
211211
// either we read the addons.make file, or we look at the parameter list.
212212
// if we are updating recursively, we *never* consider addons passed as parameters.
@@ -234,6 +234,7 @@ void updateProject(const fs::path & path, ofTargetPlatform target, bool bConside
234234
}
235235

236236
void recursiveUpdate(const fs::path & path, ofTargetPlatform target) {
237+
// FIXME: remove
237238
alert("recursiveUpdate " + path.string() );
238239
if (!fs::is_directory(path)) return;
239240
vector <fs::path> folders;
@@ -272,8 +273,8 @@ void recursiveUpdate(const fs::path & path, ofTargetPlatform target) {
272273
}
273274
setOFRoot(ofPath);
274275
fs::current_path(path);
275-
// alert ("ofRoot " + ofPath.string());
276-
// alert ("cwd " + path.string());
276+
//alert ("ofRoot " + ofPath.string());
277+
//alert ("cwd " + path.string());
277278

278279
updateProject(path, target, false);
279280
}
@@ -480,18 +481,18 @@ int main(int argc, char** argv){
480481
return EXIT_USAGE;
481482
}
482483

483-
// alert ("ofPath before " + ofPath.string());
484-
// alert ("projectPath " + projectPath.string());
484+
// alert ("ofPath before " + ofPath.string());
485+
// alert ("projectPath " + projectPath.string());
485486
if (ofPath.is_relative()) {
486487
ofPath = fs::canonical(fs::current_path() / ofPath);
487-
// alert ("ofPath canonical " + ofPath.string());
488+
//alert ("ofPath canonical " + ofPath.string());
488489
}
489490

490491
if (ofIsPathInPath(projectPath, ofPath)) {
491492
ofPath = fs::relative(ofPath, projectPath);
492493
}
493494
fs::current_path(projectPath);
494-
// alert ("ofPath after " + ofPath.string());
495+
//alert ("ofPath after " + ofPath.string());
495496
setOFRoot(ofPath);
496497
}
497498

commandLine/src/projects/baseProject.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ void baseProject::addAddon(ofAddon & addon){
461461

462462
for (auto & a : addon.libs) {
463463
ofLogVerbose() << "adding addon libs: " << a.path;
464+
// FIXME: remove
464465
alert ("addlibrary " + a.path, 33);
465466
addLibrary(a);
466467
}

commandLine/src/projects/baseProject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#define PG_VERSION "21"
3+
#define PG_VERSION "23"
44

55
#include "ofAddon.h"
66
#include "ofFileUtils.h"

commandLine/src/projects/visualStudioProject.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ void visualStudioProject::addLibrary(const LibraryBinary & lib) {
350350
string libFolderString = libFolder.string();
351351
fixSlashOrder(libFolderString);
352352

353+
// alert ("libFolderString " + libFolderString, 36);
354+
353355
auto libName = libraryName.filename();
354356

355357
// ---------| invariant: libExtension is `lib`
@@ -531,10 +533,22 @@ void visualStudioProject::addAddon(ofAddon & addon) {
531533

532534
for (auto & d : addon.dllsToCopy) {
533535
ofLogVerbose() << "adding addon dlls to bin: " << d;
534-
fs::path from = addon.addonPath / d;
535-
fs::path to = projectDir / "bin" / from.filename();
536-
// alert("copy from to " + from.string() + " : " + to.string());
537-
fs::copy_file(from, to, fs::copy_options::overwrite_existing);
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+
}
538552
}
539553

540554

0 commit comments

Comments
 (0)