diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-16 17:01:35 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-16 17:01:35 +0100 |
commit | 91a54cdbc195270556b7014d575740400955f8bf (patch) | |
tree | 79a6fa2cc91a7b2e117c5fcaef18b905341c9335 | |
parent | 629796c333bcc46f2aeb4399c1a5786d6b013289 (diff) |
Linux/BSD: Add LINUXBSD_ENABLED define for non X11-related checks
-rw-r--r-- | core/input/input_builders.py | 2 | ||||
-rw-r--r-- | drivers/unix/dir_access_unix.cpp | 4 | ||||
-rw-r--r-- | platform/ios/export/export_plugin.cpp | 6 | ||||
-rw-r--r-- | platform/linuxbsd/detect.py | 11 |
4 files changed, 14 insertions, 9 deletions
diff --git a/core/input/input_builders.py b/core/input/input_builders.py index a7729c9af2..76e199e0ff 100644 --- a/core/input/input_builders.py +++ b/core/input/input_builders.py @@ -45,7 +45,7 @@ def make_default_controller_mappings(target, source, env): platform_mappings[current_platform][guid] = line platform_variables = { - "Linux": "#if X11_ENABLED", + "Linux": "#if LINUXBSD_ENABLED", "Windows": "#ifdef WINDOWS_ENABLED", "Mac OS X": "#ifdef MACOS_ENABLED", "Android": "#if defined(__ANDROID__)", diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index 557060c907..a162f46103 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -189,7 +189,7 @@ void DirAccessUnix::list_dir_end() { _cisdir = false; } -#if defined(HAVE_MNTENT) && defined(X11_ENABLED) +#if defined(HAVE_MNTENT) && defined(LINUXBSD_ENABLED) static bool _filter_drive(struct mntent *mnt) { // Ignore devices that don't point to /dev if (strncmp(mnt->mnt_fsname, "/dev", 4) != 0) { @@ -213,7 +213,7 @@ static void _get_drives(List<String> *list) { // Add root. list->push_back("/"); -#if defined(HAVE_MNTENT) && defined(X11_ENABLED) +#if defined(HAVE_MNTENT) && defined(LINUXBSD_ENABLED) // Check /etc/mtab for the list of mounted partitions. FILE *mtab = setmntent("/etc/mtab", "r"); if (mtab) { diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp index ccd3480d11..87b599bc81 100644 --- a/platform/ios/export/export_plugin.cpp +++ b/platform/ios/export/export_plugin.cpp @@ -1572,7 +1572,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p int ret = unzGoToFirstFile(src_pkg_zip); Vector<uint8_t> project_file_data; while (ret == UNZ_OK) { -#if defined(MACOS_ENABLED) || defined(X11_ENABLED) +#if defined(MACOS_ENABLED) || defined(LINUXBSD_ENABLED) bool is_execute = false; #endif @@ -1605,7 +1605,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p continue; //ignore! } found_library = true; -#if defined(MACOS_ENABLED) || defined(X11_ENABLED) +#if defined(MACOS_ENABLED) || defined(LINUXBSD_ENABLED) is_execute = true; #endif file = file.replace(library_to_use, binary_name + ".xcframework"); @@ -1648,7 +1648,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p f->store_buffer(data.ptr(), data.size()); } -#if defined(MACOS_ENABLED) || defined(X11_ENABLED) +#if defined(MACOS_ENABLED) || defined(LINUXBSD_ENABLED) if (is_execute) { // we need execute rights on this file chmod(file.utf8().get_data(), 0755); diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 747dcbd76c..f4d36f1a87 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -338,12 +338,17 @@ def configure(env: "Environment"): env.Prepend(CPPPATH=["#platform/linuxbsd"]) + env.Append( + CPPDEFINES=[ + "LINUXBSD_ENABLED", + "UNIX_ENABLED", + ("_FILE_OFFSET_BITS", 64), + ] + ) + if env["x11"]: env.Append(CPPDEFINES=["X11_ENABLED"]) - env.Append(CPPDEFINES=["UNIX_ENABLED"]) - env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)]) - if env["vulkan"]: env.Append(CPPDEFINES=["VULKAN_ENABLED"]) if not env["use_volk"]: |