2021-05-16 13:09:32 +02:00
import os
import sys
import argparse
from execute_util import execute
if __name__ == " __main__ " :
parser = argparse . ArgumentParser (
description = ' Installs ScreenPlay dependencies. ' )
parser . add_argument (
' --path ' , help = ' You can manually set the vcpkg path via -p. This path must be an absolute path and without the ScreenPlay-vcpkg name! py.exe . \ setup.py --path " D:/Backup/Code/Qt/ " ' )
args = parser . parse_args ( )
# ScreenPlay source and ScreenPlay-vcpkg have to be on the same file system hierarchy
project_source_parent_path = " "
project_source_path = os . path . abspath ( os . path . join ( os . getcwd ( ) , " ../ " ) )
2021-05-16 14:10:37 +02:00
if args . path is not None :
2021-05-16 13:09:32 +02:00
project_source_parent_path = os . path . abspath ( args . path )
else :
print ( " No --path provided! " )
project_source_parent_path = os . path . abspath (
os . path . join ( os . getcwd ( ) , " ../../ " ) )
print ( " \n project_source_parent_path: " , project_source_parent_path ,
" \n project_source_path: " , project_source_path ,
" \n " )
execute ( " git clone https://github.com/microsoft/vcpkg.git ScreenPlay-vcpkg " ,
project_source_parent_path , True )
vcpkg_path = os . path . join ( project_source_parent_path , " ScreenPlay-vcpkg " )
print ( " vcpkg_path: " , vcpkg_path )
2021-06-25 12:42:03 +02:00
vcpkg_version = " 9172179c513aa84308e48b8dd0e3df90acec7204 " # Master 25.06.2021
2021-05-16 13:09:32 +02:00
print ( " Build vcpkg " , vcpkg_version )
execute ( " git fetch " , vcpkg_path )
execute ( " git checkout {} " . format ( vcpkg_version ) , vcpkg_path )
vcpkg_packages_list = [
" openssl-unix " ,
2021-06-25 12:35:41 +02:00
" curl " ,
2021-05-16 13:09:32 +02:00
" sentry-native " ,
" doctest " ,
2021-07-25 16:31:05 +02:00
" benchmark " ,
2021-05-16 13:09:32 +02:00
]
vcpkg_triplet = " "
2021-06-25 12:32:19 +02:00
vcpkg_command = " "
2021-05-16 13:09:32 +02:00
if sys . platform == " win32 " :
2021-06-25 12:32:19 +02:00
vcpkg_command = " vcpkg.exe "
2021-05-16 13:09:32 +02:00
vcpkg_packages_list . append ( " infoware[d3d] " )
execute ( " download_ffmpeg.bat " , project_source_path + " /Tools " , False )
execute ( " bootstrap-vcpkg.bat " , vcpkg_path , False )
2021-05-16 16:34:05 +02:00
vcpkg_triplet = " x64-windows "
2021-05-16 13:09:32 +02:00
elif sys . platform == " darwin " :
2021-06-25 12:32:19 +02:00
vcpkg_command = " ./vcpkg "
2021-05-16 13:09:32 +02:00
vcpkg_packages_list . append ( " infoware[opencl] " )
2021-06-12 15:17:38 +02:00
vcpkg_packages_list . append ( " curl " ) # Hidden dependency from sentry
2021-06-12 14:42:55 +02:00
execute ( " chmod +x bootstrap-vcpkg.sh " , vcpkg_path )
execute ( " ./bootstrap-vcpkg.sh " , vcpkg_path , False )
2021-05-16 13:09:32 +02:00
execute ( " chmod +x vcpkg " , vcpkg_path )
2021-06-12 14:42:55 +02:00
vcpkg_triplet = " x64-osx "
2021-05-16 13:09:32 +02:00
elif sys . platform == " linux " :
2021-06-25 12:32:19 +02:00
vcpkg_command = " ./vcpkg "
2021-07-25 16:21:16 +02:00
#vcpkg_packages_list.append("infoware[opengl]")
2021-06-12 14:42:55 +02:00
execute ( " chmod +x bootstrap-vcpkg.sh " , vcpkg_path )
execute ( " ./bootstrap-vcpkg.sh " , vcpkg_path , False )
2021-05-16 13:09:32 +02:00
execute ( " chmod +x vcpkg " , vcpkg_path )
2021-06-12 14:42:55 +02:00
vcpkg_triplet = " x64-linux "
2021-05-16 13:09:32 +02:00
2021-05-16 16:38:04 +02:00
vcpkg_packages = " " . join ( vcpkg_packages_list )
2021-06-25 12:32:19 +02:00
execute ( " {} update " . format ( vcpkg_command ) , vcpkg_path , False )
execute ( " {} upgrade --no-dry-run " . format ( vcpkg_command ) ,
2021-05-16 13:09:32 +02:00
vcpkg_path , False )
2021-06-25 12:32:19 +02:00
execute ( " {} install {} --triplet {} --recurse " . format ( vcpkg_command ,
2021-05-16 13:09:32 +02:00
vcpkg_packages , vcpkg_triplet ) , vcpkg_path , False )