mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-10 14:41:43 +00:00
aedi: implement dependency testing inside package
This commit is contained in:
parent
97868f324a
commit
e84f097385
2 changed files with 33 additions and 2 deletions
|
@ -86,5 +86,6 @@ def targets():
|
|||
|
||||
# Special
|
||||
CleanAllTarget(),
|
||||
CleanDepsTarget()
|
||||
CleanDepsTarget(),
|
||||
TestDepsTarget(),
|
||||
)
|
||||
|
|
|
@ -16,9 +16,11 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
from .base import Target
|
||||
from .base import Target, BuildTarget
|
||||
from ..state import BuildState
|
||||
|
||||
|
||||
|
@ -44,3 +46,31 @@ class CleanDepsTarget(CleanAllTarget):
|
|||
|
||||
def configure(self, state: BuildState):
|
||||
self.args += (state.deps_path,)
|
||||
|
||||
|
||||
class TestDepsTarget(BuildTarget):
|
||||
def __init__(self, name='test-deps'):
|
||||
super().__init__(name)
|
||||
self.multi_platform = False
|
||||
|
||||
def build(self, state: BuildState):
|
||||
test_path = state.root_path + 'test'
|
||||
|
||||
for entry in os.scandir(test_path):
|
||||
if not entry.name.endswith('.cpp'):
|
||||
continue
|
||||
|
||||
test_name = os.path.splitext(entry.name)[0]
|
||||
pkg_config_output = state.run_pkg_config('--cflags', '--libs', test_name)
|
||||
exe_name = state.build_path + test_name
|
||||
|
||||
args = [
|
||||
'clang',
|
||||
'-arch', 'x86_64',
|
||||
'-arch', 'arm64',
|
||||
'-o', exe_name,
|
||||
entry.path,
|
||||
]
|
||||
args += shlex.split(pkg_config_output)
|
||||
subprocess.run(args, cwd=state.build_path, check=True)
|
||||
subprocess.run((exe_name,), check=True)
|
||||
|
|
Loading…
Reference in a new issue