60 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #! /usr/bin/env bash
 | |
| 
 | |
| TARGET=$1
 | |
| BUILD_TYPE=$2
 | |
| 
 | |
| project=$(pwd)/
 | |
| buildTool=""
 | |
| 
 | |
| if [[ $TARGET == windows ]]; then
 | |
| 	toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/Mingw.cmake"
 | |
| 	buildTool="-GNinja"
 | |
| elif [[ $TARGET == gba ]]; then
 | |
| 	toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake"
 | |
| 	nostalgiaBuildType="-DNOSTALGIA_BUILD_TYPE=GBA"
 | |
| 	oxUseStdLib="-DOX_USE_STDLIB=OFF"
 | |
| else
 | |
| 	buildTool="-GNinja"
 | |
| fi
 | |
| 
 | |
| if [[ $BUILD_TYPE == asan ]]; then
 | |
| 	BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Debug"
 | |
| 	sanitizerArgs="-DUSE_ASAN=ON"
 | |
| elif [[ $BUILD_TYPE == debug ]]; then
 | |
| 	BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Debug"
 | |
| 	sanitizerArgs=""
 | |
| elif [[ $BUILD_TYPE == release ]]; then
 | |
| 	BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Release"
 | |
| 	sanitizerArgs=""
 | |
| fi
 | |
| 
 | |
| if [[ $NOSTALGIA_QT_PATH != "" ]]; then
 | |
| 	qtPath="-DNOSTALGIA_QT_PATH=${NOSTALGIA_QT_PATH}"
 | |
| fi
 | |
| 
 | |
| buildDir="${project}/build/${TARGET}-${BUILD_TYPE}"
 | |
| distDir="${project}/dist/${TARGET}-${BUILD_TYPE}"
 | |
| 
 | |
| mkdir -p $buildDir
 | |
| pushd $buildDir
 | |
| cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
 | |
|       -DCMAKE_INSTALL_PREFIX="$distDir" \
 | |
|       -DCMAKE_INSTALL_RPATH="$project/dist/${TARGET}-${BUILD_TYPE}/lib/nostalgia" \
 | |
|       -DNOSTALGIA_IDE_BUILD=OFF \
 | |
|       $buildTool \
 | |
|       $nostalgiaBuildType \
 | |
|       $oxUseStdLib \
 | |
|       $BUILD_TYPEArgs \
 | |
| 		$sanitizerArgs \
 | |
|       $qtPath \
 | |
|       $toolchain \
 | |
|       $project
 | |
| popd
 | |
| 
 | |
| rm -f build/current dist/current
 | |
| mkdir -p dist
 | |
| ln -s ${TARGET}-${BUILD_TYPE} build/current
 | |
| rm -f compile_commands.json
 | |
| ln -s build/current/compile_commands.json
 | |
| ln -s ${TARGET}-${BUILD_TYPE} dist/current
 |