This commit is contained in:
Gorochu
2026-05-30 21:40:16 -07:00
parent b7808b2b6e
commit 6a79c786ab
3 changed files with 77 additions and 23 deletions

View File

@ -33,14 +33,39 @@ export class MakeExporter extends Exporter {
}
async exportSolution(project: Project, from: string, to: string, platform: string, vrApi: any, options: any) {
let mFiles = [
path.join(from, 'Kinc/Backends/System/Apple/Sources/kinc/backend/appleunit.m'),
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/macosunit.m'),
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/system.m.h'),
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/BasicOpenGLView.m.h'),
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/display.m.h'),
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/mouse.m.h')
];
// TODO: Figure out why we cant get the relative path and if we even need to manually include the m files
let koreBasePath = '';
for (let fileobject of project.getFiles()) {
if (fileobject.file.includes('Kore/Backends')) {
let parts = fileobject.file.split('/');
let koreIndex = parts.indexOf('Kore');
if (koreIndex !== -1) {
koreBasePath = parts.slice(0, koreIndex + 1).join('/');
break;
}
}
}
let mFiles = [
koreBasePath + '/Backends/System/Apple/Sources/kinc/backend/appleunit.m',
koreBasePath + '/Backends/System/macOS/Sources/kinc/backend/macosunit.m',
koreBasePath + '/Backends/System/macOS/Sources/kinc/backend/system.m.h',
koreBasePath + '/Backends/System/macOS/Sources/kinc/backend/BasicOpenGLView.m.h',
koreBasePath + '/Backends/System/macOS/Sources/kinc/backend/display.m.h',
koreBasePath + '/Backends/System/macOS/Sources/kinc/backend/mouse.m.h'
];
for (let mFile of mFiles) {
let found = false;
for (let fileobject of project.getFiles()) {
if (fileobject.file === mFile) {
found = true;
break;
}
}
if (!found) {
project.files.push({file: mFile, options: null, projectDir: from, projectName: project.name});
}
}
for (let mFile of mFiles) {
let found = false;
for (let fileobject of project.getFiles()) {

View File

@ -631,19 +631,7 @@ async function exportKoremakeProject(from: string, to: string, platform: string,
exporter = new MesonExporter(options);
}
else if (platform === Platform.OSX) {
// Use MakeExporter directly for macOS to ensure .m files are compiled
let linkerFlags = '-pthread';
if (options.lib) {
linkerFlags += ' -static';
}
let outputExtension = '';
if (options.lib) {
outputExtension = '.a';
}
else if (options.dynlib) {
outputExtension = '.dylib';
}
exporter = new MakeExporter(options, 'clang', 'clang++', '', '', linkerFlags, outputExtension);
exporter = new MacOSExporter(options);
}
else if (platform === Platform.iOS || platform === Platform.tvOS) exporter = new XCodeExporter(options);
else if (platform === Platform.Android) exporter = new AndroidExporter(options);