Skip to content

Commit

Permalink
Merge pull request #88 from ninovanhooff/use-host-os
Browse files Browse the repository at this point in the history
ADD flag to use the host os std lib for compilation
  • Loading branch information
ninovanhooff authored Dec 3, 2024
2 parents 12177d5 + ecd67e7 commit 9d6a675
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/playdate/build/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ when not compiles(task):
import system/nimscript

const headlessTesting = defined(simulator) and declared(test)
const nimbleTesting = not defined(simulator) and not defined(devide) and declared(test)
const nimbleTesting = not defined(simulator) and not defined(device) and declared(test)
const testing = headlessTesting or nimbleTesting

# Use the host OS for compilation. This is useful when running supporting development tools that import the playdate SDK or where the os module needs to be available.
# This does not make the playdate api callable, only the types (header files) are available.
const useHostOS = defined(useHostOS)

# Path to the playdate src directory when checked out locally
const localPlaydatePath = currentSourcePath / "../../../../src"

Expand All @@ -24,7 +28,7 @@ let nimblePlaydatePath =
else:
gorgeEx("nimble path playdate").output.split("\n")[0]

if not testing:
if not testing and not useHostOS:
switch("noMain", "on")
switch("backend", "c")
switch("mm", "arc")
Expand All @@ -45,7 +49,9 @@ switch("passC", "-Wno-unknown-pragmas")
switch("passC", "-Wdouble-promotion")
switch("passC", "-I" & sdkPath() / "C_API")

switch("os", "any")
if not useHostOS:
echo "Setting os to any"
switch("os", "any")
switch("define", "useMalloc")
switch("define", "standalone")
switch("threads", "off")
Expand Down Expand Up @@ -133,8 +139,8 @@ when defined(simulator):
switch("passC", "-DTARGET_SIMULATOR=1")
switch("passC", "-Wstrict-prototypes")

if nimbleTesting:
# Compiling for tests.
if useHostOS or nimbleTesting:
# Compiling for host system environment.
switch("define", "simulator")
switch("nimcache", nimcacheDir() / "simulator")

Expand Down

0 comments on commit 9d6a675

Please sign in to comment.