mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-24 21:01:59 +00:00
aedi: add target to download cmake binary package
This commit is contained in:
parent
c3084e707e
commit
5ca6c4bc4d
3 changed files with 42 additions and 0 deletions
|
@ -107,5 +107,6 @@ def targets():
|
|||
# Special
|
||||
CleanAllTarget(),
|
||||
CleanDepsTarget(),
|
||||
DownloadCMakeTarget(),
|
||||
TestDepsTarget(),
|
||||
)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
import os
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from .base import Target, BuildTarget
|
||||
|
@ -50,6 +51,45 @@ class CleanDepsTarget(CleanAllTarget):
|
|||
self.args += (state.deps_path,)
|
||||
|
||||
|
||||
DOWNLOAD_CMAKE_TARGET_NAME = 'download-cmake'
|
||||
|
||||
|
||||
class DownloadCMakeTarget(Target):
|
||||
def __init__(self, name=DOWNLOAD_CMAKE_TARGET_NAME):
|
||||
super().__init__(name)
|
||||
|
||||
def build(self, state: BuildState):
|
||||
probe_paths = (
|
||||
'',
|
||||
state.bin_path,
|
||||
'/Applications/CMake.app/Contents/bin/',
|
||||
)
|
||||
|
||||
for path in probe_paths:
|
||||
try:
|
||||
subprocess.run([path + 'cmake', '--version'], check=True)
|
||||
return
|
||||
except (FileNotFoundError, IOError, subprocess.CalledProcessError):
|
||||
continue
|
||||
|
||||
cmake_version = '3.20.5'
|
||||
cmake_basename = f'cmake-{cmake_version}-macos-universal'
|
||||
|
||||
state.download_source(
|
||||
f'https://github.com/Kitware/CMake/releases/download/v{cmake_version}/{cmake_basename}.tar.gz',
|
||||
'000828af55268853ba21b91f8ce3bfb9365aa72aee960fc7f0c01a71f3a2217a')
|
||||
|
||||
target_path = state.deps_path + 'cmake'
|
||||
if os.path.exists(target_path):
|
||||
shutil.rmtree(target_path)
|
||||
os.makedirs(target_path)
|
||||
|
||||
source_path = state.source + 'CMake.app/Contents/'
|
||||
shutil.move(source_path + 'bin', target_path)
|
||||
shutil.move(source_path + 'share', target_path)
|
||||
shutil.rmtree(state.source)
|
||||
|
||||
|
||||
class TestDepsTarget(BuildTarget):
|
||||
def __init__(self, name='test-deps'):
|
||||
super().__init__(name)
|
||||
|
|
1
deps/.gitignore
vendored
1
deps/.gitignore
vendored
|
@ -55,6 +55,7 @@
|
|||
/webp/**/libwebpdemux.*
|
||||
|
||||
# Tools
|
||||
/cmake/
|
||||
/nasm/bin/ndisasm
|
||||
/yasm/bin/vsyasm
|
||||
/yasm/bin/ytasm
|
||||
|
|
Loading…
Reference in a new issue