diff --git a/CMakeLists.txt b/CMakeLists.txt index dc37cb0a..8fb4b773 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,7 +210,11 @@ if(ENABLE_CUDA) if(OpenCV_FOUND) set(ADDITIONAL_CXX_FLAGS "${ADDITIONAL_CXX_FLAGS} -DOPENCV") endif() - set(CUDA_HOST_COMPILER_FLAGS "--compiler-options \" ${ADDITIONAL_CXX_FLAGS} -fPIC -fopenmp -Ofast \"") + if (APPLE) + set(CUDA_HOST_COMPILER_FLAGS "--compiler-options \" ${ADDITIONAL_CXX_FLAGS} -fPIC -Xpreprocessor -fopenmp -Ofast \"") + else() + set(CUDA_HOST_COMPILER_FLAGS "--compiler-options \" ${ADDITIONAL_CXX_FLAGS} -fPIC -fopenmp -Ofast \"") + endif() endif() string (REPLACE ";" " " CUDA_ARCH_FLAGS_SPACE_SEPARATED "${CUDA_ARCH_FLAGS}") diff --git a/Makefile b/Makefile index af193714..e6a4ad73 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,11 @@ COMMON+= `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv endif ifeq ($(OPENMP), 1) -CFLAGS+= -fopenmp + ifeq ($(OS),Darwin) #MAC + CFLAGS+= -Xpreprocessor -fopenmp + else + CFLAGS+= -fopenmp + endif LDFLAGS+= -lgomp endif