diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/detect.py | 19 | ||||
-rw-r--r-- | platform/haiku/detect.py | 3 | ||||
-rw-r--r-- | platform/iphone/detect.py | 26 | ||||
-rw-r--r-- | platform/iphone/export/export.cpp | 361 | ||||
-rw-r--r-- | platform/javascript/SCsub | 2 | ||||
-rw-r--r-- | platform/javascript/detect.py | 16 | ||||
-rw-r--r-- | platform/osx/detect.py | 5 | ||||
-rw-r--r-- | platform/server/detect.py | 48 | ||||
-rw-r--r-- | platform/uwp/detect.py | 4 | ||||
-rw-r--r-- | platform/windows/SCsub | 2 | ||||
-rw-r--r-- | platform/windows/detect.py | 7 | ||||
-rw-r--r-- | platform/x11/detect.py | 87 |
12 files changed, 451 insertions, 129 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py index c1ac54c587..13fc4ee810 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -18,20 +18,21 @@ def can_build(): def get_opts(): + from SCons.Variables import BoolVariable, EnumVariable return [ ('ANDROID_NDK_ROOT', 'Path to the Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)), ('ndk_platform', 'Target platform (android-<api>, e.g. "android-18")', "android-18"), - ('android_arch', 'Target architecture (armv7/armv6/arm64v8/x86)', "armv7"), - ('android_neon', 'Enable NEON support (armv7 only)', "yes"), - ('android_stl', 'Enable Android STL support (for modules)', "no") + EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'armv6', 'arm64v8', 'x86')), + BoolVariable('android_neon', 'Enable NEON support (armv7 only)', True), + BoolVariable('android_stl', 'Enable Android STL support (for modules)', False), ] def get_flags(): return [ - ('tools', 'no'), + ('tools', False), ] @@ -93,7 +94,7 @@ def configure(env): env['android_arch'] = 'armv7' neon_text = "" - if env["android_arch"] == "armv7" and env['android_neon'] == 'yes': + if env["android_arch"] == "armv7" and env['android_neon']: neon_text = " (with NEON)" print("Building for Android (" + env['android_arch'] + ")" + neon_text) @@ -117,7 +118,7 @@ def configure(env): target_subpath = "arm-linux-androideabi-4.9" abi_subpath = "arm-linux-androideabi" arch_subpath = "armeabi-v7a" - if env['android_neon'] == 'yes': + if env['android_neon']: env.extra_suffix = ".armv7.neon" + env.extra_suffix else: env.extra_suffix = ".armv7" + env.extra_suffix @@ -199,7 +200,7 @@ def configure(env): elif env["android_arch"] == "armv7": target_opts = ['-target', 'armv7-none-linux-androideabi'] env.Append(CPPFLAGS='-D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfloat-abi=softfp'.split()) - if env['android_neon'] == 'yes': + if env['android_neon']: env['neon_enabled'] = True env.Append(CPPFLAGS=['-mfpu=neon', '-D__ARM_NEON__']) else: @@ -213,7 +214,7 @@ def configure(env): env.Append(CPPFLAGS=target_opts) env.Append(CPPFLAGS=common_opts) - if (env['android_stl'] == 'yes'): + if env['android_stl']: env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/" + arch_subpath + "/include"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/" + arch_subpath]) @@ -243,7 +244,7 @@ def configure(env): env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'android', 'log', 'z', 'dl']) # TODO: Move that to opus module's config - if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): + if 'module_opus_enabled' in env and env['module_opus_enabled']: if (env["android_arch"] == "armv6" or env["android_arch"] == "armv7"): env.Append(CFLAGS=["-DOPUS_ARM_OPT"]) env.opus_fixed_point = "yes" diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py index 61ee32d2dd..50f9783dd2 100644 --- a/platform/haiku/detect.py +++ b/platform/haiku/detect.py @@ -19,9 +19,10 @@ def can_build(): def get_opts(): + from SCons.Variables import EnumVariable return [ - ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes') + EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')), ] diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 0b81422fa3..dd4db0b1cd 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -20,24 +20,24 @@ def can_build(): def get_opts(): - + from SCons.Variables import BoolVariable return [ ('IPHONEPLATFORM', 'Name of the iPhone platform', 'iPhoneOS'), ('IPHONEPATH', 'Path to iPhone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'), ('IPHONESDK', 'Path to the iPhone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/${IPHONEPLATFORM}.platform/Developer/SDKs/${IPHONEPLATFORM}.sdk/'), - ('game_center', 'Support for game center', 'yes'), - ('store_kit', 'Support for in-app store', 'yes'), - ('icloud', 'Support for iCloud', 'yes'), - ('ios_exceptions', 'Enable exceptions', 'no'), + BoolVariable('game_center', 'Support for game center', True), + BoolVariable('store_kit', 'Support for in-app store', True), + BoolVariable('icloud', 'Support for iCloud', True), + BoolVariable('ios_exceptions', 'Enable exceptions', False), ('ios_triple', 'Triple for ios toolchain', ''), - ('ios_sim', 'Build simulator binary', 'no'), + BoolVariable('ios_sim', 'Build simulator binary', False), ] def get_flags(): return [ - ('tools', 'no'), + ('tools', False), ] @@ -58,7 +58,7 @@ def configure(env): ## Architecture - if (env["ios_sim"] == "yes" or env["arch"] == "x86"): # i386, simulator + if env["ios_sim"] or env["arch"] == "x86": # i386, simulator env["arch"] = "x86" env["bits"] = "32" elif (env["arch"] == "arm" or env["arch"] == "arm32" or env["arch"] == "armv7" or env["bits"] == "32"): # arm @@ -91,7 +91,7 @@ def configure(env): env.Append(CPPFLAGS=['-DNEED_LONG_INT']) env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON']) - if env['ios_exceptions'] == 'yes': + if env['ios_exceptions']: env.Append(CPPFLAGS=['-fexceptions']) else: env.Append(CPPFLAGS=['-fno-exceptions']) @@ -129,15 +129,15 @@ def configure(env): ]) # Feature options - if env['game_center'] == 'yes': + if env['game_center']: env.Append(CPPFLAGS=['-DGAME_CENTER_ENABLED']) env.Append(LINKFLAGS=['-framework', 'GameKit']) - if env['store_kit'] == 'yes': + if env['store_kit']: env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED']) env.Append(LINKFLAGS=['-framework', 'StoreKit']) - if env['icloud'] == 'yes': + if env['icloud']: env.Append(CPPFLAGS=['-DICLOUD_ENABLED']) env.Append(CPPPATH=['$IPHONESDK/usr/include', @@ -151,7 +151,7 @@ def configure(env): env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT']) # TODO: Move that to opus module's config - if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): + if 'module_opus_enabled' in env and env['module_opus_enabled']: env.opus_fixed_point = "yes" if (env["arch"] == "arm"): env.Append(CFLAGS=["-DOPUS_ARM_OPT"]) diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 8bb7f23ead..c91781ce1d 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -52,7 +52,14 @@ class EditorExportPlatformIOS : public EditorExportPlatform { Ref<ImageTexture> logo; - void _fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const String &p_name, const String &p_binary); + typedef Error (*FileHandler)(String p_file, void *p_userdata); + static Error _walk_dir_recursive(DirAccess *p_da, FileHandler p_handler, void *p_userdata); + static Error _codesign(String p_file, void *p_userdata); + + void _fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const String &p_name, const String &p_binary, bool p_debug); + static Error _export_dylibs(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total); + Error _export_loading_screens(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir); + Error _export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir); protected: virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features); @@ -63,7 +70,7 @@ public: virtual String get_os_name() const { return "iOS"; } virtual Ref<Texture> get_logo() const { return logo; } - virtual String get_binary_extension() const { return "xcodeproj"; } + virtual String get_binary_extension() const { return "ipa"; } virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0); virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const; @@ -96,16 +103,44 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/app_store_team_id"), "")); + + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/provisioning_profile_uuid_debug"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/code_sign_identity_debug"), "iPhone Developer")); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/export_method_debug", PROPERTY_HINT_ENUM, "App Store,Development,Ad-Hoc,Enterprise"), 1)); + + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/provisioning_profile_uuid_release"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/code_sign_identity_release"), "iPhone Distribution")); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/export_method_release", PROPERTY_HINT_ENUM, "App Store,Development,Ad-Hoc,Enterprise"), 0)); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine")); - // r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "png"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/identifier"), "org.godotengine.iosgame")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "godotiosgame")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "????")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/bits_mode", PROPERTY_HINT_ENUM, "Fat (32 & 64 bits),64 bits,32 bits"), 1)); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/iphone_120x120", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPhone/iPod Touch with retina display + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/ipad_76x76", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad + + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/iphone_180x180", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPhone with retina HD display + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_152x152", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad with retina display + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_167x167", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad Pro + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_40x40", PROPERTY_HINT_FILE, "png"), "")); // Spotlight + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_80x80", PROPERTY_HINT_FILE, "png"), "")); // Spotlight on devices with retina display + + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/iphone_2208x1242", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6 Plus, 6s Plus, 7 Plus + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/ipad_2732x2048", PROPERTY_HINT_FILE, "png"), "")); // 12.9-inch iPad Pro + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/ipad_2048x1536", PROPERTY_HINT_FILE, "png"), "")); // Other iPads + + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_640x1136", PROPERTY_HINT_FILE, "png"), "")); // iPhone 5, 5s, SE + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_750x1334", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6, 6s, 7 + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_1242x2208", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6 Plus, 6s Plus, 7 Plus + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/ipad_2048x2732", PROPERTY_HINT_FILE, "png"), "")); // 12.9-inch iPad Pro + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/ipad_1536x2048", PROPERTY_HINT_FILE, "png"), "")); // Other iPads + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), true)); @@ -113,11 +148,17 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) /* probably need some more info */ } -void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const String &p_name, const String &p_binary) { - +void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const String &p_name, const String &p_binary, bool p_debug) { + static const String export_method_string[] = { + "app-store", + "development", + "ad-hoc", + "enterprise" + }; String str; String strnew; str.parse_utf8((const char *)pfile.ptr(), pfile.size()); + print_line(str); Vector<String> lines = str.split("\n"); for (int i = 0; i < lines.size(); i++) { if (lines[i].find("$binary") != -1) { @@ -136,6 +177,19 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_ strnew += lines[i].replace("$signature", p_preset->get("application/signature")) + "\n"; } else if (lines[i].find("$copyright") != -1) { strnew += lines[i].replace("$copyright", p_preset->get("application/copyright")) + "\n"; + } else if (lines[i].find("$team_id") != -1) { + strnew += lines[i].replace("$team_id", p_preset->get("application/app_store_team_id")) + "\n"; + } else if (lines[i].find("$export_method") != -1) { + int export_method = p_preset->get(p_debug ? "application/export_method_debug" : "application/export_method_release"); + strnew += lines[i].replace("$export_method", export_method_string[export_method]) + "\n"; + } else if (lines[i].find("$provisioning_profile_uuid_release") != -1) { + strnew += lines[i].replace("$provisioning_profile_uuid_release", p_preset->get("application/provisioning_profile_uuid_release")) + "\n"; + } else if (lines[i].find("$provisioning_profile_uuid_debug") != -1) { + strnew += lines[i].replace("$provisioning_profile_uuid_debug", p_preset->get("application/provisioning_profile_uuid_debug")) + "\n"; + } else if (lines[i].find("$code_sign_identity_debug") != -1) { + strnew += lines[i].replace("$code_sign_identity_debug", p_preset->get("application/code_sign_identity_debug")) + "\n"; + } else if (lines[i].find("$code_sign_identity_release") != -1) { + strnew += lines[i].replace("$code_sign_identity_release", p_preset->get("application/code_sign_identity_release")) + "\n"; } else { strnew += lines[i] + "\n"; } @@ -150,12 +204,214 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_ } } +Error EditorExportPlatformIOS::_export_dylibs(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) { + if (!p_path.ends_with(".dylib")) return OK; + const String &dest_dir = *(String *)p_userdata; + String rel_path = p_path.replace_first("res://", "dylibs/"); + DirAccess *dest_dir_access = DirAccess::open(dest_dir); + ERR_FAIL_COND_V(!dest_dir_access, ERR_CANT_OPEN); + + String base_dir = rel_path.get_base_dir(); + Error make_dir_err = OK; + if (!dest_dir_access->dir_exists(base_dir)) { + make_dir_err = dest_dir_access->make_dir_recursive(base_dir); + } + if (make_dir_err != OK) { + memdelete(dest_dir_access); + return make_dir_err; + } + + Error copy_err = dest_dir_access->copy(p_path, dest_dir + rel_path); + memdelete(dest_dir_access); + + return copy_err; +} + +struct IconInfo { + const char *preset_key; + const char *idiom; + const char *export_name; + const char *actual_size_side; + const char *scale; + const char *unscaled_size; + bool is_required; +}; + +static const IconInfo icon_infos[] = { + { "required_icons/iphone_120x120", "iphone", "Icon-120.png", "120", "2x", "60x60", true }, + { "required_icons/iphone_120x120", "iphone", "Icon-120.png", "120", "3x", "40x40", true }, + + { "required_icons/ipad_76x76", "ipad", "Icon-76.png", "76", "1x", "76x76", false }, + + { "optional_icons/iphone_180x180", "iphone", "Icon-180.png", "180", "3x", "60x60", false }, + + { "optional_icons/ipad_152x152", "ipad", "Icon-152.png", "152", "2x", "76x76", false }, + + { "optional_icons/ipad_167x167", "ipad", "Icon-167.png", "167", "2x", "83.5x83.5", false }, + + { "optional_icons/spotlight_40x40", "ipad", "Icon-40.png", "40", "1x", "40x40", false }, + + { "optional_icons/spotlight_80x80", "iphone", "Icon-80.png", "80", "2x", "40x40", false }, + { "optional_icons/spotlight_80x80", "ipad", "Icon-80.png", "80", "2x", "40x40", false } + +}; + +Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir) { + String json_description = "{\"images\":["; + String sizes; + + DirAccess *da = DirAccess::open(p_iconset_dir); + ERR_FAIL_COND_V(!da, ERR_CANT_OPEN); + + for (int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) { + IconInfo info = icon_infos[i]; + String icon_path = p_preset->get(info.preset_key); + if (icon_path.length() == 0) { + if (info.is_required) { + ERR_PRINT("Required icon is not specified in the preset"); + return ERR_UNCONFIGURED; + } + continue; + } + Error err = da->copy(icon_path, p_iconset_dir + info.export_name); + if (err) { + memdelete(da); + String err_str = String("Failed to export icon: ") + icon_path; + ERR_PRINT(err_str.utf8().get_data()); + return err; + } + sizes += String(info.actual_size_side) + "\n"; + if (i > 0) { + json_description += ","; + } + json_description += String("{"); + json_description += String("\"idiom\":") + "\"" + info.idiom + "\","; + json_description += String("\"size\":") + "\"" + info.unscaled_size + "\","; + json_description += String("\"scale\":") + "\"" + info.scale + "\","; + json_description += String("\"filename\":") + "\"" + info.export_name + "\""; + json_description += String("}"); + } + json_description += "]}"; + memdelete(da); + + FileAccess *json_file = FileAccess::open(p_iconset_dir + "Contents.json", FileAccess::WRITE); + ERR_FAIL_COND_V(!json_file, ERR_CANT_CREATE); + CharString json_utf8 = json_description.utf8(); + json_file->store_buffer((const uint8_t *)json_utf8.get_data(), json_utf8.length()); + memdelete(json_file); + + FileAccess *sizes_file = FileAccess::open(p_iconset_dir + "sizes", FileAccess::WRITE); + ERR_FAIL_COND_V(!sizes_file, ERR_CANT_CREATE); + CharString sizes_utf8 = sizes.utf8(); + sizes_file->store_buffer((const uint8_t *)sizes_utf8.get_data(), sizes_utf8.length()); + memdelete(sizes_file); + + return OK; +} + +struct LoadingScreenInfo { + const char *preset_key; + const char *export_name; +}; + +static const LoadingScreenInfo loading_screen_infos[] = { + { "landscape_launch_screens/iphone_2208x1242", "Default-Landscape-736h@3x.png" }, + { "landscape_launch_screens/ipad_2732x2048", "Default-Landscape-1366h@2x.png" }, + { "landscape_launch_screens/ipad_2048x1536", "Default-Landscape@2x.png" }, + + { "portrait_launch_screens/iphone_640x1136", "Default-568h@2x.png" }, + { "portrait_launch_screens/iphone_750x1334", "Default-667h@2x.png" }, + { "portrait_launch_screens/iphone_1242x2208", "Default-Portrait-736h@3x.png" }, + { "portrait_launch_screens/ipad_2048x2732", "Default-Portrait-1366h@2x.png" }, + { "portrait_launch_screens/ipad_1536x2048", "Default-Portrait@2x.png" } +}; + +Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) { + DirAccess *da = DirAccess::open(p_dest_dir); + ERR_FAIL_COND_V(!da, ERR_CANT_OPEN); + + for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) { + LoadingScreenInfo info = loading_screen_infos[i]; + String loading_screen_file = p_preset->get(info.preset_key); + Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name); + if (err) { + memdelete(da); + String err_str = String("Failed to export loading screen: ") + loading_screen_file; + ERR_PRINT(err_str.utf8().get_data()); + return err; + } + } + memdelete(da); + + return OK; +} + +Error EditorExportPlatformIOS::_walk_dir_recursive(DirAccess *p_da, FileHandler p_handler, void *p_userdata) { + Vector<String> dirs; + String path; + String current_dir = p_da->get_current_dir(); + p_da->list_dir_begin(); + while ((path = p_da->get_next()).length() != 0) { + if (p_da->current_is_dir()) { + if (path != "." && path != "..") { + dirs.push_back(path); + } + } else { + Error err = p_handler(current_dir + "/" + path, p_userdata); + if (err) { + p_da->list_dir_end(); + return err; + } + } + } + p_da->list_dir_end(); + + for (int i = 0; i < dirs.size(); ++i) { + String dir = dirs[i]; + p_da->change_dir(dir); + Error err = _walk_dir_recursive(p_da, p_handler, p_userdata); + p_da->change_dir(".."); + if (err) { + return err; + } + } + + return OK; +} + +struct CodesignData { + const Ref<EditorExportPreset> &preset; + bool debug; + + CodesignData(const Ref<EditorExportPreset> &p_preset, bool p_debug) + : preset(p_preset), debug(p_debug) { + } +}; + +Error EditorExportPlatformIOS::_codesign(String p_file, void *p_userdata) { + if (p_file.ends_with(".dylib")) { + CodesignData *data = (CodesignData *)p_userdata; + print_line(String("Signing ") + p_file); + List<String> codesign_args; + codesign_args.push_back("-f"); + codesign_args.push_back("-s"); + codesign_args.push_back(data->preset->get(data->debug ? "application/code_sign_identity_debug" : "application/code_sign_identity_release")); + codesign_args.push_back(p_file); + return OS::get_singleton()->execute("/usr/bin/codesign", codesign_args, true); + } + return OK; +} + Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { String src_pkg_name; String dest_dir = p_path.get_base_dir() + "/"; String binary_name = p_path.get_file().get_basename(); - EditorProgress ep("export", "Exporting for iOS", 3); + EditorProgress ep("export", "Exporting for iOS", 5); + + String team_id = p_preset->get("application/app_store_team_id"); + ERR_EXPLAIN("App Store Team ID not specified - cannot configure the project."); + ERR_FAIL_COND_V(team_id.length() == 0, ERR_CANT_OPEN); if (p_debug) src_pkg_name = p_preset->get("custom_package/debug"); @@ -206,6 +462,15 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p bool found_binary = false; int total_size = 0; + Set<String> files_to_parse; + files_to_parse.insert("godot_ios/godot_ios-Info.plist"); + files_to_parse.insert("godot_ios.xcodeproj/project.pbxproj"); + files_to_parse.insert("export_options.plist"); + files_to_parse.insert("godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata"); + files_to_parse.insert("godot_ios.xcodeproj/xcshareddata/xcschemes/godot_ios.xcscheme"); + + print_line("Unzipping..."); + while (ret == UNZ_OK) { bool is_execute = false; @@ -229,12 +494,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p file = file.replace_first("iphone/", ""); - if (file == "godot_ios.xcodeproj/project.pbxproj") { - print_line("parse pbxproj"); - _fix_config_file(p_preset, data, pkg_name, binary_name); - } else if (file == "godot_ios/godot_ios-Info.plist") { - print_line("parse plist"); - _fix_config_file(p_preset, data, pkg_name, binary_name); + if (files_to_parse.has(file)) { + print_line(String("parse ") + file); + _fix_config_file(p_preset, data, pkg_name, binary_name, p_debug); } else if (file.begins_with("godot.iphone")) { if (file != binary_to_use) { ret = unzGoToNextFile(src_pkg_zip); @@ -264,6 +526,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p if (dir_err) { ERR_PRINTS("Can't create '" + dir_name + "'."); unzClose(src_pkg_zip); + memdelete(tmp_app_path); return ERR_CANT_CREATE; } } @@ -273,6 +536,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p if (!f) { ERR_PRINTS("Can't write '" + file + "'."); unzClose(src_pkg_zip); + memdelete(tmp_app_path); return ERR_CANT_CREATE; }; f->store_buffer(data.ptr(), data.size()); @@ -295,26 +559,79 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p if (!found_binary) { ERR_PRINTS("Requested template binary '" + binary_to_use + "' not found. It might be missing from your template archive."); - unzClose(src_pkg_zip); + memdelete(tmp_app_path); return ERR_FILE_NOT_FOUND; } - ep.step("Making PKG", 1); + String iconset_dir = dest_dir + binary_name + "/Images.xcassets/AppIcon.appiconset/"; + Error err = OK; + if (!tmp_app_path->dir_exists(iconset_dir)) { + Error err = tmp_app_path->make_dir_recursive(iconset_dir); + } + memdelete(tmp_app_path); + if (err) + return err; + + err = _export_icons(p_preset, iconset_dir); + if (err) + return err; + + err = _export_loading_screens(p_preset, dest_dir + binary_name + "/"); + if (err) + return err; + + ep.step("Making .pck", 1); String pack_path = dest_dir + binary_name + ".pck"; - Error err = save_pack(p_preset, pack_path); + err = save_pack(p_preset, pack_path); + if (err) + return err; - if (err) { + err = export_project_files(p_preset, _export_dylibs, &dest_dir); + if (err) return err; - } #ifdef OSX_ENABLED - /* and open up xcode with our new project.... */ - List<String> args; - args.push_back(p_path); - err = OS::get_singleton()->execute("/usr/bin/open", args, false); + ep.step("Making .xcarchive", 2); + String archive_path = p_path.get_basename() + ".xcarchive"; + List<String> archive_args; + archive_args.push_back("-project"); + archive_args.push_back(dest_dir + binary_name + ".xcodeproj"); + archive_args.push_back("-scheme"); + archive_args.push_back(binary_name); + archive_args.push_back("-sdk"); + archive_args.push_back("iphoneos"); + archive_args.push_back("-configuration"); + archive_args.push_back(p_debug ? "Debug" : "Release"); + archive_args.push_back("-destination"); + archive_args.push_back("generic/platform=iOS"); + archive_args.push_back("archive"); + archive_args.push_back("-archivePath"); + archive_args.push_back(archive_path); + err = OS::get_singleton()->execute("/usr/bin/xcodebuild", archive_args, true); ERR_FAIL_COND_V(err, err); + ep.step("Code-signing dylibs", 3); + DirAccess *dylibs_dir = DirAccess::open(archive_path + "/Products/Applications/" + binary_name + ".app/dylibs"); + ERR_FAIL_COND_V(!dylibs_dir, ERR_CANT_OPEN); + CodesignData codesign_data(p_preset, p_debug); + err = _walk_dir_recursive(dylibs_dir, _codesign, &codesign_data); + memdelete(dylibs_dir); + ERR_FAIL_COND_V(err, err); + + ep.step("Making .ipa", 4); + List<String> export_args; + export_args.push_back("-exportArchive"); + export_args.push_back("-archivePath"); + export_args.push_back(archive_path); + export_args.push_back("-exportOptionsPlist"); + export_args.push_back(dest_dir + "export_options.plist"); + export_args.push_back("-exportPath"); + export_args.push_back(dest_dir); + err = OS::get_singleton()->execute("/usr/bin/xcodebuild", export_args, true); + ERR_FAIL_COND_V(err, err); +#else + print_line(".ipa can only be built on macOS. Leaving XCode project without building the package."); #endif return OK; diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index e282041745..f01d9367d2 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -29,7 +29,7 @@ zip_dir = target_dir.Dir('.javascript_zip') zip_files = env.InstallAs(zip_dir.File('godot.html'), '#misc/dist/html/default.html') implicit_targets = [] -if env['wasm'] == 'yes': +if env['wasm']: wasm = target_dir.File(basename + '.wasm') implicit_targets.append(wasm) zip_files.append(InstallAs(zip_dir.File('godot.wasm'), wasm)) diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index bea8f156af..cc29ad8956 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -17,18 +17,18 @@ def can_build(): def get_opts(): - + from SCons.Variables import BoolVariable return [ - ['wasm', 'Compile to WebAssembly', 'no'], - ['javascript_eval', 'Enable JavaScript eval interface', 'yes'], + BoolVariable('wasm', 'Compile to WebAssembly', False), + BoolVariable('javascript_eval', 'Enable JavaScript eval interface', True), ] def get_flags(): return [ - ('tools', 'no'), - ('module_theora_enabled', 'no'), + ('tools', False), + ('module_theora_enabled', False), ] @@ -95,7 +95,7 @@ def configure(env): # These flags help keep the file size down env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti']) - if env['javascript_eval'] == 'yes': + if env['javascript_eval']: env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED']) ## Link flags @@ -103,7 +103,7 @@ def configure(env): env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS="[\'FS\']"']) env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1']) - if (env['wasm'] == 'yes'): + if env['wasm']: env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) # In contrast to asm.js, enabling memory growth on WebAssembly has no # major performance impact, and causes only a negligible increase in @@ -116,5 +116,5 @@ def configure(env): env.Append(LINKFLAGS=['--memory-init-file', '1']) # TODO: Move that to opus module's config - if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): + if 'module_opus_enabled' in env and env['module_opus_enabled']: env.opus_fixed_point = "yes" diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 24302b5ff9..51da000712 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -19,10 +19,11 @@ def can_build(): def get_opts(): + from SCons.Variables import EnumVariable return [ ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'), - ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes'), + EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')), ] @@ -96,7 +97,7 @@ def configure(env): ## Dependencies - if (env['builtin_libtheora'] != 'no'): + if env['builtin_libtheora']: env["x86_libtheora_opt_gcc"] = True ## Flags diff --git a/platform/server/detect.py b/platform/server/detect.py index 5c13297bc6..04b38f280d 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -19,9 +19,9 @@ def can_build(): def get_opts(): - + from SCons.Variables import BoolVariable return [ - ('use_llvm', 'Use the LLVM compiler', 'no'), + BoolVariable('use_llvm', 'Use the LLVM compiler', False), ] @@ -52,7 +52,7 @@ def configure(env): ## Compiler configuration - if (env["use_llvm"] == "yes"): + if env['use_llvm']: if ('clang++' not in env['CXX']): env["CC"] = "clang" env["CXX"] = "clang++" @@ -64,60 +64,60 @@ def configure(env): # FIXME: Check for existence of the libs before parsing their flags with pkg-config - if (env['builtin_openssl'] == 'no'): + if not env['builtin_openssl']: env.ParseConfig('pkg-config openssl --cflags --libs') - if (env['builtin_libwebp'] == 'no'): + if not env['builtin_libwebp']: env.ParseConfig('pkg-config libwebp --cflags --libs') # freetype depends on libpng and zlib, so bundling one of them while keeping others # as shared libraries leads to weird issues - if (env['builtin_freetype'] == 'yes' or env['builtin_libpng'] == 'yes' or env['builtin_zlib'] == 'yes'): - env['builtin_freetype'] = 'yes' - env['builtin_libpng'] = 'yes' - env['builtin_zlib'] = 'yes' + if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']: + env['builtin_freetype'] = True + env['builtin_libpng'] = True + env['builtin_zlib'] = True - if (env['builtin_freetype'] == 'no'): + if not env['builtin_freetype']: env.ParseConfig('pkg-config freetype2 --cflags --libs') - if (env['builtin_libpng'] == 'no'): + if not env['builtin_libpng']: env.ParseConfig('pkg-config libpng --cflags --libs') - if (env['builtin_enet'] == 'no'): + if not env['builtin_enet']: env.ParseConfig('pkg-config libenet --cflags --libs') - if (env['builtin_squish'] == 'no' and env["tools"] == "yes"): + if not env['builtin_squish'] and env['tools']: env.ParseConfig('pkg-config libsquish --cflags --libs') - if env['builtin_zstd'] == 'no': + if not env['builtin_zstd']: env.ParseConfig('pkg-config libzstd --cflags --libs') # Sound and video libraries # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - if (env['builtin_libtheora'] == 'no'): - env['builtin_libogg'] = 'no' # Needed to link against system libtheora - env['builtin_libvorbis'] = 'no' # Needed to link against system libtheora + if not env['builtin_libtheora']: + env['builtin_libogg'] = False # Needed to link against system libtheora + env['builtin_libvorbis'] = False # Needed to link against system libtheora env.ParseConfig('pkg-config theora theoradec --cflags --libs') - if (env['builtin_libvpx'] == 'no'): + if not env['builtin_libvpx']: env.ParseConfig('pkg-config vpx --cflags --libs') - if (env['builtin_libvorbis'] == 'no'): - env['builtin_libogg'] = 'no' # Needed to link against system libvorbis + if not env['builtin_libvorbis']: + env['builtin_libogg'] = False # Needed to link against system libvorbis env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs') - if (env['builtin_opus'] == 'no'): - env['builtin_libogg'] = 'no' # Needed to link against system opus + if not env['builtin_opus']: + env['builtin_libogg'] = False # Needed to link against system opus env.ParseConfig('pkg-config opus opusfile --cflags --libs') - if (env['builtin_libogg'] == 'no'): + if not env['builtin_libogg']: env.ParseConfig('pkg-config ogg --cflags --libs') ## Flags # Linkflags below this line should typically stay the last ones - if (env['builtin_zlib'] == 'no'): + if not env['builtin_zlib']: env.ParseConfig('pkg-config zlib --cflags --libs') env.Append(CPPPATH=['#platform/server']) diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 23929dd804..af53f97446 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -33,8 +33,8 @@ def get_opts(): def get_flags(): return [ - ('tools', 'no'), - ('xaudio2', 'yes'), + ('tools', False), + ('xaudio2', True), ] diff --git a/platform/windows/SCsub b/platform/windows/SCsub index fd041e096e..d3c160f052 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -30,7 +30,7 @@ common_win.append(obj) binary = env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"]) # Microsoft Visual Studio Project Generation -if (env['vsproj']) == "yes": +if env['vsproj']: env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"] for x in common_win: env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)] diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 053ea466f3..92f2e078c8 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -49,6 +49,7 @@ def can_build(): def get_opts(): + from SCons.Variables import BoolVariable, EnumVariable mingw32 = "" mingw64 = "" @@ -64,8 +65,8 @@ def get_opts(): return [ ('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32), ('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64), - ('use_lto', 'Use link time optimization (when using MingW)', 'no'), - ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes') + BoolVariable('use_lto', 'Use link time optimization (when using MingW)', False), + EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')), ] @@ -262,7 +263,7 @@ def configure(env): env['LD'] = mingw_prefix + "g++" env["x86_libtheora_opt_gcc"] = True - if (env["use_lto"] == "yes"): + if env['use_lto']: env.Append(CCFLAGS=['-flto']) env.Append(LINKFLAGS=['-flto']) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index b9b4ad8201..c8d9930af1 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -45,26 +45,27 @@ def can_build(): return True def get_opts(): + from SCons.Variables import BoolVariable, EnumVariable return [ - ('use_llvm', 'Use the LLVM compiler', 'no'), - ('use_static_cpp', 'Link stdc++ statically', 'no'), - ('use_sanitizer', 'Use LLVM compiler address sanitizer', 'no'), - ('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', 'no'), - ('use_lto', 'Use link time optimization', 'no'), - ('pulseaudio', 'Detect & use pulseaudio', 'yes'), - ('udev', 'Use udev for gamepad connection callbacks', 'no'), - ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes') + BoolVariable('use_llvm', 'Use the LLVM compiler', False), + BoolVariable('use_static_cpp', 'Link stdc++ statically', False), + BoolVariable('use_sanitizer', 'Use LLVM compiler address sanitizer', False), + BoolVariable('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', False), + BoolVariable('use_lto', 'Use link time optimization', False), + BoolVariable('pulseaudio', 'Detect & use pulseaudio', True), + BoolVariable('udev', 'Use udev for gamepad connection callbacks', False), + EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')), ] def get_flags(): return [ - ('builtin_freetype', 'no'), - ('builtin_libpng', 'no'), - ('builtin_openssl', 'no'), - ('builtin_zlib', 'no'), + ('builtin_freetype', False), + ('builtin_libpng', False), + ('builtin_openssl', False), + ('builtin_zlib', False), ] @@ -100,7 +101,7 @@ def configure(env): ## Compiler configuration - if (env["use_llvm"] == "yes"): + if env['use_llvm']: if ('clang++' not in env['CXX']): env["CC"] = "clang" env["CXX"] = "clang++" @@ -109,18 +110,18 @@ def configure(env): env.extra_suffix = ".llvm" + env.extra_suffix # leak sanitizer requires (address) sanitizer - if (env["use_sanitizer"] == "yes" or env["use_leak_sanitizer"] == "yes"): + if env['use_sanitizer'] or env['use_leak_sanitizer']: env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer']) env.Append(LINKFLAGS=['-fsanitize=address']) env.extra_suffix += "s" - if (env["use_leak_sanitizer"] == "yes"): + if env['use_leak_sanitizer']: env.Append(CCFLAGS=['-fsanitize=leak']) env.Append(LINKFLAGS=['-fsanitize=leak']) - if (env["use_lto"] == "yes"): + if env['use_lto']: env.Append(CCFLAGS=['-flto']) env.Append(LINKFLAGS=['-flto']) - if (env["use_llvm"] == "no"): + if not env['use_llvm']: env['RANLIB'] = 'gcc-ranlib' env['AR'] = 'gcc-ar' @@ -136,64 +137,64 @@ def configure(env): # FIXME: Check for existence of the libs before parsing their flags with pkg-config - if (env['builtin_openssl'] == 'no'): + if not env['builtin_openssl']: env.ParseConfig('pkg-config openssl --cflags --libs') - if (env['builtin_libwebp'] == 'no'): + if not env['builtin_libwebp']: env.ParseConfig('pkg-config libwebp --cflags --libs') # freetype depends on libpng and zlib, so bundling one of them while keeping others # as shared libraries leads to weird issues - if (env['builtin_freetype'] == 'yes' or env['builtin_libpng'] == 'yes' or env['builtin_zlib'] == 'yes'): - env['builtin_freetype'] = 'yes' - env['builtin_libpng'] = 'yes' - env['builtin_zlib'] = 'yes' + if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']: + env['builtin_freetype'] = True + env['builtin_libpng'] = True + env['builtin_zlib'] = True - if (env['builtin_freetype'] == 'no'): + if not env['builtin_freetype']: env.ParseConfig('pkg-config freetype2 --cflags --libs') - if (env['builtin_libpng'] == 'no'): + if not env['builtin_libpng']: env.ParseConfig('pkg-config libpng --cflags --libs') - if (env['builtin_enet'] == 'no'): + if not env['builtin_enet']: env.ParseConfig('pkg-config libenet --cflags --libs') - if (env['builtin_squish'] == 'no' and env["tools"] == "yes"): + if not env['builtin_squish'] and env['tools']: env.ParseConfig('pkg-config libsquish --cflags --libs') - if env['builtin_zstd'] == 'no': + if not env['builtin_zstd']: env.ParseConfig('pkg-config libzstd --cflags --libs') # Sound and video libraries # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - if (env['builtin_libtheora'] == 'no'): - env['builtin_libogg'] = 'no' # Needed to link against system libtheora - env['builtin_libvorbis'] = 'no' # Needed to link against system libtheora + if not env['builtin_libtheora']: + env['builtin_libogg'] = False # Needed to link against system libtheora + env['builtin_libvorbis'] = False # Needed to link against system libtheora env.ParseConfig('pkg-config theora theoradec --cflags --libs') - if (env['builtin_libvpx'] == 'no'): + if not env['builtin_libvpx']: env.ParseConfig('pkg-config vpx --cflags --libs') - if (env['builtin_libvorbis'] == 'no'): - env['builtin_libogg'] = 'no' # Needed to link against system libvorbis + if not env['builtin_libvorbis']: + env['builtin_libogg'] = False # Needed to link against system libvorbis env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs') - if (env['builtin_opus'] == 'no'): - env['builtin_libogg'] = 'no' # Needed to link against system opus + if not env['builtin_opus']: + env['builtin_libogg'] = False # Needed to link against system opus env.ParseConfig('pkg-config opus opusfile --cflags --libs') - if (env['builtin_libogg'] == 'no'): + if not env['builtin_libogg']: env.ParseConfig('pkg-config ogg --cflags --libs') - if (env['builtin_libtheora'] != 'no'): + if env['builtin_libtheora']: list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] if any(platform.machine() in s for s in list_of_x86): env["x86_libtheora_opt_gcc"] = True # On Linux wchar_t should be 32-bits # 16-bit library shouldn't be required due to compiler optimisations - if (env['builtin_pcre2'] == 'no'): + if not env['builtin_pcre2']: env.ParseConfig('pkg-config libpcre2-32 --cflags --libs') ## Flags @@ -205,7 +206,7 @@ def configure(env): else: print("ALSA libraries not found, disabling driver") - if (env["pulseaudio"] == "yes"): + if env['pulseaudio']: if (os.system("pkg-config --exists libpulse-simple") == 0): # 0 means found print("Enabling PulseAudio") env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"]) @@ -216,7 +217,7 @@ def configure(env): if (platform.system() == "Linux"): env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"]) - if (env["udev"] == "yes"): + if env['udev']: if (os.system("pkg-config --exists libudev") == 0): # 0 means found print("Enabling udev support") env.Append(CPPFLAGS=["-DUDEV_ENABLED"]) @@ -225,7 +226,7 @@ def configure(env): print("libudev development libraries not found, disabling udev support") # Linkflags below this line should typically stay the last ones - if (env['builtin_zlib'] == 'no'): + if not env['builtin_zlib']: env.ParseConfig('pkg-config zlib --cflags --libs') env.Append(CPPPATH=['#platform/x11']) @@ -244,5 +245,5 @@ def configure(env): env.Append(CPPFLAGS=['-m64']) env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu']) - if (env["use_static_cpp"] == "yes"): + if env['use_static_cpp']: env.Append(LINKFLAGS=['-static-libstdc++']) |