From 900d311bba6d6d9029f5f3880ba4ede86d91e74b Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 22 Nov 2023 06:45:41 +0000 Subject: [PATCH] Added fixes which caused issues building on Apple Silicon (#170) * Fixes issues which occur when building on Apple Silicon Stopped Cuda library been loaded when on Apple and sets CMAKE_SHARED_LIBRARY_SUFFIX without hardcoding --- cmake/CppInterOp/CppInterOpConfig.cmake.in | 3 +++ lib/Interpreter/Compatibility.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/cmake/CppInterOp/CppInterOpConfig.cmake.in b/cmake/CppInterOp/CppInterOpConfig.cmake.in index 51f59ef0f..d6565a0a6 100644 --- a/cmake/CppInterOp/CppInterOpConfig.cmake.in +++ b/cmake/CppInterOp/CppInterOpConfig.cmake.in @@ -6,6 +6,9 @@ get_filename_component(CPPINTEROP_INSTALL_PREFIX "${CPPINTEROP_INSTALL_PREFIX}" get_filename_component(CPPINTEROP_INSTALL_PREFIX "${CPPINTEROP_INSTALL_PREFIX}" PATH) get_filename_component(CPPINTEROP_INSTALL_PREFIX "${CPPINTEROP_INSTALL_PREFIX}" PATH) +# Determine CMAKE_SHARED_LIBRARY_SUFFIX based on operating system +include(CMakeSystemSpecificInformation) + ### build/install workaround if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/include") diff --git a/lib/Interpreter/Compatibility.h b/lib/Interpreter/Compatibility.h index 5f7229655..b84579c47 100644 --- a/lib/Interpreter/Compatibility.h +++ b/lib/Interpreter/Compatibility.h @@ -96,7 +96,11 @@ createClangInterpreter(std::vector& args) { }; auto it = std::find_if(args.begin(), args.end(), has_arg); std::vector gpu_args = {it, args.end()}; +#ifdef __APPLE__ + bool CudaEnabled = false; +#else bool CudaEnabled = !gpu_args.empty(); +#endif clang::IncrementalCompilerBuilder CB; CB.SetCompilerArgs({args.begin(), it});