mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Merge pull request #5438 from Laserlicht/portmaster-build
[1.6.6] portmaster support
This commit is contained in:
		| @@ -109,6 +109,8 @@ include(CMakeDependentOption) | ||||
| cmake_dependent_option(ENABLE_INNOEXTRACT "Enable innoextract for GOG file extraction in launcher" ON "ENABLE_LAUNCHER" OFF) | ||||
| cmake_dependent_option(ENABLE_GITVERSION "Enable Version.cpp with Git commit hash" ON "NOT ENABLE_GOLDMASTER" OFF) | ||||
|  | ||||
| option(VCMI_PORTMASTER "PortMaster build" OFF) | ||||
|  | ||||
| ############################################ | ||||
| #        Miscellaneous options             # | ||||
| ############################################ | ||||
|   | ||||
| @@ -319,6 +319,25 @@ | ||||
|             "cacheVariables": { | ||||
|                 "ANDROID_GRADLE_PROPERTIES": "applicationIdSuffix=.daily;signingConfig=dailySigning;applicationLabel=VCMI daily;applicationVariant=daily" | ||||
|             } | ||||
|         }, | ||||
|         { | ||||
|             "name": "portmaster-release", | ||||
|             "displayName": "PortMaster", | ||||
|             "description": "VCMI PortMaster", | ||||
|             "inherits": "default-release", | ||||
|             "cacheVariables": { | ||||
|                 "CMAKE_BUILD_TYPE": "Release", | ||||
|                 "CMAKE_INSTALL_PREFIX": ".", | ||||
|                 "ENABLE_DEBUG_CONSOLE": "OFF", | ||||
|                 "ENABLE_EDITOR": "OFF", | ||||
|                 "ENABLE_GITVERSION": "OFF", | ||||
|                 "ENABLE_LAUNCHER": "OFF", | ||||
|                 "ENABLE_SERVER": "OFF", | ||||
|                 "ENABLE_TRANSLATIONS": "OFF", | ||||
|                 "FORCE_BUNDLED_FL": "ON", | ||||
|                 "ENABLE_GOLDMASTER": "ON", | ||||
|                 "VCMI_PORTMASTER": "ON" | ||||
|             } | ||||
|         } | ||||
|     ], | ||||
|     "buildPresets": [ | ||||
| @@ -447,6 +466,12 @@ | ||||
|             "name": "android-daily-release", | ||||
|             "configurePreset": "android-daily-release", | ||||
|             "inherits": "android-conan-ninja-release" | ||||
|         }, | ||||
|         { | ||||
|             "name": "portmaster-release", | ||||
|             "configurePreset": "portmaster-release", | ||||
|             "inherits": "default-release", | ||||
|             "configuration": "Release" | ||||
|         } | ||||
|     ], | ||||
|     "testPresets": [ | ||||
|   | ||||
| @@ -493,5 +493,9 @@ if (ffmpeg_INCLUDE_DIRS) | ||||
| 	) | ||||
| endif() | ||||
|  | ||||
| if(VCMI_PORTMASTER) | ||||
| 	target_compile_definitions(vcmiclientcommon PRIVATE VCMI_PORTMASTER) | ||||
| endif() | ||||
|  | ||||
| vcmi_set_output_dir(vcmiclientcommon "") | ||||
| enable_pch(vcmiclientcommon) | ||||
|   | ||||
| @@ -24,7 +24,7 @@ | ||||
|  | ||||
| std::unique_ptr<ICursor> CursorHandler::createCursor() | ||||
| { | ||||
| #if defined(VCMI_MOBILE) | ||||
| #if defined(VCMI_MOBILE) || defined(VCMI_PORTMASTER) | ||||
| 	if (settings["general"]["userRelativePointer"].Bool()) | ||||
| 		return std::make_unique<CursorSoftware>(); | ||||
| #endif | ||||
|   | ||||
							
								
								
									
										28
									
								
								docker/BuildPortmaster-aarch64.dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								docker/BuildPortmaster-aarch64.dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| FROM monkeyx/retro_builder:arm64 | ||||
| WORKDIR /usr/local/app | ||||
|  | ||||
| ENV DEBIAN_FRONTEND=noninteractive | ||||
|  | ||||
| # from VCMI build docs | ||||
| RUN apt-get update && apt-get install -y cmake g++ clang libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev zlib1g-dev libavformat-dev libswscale-dev libboost-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-locale-dev libboost-iostreams-dev qtbase5-dev libtbb-dev libluajit-5.1-dev liblzma-dev libsqlite3-dev qttools5-dev ninja-build ccache | ||||
|  | ||||
| # newer cmake version to support presets | ||||
| RUN apt-get remove -y cmake | ||||
| RUN apt-get install -y libssl-dev | ||||
| RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.5/cmake-3.31.5.tar.gz ; tar zxvf cmake-3.31.5.tar.gz ; cd cmake-3.31.5 ; ./bootstrap ; make ; make install ; cd .. ; rm -rf cmake-3.31.5 | ||||
|  | ||||
| CMD ["sh", "-c", " \ | ||||
|     # switch to mounted dir | ||||
|     cd /vcmi ; \ | ||||
|     # fix for wrong path of base image | ||||
|     ln -s /usr/lib/libSDL2.so /usr/lib/aarch64-linux-gnu/libSDL2.so ; \ | ||||
|     # build | ||||
|     cmake --preset portmaster-release ; \ | ||||
|     cmake --build --preset portmaster-release ; \ | ||||
|     # export missing libraries | ||||
|     ldd /vcmi/out/build/portmaster-release/bin/vcmiclient | grep -e libboost -e libtbb -e libicu | awk 'NF == 4 { system(\"cp \" $3 \" /vcmi/out/build/portmaster-release/bin/\") }' \ | ||||
| "] | ||||
|  | ||||
| # Build on ARM64 processor or ARM64 chroot with: | ||||
| #      docker build -f docker/BuildPortmaster-aarch64.dockerfile -t vcmi-portmaster-build . | ||||
| #      docker run -it --rm -v $PWD/:/vcmi vcmi-portmaster-build | ||||
| @@ -872,3 +872,7 @@ if(APPLE_IOS AND NOT USING_CONAN) | ||||
| 		install(${INSTALL_TYPE} ${LINKED_LIB_REAL} LIBRARY DESTINATION ${LIB_DIR}) | ||||
| 	endforeach() | ||||
| endif() | ||||
|  | ||||
| if(VCMI_PORTMASTER) | ||||
| 	target_compile_definitions(vcmi PRIVATE VCMI_PORTMASTER) | ||||
| endif() | ||||
|   | ||||
| @@ -579,6 +579,90 @@ void VCMIDirsAndroid::init() | ||||
| 	nativePath = envHelper.callStaticStringMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "nativePath"); | ||||
| 	IVCMIDirsUNIX::init(); | ||||
| } | ||||
|  | ||||
| #elif defined(VCMI_PORTMASTER) | ||||
| class VCMIDirsPM : public IVCMIDirsUNIX | ||||
| { | ||||
| public: | ||||
| 	bfs::path userDataPath() const override; | ||||
| 	bfs::path userCachePath() const override; | ||||
| 	bfs::path userConfigPath() const override; | ||||
|  | ||||
| 	std::vector<bfs::path> dataPaths() const override; | ||||
|  | ||||
| 	bfs::path libraryPath() const override; | ||||
| 	bfs::path binaryPath() const override; | ||||
|  | ||||
| 	std::string libraryName(const std::string& basename) const override; | ||||
| }; | ||||
|  | ||||
| bfs::path VCMIDirsPM::userDataPath() const | ||||
| { | ||||
| 	const char* homeDir; | ||||
| 	if((homeDir = getenv("PORTMASTER_HOME"))) | ||||
| 		return bfs::path(homeDir) / "data"; | ||||
| 	else | ||||
| 		return bfs::path(".") / "data"; | ||||
| } | ||||
| bfs::path VCMIDirsPM::userCachePath() const | ||||
| { | ||||
| 	// $XDG_CACHE_HOME, default: $HOME/.cache | ||||
| 	const char * tempResult; | ||||
| 	if ((tempResult = getenv("PORTMASTER_HOME"))) | ||||
| 		return bfs::path(tempResult) / "cache"; | ||||
| 	else | ||||
| 		return bfs::path(".") / "cache"; | ||||
| } | ||||
| bfs::path VCMIDirsPM::userConfigPath() const | ||||
| { | ||||
| 	// $XDG_CONFIG_HOME, default: $HOME/.config | ||||
| 	const char * tempResult; | ||||
| 	if ((tempResult = getenv("PORTMASTER_HOME"))) | ||||
| 		return bfs::path(tempResult) / "save"; | ||||
| 	else | ||||
| 		return bfs::path(".") / "save"; | ||||
| } | ||||
|  | ||||
| std::vector<bfs::path> VCMIDirsPM::dataPaths() const | ||||
| { | ||||
| 	// $XDG_DATA_DIRS, default: /usr/local/share/:/usr/share/ | ||||
|  | ||||
| 	// construct list in reverse. | ||||
| 	// in specification first directory has highest priority | ||||
| 	// in vcmi fs last directory has highest priority | ||||
| 	std::vector<bfs::path> ret; | ||||
| 	const char * tempResult; | ||||
| 	if ((tempResult = getenv("PORTMASTER_HOME"))) | ||||
| 	{ | ||||
| 		ret.push_back(bfs::path(tempResult) / "data"); | ||||
| 		ret.push_back(bfs::path(tempResult)); | ||||
| 	} | ||||
|  | ||||
| 	ret.push_back(bfs::path(".") / "data"); | ||||
| 	ret.push_back(bfs::path(".")); | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| bfs::path VCMIDirsPM::libraryPath() const | ||||
| { | ||||
| 	const char * tempResult; | ||||
| 	if ((tempResult = getenv("PORTMASTER_HOME"))) | ||||
| 		return bfs::path(tempResult) / "libs"; | ||||
| 	else | ||||
| 		return M_LIB_DIR; | ||||
| } | ||||
|  | ||||
| bfs::path VCMIDirsPM::binaryPath() const | ||||
| { | ||||
| 	const char * tempResult; | ||||
| 	if ((tempResult = getenv("PORTMASTER_HOME"))) | ||||
| 		return bfs::path(tempResult) / "bin"; | ||||
| 	else | ||||
| 		return M_BIN_DIR; | ||||
| } | ||||
|  | ||||
| std::string VCMIDirsPM::libraryName(const std::string& basename) const { return "lib" + basename + ".so"; } | ||||
|  | ||||
| #elif defined(VCMI_XDG) | ||||
| class VCMIDirsXDG : public IVCMIDirsUNIX | ||||
| { | ||||
| @@ -700,6 +784,8 @@ namespace VCMIDirs | ||||
| 			static VCMIDirsWIN32 singleton; | ||||
| 		#elif defined(VCMI_ANDROID) | ||||
| 			static VCMIDirsAndroid singleton; | ||||
| 		#elif defined(VCMI_PORTMASTER) | ||||
| 			static VCMIDirsPM singleton; | ||||
| 		#elif defined(VCMI_XDG) | ||||
| 			static VCMIDirsXDG singleton; | ||||
| 		#elif defined(VCMI_MAC) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user