Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(qpbo): use system qpbo library option #239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 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,15 @@ 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(WITH_QPBO)
message(STATUS "System QPBO was disabled, using embedded one")
endif(WITH_QPBO)

######################################
## Trouver les EXES et Libs ##
######################################
Expand Down
8 changes: 8 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ 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}")
else(qpbo_FOUND)
target_include_directories(${libElise} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/uti_phgrm/GraphCut/QPBO-v1.4/>")
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
2 changes: 2 additions & 0 deletions src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "QPBO.h"


using namespace qpbo;

template <typename T>
QPBO<T>::QPBO(int node_num_max, int edge_num_max, void (*err_function)(const char *))
: node_num(0),
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
2 changes: 2 additions & 0 deletions src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO_extra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#undef REAL
#endif

using namespace qpbo;

/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO_maxflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <stdio.h>
#include "QPBO.h"

using namespace qpbo;

#ifdef REAL
#undef REAL
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO_postprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#undef REAL
#endif

using namespace qpbo;

template <typename REAL>
void QPBO<REAL>::ComputeWeakPersistencies()
{
Expand Down
4 changes: 3 additions & 1 deletion src/uti_phgrm/GraphCut/QPBO-v1.4/instances.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

// Instantiations

namespace qpbo {

template <>
inline void QPBO<int>::get_type_information(const char*& type_name, const char*& type_format)
{
Expand All @@ -31,4 +33,4 @@ template class QPBO<int>;
template class QPBO<float>;
template class QPBO<double>;


} // end namespace qpbo
1 change: 1 addition & 0 deletions src/uti_phgrm/GraphCut/QPBO-v1.4/qpbo.h
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