mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-21 19:41:15 +00:00
add test script for checking built libraries
This commit is contained in:
parent
26360d3d4d
commit
ec07b62756
2 changed files with 63 additions and 0 deletions
2
test/.gitignore
vendored
Normal file
2
test/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/a.out
|
||||
/pkg-config.log
|
61
test/test.py
Normal file
61
test/test.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# Helper module to build macOS version of various source ports
|
||||
# Copyright (C) 2020 Alexey Lysiuk
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def _build(source_file: str):
|
||||
self_path = os.path.dirname(os.path.abspath(__file__))
|
||||
pkg_config_path = os.path.abspath(self_path + '/../prefix/bin/pkg-config')
|
||||
|
||||
args = (
|
||||
pkg_config_path,
|
||||
'--cflags', '--libs',
|
||||
os.path.splitext(source_file)[0]
|
||||
)
|
||||
pkg_config_output = subprocess.check_output(args, cwd=self_path)
|
||||
pkg_config_output = pkg_config_output.decode('utf-8').strip('\n')
|
||||
|
||||
args = [
|
||||
'clang',
|
||||
'-arch', 'x86_64',
|
||||
'-arch', 'arm64',
|
||||
source_file
|
||||
]
|
||||
args += shlex.split(pkg_config_output)
|
||||
subprocess.check_call(args, cwd=self_path)
|
||||
|
||||
|
||||
def _main():
|
||||
if len(sys.argv) == 1:
|
||||
test_path = os.path.dirname(os.path.abspath(__file__))
|
||||
tests = [entry.name for entry in os.scandir(test_path) if entry.name.endswith('.cpp')]
|
||||
else:
|
||||
tests = sys.argv[1:]
|
||||
|
||||
for test in tests:
|
||||
_build(test)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
_main()
|
Loading…
Reference in a new issue