Skip to content

Commit

Permalink
Fix iOS plat check and add default toolchain config
Browse files Browse the repository at this point in the history
  • Loading branch information
L1ghtmann committed Jan 13, 2024
1 parent d121594 commit ad0c20a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
14 changes: 11 additions & 3 deletions src/dragongen/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,18 @@ def generate_vars(self, module_variables: dict, target: str) -> dict:
# Specify toolchain paths
use_objcs = 'objcs' in project_dict

if platform.platform().startswith('macOS'):
toolchain = Toolchain.locate_macos_toolchain(use_objcs)
sys = platform.system()
if sys == 'Darwin':
plat = platform.platform()
if 'iP' in plat:
toolchain = Toolchain()
else:
toolchain = Toolchain.locate_macos_toolchain(use_objcs)
# elif WINDOWS IS NOT A REAL OPERATING SYSTEM ::::)
else:
elif sys == 'Linux':
toolchain = Toolchain.locate_linux_toolchain(use_objcs)
else:
toolchain = Toolchain()

if toolchain is None:
dberror("Dragon Gen", "Could not locate any usable toolchain or even determine the existence of clang.")
Expand Down Expand Up @@ -552,6 +559,7 @@ def handle(ex: Exception):
else:
dberror("Dragon Gen", "Exiting...")
except Exception:
dberror("Dragon Gen", f'tty/termios unavailable: {ex}')
dberror("Dragon Gen", "Exiting...")

print('export DRAGONGEN_FAILURE=1')
Expand Down
18 changes: 9 additions & 9 deletions src/dragongen/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

class Toolchain:
def __init__(self):
self.ass = ""
self.clang = ""
self.clangpp = ""
self.ld = ""
self.codesign = ""
self.dsym = ""
self.lipo = ""
self.tapi = ""
self.clang = "clang"
self.clangpp = "clang++"
self.ass = self.clang
self.ld = self.clang
self.codesign = "ldid"
self.dsym = "dsymutil"
self.plutil = "plutil"
self.lipo = "lipo"
self.tapi = "tapi"

@classmethod
def locate_macos_toolchain(cls, use_objcs: bool):
Expand All @@ -35,7 +36,6 @@ def locate_macos_toolchain(cls, use_objcs: bool):
tc.clangpp = tc_dir + 'clang++'
tc.ass = tc.clang
tc.ld = tc.clang
tc.codesign = 'ldid'
tc.dsym = tc_dir + 'dsymutil'
# FIXME: hardcoded while I wait on a real distribution of llvm-objcs
if use_objcs:
Expand Down

0 comments on commit ad0c20a

Please sign in to comment.