Update
This commit is contained in:
@ -33,14 +33,39 @@ export class MakeExporter extends Exporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async exportSolution(project: Project, from: string, to: string, platform: string, vrApi: any, options: any) {
|
async exportSolution(project: Project, from: string, to: string, platform: string, vrApi: any, options: any) {
|
||||||
let mFiles = [
|
// TODO: Figure out why we cant get the relative path and if we even need to manually include the m files
|
||||||
path.join(from, 'Kinc/Backends/System/Apple/Sources/kinc/backend/appleunit.m'),
|
let koreBasePath = '';
|
||||||
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/macosunit.m'),
|
for (let fileobject of project.getFiles()) {
|
||||||
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/system.m.h'),
|
if (fileobject.file.includes('Kore/Backends')) {
|
||||||
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/BasicOpenGLView.m.h'),
|
let parts = fileobject.file.split('/');
|
||||||
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/display.m.h'),
|
let koreIndex = parts.indexOf('Kore');
|
||||||
path.join(from, 'Kinc/Backends/System/macOS/Sources/kinc/backend/mouse.m.h')
|
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) {
|
for (let mFile of mFiles) {
|
||||||
let found = false;
|
let found = false;
|
||||||
for (let fileobject of project.getFiles()) {
|
for (let fileobject of project.getFiles()) {
|
||||||
|
|||||||
@ -631,19 +631,7 @@ async function exportKoremakeProject(from: string, to: string, platform: string,
|
|||||||
exporter = new MesonExporter(options);
|
exporter = new MesonExporter(options);
|
||||||
}
|
}
|
||||||
else if (platform === Platform.OSX) {
|
else if (platform === Platform.OSX) {
|
||||||
// Use MakeExporter directly for macOS to ensure .m files are compiled
|
exporter = new MacOSExporter(options);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
else if (platform === Platform.iOS || platform === Platform.tvOS) exporter = new XCodeExporter(options);
|
else if (platform === Platform.iOS || platform === Platform.tvOS) exporter = new XCodeExporter(options);
|
||||||
else if (platform === Platform.Android) exporter = new AndroidExporter(options);
|
else if (platform === Platform.Android) exporter = new AndroidExporter(options);
|
||||||
|
|||||||
@ -25,13 +25,46 @@ class MakeExporter extends Exporter_1.Exporter {
|
|||||||
return libs;
|
return libs;
|
||||||
}
|
}
|
||||||
async exportSolution(project, from, to, platform, vrApi, options) {
|
async exportSolution(project, from, to, platform, vrApi, options) {
|
||||||
|
// 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});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let objects = {};
|
let objects = {};
|
||||||
let ofiles = {};
|
let ofiles = {};
|
||||||
let outputPath = path.resolve(to, options.buildPath);
|
let outputPath = path.resolve(to, options.buildPath);
|
||||||
fs.ensureDirSync(outputPath);
|
fs.ensureDirSync(outputPath);
|
||||||
for (let fileobject of project.getFiles()) {
|
for (let fileobject of project.getFiles()) {
|
||||||
let file = fileobject.file;
|
let file = fileobject.file;
|
||||||
if (file.endsWith('.cpp') || file.endsWith('.c') || file.endsWith('.cc') || file.endsWith('.s') || file.endsWith('.S')) {
|
if (file.endsWith('.cpp') || file.endsWith('.c') || file.endsWith('.cc') || file.endsWith('.s') || file.endsWith('.S') || file.endsWith('.m') || file.endsWith('.mm')) {
|
||||||
if (fileobject.options && fileobject.options.nocompile) {
|
if (fileobject.options && fileobject.options.nocompile) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -166,7 +199,7 @@ class MakeExporter extends Exporter_1.Exporter {
|
|||||||
}
|
}
|
||||||
for (let fileobject of project.getFiles()) {
|
for (let fileobject of project.getFiles()) {
|
||||||
let file = fileobject.file;
|
let file = fileobject.file;
|
||||||
if (file.endsWith('.c') || file.endsWith('.cpp') || file.endsWith('.cc') || file.endsWith('.s') || file.endsWith('.S')) {
|
if (file.endsWith('.c') || file.endsWith('.cpp') || file.endsWith('.cc') || file.endsWith('.s') || file.endsWith('.S') || file.endsWith('.m') || file.endsWith('.mm')) {
|
||||||
if (fileobject.options && fileobject.options.nocompile) {
|
if (fileobject.options && fileobject.options.nocompile) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -185,6 +218,14 @@ class MakeExporter extends Exporter_1.Exporter {
|
|||||||
compiler = this.cCompiler;
|
compiler = this.cCompiler;
|
||||||
flags = '';
|
flags = '';
|
||||||
}
|
}
|
||||||
|
else if (file.endsWith('.m')) {
|
||||||
|
compiler = this.cCompiler;
|
||||||
|
flags = '$(CPPFLAGS)';
|
||||||
|
}
|
||||||
|
else if (file.endsWith('.mm')) {
|
||||||
|
compiler = this.cppCompiler;
|
||||||
|
flags = '$(CPPFLAGS)';
|
||||||
|
}
|
||||||
this.p('\t' + compiler + ' ' + optimization + ' $(INC) $(DEF) -MD ' + flags + ' -c ' + realfile + ' -o ' + name + '.o');
|
this.p('\t' + compiler + ' ' + optimization + ' $(INC) $(DEF) -MD ' + flags + ' -c ' + realfile + ' -o ' + name + '.o');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user