mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-22 20:11:51 +00:00
fix detection of target name from cmake config file
all supported targets are now detected correctly
This commit is contained in:
parent
b42a197854
commit
d05711feb0
1 changed files with 19 additions and 3 deletions
22
build.py
22
build.py
|
@ -423,6 +423,22 @@ class Builder(object):
|
||||||
if self.target.post_build:
|
if self.target.post_build:
|
||||||
self.target.post_build(self)
|
self.target.post_build(self)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def extract_project_name(line: str):
|
||||||
|
project_name = None
|
||||||
|
|
||||||
|
# Try to get project name without whitespaces in it
|
||||||
|
match = re.search(r'project\s*\(\s*(\w[\w-]+)', line, re.IGNORECASE)
|
||||||
|
|
||||||
|
if not match:
|
||||||
|
# Try to get project name that contains whitespaces
|
||||||
|
match = re.search(r'project\s*\(\s*"?(\w[\s\w-]+)"?', line, re.IGNORECASE)
|
||||||
|
|
||||||
|
if match:
|
||||||
|
project_name = match.group(1)
|
||||||
|
|
||||||
|
return project_name
|
||||||
|
|
||||||
def _detect_target(self):
|
def _detect_target(self):
|
||||||
cmakelists_path = None
|
cmakelists_path = None
|
||||||
|
|
||||||
|
@ -438,9 +454,9 @@ class Builder(object):
|
||||||
project_name = None
|
project_name = None
|
||||||
|
|
||||||
for line in open(cmakelists_path).readlines():
|
for line in open(cmakelists_path).readlines():
|
||||||
match = re.search(r'project\s*\(\s*"?(\w[\s\w-]+)"?', line, re.IGNORECASE)
|
project_name = Builder.extract_project_name(line)
|
||||||
if match:
|
if project_name:
|
||||||
project_name = match.group(1).lower()
|
project_name = project_name.lower()
|
||||||
break
|
break
|
||||||
|
|
||||||
assert project_name
|
assert project_name
|
||||||
|
|
Loading…
Reference in a new issue