mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-23 19:43:27 +01:00
MacOSX: Better build flags logic handling. Suppress Xcode 15 linked warning.
This commit is contained in:
parent
406a1686f5
commit
8a4962dc07
113
src/Makefile
113
src/Makefile
@ -296,7 +296,8 @@ ifeq "$(shell uname -s)" "Darwin"
|
|||||||
APPNAME := VeraCrypt
|
APPNAME := VeraCrypt
|
||||||
|
|
||||||
export VC_OSX_TARGET ?= 12
|
export VC_OSX_TARGET ?= 12
|
||||||
export VC_OSX_SDK ?= $(VC_OSX_TARGET)
|
# use the output of the command "xcrun --show-sdk-version" to set the SDK version if not set
|
||||||
|
export VC_OSX_SDK ?= $(shell xcrun --show-sdk-version)
|
||||||
|
|
||||||
#check to see if XCode 3 path exists.Otherwise, use XCode 4 path
|
#check to see if XCode 3 path exists.Otherwise, use XCode 4 path
|
||||||
VC_OSX_SDK_PATH := /Developer/SDKs/MacOSX$(VC_OSX_SDK).sdk
|
VC_OSX_SDK_PATH := /Developer/SDKs/MacOSX$(VC_OSX_SDK).sdk
|
||||||
@ -316,29 +317,41 @@ ifeq "$(shell uname -s)" "Darwin"
|
|||||||
|
|
||||||
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=$(VC_OSX_TARGET) -isysroot $(VC_OSX_SDK_PATH)
|
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=$(VC_OSX_TARGET) -isysroot $(VC_OSX_SDK_PATH)
|
||||||
LFLAGS += -mmacosx-version-min=$(VC_OSX_TARGET) -Wl,-syslibroot $(VC_OSX_SDK_PATH)
|
LFLAGS += -mmacosx-version-min=$(VC_OSX_TARGET) -Wl,-syslibroot $(VC_OSX_SDK_PATH)
|
||||||
|
#Xcode 15 linker emits a warning "no platform load command found" when linking object files generated by yasm
|
||||||
|
# To suppress this warning, we need to use -Wl,-ld_classic flag in order to use the old ld64 linker
|
||||||
|
# https://mjtsai.com/blog/2024/03/15/xcode-15-no-platform-load-command-found/
|
||||||
|
# Check Xcode version for using specific linker flag
|
||||||
|
XCODE_VERSION := $(shell xcodebuild -version 2>/dev/null | grep 'Xcode' | sed -E 's/Xcode ([0-9]+).*/\1/')
|
||||||
|
ifneq ($(XCODE_VERSION),)
|
||||||
|
ifeq "$(shell expr $(XCODE_VERSION) \>= 15)" "1"
|
||||||
|
LFLAGS += -Wl,-ld_classic
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
$(error Xcode not found, please check your installation)
|
||||||
|
endif
|
||||||
|
|
||||||
WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK_PATH)
|
WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK_PATH)
|
||||||
|
|
||||||
ifeq "$(CPU_ARCH)" "x64"
|
|
||||||
CPU_ARCH = x86
|
# Set x86 assembly flags (-msse2, -mssse3, -msse4.1)
|
||||||
endif
|
# Apply flags if SIMD_SUPPORTED is 1 or if not in local development build (we are creating universal binary in this case)
|
||||||
|
ifneq "$(LOCAL_DEVELOPMENT_BUILD)" "true"
|
||||||
ifeq "$(CPU_ARCH)" "arm64"
|
SIMD_SUPPORTED = 1
|
||||||
CPU_ARCH = arm64
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq "$(CPU_ARCH)" "arm64"
|
ifeq "$(SIMD_SUPPORTED)" "1"
|
||||||
CFLAGS += -msse2
|
CFLAGS += -msse2
|
||||||
CXXFLAGS += -msse2
|
CXXFLAGS += -msse2
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq "$(origin SSSE3)" "command line"
|
ifeq "$(origin SSSE3)" "command line"
|
||||||
CFLAGS += -mssse3
|
CFLAGS += -mssse3
|
||||||
CXXFLAGS += -mssse3
|
CXXFLAGS += -mssse3
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq "$(origin SSE41)" "command line"
|
ifeq "$(origin SSE41)" "command line"
|
||||||
CFLAGS += -mssse3 -msse4.1
|
CFLAGS += -mssse3 -msse4.1
|
||||||
CXXFLAGS += -mssse3 -msse4.1
|
CXXFLAGS += -mssse3 -msse4.1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
AS ?= $(BASE_DIR)/Build/Tools/MacOSX/yasm
|
AS ?= $(BASE_DIR)/Build/Tools/MacOSX/yasm
|
||||||
@ -347,52 +360,38 @@ ifeq "$(shell uname -s)" "Darwin"
|
|||||||
|
|
||||||
ifeq "$(TC_BUILD_CONFIG)" "Release"
|
ifeq "$(TC_BUILD_CONFIG)" "Release"
|
||||||
|
|
||||||
export DISABLE_PRECOMPILED_HEADERS := 1
|
export DISABLE_PRECOMPILED_HEADERS := 1
|
||||||
|
|
||||||
S := $(C_CXX_FLAGS)
|
C_CXX_FLAGS := $(subst -MMD,,$(C_CXX_FLAGS)) -gfull
|
||||||
C_CXX_FLAGS = $(subst -MMD,,$(S))
|
LFLAGS += -Wl,-dead_strip
|
||||||
|
|
||||||
# only build local arch in development builds
|
# Initialize architecture flag
|
||||||
ifeq "$(LOCAL_DEVELOPMENT_BUILD)" "true"
|
ARCH_FLAG := -arch x86_64
|
||||||
ifeq "$(CPU_ARCH)" "arm64"
|
|
||||||
C_CXX_FLAGS += -gfull -arch $(CPU_ARCH)
|
# Set architecture flags based on build type and CPU architecture
|
||||||
LFLAGS += -Wl,-dead_strip -arch $(CPU_ARCH)
|
ifeq "$(LOCAL_DEVELOPMENT_BUILD)" "true"
|
||||||
|
ifeq "$(CPU_ARCH)" "arm64"
|
||||||
|
ARCH_FLAG := -arch arm64
|
||||||
|
endif
|
||||||
|
WX_CONFIGURE_FLAGS += --disable-universal_binary
|
||||||
|
else
|
||||||
|
# Legacy build settings
|
||||||
|
ifdef VC_LEGACY_BUILD
|
||||||
|
ARCH_FLAG += -arch i386
|
||||||
|
WX_CONFIGURE_FLAGS += --enable-universal_binary=i386,x86_64
|
||||||
else
|
else
|
||||||
C_CXX_FLAGS += -gfull -arch x86_64
|
CXXFLAGS += -std=c++11
|
||||||
LFLAGS += -Wl,-dead_strip -arch x86_64
|
# Non-development build defaults to universal binary for arm64 and x86_64
|
||||||
endif
|
ARCH_FLAG += -arch arm64
|
||||||
else
|
|
||||||
# leave previous logic as is
|
|
||||||
C_CXX_FLAGS += -gfull -arch x86_64
|
|
||||||
LFLAGS += -Wl,-dead_strip -arch x86_64
|
|
||||||
endif
|
|
||||||
|
|
||||||
WX_CONFIGURE_FLAGS += --without-libpng --disable-gif --disable-pcx --disable-tga --disable-iff --disable-gif --disable-svg
|
|
||||||
|
|
||||||
#----- Legacy build: we build both 32-bit and 64-bit ----
|
|
||||||
ifdef VC_LEGACY_BUILD
|
|
||||||
C_CXX_FLAGS += -arch i386
|
|
||||||
LFLAGS += -arch i386
|
|
||||||
WX_CONFIGURE_FLAGS += --enable-universal_binary=i386,x86_64
|
|
||||||
else
|
|
||||||
CXXFLAGS += -std=c++11
|
|
||||||
ifeq "$(LOCAL_DEVELOPMENT_BUILD)" "true"
|
|
||||||
ifeq "$(CPU_ARCH)" "arm64"
|
|
||||||
C_CXX_FLAGS += -arch arm64
|
|
||||||
LFLAGS += -arch arm64
|
|
||||||
else
|
|
||||||
C_CXX_FLAGS += -arch x86_64
|
|
||||||
LFLAGS += -arch x86_64
|
|
||||||
endif
|
|
||||||
WX_CONFIGURE_FLAGS += --disable-universal_binary
|
|
||||||
else
|
|
||||||
# leave previous logic as is
|
|
||||||
C_CXX_FLAGS += -arch arm64
|
|
||||||
LFLAGS += -arch arm64
|
|
||||||
WX_CONFIGURE_FLAGS += --enable-universal_binary=arm64,x86_64
|
WX_CONFIGURE_FLAGS += --enable-universal_binary=arm64,x86_64
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Apply architecture flags
|
||||||
|
C_CXX_FLAGS += $(ARCH_FLAG)
|
||||||
|
LFLAGS += $(ARCH_FLAG)
|
||||||
|
|
||||||
|
WX_CONFIGURE_FLAGS += --without-libpng --disable-gif --disable-pcx --disable-tga --disable-iff --disable-svg
|
||||||
WXCONFIG_CFLAGS += -gfull
|
WXCONFIG_CFLAGS += -gfull
|
||||||
WXCONFIG_CXXFLAGS += -gfull
|
WXCONFIG_CXXFLAGS += -gfull
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user