Created
July 6, 2020 19:44
-
-
Save andrewgrant/477c7037b1fc0dd7275109d3f2254ea9 to your computer and use it in GitHub Desktop.
Revisions
-
andrewgrant created this gist
Jul 6, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ # configure.ac # add an --enable-macos-universal-binary flag that when building for mac # create a universal x86_64 / arm64 binary AC_ARG_ENABLE([macos-universal-binary], [AS_HELP_STRING([--enable-macos-universal-binary], [Create an universal x86_64+arm64 binary when building for macos)])],, [enable_macos_universal_binary=no]) # Determine if we're building for macos/darwin by checking for macos & darwin # in the build triple. AC_CANONICAL_HOST case $host_os in *macos*) macos="yes" ;; *darwin*) macos="yes" ;; *) macos="no" ;; esac # If building for Mac we will pass x86_64 or arm64 to the compiler based # on user options or target type. AS_IF([test "$macos" = "yes"],[ clang_arch_x86_64="no" clang_arch_arm64="no" # If building a universal binary ask clang for both AS_IF([test "$enable_macos_universal_binary" = "yes"],[ clang_arch_x86_64="yes" clang_arch_arm64="yes" ],[ # If building for x86_64 ask for that AS_IF([test "$host_cpu" = "x86_64"],[ clang_arch_x86_64="yes" ]) # If building for arm64, ask for that AS_IF([test "$host_cpu" = "aarch64"],[ clang_arch_arm64="yes" ]) ]) # set the defines for our makefile AM_CONDITIONAL([CLANG_ARCH_X86_64], [test "$clang_arch_x86_64" = "yes"]) AM_CONDITIONAL([CLANG_ARCH_ARM64], [test "$clang_arch_arm64" = "yes"]) ], [ # Just set these to false. They need to be present in the else clause to keep # automake happy. AM_CONDITIONAL([CLANG_ARCH_X86_64], [false]) AM_CONDITIONAL([CLANG_ARCH_ARM64], [false]) ]) # makefile.am # Pass x86_64 in compiler and linker flags if asked if CLANG_ARCH_X86_64 AM_CPPFLAGS += -arch x86_64 AM_CFLAGS += -arch x86_64 AM_CXXFLAGS += -arch x86_64 AM_LDFLAGS += -arch x86_64 endif # Pass arm64 in compiler and linker flags if asked # (Note - may be additive to the above) if CLANG_ARCH_ARM64 AM_CPPFLAGS += -arch arm64 AM_CFLAGS += -arch arm64 AM_CXXFLAGS += -arch arm64 AM_LDFLAGS += -arch arm64 endif