mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-10 14:41:43 +00:00
aedi: move single executable C target to base module
This commit is contained in:
parent
58259bae1d
commit
b48ce185c2
2 changed files with 27 additions and 27 deletions
|
@ -19,6 +19,7 @@
|
|||
import copy
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
import typing
|
||||
|
@ -499,3 +500,29 @@ class CMakeStaticDependencyTarget(CMakeTarget):
|
|||
|
||||
if module_path.exists():
|
||||
self.update_text_file(module_path, _keep_target)
|
||||
|
||||
|
||||
class SingleExeCTarget(MakeTarget):
|
||||
def __init__(self, name=None):
|
||||
super().__init__(name)
|
||||
self.options = ()
|
||||
|
||||
def configure(self, state: BuildState):
|
||||
super().configure(state)
|
||||
|
||||
for option in self.options:
|
||||
state.options[option] = None
|
||||
|
||||
def build(self, state: BuildState):
|
||||
c_compiler = state.c_compiler()
|
||||
assert c_compiler
|
||||
|
||||
args = [str(c_compiler), '-O3', '-o', self.name] + state.options.to_list()
|
||||
|
||||
for var in ('CFLAGS', 'LDFLAGS'):
|
||||
args += shlex.split(state.environment[var])
|
||||
|
||||
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
|
||||
|
||||
def post_build(self, state: BuildState):
|
||||
self.copy_to_bin(state)
|
||||
|
|
|
@ -17,38 +17,11 @@
|
|||
#
|
||||
|
||||
import pathlib
|
||||
import shlex
|
||||
import zipapp
|
||||
|
||||
from .base import *
|
||||
|
||||
|
||||
class SingleExeCTarget(MakeTarget):
|
||||
def __init__(self, name=None):
|
||||
super().__init__(name)
|
||||
self.options = ()
|
||||
|
||||
def configure(self, state: BuildState):
|
||||
super().configure(state)
|
||||
|
||||
for option in self.options:
|
||||
state.options[option] = None
|
||||
|
||||
def build(self, state: BuildState):
|
||||
c_compiler = state.c_compiler()
|
||||
assert c_compiler
|
||||
|
||||
args = [str(c_compiler), '-O3', '-o', self.name] + state.options.to_list()
|
||||
|
||||
for var in ('CFLAGS', 'LDFLAGS'):
|
||||
args += shlex.split(state.environment[var])
|
||||
|
||||
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
|
||||
|
||||
def post_build(self, state: BuildState):
|
||||
self.copy_to_bin(state)
|
||||
|
||||
|
||||
class BuildCMakeTarget(CMakeTarget):
|
||||
def __init__(self, name='cmake'):
|
||||
super().__init__(name)
|
||||
|
|
Loading…
Reference in a new issue