mirror of
https://github.com/NeoFlock/neonucleus.git
synced 2025-09-24 09:03:32 +02:00
changes
This commit is contained in:
parent
20a149cc28
commit
833d919066
@ -5,6 +5,7 @@ const LibBuildOpts = struct {
|
|||||||
target: std.Build.ResolvedTarget,
|
target: std.Build.ResolvedTarget,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
baremetal: bool,
|
baremetal: bool,
|
||||||
|
bit32: bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn addEngineSources(b: *std.Build, opts: LibBuildOpts) *std.Build.Module {
|
fn addEngineSources(b: *std.Build, opts: LibBuildOpts) *std.Build.Module {
|
||||||
@ -34,6 +35,7 @@ fn addEngineSources(b: *std.Build, opts: LibBuildOpts) *std.Build.Module {
|
|||||||
},
|
},
|
||||||
.flags = &.{
|
.flags = &.{
|
||||||
if(opts.baremetal) "-DNN_BAREMETAL" else "",
|
if(opts.baremetal) "-DNN_BAREMETAL" else "",
|
||||||
|
if(opts.bit32) "-DNN_BIT32" else "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -108,8 +110,11 @@ pub fn build(b: *std.Build) void {
|
|||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
.baremetal = b.option(bool, "baremetal", "Compiles without libc integration") orelse false,
|
.baremetal = b.option(bool, "baremetal", "Compiles without libc integration") orelse false,
|
||||||
|
.bit32 = target.result.ptrBitWidth() == 32,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const noEmu = b.option(bool, "noEmu", "Disable compiling the emulator (fixes some build system quirks)") orelse false;
|
||||||
|
|
||||||
const includeFiles = b.addInstallHeaderFile(b.path("src/neonucleus.h"), "neonucleus.h");
|
const includeFiles = b.addInstallHeaderFile(b.path("src/neonucleus.h"), "neonucleus.h");
|
||||||
|
|
||||||
const engineMod = addEngineSources(b, opts);
|
const engineMod = addEngineSources(b, opts);
|
||||||
@ -134,6 +139,7 @@ pub fn build(b: *std.Build) void {
|
|||||||
sharedStep.dependOn(&includeFiles.step);
|
sharedStep.dependOn(&includeFiles.step);
|
||||||
sharedStep.dependOn(&b.addInstallArtifact(engineShared, .{}).step);
|
sharedStep.dependOn(&b.addInstallArtifact(engineShared, .{}).step);
|
||||||
|
|
||||||
|
if(!noEmu) {
|
||||||
const emulator = b.addExecutable(.{
|
const emulator = b.addExecutable(.{
|
||||||
.name = "neonucleus",
|
.name = "neonucleus",
|
||||||
.target = target,
|
.target = target,
|
||||||
@ -158,6 +164,7 @@ pub fn build(b: *std.Build) void {
|
|||||||
},
|
},
|
||||||
.flags = &.{
|
.flags = &.{
|
||||||
if(opts.baremetal) "-DNN_BAREMETAL" else "",
|
if(opts.baremetal) "-DNN_BAREMETAL" else "",
|
||||||
|
if(opts.bit32) "-DNN_BIT32" else "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
compileTheRightLua(b, emulator, luaVer) catch unreachable;
|
compileTheRightLua(b, emulator, luaVer) catch unreachable;
|
||||||
@ -178,4 +185,5 @@ pub fn build(b: *std.Build) void {
|
|||||||
const run_step = b.step("run", "Run the emulator");
|
const run_step = b.step("run", "Run the emulator");
|
||||||
run_step.dependOn(emulatorStep);
|
run_step.dependOn(emulatorStep);
|
||||||
run_step.dependOn(&run_cmd.step);
|
run_step.dependOn(&run_cmd.step);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NN_BAREMETAL
|
#ifdef NN_BAREMETAL
|
||||||
#if defined(__LP64__) || defined(_LP64)
|
#ifdef NN_BIT32
|
||||||
|
typedef int nn_intptr_t;
|
||||||
|
typedef unsigned int nn_size_t;
|
||||||
|
#elif defined(__LP64__) || defined(_LP64)
|
||||||
// long is ptr sized
|
// long is ptr sized
|
||||||
typedef long nn_intptr_t;
|
typedef long nn_intptr_t;
|
||||||
typedef unsigned long nn_size_t;
|
typedef unsigned long nn_size_t;
|
||||||
#else
|
#else
|
||||||
|
#error "fuck you"
|
||||||
typedef long long nn_intptr_t;
|
typedef long long nn_intptr_t;
|
||||||
typedef unsigned long long nn_size_t;
|
typedef unsigned long long nn_size_t;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user