Update PyPatchMatch/Makefile

#45
Files changed (1) hide show
  1. PyPatchMatch/Makefile +16 -3
PyPatchMatch/Makefile CHANGED
@@ -15,10 +15,22 @@ CXX = $(ENVIRONMENT_OPTIONS) g++
15
  CXXFLAGS = -std=c++14
16
  CXXFLAGS += -Ofast -ffast-math -w
17
  # CXXFLAGS += -g
18
- CXXFLAGS += $(shell pkg-config --cflags opencv) -fPIC
19
- CXXFLAGS += $(INCLUDE_DIR)
20
- LDFLAGS = $(shell pkg-config --cflags --libs opencv) -shared -fPIC
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  CXXSOURCES = $(shell find $(SRC_DIR)/ -name "*.cpp")
24
  OBJS = $(addprefix $(OBJ_DIR)/,$(CXXSOURCES:.cpp=.o))
@@ -28,6 +40,7 @@ DEPFILES = $(OBJS:.o=.d)
28
 
29
  all: $(LIB_TARGET)
30
 
 
31
  $(OBJ_DIR)/%.o: %.cpp
32
  @echo "[CC] $< ..."
33
  @$(CXX) -c $< $(CXXFLAGS) -o $@
 
15
  CXXFLAGS = -std=c++14
16
  CXXFLAGS += -Ofast -ffast-math -w
17
  # CXXFLAGS += -g
 
 
 
18
 
19
+ PKG_CONFIG := $(shell pkg-config --exists opencv || echo "no")
20
+ ifeq ($(PKG_CONFIG),no)
21
+ PKG_CONFIG := $(shell pkg-config --exists opencv4 || echo "no")
22
+ ifeq ($(PKG_CONFIG),no)
23
+ $(error "opencv or opencv4 not found, please install OpenCV and try again.")
24
+ else
25
+ CXXFLAGS += $(shell pkg-config --cflags opencv4) -fPIC
26
+ LDFLAGS = $(shell pkg-config --cflags --libs opencv4) -shared -fPIC
27
+ endif
28
+ else
29
+ CXXFLAGS += $(shell pkg-config --cflags opencv) -fPIC
30
+ LDFLAGS = $(shell pkg-config --cflags --libs opencv) -shared -fPIC
31
+ endif
32
+
33
+ CXXFLAGS += $(INCLUDE_DIR)
34
 
35
  CXXSOURCES = $(shell find $(SRC_DIR)/ -name "*.cpp")
36
  OBJS = $(addprefix $(OBJ_DIR)/,$(CXXSOURCES:.cpp=.o))
 
40
 
41
  all: $(LIB_TARGET)
42
 
43
+
44
  $(OBJ_DIR)/%.o: %.cpp
45
  @echo "[CC] $< ..."
46
  @$(CXX) -c $< $(CXXFLAGS) -o $@