diff --git a/CMakeLists.txt b/CMakeLists.txt index 3110457628..914f42f869 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,9 @@ option(WITH_OPENCL "Utilisation d'OpenCL" OFF) # Multi thread Poisson avec OpenMP option(WITH_OPEN_MP "use OpenMP" OFF) +# External QPBO library require +option(WITH_QPBO "use external QPBO" OFF) + # print system calls option(TRACE_SYSTEM "print system calls" OFF) @@ -174,6 +177,17 @@ if(WITH_OPEN_MP) set(USE_OPEN_MP 1) endif() +if(WITH_QPBO) + FIND_PACKAGE(qpbo REQUIRED) + if(NOT qpbo_FOUND) + message(FATAL_ERROR "QPBO library package wasn't found. Please disable QPBO with -DWITH_QPBO=OFF") + endif() +else() + message(STATUS "System QPBO was disabled, using embedded one") + string(APPEND CMAKE_C_FLAGS " -I./src/uti_phgrm/GraphCut/QPBO-v1.4/") + string(APPEND CMAKE_CXX_FLAGS " -I./src/uti_phgrm/GraphCut/QPBO-v1.4/") +endif() + ###################################### ## Trouver les EXES et Libs ## ###################################### diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a6a732a50..6f195b9ca9 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -170,6 +170,13 @@ else() add_library(${libElise} ${Elise_Src_Files} ${QT_ALLFILES}) endif() +if(qpbo_FOUND) + string(APPEND CMAKE_C_FLAGS " ${qpbo_C_FLAGS}") + string(APPEND CMAKE_CXX_FLAGS " ${qpbo_CXX_FLAGS}") + target_link_libraries(${libElise} "${qpbo_LD_FLAGS}") + #target_compile_options(${libElise} "${qpbo_CXX_FLAGS}") +endif(qpbo_FOUND) + if(QT_ENABLED) target_link_libraries(${libElise} Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Xml Qt5::Concurrent Qt5::OpenGL) add_subdirectory(saisieQT) diff --git a/src/uti_phgrm/CPP_Tequila.cpp b/src/uti_phgrm/CPP_Tequila.cpp index dd553fcc9e..f428bfe6d9 100755 --- a/src/uti_phgrm/CPP_Tequila.cpp +++ b/src/uti_phgrm/CPP_Tequila.cpp @@ -38,7 +38,7 @@ English : Header-MicMac-eLiSe-25/06/2007*/ #include "StdAfx.h" #include "TexturePacker/TexturePacker.h" -#include "GraphCut/QPBO-v1.4/QPBO.h" +#include "qpbo.h" void LoadTrScaleRotate ( @@ -558,7 +558,7 @@ int Tequila_main(int argc,char ** argv) for(int aCam=0; aCam< nCam;++aCam) { - QPBO* q = new QPBO(nTriangles, nEdges); // max number of nodes & edges + qpbo::QPBO* q = new qpbo::QPBO(nTriangles, nEdges); // max number of nodes & edges set vTri; cZBuf *aZBuffer = aZBufManager.getZBuf(aCam); diff --git a/src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO.h b/src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO.h index f0759fd383..d68715d7be 100755 --- a/src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO.h +++ b/src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO.h @@ -121,6 +121,7 @@ // #define code_assert(ignore)((void) 0) +namespace qpbo { // REAL: can be int, float, double. // Current instantiations are in instances.inc @@ -804,6 +805,8 @@ template } } +} // end namespace qpbo + /* special constants for node->parent */ diff --git a/src/uti_phgrm/Sources.cmake b/src/uti_phgrm/Sources.cmake index 0f33baee26..713758d8fc 100755 --- a/src/uti_phgrm/Sources.cmake +++ b/src/uti_phgrm/Sources.cmake @@ -22,7 +22,9 @@ set(UTI_PHGRM_SAT_PHYS_MOD ${UTI_PHGRM_DIR}/SatPhysMod) set(UTI_PHGRM_TEXT_DIR ${UTI_PHGRM_DIR}/TexturePacker) set(UTI_PHGRM_MAXFLOW_DIR ${UTI_PHGRM_GRAPHCUT_DIR}/MaxFlow) -set(UTI_PHGRM_QPBO_DIR ${UTI_PHGRM_GRAPHCUT_DIR}/QPBO-v1.4) +if(NOT QPBO_FOUND) + set(UTI_PHGRM_QPBO_DIR ${UTI_PHGRM_GRAPHCUT_DIR}/QPBO-v1.4) +endif(NOT QPBO_FOUND) set(UTI_PHGRM_SAT4GEO_DIR ${UTI_PHGRM_DIR}/SAT4GEO) set(SrcGrp_Uti_PHGRM uti_phgrm) @@ -31,7 +33,9 @@ set(SrcGrp_Graph_Cut uti_phgrm/GraphCut) include(${UTI_PHGRM_APERO_DIR}/Sources.cmake) include(${UTI_PHGRM_MICMAC_DIR}/Sources.cmake) include(${UTI_PHGRM_MAXFLOW_DIR}/Sources.cmake) -include(${UTI_PHGRM_QPBO_DIR}/Sources.cmake) +if(NOT QPBO_FOUND) + include(${UTI_PHGRM_QPBO_DIR}/Sources.cmake) +endif(NOT QPBO_FOUND) include(${UTI_PHGRM_REDUCHOM_DIR}/Sources.cmake) include(${UTI_PHGRM_RHH_DIR}/Sources.cmake) include(${UTI_PHGRM_PORTO_DIR}/Sources.cmake)