diff --git a/makefiles/Makefile.third_party.unix.mk b/makefiles/Makefile.third_party.unix.mk index 77c2010ac3..c8276d47da 100644 --- a/makefiles/Makefile.third_party.unix.mk +++ b/makefiles/Makefile.third_party.unix.mk @@ -220,40 +220,6 @@ Makefile.local: makefiles/Makefile.third_party.$(SYSTEM).mk @echo "# note: You don't need to run \"make third_party\" if you only use external dependencies" >> Makefile.local @echo "# i.e. You have defined all UNIX_GFLAGS_DIR, UNIX_GLOG_DIR, UNIX_PROTOBUF_DIR and UNIX_CBC_DIR" >> Makefile.local -############## -## GFLAGS ## -############## -# This uses gflags cmake-based build. -.PHONY: install_gflags -install_gflags: dependencies/install/lib/libgflags.a - -dependencies/install/lib/libgflags.a: dependencies/sources/gflags-$(GFLAGS_TAG) | dependencies/install - cd dependencies/sources/gflags-$(GFLAGS_TAG) && \ - $(SET_COMPILER) $(CMAKE) -H. -Bbuild_cmake \ - -DBUILD_SHARED_LIBS=OFF \ - -DBUILD_STATIC_LIBS=ON \ - -DBUILD_TESTING=OFF \ - -DGFLAGS_NAMESPACE=gflags \ - -DCMAKE_CXX_FLAGS="-fPIC $(MAC_VERSION)" \ - -DCMAKE_INSTALL_PREFIX=../../install && \ - $(CMAKE) --build build_cmake -- -j 4 && \ - $(CMAKE) --build build_cmake --target install - -dependencies/sources/gflags-$(GFLAGS_TAG): | dependencies/sources - -$(DELREC) dependencies/sources/gflags-$(GFLAGS_TAG) - git clone --quiet -b v$(GFLAGS_TAG) https://github.com/gflags/gflags.git dependencies/sources/gflags-$(GFLAGS_TAG) - -GFLAGS_INC = -I$(UNIX_GFLAGS_DIR)/include -GFLAGS_SWIG = $(GFLAGS_INC) -STATIC_GFLAGS_LNK = $(UNIX_GFLAGS_DIR)/lib/libgflags.a - -GFLAGS_LNK = $(STATIC_GFLAGS_LNK) - -DEPENDENCIES_INC += $(GFLAGS_INC) -SWIG_INC += $(GFLAGS_SWIG) -DEPENDENCIES_LNK += $(GFLAGS_LNK) -OR_TOOLS_LNK += $(GFLAGS_LNK) - ############ ## GLOG ## ############ @@ -292,6 +258,40 @@ SWIG_INC += $(GLOG_SWIG) DEPENDENCIES_LNK += $(GLOG_LNK) OR_TOOLS_LNK += $(GLOG_LNK) +############## +## GFLAGS ## +############## +# This uses gflags cmake-based build. +.PHONY: install_gflags +install_gflags: dependencies/install/lib/libgflags.a + +dependencies/install/lib/libgflags.a: dependencies/sources/gflags-$(GFLAGS_TAG) | dependencies/install + cd dependencies/sources/gflags-$(GFLAGS_TAG) && \ + $(SET_COMPILER) $(CMAKE) -H. -Bbuild_cmake \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_STATIC_LIBS=ON \ + -DBUILD_TESTING=OFF \ + -DGFLAGS_NAMESPACE=gflags \ + -DCMAKE_CXX_FLAGS="-fPIC $(MAC_VERSION)" \ + -DCMAKE_INSTALL_PREFIX=../../install && \ + $(CMAKE) --build build_cmake -- -j 4 && \ + $(CMAKE) --build build_cmake --target install + +dependencies/sources/gflags-$(GFLAGS_TAG): | dependencies/sources + -$(DELREC) dependencies/sources/gflags-$(GFLAGS_TAG) + git clone --quiet -b v$(GFLAGS_TAG) https://github.com/gflags/gflags.git dependencies/sources/gflags-$(GFLAGS_TAG) + +GFLAGS_INC = -I$(UNIX_GFLAGS_DIR)/include +GFLAGS_SWIG = $(GFLAGS_INC) +STATIC_GFLAGS_LNK = $(UNIX_GFLAGS_DIR)/lib/libgflags.a + +GFLAGS_LNK = $(STATIC_GFLAGS_LNK) + +DEPENDENCIES_INC += $(GFLAGS_INC) +SWIG_INC += $(GFLAGS_SWIG) +DEPENDENCIES_LNK += $(GFLAGS_LNK) +OR_TOOLS_LNK += $(GFLAGS_LNK) + ################ ## Protobuf ## ################ @@ -717,6 +717,9 @@ ifeq ($(PLATFORM),MACOSX) READLINE=false \ TPI=tny \ LPS=none \ + USRCFLAGS="$(MAC_VERSION)" \ + USRCXXFLAGS="$(MAC_VERSION)" \ + USRCPPFLAGS="$(MAC_VERSION)" \ INSTALLDIR="$(OR_TOOLS_TOP)/dependencies/install" endif ar d "$(OR_TOOLS_TOP)"/dependencies/install/lib/liblpinone.a lpi_none.o diff --git a/makefiles/Makefile.unix.mk b/makefiles/Makefile.unix.mk index c17d6a4d81..0fe397c0de 100644 --- a/makefiles/Makefile.unix.mk +++ b/makefiles/Makefile.unix.mk @@ -164,6 +164,7 @@ ifeq ($(PLATFORM),MACOSX) MAC_VERSION = -mmacosx-version-min=$(MAC_MIN_VERSION) CCC = clang++ -fPIC -std=c++17 $(MAC_VERSION) -stdlib=libc++ DYNAMIC_LD = clang++ -dynamiclib -undefined dynamic_lookup \ + $(MAC_VERSION) \ -Wl,-search_paths_first \ -Wl,-headerpad_max_install_names \ -current_version $(OR_TOOLS_MAJOR).$(OR_TOOLS_MINOR) \ @@ -192,7 +193,7 @@ ifeq ($(PLATFORM),MACOSX) SWIG_PYTHON_LIB_SUFFIX = so# To overcome a bug in Mac OS X loader. SWIG_DOTNET_LIB_SUFFIX = dylib - LINK_CMD = clang++ -dynamiclib \ + LINK_CMD = clang++ -dynamiclib $(MAC_VERSION) \ -Wl,-search_paths_first \ -Wl,-headerpad_max_install_names \ -current_version $(OR_TOOLS_MAJOR).$(OR_TOOLS_MINOR) \