diff --git a/kmake/src/Exporters/MacOSExporter.ts b/kmake/src/Exporters/MacOSExporter.ts index 17ac3bb7..bf0064b9 100644 --- a/kmake/src/Exporters/MacOSExporter.ts +++ b/kmake/src/Exporters/MacOSExporter.ts @@ -32,21 +32,25 @@ export class MacOSExporter extends Exporter { outputExtension = '.dylib'; } + const macLibsLine = (project: Project): string => { + let libs = ''; + for (let lib of project.getLibs()) { + if (['OpenGL', 'Cocoa', 'IOKit', 'AppKit', 'CoreAudio', 'CoreData', 'CoreMedia', 'CoreVideo', 'AVFoundation', 'Foundation', 'Metal', 'MetalKit'].includes(lib)) { + libs += ' -framework ' + lib; + } else { + libs += ' -l' + lib; + } + } + return libs; + }; + this.ninja = new NinjaExporter(options, this.getCCompiler(), this.getCPPCompiler(), '', '', linkerFlags, outputExtension); - this.make = new MakeExporter(options, this.getCCompiler(), this.getCPPCompiler(), '', '', linkerFlags, outputExtension); + this.make = new MakeExporter(options, this.getCCompiler(), this.getCPPCompiler(), '', '', linkerFlags, outputExtension, macLibsLine); this.clion = new CLionExporter(options); this.compileCommands = new CompilerCommandsExporter(options); } async exportSolution(project: Project, from: string, to: string, platform: string, vrApi: any, options: any) { - // Debug: log .m files before export - console.log('MacOSExporter: Total files:', project.getFiles().length); - for (let fileobject of project.getFiles()) { - if (fileobject.file.endsWith('.m') || fileobject.file.endsWith('.mm')) { - console.log('MacOSExporter: Found .m file:', fileobject.file); - } - } - this.ninja.exportSolution(project, from, to, platform, vrApi, options); this.make.exportSolution(project, from, to, platform, vrApi, options); this.clion.exportSolution(project, from, to, platform, vrApi, options);