diff --git a/BUILD.md b/BUILD.md new file mode 100644 index 00000000..968b5b84 --- /dev/null +++ b/BUILD.md @@ -0,0 +1,15 @@ +# Windows +Windows => Use precompiled binary, or compile it with VS2008/2010 (Express or pro, Pro will allow you to enable Opemp in CMVS) + => Use CMake GUI in order to generate the Visual Studio project file (in ./program you will find the main CMakeLists.txt). + +# Linux compilations (Ubuntu used as example) +``` +#Prepare an empty machine for building: +sudo apt-get update -qq && sudo apt-get install -qq +sudo apt-get -y install git jpeg boost boost-graph +git clone https://github.com/pmoulon/CMVS-PMVS +mkdir CMVS-PMVS_build && cd CMVS-PMVS_build +cmake ../CMVS-PMVS/program +make +sudo make install +``` diff --git a/README b/README index 25a7d3ab..9027231e 100644 --- a/README +++ b/README @@ -1,5 +1,8 @@ This is a modified version of CMVS/PMVS. +Building: + - See https://github.com/pmoulon/CMVS-PMVS/BUILD.md + Main modification: - cross platform compilation Linux, Windows => CMake build system generator. - added bug fix from Nghia Ho. diff --git a/Readme.txt b/Readme.txt index 6eeb2d45..96f87633 100644 --- a/Readme.txt +++ b/Readme.txt @@ -18,19 +18,7 @@ Date : 13 July 2011 -- Compilation -- -------------------- -Windows => Use precompiled binary, or compile it with VS2008/2010 (Express or pro, Pro will allow you to enable Opemp in CMVS) - => Use CMake GUI in order to generate the Visual Studio project file (in ./program you will find the main CMakeLists.txt). - -Linux => use makefile in program/main. - - Or use CMake build system : -=> Install the following libraries : jpeg boost boost-graph - $ mkdir OutputLinux - $ cd OutputLinux - $ cmake . .. - $ make - => That's all. Openmp is not activated yet. Add openmp in the cmvs link option and define the _OPENMP cxx flags - +- See https://github.com/pmoulon/CMVS-PMVS/BUILD.md -------------------- ---- Notes : ---- diff --git a/program/CMakeLists.txt b/program/CMakeLists.txt index 2a4cd941..61d2d438 100644 --- a/program/CMakeLists.txt +++ b/program/CMakeLists.txt @@ -30,6 +30,9 @@ INCLUDE_DIRECTORIES( FIND_PACKAGE(Threads REQUIRED) SET(PMVS_LIBRARIES ${PMVS_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +# OPTIONS +OPTION(CIMG_USE_OPENMP "Enable OpenMP parallelization in cimg" ON) + # Eigen SET( EIGEN3_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdParty/Eigen ) SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${EIGEN3_INCLUDE_DIR}/cmake" ) @@ -95,6 +98,30 @@ IF(PMVS_USE_TIFF) ENDIF(TIFF_FOUND) ENDIF(PMVS_USE_TIFF) +# OpenMP +# ============================================================================== +# OpenMP detection +# ============================================================================== +IF(CIMG_USE_OPENMP) + FIND_PACKAGE(OpenMP) + IF(OPENMP_FOUND) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + OPTION(CIMG_USE_OPENMP "Use OpenMP for parallelization in cimg" ON) + ADD_DEFINITIONS(-DCIMG_USE_OPENMP) + IF (NOT MSVC) + IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # for those using the clang with OpenMP support + LIST(APPEND OPENMVG_LIBRARY_DEPENDENCIES iomp) + ELSE() + LIST(APPEND OPENMVG_LIBRARY_DEPENDENCIES gomp) + ENDIF() + ENDIF(NOT MSVC) + ENDIF(OPENMP_FOUND) +ELSE(CIMG_USE_OPENMP) + OPTION(OpenMVG_USE_OPENMP "Use OpenMP for parallelization in cimg" OFF) + UPDATE_CACHE_VARIABLE(CIMG_USE_OPENMP OFF) + REMOVE_DEFINITIONS(-DCIMG_USE_OPENMP) +ENDIF(CIMG_USE_OPENMP) ADD_SUBDIRECTORY(base) ADD_SUBDIRECTORY(main)