mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Installer: Converted the build scripts to cmake and added an "installer" target
This commit is contained in:
		
							parent
							
								
									d11cf9a0a5
								
							
						
					
					
						commit
						709c89a1d8
					
				
					 8 changed files with 53 additions and 78 deletions
				
			
		
							
								
								
									
										5
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -26,8 +26,3 @@ src/common/scm_rev.cpp | ||||||
| # Windows global filetypes | # Windows global filetypes | ||||||
| Thumbs.db | Thumbs.db | ||||||
| 
 | 
 | ||||||
| # QtIFW builds |  | ||||||
| dist/installer/redist |  | ||||||
| dist/installer/citra-installer* |  | ||||||
| dist/installer/*.zip |  | ||||||
| dist/installer/*.tar.gz |  | ||||||
|  |  | ||||||
|  | @ -303,6 +303,7 @@ get_timestamp(BUILD_DATE) | ||||||
| enable_testing() | enable_testing() | ||||||
| add_subdirectory(externals) | add_subdirectory(externals) | ||||||
| add_subdirectory(src) | add_subdirectory(src) | ||||||
|  | add_subdirectory(dist/installer) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Installation instructions | # Installation instructions | ||||||
|  |  | ||||||
							
								
								
									
										28
									
								
								CMakeModules/BuildInstaller.cmake
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								CMakeModules/BuildInstaller.cmake
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | ||||||
|  | # To use this as a script, make sure you pass in the variables SRC_DIR BUILD_DIR and TARGET_FILE | ||||||
|  | 
 | ||||||
|  | if(WIN32) | ||||||
|  |     set(PLATFORM "windows") | ||||||
|  | elseif(APPLE) | ||||||
|  |     set(PLATFORM "mac") | ||||||
|  | elseif(LINUX) | ||||||
|  |     set(PLATFORM "linux") | ||||||
|  | else() | ||||||
|  |     message(FATAL_ERROR "Cannot build installer for this unsupported platform") | ||||||
|  | endif() | ||||||
|  | 
 | ||||||
|  | set(DIST_DIR "${BUILD_DIR}/dist") | ||||||
|  | set(ARCHIVE "${PLATFORM}.7z") | ||||||
|  | 
 | ||||||
|  | file(MAKE_DIRECTORY ${DIST_DIR}) | ||||||
|  | file(DOWNLOAD https://github.com/citra-emu/ext-windows-bin/raw/master/qtifw/${ARCHIVE} | ||||||
|  |     "${BUILD_DIR}/${ARCHIVE}" SHOW_PROGRESS) | ||||||
|  | execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${BUILD_DIR}/${ARCHIVE}" | ||||||
|  |     WORKING_DIRECTORY "${BUILD_DIR}/") | ||||||
|  | 
 | ||||||
|  | set(CONFIG_FILE "${SRC_DIR}/config/config_${PLATFORM}.xml") | ||||||
|  | set(INSTALLER_BASE "${BUILD_DIR}/installerbase_${PLATFORM}") | ||||||
|  | set(BINARY_CREATOR "${BUILD_DIR}/binarycreator_${PLATFORM}") | ||||||
|  | set(PACKAGES_DIR "${BUILD_DIR}/packages") | ||||||
|  | file(MAKE_DIRECTORY ${PACKAGES_DIR}) | ||||||
|  | 
 | ||||||
|  | execute_process(COMMAND ${BINARY_CREATOR} -t ${INSTALLER_BASE} -n -c ${CONFIG_FILE} -p ${PACKAGES_DIR} ${TARGET_FILE}) | ||||||
							
								
								
									
										22
									
								
								dist/installer/CMakeLists.txt
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								dist/installer/CMakeLists.txt
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | ||||||
|  | 
 | ||||||
|  | if(WIN32) | ||||||
|  |     set(PLATFORM "windows") | ||||||
|  | elseif(APPLE) | ||||||
|  |     set(PLATFORM "mac") | ||||||
|  | elseif(LINUX) | ||||||
|  |     set(PLATFORM "linux") | ||||||
|  | endif() | ||||||
|  | 
 | ||||||
|  | set(BUILD_DIR "${CMAKE_BINARY_DIR}/installer") | ||||||
|  | set(DIST_DIR "${BUILD_DIR}/dist") | ||||||
|  | set(TARGET_FILE "${DIST_DIR}/citra-setup-${PLATFORM}") | ||||||
|  | 
 | ||||||
|  | # Adds a custom target that will run the BuildInstaller.cmake file | ||||||
|  | # CMake can't just run a cmake function as a custom command, so this is a way around it. | ||||||
|  | # Calls the cmake command and runs a cmake file in "scripting" mode passing in variables with -D | ||||||
|  | add_custom_command(OUTPUT "${TARGET_FILE}" | ||||||
|  |     COMMAND ${CMAKE_COMMAND} -DSRC_DIR=${CMAKE_CURRENT_SOURCE_DIR} -D BUILD_DIR=${BUILD_DIR} -D TARGET_FILE=${TARGET_FILE} -P ${CMAKE_SOURCE_DIR}/CMakeModules/BuildInstaller.cmake | ||||||
|  |     WORKING_DIRECTORY ${BUILD_DIR} | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | add_custom_target(installer DEPENDS ${TARGET_FILE}) | ||||||
							
								
								
									
										25
									
								
								dist/installer/README.md
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										25
									
								
								dist/installer/README.md
									
										
									
									
										vendored
									
									
								
							|  | @ -3,28 +3,7 @@ Citra Qt Installer | ||||||
| 
 | 
 | ||||||
| This contains the configuration files for building Citra's installer. | This contains the configuration files for building Citra's installer. | ||||||
| 
 | 
 | ||||||
| `packages` is empty as Qt expects that it gets a valid directory for offline |  | ||||||
|  packages, even if you are a online-only installer. |  | ||||||
| 
 |  | ||||||
| Installers can only be built on the platform that they are targeting. | Installers can only be built on the platform that they are targeting. | ||||||
| 
 | 
 | ||||||
| Windows | Build the `installer` target to generate the installer, and the installer will be in | ||||||
| ------- | ${build_dir}/installer/dist/ | ||||||
| 
 |  | ||||||
| Using Powershell 2.0 (Windows 10): |  | ||||||
| 
 |  | ||||||
| ```powershell |  | ||||||
| cd dist\installer |  | ||||||
| powershell –ExecutionPolicy Bypass .\build.ps1 |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| Linux/Mac |  | ||||||
| --------- |  | ||||||
| 
 |  | ||||||
| Curl + Bash must be available. |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| cd dist/installer |  | ||||||
| chmod +x build.sh |  | ||||||
| ./build.sh |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								dist/installer/build.ps1
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								dist/installer/build.ps1
									
										
									
									
										vendored
									
									
								
							|  | @ -1,14 +0,0 @@ | ||||||
| if (!(Test-Path redist\installerbase_win.exe)) { |  | ||||||
|     echo "Downloading dependencies..." |  | ||||||
|     if (!(Test-Path redist)) { |  | ||||||
|         New-Item -path . -name redist -itemtype directory |  | ||||||
|     } |  | ||||||
|     Invoke-WebRequest -Uri "https://github.com/citra-emu/ext-windows-bin/raw/master/qtifw/windows.zip" -OutFile windows.zip |  | ||||||
|     echo "Extracting..." |  | ||||||
|     Expand-Archive windows.zip -DestinationPath redist |  | ||||||
| } else { |  | ||||||
|     echo "Found pre-downloaded redist." |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| echo "Building Qt Installer to '.\citra-installer-windows.exe'..." |  | ||||||
| .\redist\binarycreator_win.exe -t .\redist\installerbase_win.exe -n -c .\config\config_windows.xml -p .\packages\ citra-installer-windows |  | ||||||
							
								
								
									
										36
									
								
								dist/installer/build.sh
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								dist/installer/build.sh
									
										
									
									
										vendored
									
									
								
							|  | @ -1,36 +0,0 @@ | ||||||
| #!/bin/bash |  | ||||||
| 
 |  | ||||||
| set -e |  | ||||||
| 
 |  | ||||||
| PLATFORM="" |  | ||||||
| if [[ "$OSTYPE" == "linux-gnu" ]]; then |  | ||||||
|     PLATFORM="linux" |  | ||||||
| elif [[ "$OSTYPE" == "darwin"* ]]; then |  | ||||||
|     PLATFORM="mac" |  | ||||||
| else |  | ||||||
|     echo Your platform is not supported. |  | ||||||
|     exit 1 |  | ||||||
| fi |  | ||||||
|          |  | ||||||
| if [ ! -f redist/installerbase_$PLATFORM ]; then |  | ||||||
|     echo Downloading dependencies... |  | ||||||
|     curl -L -O https://github.com/citra-emu/ext-windows-bin/raw/master/qtifw/$PLATFORM.tar.gz |  | ||||||
| 
 |  | ||||||
|     echo Extracting... |  | ||||||
|     mkdir -p redist |  | ||||||
|     cd redist |  | ||||||
|     tar -zxvf ../$PLATFORM.tar.gz |  | ||||||
|     cd .. |  | ||||||
| 
 |  | ||||||
|     chmod +x redist/* |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| TARGET_FILE=citra-installer-$PLATFORM |  | ||||||
| CONFIG_FILE=config/config_$PLATFORM.xml |  | ||||||
| REDIST_BASE=redist/installerbase_$PLATFORM |  | ||||||
| BINARY_CREATOR=redist/binarycreator_$PLATFORM |  | ||||||
| PACKAGES_DIR=packages |  | ||||||
| 
 |  | ||||||
| echo Building to \'$TARGET_FILE\'... |  | ||||||
| 
 |  | ||||||
| $BINARY_CREATOR -t $REDIST_BASE -n -c $CONFIG_FILE -p $PACKAGES_DIR $TARGET_FILE |  | ||||||
							
								
								
									
										0
									
								
								dist/installer/packages/.gitkeep
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										0
									
								
								dist/installer/packages/.gitkeep
									
										
									
									
										vendored
									
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue