1
0
Fork 0

Apple: update

merge-requests/1/head
Maksym H 2023-08-11 13:35:54 +03:00 committed by mckaygerhard
parent 0785a0064a
commit 592f225798
13 changed files with 77 additions and 18 deletions

View File

@ -147,6 +147,7 @@
84BE974528CA129C004E8CEC /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84BE974428CA129C004E8CEC /* CoreHaptics.framework */; };
84C2AB5328DA7776001968EE /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C2AB5228DA7770001968EE /* libpng.a */; };
84DE114525D55D2400EDB067 /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A1F9A8252E616A00000717 /* event.cpp */; };
84E33D882A7BBEE900609F77 /* wrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E33D872A7BBEE900609F77 /* wrapper.m */; };
84F20D5925D52790009562A9 /* static_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20D5525D52790009562A9 /* static_text.cpp */; };
84F20D5A25D52790009562A9 /* CGUITTFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20D5725D52790009562A9 /* CGUITTFont.cpp */; };
84F20DA225D527C5009562A9 /* serverpackethandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F20D9325D527C4009562A9 /* serverpackethandler.cpp */; };
@ -598,6 +599,8 @@
84BE974228CA1291004E8CEC /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
84BE974428CA129C004E8CEC /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = System/Library/Frameworks/CoreHaptics.framework; sourceTree = SDKROOT; };
84C2AB5228DA7770001968EE /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = ../deps/libpng/libpng.a; sourceTree = "<group>"; };
84E33D862A7BBEC100609F77 /* wrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = wrapper.h; sourceTree = "<group>"; };
84E33D872A7BBEE900609F77 /* wrapper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = wrapper.m; sourceTree = "<group>"; };
84EEE5E62782728E00F61929 /* libintl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libintl.a; path = ../deps/gettext/libintl.a; sourceTree = "<group>"; };
84F20D5425D52790009562A9 /* irrUString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrUString.h; path = ../../../src/irrlicht_changes/irrUString.h; sourceTree = "<group>"; };
84F20D5525D52790009562A9 /* static_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = static_text.cpp; path = ../../../src/irrlicht_changes/static_text.cpp; sourceTree = "<group>"; };
@ -1108,6 +1111,7 @@
845856B724B1322D0040BA4F /* Info.plist */,
845856BA24B1322D0040BA4F /* MultiCraft.entitlements */,
848ADEF627BD68AE001C60F3 /* Localizable.strings */,
84E33D852A7BBEA200609F77 /* Supporting Files */,
84585CD524B138F50040BA4F /* src */,
);
path = MultiCraft;
@ -1670,6 +1674,15 @@
name = lua_api;
sourceTree = "<group>";
};
84E33D852A7BBEA200609F77 /* Supporting Files */ = {
isa = PBXGroup;
children = (
84E33D862A7BBEC100609F77 /* wrapper.h */,
84E33D872A7BBEE900609F77 /* wrapper.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
84F20D5B25D5279D009562A9 /* mapgen */ = {
isa = PBXGroup;
children = (
@ -1738,7 +1751,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1250;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "MultiCraft Studio OÜ";
TargetAttributes = {
845856A824B1322C0040BA4F = {
@ -2022,6 +2035,7 @@
84F20EA625D528C5009562A9 /* sidebyside.cpp in Sources */,
84F20E8325D52868009562A9 /* metricsbackend.cpp in Sources */,
84135C2425D526D700CA4DCF /* content_mapblock.cpp in Sources */,
84E33D882A7BBEE900609F77 /* wrapper.m in Sources */,
84F20E3225D5282A009562A9 /* l_nodetimer.cpp in Sources */,
84135B7325D5264B00CA4DCF /* inventorymanager.cpp in Sources */,
84135C1825D526D700CA4DCF /* filecache.cpp in Sources */,
@ -2186,6 +2200,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MultiCraft/MultiCraft.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
COMBINE_HIDPI_IMAGES = YES;
@ -2253,6 +2268,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MultiCraft/MultiCraft.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
COMBINE_HIDPI_IMAGES = YES;

View File

@ -0,0 +1,11 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
const char *get_secret_key(const char *key);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,8 @@
@import Foundation;
#import "wrapper.h"
const char *get_secret_key(const char *key)
{
return "dummy";
}

View File

@ -1,15 +1,15 @@
#!/bin/bash -e
SDL2_VERSION=2.28.0
SDL2_VERSION=release-2.28.2
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d SDL2-src ]; then
wget https://github.com/libsdl-org/SDL/archive/release-$SDL2_VERSION.tar.gz
tar -xzvf release-$SDL2_VERSION.tar.gz
mv SDL-release-$SDL2_VERSION SDL2-src
rm release-$SDL2_VERSION.tar.gz
wget https://github.com/libsdl-org/SDL/archive/$SDL2_VERSION.tar.gz
tar -xzf $SDL2_VERSION.tar.gz
mv SDL-$SDL2_VERSION SDL2-src
rm $SDL2_VERSION.tar.gz
# Disable some features that are not needed
sed -i '' 's/#define SDL_AUDIO_DRIVER_COREAUDIO 1/#define SDL_AUDIO_DRIVER_COREAUDIO 0/g' SDL2-src/include/SDL_config_macosx.h
sed -i '' 's/#define SDL_AUDIO_DRIVER_DISK 1/#define SDL_AUDIO_DRIVER_DISK 0/g' SDL2-src/include/SDL_config_macosx.h

View File

@ -7,7 +7,7 @@ mkdir -p deps; cd deps
if [ ! -d freetype-src ]; then
wget http://download.savannah.gnu.org/releases/freetype/freetype-$FREETYPE_VERSION.tar.gz
tar -xzvf freetype-$FREETYPE_VERSION.tar.gz
tar -xzf freetype-$FREETYPE_VERSION.tar.gz
mv freetype-$FREETYPE_VERSION freetype-src
rm freetype-$FREETYPE_VERSION.tar.gz
mkdir freetype-src/build

View File

@ -7,7 +7,7 @@ mkdir -p deps; cd deps
if [ ! -d gettext-src ]; then
wget https://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz
tar -xzvf gettext-$GETTEXT_VERSION.tar.gz
tar -xzf gettext-$GETTEXT_VERSION.tar.gz
mv gettext-$GETTEXT_VERSION gettext-src
rm gettext-$GETTEXT_VERSION.tar.gz
fi

View File

@ -1,13 +1,13 @@
#!/bin/bash -e
JPEG_VERSION=2.1.5.1
JPEG_VERSION=3.0.0
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d libjpeg-src ]; then
wget https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-$JPEG_VERSION.tar.gz
tar -xzvf libjpeg-turbo-$JPEG_VERSION.tar.gz
tar -xzf libjpeg-turbo-$JPEG_VERSION.tar.gz
mv libjpeg-turbo-$JPEG_VERSION libjpeg-src
rm libjpeg-turbo-$JPEG_VERSION.tar.gz
fi

View File

@ -7,7 +7,7 @@ mkdir -p deps; cd deps
if [ ! -d libpng-src ]; then
wget https://download.sourceforge.net/libpng/libpng-$PNG_VERSION.tar.gz
tar -xzvf libpng-$PNG_VERSION.tar.gz
tar -xzf libpng-$PNG_VERSION.tar.gz
mv libpng-$PNG_VERSION libpng-src
rm libpng-$PNG_VERSION.tar.gz
fi

View File

@ -1,14 +1,12 @@
#!/bin/bash -e
# This file sets the appropriate compiler and flags for compiling for macOS
sdk=macosx
export OSX_OSVER=10.11
export OSX_ARCHES="x86_64 arm64"
export OSX_ARCHITECTURES="x86_64;arm64"
export OSX_ARCH="-arch x86_64 -arch arm64"
export OSX_COMPILER=$(xcrun --sdk $sdk --find clang)
export OSX_CC=$OSX_COMPILER
export OSX_CXX=$OSX_COMPILER
export OSX_FLAGS="-isysroot $(xcrun --sdk $sdk --show-sdk-path) -mmacosx-version-min=$OSX_OSVER -fdata-sections -ffunction-sections -Ofast"
export OSX_CC=$(xcrun --sdk macosx --find clang)
export OSX_CXX=$(xcrun --sdk macosx --find clang++)
export OSX_FLAGS="-isysroot $(xcrun --sdk macosx --show-sdk-path) -mmacosx-version-min=$OSX_OSVER -fdata-sections -ffunction-sections -Ofast"

View File

@ -82,6 +82,13 @@ SubgameSpec findSubgame(const std::string &id)
find_paths.emplace_back(path, false);
}
#ifdef __APPLE__
std::string path = porting::path_cache + DIR_DELIM + "games" + DIR_DELIM + id;
find_paths.emplace_back(path, false);
path.append("_game");
find_paths.emplace_back(path, false);
#endif
std::string game_base = DIR_DELIM;
game_base = game_base.append("games").append(DIR_DELIM).append(id);
std::string game_suffixed = game_base + "_game";
@ -177,6 +184,9 @@ std::set<std::string> getAvailableGameIds()
std::set<std::string> gamespaths;
gamespaths.insert(porting::path_share + DIR_DELIM + "games");
gamespaths.insert(porting::path_user + DIR_DELIM + "games");
#ifdef __APPLE__
gamespaths.insert(porting::path_cache + DIR_DELIM + "games");
#endif
Strfnd search_paths(getSubgamePathEnv());

View File

@ -742,6 +742,13 @@ bool open_url(const std::string &url)
return open_uri(url);
}
#if defined(__APPLE__)
std::string getSecretKey(const std::string &key)
{
return std::string(get_secret_key(key.c_str()));
}
#endif
bool open_directory(const std::string &path)
{
if (!fs::IsDir(path)) {

View File

@ -126,6 +126,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif
#endif
#if defined(__APPLE__)
#include "wrapper.h"
#endif
namespace porting
{
@ -353,6 +357,11 @@ bool open_url(const std::string &url);
* @param path Path to directory
* @return true on success, false on failure
*/
#if defined(__APPLE__)
std::string getSecretKey(const std::string &key);
#endif
bool open_directory(const std::string &path);
} // namespace porting

View File

@ -509,12 +509,12 @@ int ModApiUtil::l_upgrade(lua_State *L)
int ModApiUtil::l_get_secret_key(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
#if defined(__ANDROID__) || defined(__IOS__)
#if defined(__ANDROID__) || defined(__APPLE__)
const std::string secret_name = luaL_checkstring(L, 1);
const std::string res = porting::getSecretKey(secret_name);
lua_pushlstring(L, res.c_str(), res.size());
#else
// Not implemented on desktop platforms
// Not implemented on other platforms
lua_pushstring(L, "");
#endif