mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:20:06 +00:00 
			
		
		
		
	Activate Python virtual environment on Windows during configuration
This commit is contained in:
		
							parent
							
								
									ac475999f5
								
							
						
					
					
						commit
						0e90f8a7a1
					
				
					 10 changed files with 95 additions and 8 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -16,3 +16,6 @@ _deps | ||||||
| # Editor directories | # Editor directories | ||||||
| .idea/ | .idea/ | ||||||
| .vs/ | .vs/ | ||||||
|  | 
 | ||||||
|  | # Python Virtual Environment | ||||||
|  | .venv/ | ||||||
|  |  | ||||||
|  | @ -1,9 +1,18 @@ | ||||||
| @setlocal enabledelayedexpansion | @setlocal enabledelayedexpansion | ||||||
| 
 | 
 | ||||||
| @set script_dir=%~dp0 | @set script_dir=%~dp0 | ||||||
|  | @set venv_path=%script_dir%\..\.venv | ||||||
|  | 
 | ||||||
|  | :: Assign user-specified Python Virtual Environment | ||||||
|  | @if not "%~1"=="" set venv_path=%~f1 | ||||||
|  | 
 | ||||||
|  | :: Activate Python Virtual Environment | ||||||
|  | python -m venv %venv_path% | ||||||
|  | @call %venv_path%\Scripts\activate.bat | ||||||
| 
 | 
 | ||||||
| :: Install Python packages | :: Install Python packages | ||||||
| @pip install --upgrade -r "%script_dir%\..\requirements.txt" | python -m pip install --upgrade pip | ||||||
|  | pip install --upgrade -r "%script_dir%\..\requirements.txt" | ||||||
| 
 | 
 | ||||||
| :: Configure default Conan profile | :: Configure default Conan profile | ||||||
| @conan profile detect -e | @conan profile detect -e | ||||||
|  | @ -19,4 +28,7 @@ | ||||||
|     conan config install "%script_dir%\conan\profiles\!profile_name!" -tf profiles |     conan config install "%script_dir%\conan\profiles\!profile_name!" -tf profiles | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | :: Deactivate Python Virtual Environment | ||||||
|  | @call %venv_path%\Scripts\deactivate.bat | ||||||
|  | 
 | ||||||
| @pause | @pause | ||||||
|  |  | ||||||
|  | @ -5,7 +5,8 @@ | ||||||
|     -DCMAKE_PREFIX_PATH="%qt_base%/%qt_version%/%qt_arch%" ^ |     -DCMAKE_PREFIX_PATH="%qt_base%/%qt_version%/%qt_arch%" ^ | ||||||
|     -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="%script_dir%\..\..\external\cmake-conan\conan_provider.cmake" ^ |     -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="%script_dir%\..\..\external\cmake-conan\conan_provider.cmake" ^ | ||||||
|     -DCONAN_HOST_PROFILE=%conan_profile% ^ |     -DCONAN_HOST_PROFILE=%conan_profile% ^ | ||||||
|     -DCONAN_BUILD_PROFILE=%conan_profile% |     -DCONAN_BUILD_PROFILE=%conan_profile% ^ | ||||||
|  |     -DSCWX_VENV_PATH=%venv_path% | ||||||
| 
 | 
 | ||||||
| @if defined build_type ( | @if defined build_type ( | ||||||
|     set cmake_args=%cmake_args% ^ |     set cmake_args=%cmake_args% ^ | ||||||
|  |  | ||||||
|  | @ -3,7 +3,15 @@ | ||||||
| :: Import common paths | :: Import common paths | ||||||
| @call %script_dir%\common-paths.bat | @call %script_dir%\common-paths.bat | ||||||
| 
 | 
 | ||||||
|  | :: Activate Python Virtual Environment | ||||||
|  | @if defined venv_path ( | ||||||
|  |     echo Activating Python Virtual Environment: %venv_path% | ||||||
|  |     python -m venv %venv_path% | ||||||
|  |     call %venv_path%\Scripts\activate.bat | ||||||
|  | ) | ||||||
|  | 
 | ||||||
| :: Install Python packages | :: Install Python packages | ||||||
|  | python -m pip install --upgrade pip | ||||||
| pip install --upgrade -r "%script_dir%\..\..\requirements.txt" | pip install --upgrade -r "%script_dir%\..\..\requirements.txt" | ||||||
| 
 | 
 | ||||||
| @if defined build_type ( | @if defined build_type ( | ||||||
|  | @ -24,3 +32,6 @@ pip install --upgrade -r "%script_dir%\..\..\requirements.txt" | ||||||
| 
 | 
 | ||||||
| :: Run CMake Configure | :: Run CMake Configure | ||||||
| @call %script_dir%\run-cmake-configure.bat | @call %script_dir%\run-cmake-configure.bat | ||||||
|  | 
 | ||||||
|  | :: Deactivate Python Virtual Environment | ||||||
|  | @call %venv_path%\Scripts\deactivate.bat | ||||||
|  |  | ||||||
|  | @ -6,9 +6,19 @@ | ||||||
| @set generator=Visual Studio 17 2022 | @set generator=Visual Studio 17 2022 | ||||||
| @set qt_base=C:/Qt | @set qt_base=C:/Qt | ||||||
| @set qt_arch=msvc2022_64 | @set qt_arch=msvc2022_64 | ||||||
|  | @set venv_path=%script_dir%\..\.venv | ||||||
| 
 | 
 | ||||||
| :: Assign user-specified build directory | :: Assign user-specified build directory | ||||||
| @if not "%~1"=="" set build_dir=%~1 | @if not "%~1"=="" set build_dir=%~f1 | ||||||
|  | 
 | ||||||
|  | :: Assign user-specified Python Virtual Environment | ||||||
|  | @if not "%~2"=="" ( | ||||||
|  |     if /i "%~2"=="none" ( | ||||||
|  |         set venv_path= | ||||||
|  |     ) else ( | ||||||
|  |         set venv_path=%~f2 | ||||||
|  |     ) | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| :: Perform common setup | :: Perform common setup | ||||||
| @call %script_dir%\lib\setup-common.bat | @call %script_dir%\lib\setup-common.bat | ||||||
|  |  | ||||||
|  | @ -6,9 +6,19 @@ | ||||||
| @set generator=Ninja | @set generator=Ninja | ||||||
| @set qt_base=C:/Qt | @set qt_base=C:/Qt | ||||||
| @set qt_arch=msvc2022_64 | @set qt_arch=msvc2022_64 | ||||||
|  | @set venv_path=%script_dir%\..\.venv | ||||||
| 
 | 
 | ||||||
| :: Assign user-specified build directory | :: Assign user-specified build directory | ||||||
| @if not "%~1"=="" set build_dir=%~1 | @if not "%~1"=="" set build_dir=%~f1 | ||||||
|  | 
 | ||||||
|  | :: Assign user-specified Python Virtual Environment | ||||||
|  | @if not "%~2"=="" ( | ||||||
|  |     if /i "%~2"=="none" ( | ||||||
|  |         set venv_path= | ||||||
|  |     ) else ( | ||||||
|  |         set venv_path=%~f2 | ||||||
|  |     ) | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| :: Perform common setup | :: Perform common setup | ||||||
| @call %script_dir%\lib\setup-common.bat | @call %script_dir%\lib\setup-common.bat | ||||||
|  |  | ||||||
|  | @ -5,9 +5,19 @@ | ||||||
| @set generator=Visual Studio 17 2022 | @set generator=Visual Studio 17 2022 | ||||||
| @set qt_base=C:/Qt | @set qt_base=C:/Qt | ||||||
| @set qt_arch=msvc2022_64 | @set qt_arch=msvc2022_64 | ||||||
|  | @set venv_path=%script_dir%\..\.venv | ||||||
| 
 | 
 | ||||||
| :: Assign user-specified build directory | :: Assign user-specified build directory | ||||||
| @if not "%~1"=="" set build_dir=%~1 | @if not "%~1"=="" set build_dir=%~f1 | ||||||
|  | 
 | ||||||
|  | :: Assign user-specified Python Virtual Environment | ||||||
|  | @if not "%~2"=="" ( | ||||||
|  |     if /i "%~2"=="none" ( | ||||||
|  |         set venv_path= | ||||||
|  |     ) else ( | ||||||
|  |         set venv_path=%~f2 | ||||||
|  |     ) | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| :: Perform common setup | :: Perform common setup | ||||||
| @call %script_dir%\lib\setup-common.bat | @call %script_dir%\lib\setup-common.bat | ||||||
|  |  | ||||||
|  | @ -5,9 +5,19 @@ | ||||||
| @set generator=Ninja Multi-Config | @set generator=Ninja Multi-Config | ||||||
| @set qt_base=C:/Qt | @set qt_base=C:/Qt | ||||||
| @set qt_arch=msvc2022_64 | @set qt_arch=msvc2022_64 | ||||||
|  | @set venv_path=%script_dir%\..\.venv | ||||||
| 
 | 
 | ||||||
| :: Assign user-specified build directory | :: Assign user-specified build directory | ||||||
| @if not "%~1"=="" set build_dir=%~1 | @if not "%~1"=="" set build_dir=%~f1 | ||||||
|  | 
 | ||||||
|  | :: Assign user-specified Python Virtual Environment | ||||||
|  | @if not "%~2"=="" ( | ||||||
|  |     if /i "%~2"=="none" ( | ||||||
|  |         set venv_path= | ||||||
|  |     ) else ( | ||||||
|  |         set venv_path=%~f2 | ||||||
|  |     ) | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| :: Perform common setup | :: Perform common setup | ||||||
| @call %script_dir%\lib\setup-common.bat | @call %script_dir%\lib\setup-common.bat | ||||||
|  |  | ||||||
|  | @ -6,9 +6,19 @@ | ||||||
| @set generator=Visual Studio 17 2022 | @set generator=Visual Studio 17 2022 | ||||||
| @set qt_base=C:/Qt | @set qt_base=C:/Qt | ||||||
| @set qt_arch=msvc2022_64 | @set qt_arch=msvc2022_64 | ||||||
|  | @set venv_path=%script_dir%\..\.venv | ||||||
| 
 | 
 | ||||||
| :: Assign user-specified build directory | :: Assign user-specified build directory | ||||||
| @if not "%~1"=="" set build_dir=%~1 | @if not "%~1"=="" set build_dir=%~f1 | ||||||
|  | 
 | ||||||
|  | :: Assign user-specified Python Virtual Environment | ||||||
|  | @if not "%~2"=="" ( | ||||||
|  |     if /i "%~2"=="none" ( | ||||||
|  |         set venv_path= | ||||||
|  |     ) else ( | ||||||
|  |         set venv_path=%~f2 | ||||||
|  |     ) | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| :: Perform common setup | :: Perform common setup | ||||||
| @call %script_dir%\lib\setup-common.bat | @call %script_dir%\lib\setup-common.bat | ||||||
|  |  | ||||||
|  | @ -6,9 +6,19 @@ | ||||||
| @set generator=Ninja | @set generator=Ninja | ||||||
| @set qt_base=C:/Qt | @set qt_base=C:/Qt | ||||||
| @set qt_arch=msvc2022_64 | @set qt_arch=msvc2022_64 | ||||||
|  | @set venv_path=%script_dir%\..\.venv | ||||||
| 
 | 
 | ||||||
| :: Assign user-specified build directory | :: Assign user-specified build directory | ||||||
| @if not "%~1"=="" set build_dir=%~1 | @if not "%~1"=="" set build_dir=%~f1 | ||||||
|  | 
 | ||||||
|  | :: Assign user-specified Python Virtual Environment | ||||||
|  | @if not "%~2"=="" ( | ||||||
|  |     if /i "%~2"=="none" ( | ||||||
|  |         set venv_path= | ||||||
|  |     ) else ( | ||||||
|  |         set venv_path=%~f2 | ||||||
|  |     ) | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| :: Perform common setup | :: Perform common setup | ||||||
| @call %script_dir%\lib\setup-common.bat | @call %script_dir%\lib\setup-common.bat | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat