leovandriel / cvplot

Graph plots, drawing, layout and windows in OpenCV
MIT License
122 stars 26 forks source link

Cannot make with OpenCV 2.4.9 #2

Closed quangchiem139 closed 6 years ago

quangchiem139 commented 6 years ago

Hi!

I just want to ask which opencv version you code can run on? I use 2.4.9 and get a hundreds of errors when building your project. However, I also believe it 's a great application. Thank you so much for sharing!

leovandriel commented 6 years ago

Hi @quangchiem139,

Thanks for getting in touch about this. I've tested cvplot with OpenCV 2.4.9.1 on Ubuntu 16.04. Can you show some of the errors so I can take a look?

quangchiem139 commented 6 years ago

Hi, I modified your CMakeLists a little bit and the errors went away. Here is my CMakeList.txt

Cmake_minimum_required(VERSION 2.6)

project (cvplot)
find_package(OpenCV REQUIRED)
#find_library(GTEST_LIB gtest)
SET(OpenCV_DIR "${CMAKE_SOURCE_DIR}/../install")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CVPLOT_LIB cvplot)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
set(OpenCV_INCLUDE_DIRS "/usr/include/opencv;/usr/include/opencv2")
set(CMAKE_BUILD_TYPE Release)

include_directories(include)
include_directories(${OpenCV_INCLUDE_DIRS})

if (DEFINED CVPLOT_LIB)
  file(GLOB LIB_SOURCES "${PROJECT_SOURCE_DIR}/src/cvplot/*.cc")
  add_library(${CVPLOT_LIB} ${LIB_SOURCES})
endif()

ADD_EXECUTABLE(cvplot src/main.cpp src/cvplot/color.cc src/cvplot/figure.cc src/cvplot/highgui.cc src/cvplot/internal.h src/cvplot/window.cc)
TARGET_LINK_LIBRARIES(${CVPLOT_LIB} ${OpenCV_LIBS}) 

if (${CVPLOT_DEMO})                                                                                                                                                                                        
  file(GLOB BIN_SOURCES "${PROJECT_SOURCE_DIR}/src/demo/*.cc")
  foreach(filename ${BIN_SOURCES})
    get_filename_component(name ${filename} NAME_WE)
    add_executable(${name} ${filename})
    target_link_libraries(${name} ${CVPLOT_LIB} ${OpenCV_LIBS})
  endforeach()
endif()

if (${CVPLOT_TEST})
  file(GLOB TEST_SOURCES "${PROJECT_SOURCE_DIR}/test/cvplot/*_test.cc")
  foreach(filename ${TEST_SOURCES})
    get_filename_component(name ${filename} NAME_WE)
    add_executable(${name} ${filename})
    target_link_libraries(${name} ${CVPLOT_LIB} ${OpenCV_LIBS} ${GTEST_LIB})
  endforeach()
endif()
leovandriel commented 6 years ago

Thanks for figuring all that out. I'll cherry pick some changes into the repo.