[objc] pass SDK config to plugin

Summary: This makes the plugin follow infer's configuration.

Reviewed By: martintrojer

Differential Revision: D18595972

fbshipit-source-id: f685dd057
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent 25f2293e70
commit de6864a07a

@ -119,7 +119,7 @@ DIRECT_TESTS += \
objcpp_linters-for-test-only \
objcpp_liveness \
objcpp_nullable \
objcpp_pulse \
objcpp_pulse \
objcpp_racerd \
objcpp_retain-cycles \
@ -366,7 +366,9 @@ clang_plugin: clang_setup
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES))
CLANG_INCLUDES=$(CLANG_INCLUDES) \
SDKPATH=$(XCODE_ISYSROOT) \
)
$(QUIET)$(call silent_on_success,Building clang plugin OCaml interface,\
$(MAKE) -C $(FCP_DIR)/clang-ocaml all \
build/clang_ast_proj.ml build/clang_ast_proj.mli \
@ -375,45 +377,54 @@ clang_plugin: clang_setup
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES))
CLANG_INCLUDES=$(CLANG_INCLUDES) \
SDKPATH=$(XCODE_ISYSROOT) \
)
.PHONY: clang_plugin_test
clang_plugin_test: clang_setup
$(QUIET)$(call silent_on_success,Running facebook-clang-plugins/libtooling/ tests,\
$(MAKE) -C $(FCP_DIR)/libtooling test \
CC=$(CC) CXX=$(CXX) \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES))
$(QUIET)$(call silent_on_success,Running facebook-clang-plugins/clang-ocaml/ tests,\
$(MAKE) -C $(FCP_DIR)/clang-ocaml test \
CC=$(CC) CXX=$(CXX) \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES))
$(QUIET)$(call silent_on_success,Running facebook-clang-plugins/libtooling/ tests,\
$(MAKE) -C $(FCP_DIR)/libtooling test \
CC=$(CC) CXX=$(CXX) \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES) \
SDKPATH=$(XCODE_ISYSROOT) \
)
$(QUIET)$(call silent_on_success,Running facebook-clang-plugins/clang-ocaml/ tests,\
$(MAKE) -C $(FCP_DIR)/clang-ocaml test \
CC=$(CC) CXX=$(CXX) \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES) \
SDKPATH=$(XCODE_ISYSROOT) \
)
.PHONY: clang_plugin_test
clang_plugin_test_replace: clang_setup
$(QUIET)$(call silent_on_success,Running facebook-clang-plugins/libtooling/ record tests,\
$(MAKE) -C $(FCP_DIR)/libtooling record-test-outputs \
CC=$(CC) CXX=$(CXX) \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES))
$(QUIET)$(call silent_on_success,Running facebook-clang-plugins/clang-ocaml/ record tests,\
$(MAKE) -C $(FCP_DIR)/clang-ocaml record-test-outputs \
CC=$(CC) CXX=$(CXX) \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES))
$(QUIET)$(call silent_on_success,Running facebook-clang-plugins/libtooling/ record tests,\
$(MAKE) -C $(FCP_DIR)/libtooling record-test-outputs \
CC=$(CC) CXX=$(CXX) \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES) \
SDKPATH=$(XCODE_ISYSROOT) \
)
$(QUIET)$(call silent_on_success,Running facebook-clang-plugins/clang-ocaml/ record tests,\
$(MAKE) -C $(FCP_DIR)/clang-ocaml record-test-outputs \
CC=$(CC) CXX=$(CXX) \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
CLANG_PREFIX=$(CLANG_PREFIX) \
CLANG_INCLUDES=$(CLANG_INCLUDES) \
SDKPATH=$(XCODE_ISYSROOT) \
)
.PHONY: ocaml_unit_test
ocaml_unit_test: test_build
@ -594,7 +605,7 @@ ifeq ($(BUILD_C_ANALYZERS),yes)
test -d '$(DESTDIR)$(libdir)/infer/infer/lib/linter_rules/' || \
$(MKDIR_P) '$(DESTDIR)$(libdir)/infer/infer/lib/linter_rules/'
test -d '$(DESTDIR)$(libdir)/infer/infer/etc/' || \
$(MKDIR_P) '$(DESTDIR)$(libdir)/infer/infer/etc'
$(MKDIR_P) '$(DESTDIR)$(libdir)/infer/infer/etc'
endif
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
test -d '$(DESTDIR)$(libdir)/infer/infer/lib/java/' || \

@ -110,6 +110,10 @@ CLANG_DEPS_NO_MODELS = \
CLANG_DEPS = $(CLANG_DEPS_NO_MODELS) $(MODELS_RESULTS_FILE)
ifeq ($(HAS_OBJC),yes)
XCODE_ISYSROOT = $(XCODE_BASE)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
endif
define copy_or_same_file
$(COPY) "$(1)" "$(2)" || diff -q "$(1)" "$(2)"
endef

@ -1 +1 @@
Subproject commit 18bf6770420d4d53ce5bbc1bfbee909f3662c9d9
Subproject commit b97ae1305b35e22ce80eeea28c5545c36a49db26

@ -12,10 +12,9 @@ OBJECTS=$(M_SOURCES:.m=.o) $(C_SOURCES:.c=.o)
# let infer override CC by letting the shell resolve its location according to PATH
CC=clang
IPHONESIMULATOR_ISYSROOT = $(XCODE_BASE)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
OBJC_TARGET = x86_64-apple-darwin14
CFLAGS += -Wno-deprecated-objc-isa-usage --target=$(OBJC_TARGET) -x objective-c -c -mios-simulator-version-min=8.2 -isysroot $(IPHONESIMULATOR_ISYSROOT)
CFLAGS += -Wno-deprecated-objc-isa-usage --target=$(OBJC_TARGET) -x objective-c -c -mios-simulator-version-min=8.2 -isysroot $(XCODE_ISYSROOT)
all: $(OBJECTS)

@ -13,10 +13,9 @@ OBJECTS=$(patsubst %.m,%_cxx.o, $(M_SOURCES)) $(patsubst %.c,%_cxx.o, $(C_SOURCE
# let infer override CC by letting the shell resolve its location according to PATH
CXX=clang++
IPHONESIMULATOR_ISYSROOT = $(XCODE_BASE)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
OBJC_TARGET = x86_64-apple-darwin14
CXXFLAGS += -Wno-deprecated-objc-isa-usage --target=$(OBJC_TARGET) -x objective-c++ -c -mios-simulator-version-min=8.2 -isysroot $(IPHONESIMULATOR_ISYSROOT)
CXXFLAGS += -Wno-deprecated-objc-isa-usage --target=$(OBJC_TARGET) -x objective-c++ -c -mios-simulator-version-min=8.2 -isysroot $(XCODE_ISYSROOT)
all: $(OBJECTS)

@ -3,13 +3,11 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
IPHONESIMULATOR_ISYSROOT = $(XCODE_BASE)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
OBJC_TARGET = x86_64-apple-darwin14
IOS_SIMULATOR_VERSION = 8.2
IOS_CLANG_OPTIONS = -isysroot $(IPHONESIMULATOR_ISYSROOT) \
IOS_CLANG_OPTIONS = -isysroot $(XCODE_ISYSROOT) \
-target $(OBJC_TARGET) -mios-simulator-version-min=$(IOS_SIMULATOR_VERSION)
OBJC_CLANG_OPTIONS = $(IOS_CLANG_OPTIONS) -x objective-c

Loading…
Cancel
Save