target_compile_options(loader_common_options INTERFACE /WX)
endif()
target_compile_options(loader_common_options INTERFACE /W4)
-elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# using GCC or Clang with the regular front end
if (ENABLE_WERROR)
target_compile_options(loader_common_options INTERFACE -Werror)
target_compile_options(loader_common_options INTERFACE -Wall -Wextra)
endif()
-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(loader_common_options INTERFACE -Wno-missing-field-initializers)
# need to prepend /clang: to compiler arguments when using clang-cl
# Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it.
target_compile_options(asm_offset PRIVATE -save-temps=obj)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set(ASM_OFFSET_EXECUTABLE_LOCATION "$<TARGET_FILE_DIR:asm_offset>/gen_defines.asm")
set(ASM_OFFSET_INTERMEDIATE_LOCATION "$<TARGET_FILE_DIR:asm_offset>/CMakeFiles/asm_offset.dir/asm_offset.c.s")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ set(ASM_OFFSET_EXECUTABLE_LOCATION "$<TARGET_FILE_DIR:asm_offset>/gen_defines.asm")
set(ASM_OFFSET_INTERMEDIATE_LOCATION "$<TARGET_FILE_DIR:asm_offset>/CMakeFiles/asm_offset.dir/asm_offset.s")
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ # Need to use the current binary dir since the asm_offset.s file is in that folder rather than the bundle
+ set(ASM_OFFSET_EXECUTABLE_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/gen_defines.asm")
+ set(ASM_OFFSET_INTERMEDIATE_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/asm_offset.dir/asm_offset.s")
+ else()
+ message(FATAL_ERROR "CXX_COMPILER_ID not supported!")
endif()
find_package(Python3 REQUIRED QUIET)
# Run parse_asm_values.py on asm_offset's assembly file to generate the gen_defines.asm, which the asm code depends on
add_custom_command(TARGET asm_offset POST_BUILD
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/parse_asm_values.py "$<TARGET_FILE_DIR:asm_offset>/gen_defines.asm"
+ COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/parse_asm_values.py "${ASM_OFFSET_EXECUTABLE_LOCATION}"
"${ASM_OFFSET_INTERMEDIATE_LOCATION}" "GAS" "${CMAKE_CXX_COMPILER_ID}" "${ASM_OFFSET_SYSTEM_PROCESSOR}"
BYPRODUCTS gen_defines.asm
)
# Only used with GAS - MASM doesn't need this, as it has its own way to determine x86 vs x64
arch = sys.argv[5]
+POSIX_COMPILERS = ["GNU", "Clang", "AppleClang"]
+
if destination_file is None or source_asm_file is None or assembler_type is None or compiler is None or arch is None:
print("Required command line arguments were not provided")
sys.exit(1)
if d == "VULKAN_LOADER_ERROR_BIT":
continue # skip due to special case
match = re.search(d + " DD [ ]*([0-9a-f]+)H", asm_intermediate_file)
- elif compiler == "Clang" or compiler == "GNU":
+ elif compiler in POSIX_COMPILERS:
match = re.search(d + " = ([0-9]+)", asm_intermediate_file)
if match:
if compiler == "MSVC":
value = str(int(match.group(1), 16))
- elif compiler == "Clang" or compiler == "GNU":
+ elif compiler in POSIX_COMPILERS:
value = match.group(1)
if assembler_type == "MASM":
# MASM uses hex values, decode them here
#endif // VK_USE_PLATFORM_DIRECTFB_EXT
#if defined(VK_USE_PLATFORM_MACOS_MVK)
-VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo,
- const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
+VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateMacOSSurfaceMVK([[maybe_unused]] VkInstance instance,
+ [[maybe_unused]] const VkMacOSSurfaceCreateInfoMVK* pCreateInfo,
+ [[maybe_unused]] const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface) {
common_nondispatch_handle_creation(icd.surface_handles, pSurface);
return VK_SUCCESS;
}
#endif // VK_USE_PLATFORM_MACOS_MVK
#if defined(VK_USE_PLATFORM_IOS_MVK)
-VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo,
- const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
+VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateIOSSurfaceMVK([[maybe_unused]] VkInstance instance,
+ [[maybe_unused]] const VkIOSSurfaceCreateInfoMVK* pCreateInfo,
+ [[maybe_unused]] const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface) {
common_nondispatch_handle_creation(icd.surface_handles, pSurface);
return VK_SUCCESS;
}
#endif // VK_USE_PLATFORM_GGP
#if defined(VK_USE_PLATFORM_METAL_EXT)
-VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateMetalSurfaceEXT(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo,
- const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
+VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateMetalSurfaceEXT([[maybe_unused]] VkInstance instance,
+ [[maybe_unused]] const VkMetalSurfaceCreateInfoEXT* pCreateInfo,
+ [[maybe_unused]] const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface) {
common_nondispatch_handle_creation(icd.surface_handles, pSurface);
return VK_SUCCESS;
}
#define DLOPEN_FUNC_NAME my_dlopen
#define GETEUID_FUNC_NAME my_geteuid
#define GETEGID_FUNC_NAME my_getegid
+#if !defined(TARGET_OS_IPHONE)
#if defined(HAVE_SECURE_GETENV)
#define SECURE_GETENV_FUNC_NAME my_secure_getenv
#endif
#define __SECURE_GETENV_FUNC_NAME my__secure_getenv
#endif
#endif
+#endif
using PFN_OPENDIR = DIR* (*)(const char* path_name);
using PFN_READDIR = struct dirent* (*)(DIR* dir_stream);
#define real_geteuid geteuid
#define real_getegid getegid
#if defined(HAVE_SECURE_GETENV)
-#define real_secure_getenv _secure_getenv
+#define real_secure_getenv secure_getenv
#endif
#if defined(HAVE___SECURE_GETENV)
#define real__secure_getenv __secure_getenv
}
}
+#if !defined(TARGET_OS_IPHONE)
#if defined(HAVE_SECURE_GETENV)
FRAMEWORK_EXPORT char* SECURE_GETENV_FUNC_NAME(const char* name) {
#if !defined(__APPLE__)
}
}
#endif
-
+#endif
#if defined(__APPLE__)
FRAMEWORK_EXPORT CFBundleRef my_CFBundleGetMainBundle() {
static CFBundleRef global_bundle{};
return reinterpret_cast<CFBundleRef>(&global_bundle);
}
-FRAMEWORK_EXPORT CFURLRef my_CFBundleCopyResourcesDirectoryURL(CFBundleRef bundle) {
+FRAMEWORK_EXPORT CFURLRef my_CFBundleCopyResourcesDirectoryURL([[maybe_unused]] CFBundleRef bundle) {
static CFURLRef global_url{};
return reinterpret_cast<CFURLRef>(&global_url);
}
-FRAMEWORK_EXPORT Boolean my_CFURLGetFileSystemRepresentation(CFURLRef url, Boolean resolveAgainstBase, UInt8* buffer,
+FRAMEWORK_EXPORT Boolean my_CFURLGetFileSystemRepresentation([[maybe_unused]] CFURLRef url,
+ [[maybe_unused]] Boolean resolveAgainstBase, UInt8* buffer,
CFIndex maxBufLen) {
if (!platform_shim.bundle_contents.empty()) {
- size_t copy_len = platform_shim.bundle_contents.size();
+ CFIndex copy_len = (CFIndex)platform_shim.bundle_contents.size();
if (copy_len > maxBufLen) {
copy_len = maxBufLen;
}
__attribute__((used)) static Interposer _interpose_dlopen MACOS_ATTRIB = {VOIDP_CAST(my_dlopen), VOIDP_CAST(dlopen)};
__attribute__((used)) static Interposer _interpose_euid MACOS_ATTRIB = {VOIDP_CAST(my_geteuid), VOIDP_CAST(geteuid)};
__attribute__((used)) static Interposer _interpose_egid MACOS_ATTRIB = {VOIDP_CAST(my_getegid), VOIDP_CAST(getegid)};
+#if !defined(TARGET_OS_IPHONE)
#if defined(HAVE_SECURE_GETENV)
__attribute__((used)) static Interposer _interpose_secure_getenv MACOS_ATTRIB = {VOIDP_CAST(my_secure_getenv),
VOIDP_CAST(secure_getenv)};
__attribute__((used)) static Interposer _interpose__secure_getenv MACOS_ATTRIB = {VOIDP_CAST(my__secure_getenv),
VOIDP_CAST(__secure_getenv)};
#endif
+#endif
__attribute__((used)) static Interposer _interpose_CFBundleGetMainBundle MACOS_ATTRIB = {VOIDP_CAST(my_CFBundleGetMainBundle),
VOIDP_CAST(CFBundleGetMainBundle)};
__attribute__((used)) static Interposer _interpose_CFBundleCopyResourcesDirectoryURL MACOS_ATTRIB = {