Skip to content

Commit

Permalink
feat(qpbo): use system qpbo library option
Browse files Browse the repository at this point in the history
+ used system qpbo library option
! fixed code to compile QPBO from insource with outsource
  • Loading branch information
majioa committed Feb 18, 2024
1 parent 2d0e290 commit 35cc8f8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 ##
######################################
Expand Down
7 changes: 7 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/uti_phgrm/CPP_Tequila.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
(
Expand Down Expand Up @@ -558,7 +558,7 @@ int Tequila_main(int argc,char ** argv)

for(int aCam=0; aCam< nCam;++aCam)
{
QPBO<float>* q = new QPBO<float>(nTriangles, nEdges); // max number of nodes & edges
qpbo::QPBO<float>* q = new qpbo::QPBO<float>(nTriangles, nEdges); // max number of nodes & edges

set <int> vTri;
cZBuf *aZBuffer = aZBufManager.getZBuf(aCam);
Expand Down
3 changes: 3 additions & 0 deletions src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
// #define code_assert(ignore)((void) 0)


namespace qpbo {

// REAL: can be int, float, double.
// Current instantiations are in instances.inc
Expand Down Expand Up @@ -804,6 +805,8 @@ template <typename T>
}
}

} // end namespace qpbo

/*
special constants for node->parent
*/
Expand Down
8 changes: 6 additions & 2 deletions src/uti_phgrm/Sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 35cc8f8

Please sign in to comment.