build: Make build_data_stream.py cross platform
Previously it only worked on Windows
This commit is contained in:
1 parent
672149dd89
commit
6049826e90
1 file changed
+25
-3
@@ -1,6 +1,7 @@
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from core.file_utils import SparkPaths
|
||||
from core.iter_utils import at_bounded
|
||||
@@ -59,6 +60,26 @@ def _cmake_verbosity(level):
|
||||
return at_bounded(names, level)
|
||||
|
||||
|
||||
def _cmake_preset():
|
||||
match sys.platform:
|
||||
case 'win32':
|
||||
return 'data-stream-suite'
|
||||
case 'linux':
|
||||
return 'data-stream-suite-linux'
|
||||
case _:
|
||||
raise ValueError(f'Unsupported platform {sys.platform}')
|
||||
|
||||
|
||||
def _cmake_build_preset(configuration):
|
||||
match sys.platform:
|
||||
case 'win32':
|
||||
return f'data-stream-suite-{configuration}'
|
||||
case 'linux':
|
||||
return f'data-stream-suite-linux-{configuration}'
|
||||
case _:
|
||||
raise ValueError(f'Unsupported platform {sys.platform}')
|
||||
|
||||
|
||||
def _main():
|
||||
parser = _get_arg_parser()
|
||||
args = parser.parse_args()
|
||||
@@ -67,7 +88,7 @@ def _main():
|
||||
print(cmd)
|
||||
if args.dry_run:
|
||||
return
|
||||
subprocess.run(cmd).check_returncode()
|
||||
subprocess.run(cmd, shell=True).check_returncode()
|
||||
|
||||
def dotnet_cmd(action='build'):
|
||||
sln = SparkPaths.root().joinpath(
|
||||
@@ -84,13 +105,14 @@ def _main():
|
||||
os.chdir(SparkPaths.root())
|
||||
cmake_configure_cmd = ' '.join([
|
||||
f'cmake',
|
||||
f'--preset data-stream-suite',
|
||||
f'--preset',
|
||||
_cmake_preset(),
|
||||
f'-DCMAKE_MESSAGE_LOG_LEVEL={_cmake_verbosity(args.verbosity)}',
|
||||
])
|
||||
cmake_build_cmd = ' '.join([
|
||||
f'cmake',
|
||||
f'--build',
|
||||
f'--preset data-stream-suite-{args.configuration.lower()}',
|
||||
f'--preset {_cmake_build_preset(args.configuration.lower())}',
|
||||
])
|
||||
if args.clean:
|
||||
run(f'{cmake_build_cmd} --target clean')
|
||||
|
||||
Reference in new issue
Block a user