Skip to content

Commit 567076f

Browse files
authored
macOS changes / addons / xcframeworks fixes [bleeding test] (#527)
* macOS changes. Fixes for addons target platform paths. Added macOS * v49
1 parent fdb7762 commit 567076f

File tree

8 files changed

+36
-37
lines changed

8 files changed

+36
-37
lines changed

commandLine/src/addons/ofAddon.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,17 +475,18 @@ void ofAddon::parseConfig(){
475475

476476
void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFolder) {
477477
// alert ("parseLibsPath " + libsPath.string(), 35);
478-
479478
if (!fs::exists(libsPath)) {
480479
// alert("file not found " + libsPath.string(), 35);
481480
return;
482481
}
483-
484482

485483
getLibsRecursively(libsPath, libFiles, libs, platform);
486-
if (platform == "osx" || platform == "ios"){
487-
getFrameworksRecursively(libsPath, frameworks, platform);
488-
getXCFrameworksRecursively(libsPath, xcframeworks, platform);
484+
if (platform == "osx" ||
485+
platform == "ios" ||
486+
platform == "tvos" ||
487+
platform == "macos"){
488+
getFrameworksRecursively(libsPath, frameworks, platform);
489+
getXCFrameworksRecursively(libsPath, xcframeworks, platform);
489490
}
490491

491492
if (platform == "vs" || platform == "msys2"
@@ -496,7 +497,7 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
496497
|| platform == "linuxarmv7l"
497498
|| platform == "linuxaarch64"
498499
) {
499-
getDllsRecursively(libsPath, dllsToCopy, platform);
500+
getDllsRecursively(libsPath, dllsToCopy, platform);
500501
}
501502

502503

commandLine/src/addons/ofAddon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const vector<string> parseStates {
4444
"ios",
4545
"osx",
4646
"tvos",
47+
"macos",
4748
"watchos",
4849
"visionos",
4950
};

commandLine/src/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ int main(int argc, char ** argv) {
457457
ofPath = fs::canonical(fs::current_path() / ofPath);
458458
//alert ("ofPath canonical " + ofPath.string());
459459
}
460-
461460
if (ofIsPathInPath(projectPath, ofPath)) {
462461
ofPath = fs::relative(ofPath, projectPath);
463462
}

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 "48"
3+
#define PG_VERSION "49"
44

55
#include "ofAddon.h"
66
#include "pugixml.hpp"

commandLine/src/projects/xcodeProject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ bool xcodeProject::createProjectFile(){
9494
{ rootReplacements }
9595
});
9696

97-
if (target == "osx") {
97+
if (target == "osx" || target == "macos") {
9898
// TODO: TEST
9999
for (auto & f : { "openFrameworks-Info.plist", "of.entitlements" }) {
100100
copyTemplateFiles.push_back({ templatePath / f, projectDir / f });
@@ -113,7 +113,7 @@ bool xcodeProject::createProjectFile(){
113113

114114
saveScheme();
115115

116-
if(target == "osx"){
116+
if(target == "osx" || target == "macos"){
117117
saveMakefile();
118118
}
119119

commandLine/src/utils/Utils.cpp

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ bool isFolderNotCurrentPlatform(const string & folderName, const string & platfo
164164
"msys2",
165165
"vs",
166166
"ios",
167+
"macos",
168+
"tvos",
167169
"linux",
168170
"linux64",
169171
"linuxarmv6l",
@@ -198,12 +200,6 @@ void getFoldersRecursively(const fs::path & path, std::vector < fs::path > & fol
198200

199201
// TODO: This can be converted to recursive_directory, but we have to review if the function isFolderNotCurrentPlatform works correctly in this case.
200202

201-
// for (const auto & entry : fs::recursive_directory_iterator(path)) {
202-
// auto f = entry.path();
203-
// if (f.filename().c_str()[0] == '.') continue;
204-
// if (f.extension() == ".framework") continue;
205-
// }
206-
207203
// TODO: disable recursion pending... it is not recursive yet.
208204
if ((path.extension() != ".framework") || (path.extension() != ".xcframework")) {
209205
for (const auto & entry : fs::directory_iterator(path)) {
@@ -224,20 +220,32 @@ void getFrameworksRecursively(const fs::path & path, std::vector < string > & fr
224220
for (const auto & f : dirList(path)) {
225221
if (fs::is_directory(f)) {
226222
if (f.extension() == ".framework") {
227-
frameworks.emplace_back(f.string());
223+
bool platformFound = false;
224+
if (!platform.empty() && f.string().find(platform) != std::string::npos) {
225+
platformFound = true;
226+
}
227+
if(platformFound) {
228+
frameworks.emplace_back(f.string());
229+
}
228230
}
229231
}
230232
}
231233
}
232234

233-
void getXCFrameworksRecursively(const fs::path & path, std::vector<string> & frameworks, string platform) {
235+
void getXCFrameworksRecursively(const fs::path & path, std::vector<string> & xcframeworks, string platform) {
234236
// alert("getXCFrameworksRecursively " + path.string(), 34);
235237
if (!fs::exists(path) || !fs::is_directory(path)) return;
236238

237239
for (const auto & f : dirList(path)) {
238240
if (fs::is_directory(f)) {
239241
if (f.extension() == ".xcframework") {
240-
frameworks.emplace_back(f.string());
242+
bool platformFound = false;
243+
if (!platform.empty() && f.string().find(platform) != std::string::npos) {
244+
platformFound = true;
245+
}
246+
if(platformFound) {
247+
xcframeworks.emplace_back(f.string());
248+
}
241249
}
242250
}
243251
}
@@ -297,8 +305,6 @@ void getLibsRecursively(const fs::path & path, std::vector < fs::path > & libFil
297305
continue;
298306
} else {
299307
auto stem = f.stem();
300-
301-
// cout << "STEM " << stem << endl;
302308
auto archFound = std::find(LibraryBinary::archs.begin(), LibraryBinary::archs.end(), stem);
303309
if (archFound != LibraryBinary::archs.end()) {
304310
arch = *archFound;
@@ -321,24 +327,15 @@ void getLibsRecursively(const fs::path & path, std::vector < fs::path > & libFil
321327
}
322328
}
323329
}
330+
331+
if (!platform.empty() && f.string().find(platform) != std::string::npos) {
332+
platformFound = true;
333+
}
324334

325-
if (ext == ".a" || ext == ".lib" || ext == ".dylib" || ext == ".so" || ext == ".xcframework" ||
335+
if (ext == ".a" || ext == ".lib" || ext == ".dylib" || ext == ".so" || ext == ".xcframework" || ext == ".framework" ||
326336
(ext == ".dll" && platform != "vs")){
327337
if (platformFound){
328-
// libLibs.emplace_back( f, arch, target );
329338
libLibs.push_back({ f.string(), arch, target });
330-
331-
//TODO: THEO hack
332-
if( platform == "ios" ){ //this is so we can add the osx libs for the simulator builds
333-
string currentPath = f.string();
334-
//TODO: THEO double hack this is why we need install.xml - custom ignore ofxOpenCv
335-
if( currentPath.find("ofxOpenCv") == string::npos ){
336-
ofStringReplace(currentPath, "ios", "osx");
337-
if( fs::exists(currentPath) ){
338-
libLibs.push_back({ currentPath, arch, target });
339-
}
340-
}
341-
}
342339
}
343340
} else if (ext == ".h" || ext == ".hpp" || ext == ".c" || ext == ".cpp" || ext == ".cc" || ext == ".cxx" || ext == ".m" || ext == ".mm"){
344341
libFiles.emplace_back(f);

commandLine/src/utils/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void getFilesRecursively(const fs::path & path, std::vector < string > & fileNam
6666
void getFilesRecursively(const fs::path & path, std::vector < fs::path > & fileNames);
6767
void getLibsRecursively(const fs::path & path, std::vector < fs::path > & libFiles, std::vector < LibraryBinary > & libLibs, string platform = "", string arch = "", string target = "");
6868
void getFrameworksRecursively(const fs::path & path, std::vector < string > & frameworks, string platform = "" );
69-
void getXCFrameworksRecursively(const fs::path & path, std::vector<string> & frameworks, string platform = "");
69+
void getXCFrameworksRecursively(const fs::path & path, std::vector<string> & xcframeworks, string platform = "");
7070
void getPropsRecursively(const fs::path & path, std::vector < fs::path > & props, const string & platform);
7171
void getDllsRecursively(const fs::path & path, std::vector < string > & dlls, string platform);
7272

frontend/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ const platforms = {
129129
"vs": "Windows (Visual Studio)",
130130
"msys2": "Windows (msys2/mingw)",
131131
"ios": "iOS (Xcode)",
132+
"macos": "Mega iOS/tvOS/macOS (Xcode)",
132133
"android": "Android (Android Studio)",
133134
"linux64": "Linux 64 (VS Code/Make)",
134135
"linuxarmv6l": "Arm 32 (VS Code/Make)",
@@ -1096,7 +1097,7 @@ ipcMain.on('launchProjectinIDE', (event, arg) => {
10961097
}
10971098

10981099
// // launch xcode
1099-
if( arg.platform == 'osx' || arg.platform == 'ios'){
1100+
if( arg.platform == 'osx' || arg.platform == 'ios' || arg.platform == 'macos' || || arg.platform == 'tvos' ){
11001101
if(hostplatform == 'osx'){
11011102
let osxPath = path.join(fullPath, projectName + '.xcodeproj');
11021103
console.log( osxPath );

0 commit comments

Comments
 (0)