diff --git a/CMakeLists.txt b/CMakeLists.txt index 74f9becde..2d70c41bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ ENDIF() # List configuration options SET(OpenMVS_BUILD_TOOLS ON CACHE BOOL "Build example applications") +SET(OpenMVS_BUILD_VIEWER ON CACHE BOOL "Build viewer application") SET(OpenMVS_USE_OPENMP ON CACHE BOOL "Enable OpenMP library") SET(OpenMVS_USE_BREAKPAD ON CACHE BOOL "Enable BreakPad library") SET(OpenMVS_USE_PYTHON ON CACHE BOOL "Enable Python library bindings") @@ -40,6 +41,12 @@ SET(OpenMVS_USE_SSE ON CACHE BOOL "Enable SSE optimizations") SET(OpenMVS_MAX_CUDA_COMPATIBILITY OFF CACHE BOOL "Build for maximum CUDA device compatibility") SET(OpenMVS_ENABLE_TESTS ON CACHE BOOL "Enable test code") +# Disable CUDA on MacOS +IF(APPLE) + SET(OpenMVS_USE_CUDA OFF) + MESSAGE(STATUS "Disabling CUDA on MacOS") +ENDIF() + # Load automatically VCPKG toolchain if available IF(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{VCPKG_ROOT}) SET(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") @@ -47,6 +54,9 @@ IF(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{VCPKG_ROOT}) SET(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "") ENDIF() ENDIF() +IF(OpenMVS_BUILD_TOOLS AND OpenMVS_BUILD_VIEWER) + LIST(APPEND VCPKG_MANIFEST_FEATURES "viewer") +ENDIF() IF(OpenMVS_USE_CUDA) LIST(APPEND VCPKG_MANIFEST_FEATURES "cuda") ENDIF() @@ -55,11 +65,10 @@ IF(OpenMVS_USE_PYTHON) SET(PARTIAL_BUILD_SHARED_LIBS ON) ENDIF() -# Name of the project. -# -# CMake files in this project can refer to the root source directory -# as ${OpenMVS_SOURCE_DIR} and to the root binary directory as -# ${OpenMVS_BINARY_DIR}. +# Name of the project: +# CMake files in this project can refer to the root source directory +# as ${OpenMVS_SOURCE_DIR} and to the root binary directory as +# ${OpenMVS_BINARY_DIR}. PROJECT(OpenMVS LANGUAGES CXX) SET(OpenMVS_MAJOR_VERSION 2) @@ -70,6 +79,19 @@ SET(OpenMVS_VERSION ${OpenMVS_MAJOR_VERSION}.${OpenMVS_MINOR_VERSION}.${OpenMVS_ # Disable SSE on unsupported platforms IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|ARM|aarch64|AARCH64)") SET(OpenMVS_USE_SSE OFF) + MESSAGE(STATUS "Disabling SSE on ARM platform") +ENDIF() + +# Set default build type to Release if not already set and using single-configuration generator. +IF(CMAKE_CONFIGURATION_TYPES) + MESSAGE(STATUS "Multi-configuration generator: ${CMAKE_GENERATOR}") +ELSE() + IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release" CACHE STRING + "Choose the type of build, options are: None(debug information only), Debug, Release, RelWithDebInfo, MinSizeRel." + FORCE) # FORCE to override user settings from command line if they are empty + ENDIF() + MESSAGE(STATUS "Build configuration: ${CMAKE_GENERATOR} - ${CMAKE_BUILD_TYPE}") ENDIF() # Define helper functions and macros. @@ -94,9 +116,9 @@ if(OpenMVS_USE_OPENMP) if(OPENMP_FOUND) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") SET(_USE_OPENMP TRUE) - #cmake only check for separate OpenMP library on AppleClang 7+ - #https://github.com/Kitware/CMake/blob/42212f7539040139ecec092547b7d58ef12a4d72/Modules/FindOpenMP.cmake#L252 - if (CMAKE_CXX_COMPILER_ID MATCHES "AppleClang" AND (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.0")) + # cmake only check for separate OpenMP library on AppleClang 7+ + # https://github.com/Kitware/CMake/blob/42212f7539040139ecec092547b7d58ef12a4d72/Modules/FindOpenMP.cmake#L252 + if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang" AND (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.0")) SET(OpenMP_LIBS ${OpenMP_libomp_LIBRARY}) LIST(APPEND OpenMVS_EXTRA_LIBS ${OpenMP_LIBS}) endif() @@ -109,6 +131,9 @@ if(OpenMVS_USE_CUDA) INCLUDE(CheckLanguage) CHECK_LANGUAGE(CUDA) if(CMAKE_CUDA_COMPILER) + # Finding CUDA fails on some systems if paths to nvcc / cuda library are not set; ex. on linux: + # export PATH="/usr/local/cuda/bin:$PATH" + # export LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}" SET(CUDA_FOUND TRUE) if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) SET(CMAKE_CUDA_ARCHITECTURES "native") diff --git a/build/Utils.cmake b/build/Utils.cmake index 3cfe776c5..f4ce379f2 100644 --- a/build/Utils.cmake +++ b/build/Utils.cmake @@ -62,8 +62,6 @@ macro(GetOperatingSystemArchitectureBitness) if(CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc") set(${MY_VAR_PREFIX}_ARCHITECTURE "ppc") endif() - #elseif(CMAKE_SYSTEM_NAME STREQUAL "Solaris") - #set(${MY_VAR_PREFIX}_BUILD "solaris8") # What about solaris9 and solaris10 ? endif() # Detect Microsoft compiler: @@ -450,7 +448,7 @@ macro(optimize_default_compiler_settings) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) - message("Compiling with C++${CMAKE_CXX_STANDARD}") + message(STATUS "Compiling with C++${CMAKE_CXX_STANDARD}") if(FLG_COMPILER_IS_GNU) # High level of warnings. diff --git a/scripts/python/MvsUtils.py b/scripts/python/MvsUtils.py index dbd3f56a8..787bb4ccd 100644 --- a/scripts/python/MvsUtils.py +++ b/scripts/python/MvsUtils.py @@ -125,7 +125,7 @@ def saveDMAP(data: dict, dmap_path: str): if 'confidence_map' in data: data['confidence_map'].astype(np.float32).tofile(dmap) if 'views_map' in data: - data['views_map'].astype(np.float32).tofile(dmap) + data['views_map'].astype(np.uint8).tofile(dmap) def loadMVSInterface(archive_path): diff --git a/vcpkg.json b/vcpkg.json index b4d3f821d..5d37210e6 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,8 +14,6 @@ "default-features": false }, "eigen3", - "glad", - "glfw3", "libpng", { "name": "opencv", @@ -29,6 +27,13 @@ "zlib" ], "features": { + "viewer": { + "description": "Viewer support in OpenMVS", + "dependencies": [ + "glad", + "glfw3" + ] + }, "cuda": { "description": "CUDA support for OpenMVS", "dependencies": [