Make Android.mk threads sensitive. Make the definition of CERES_NO_THREADS conditional on the presence of the CERES_HAVE_PTHREADS define. This allows the user to enable threading in ceres using a combination of CERES_EXTRA_DEFINES and linker flags which they need to do in their app. Change-Id: I43b99fc829001166e2f6dfb0a770768e61470591
diff --git a/jni/Android.mk b/jni/Android.mk index 45b95b4..cdee79e 100644 --- a/jni/Android.mk +++ b/jni/Android.mk
@@ -102,10 +102,19 @@ LOCAL_CFLAGS := $(CERES_EXTRA_DEFINES) \ -DCERES_NO_LAPACK \ -DCERES_NO_SUITESPARSE \ - -DCERES_NO_THREADS \ -DCERES_NO_CXSPARSE \ -DCERES_STD_UNORDERED_MAP + +# If the user did not enable threads in CERES_EXTRA_DEFINES, then add +# CERES_NO_THREADS. +# +# TODO(sameeragarwal): Update comments here and in the docs to +# demonstrate how OpenMP can be used by the user. +ifeq (,$(findstring CERES_HAVE_PTHREAD, $(LOCAL_CFLAGS))) + LOCAL_CFLAGS += -DCERES_NO_THREADS +endif + LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \ $(CERES_SRC_PATH)/blas.cc \ $(CERES_SRC_PATH)/block_evaluate_preparer.cc \