Skip to content

Commit

Permalink
ADD useHostOS flag to make the os module available
Browse files Browse the repository at this point in the history
  • Loading branch information
ninovanhooff committed Nov 28, 2024
1 parent 6044a17 commit 7efad74
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/playdate/build/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const headlessTesting = defined(simulator) 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 Down Expand Up @@ -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 7efad74

Please sign in to comment.