Skip to content

Commit

Permalink
Add CMake flag FORCE_OPENGL_ENABLED
Browse files Browse the repository at this point in the history
  • Loading branch information
clintlombard committed Oct 12, 2022
1 parent 87b3aa3 commit ad7953d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ option(IPO_ENABLED "Whether to enable interprocedural optimization" ON)
option(CUDA_ENABLED "Whether to enable CUDA, if available" ON)
option(GUI_ENABLED "Whether to enable the graphical UI" ON)
option(OPENGL_ENABLED "Whether to enable OpenGL, if available" ON)
option(FORCE_OPENGL_ENABLED "Force enable OpenGL even if GUI_ENABLED=OFF" OFF)
option(TESTS_ENABLED "Whether to build test binaries" OFF)
option(ASAN_ENABLED "Whether to enable AddressSanitizer flags" OFF)
option(PROFILING_ENABLED "Whether to enable google-perftools linker flags" OFF)
Expand Down Expand Up @@ -131,7 +132,7 @@ if(GUI_ENABLED)
endif()
endif()

if(OPENGL_ENABLED AND NOT GUI_ENABLED)
if(OPENGL_ENABLED AND NOT GUI_ENABLED AND NOT FORCE_OPENGL_ENABLED)
message(STATUS "Disabling GUI will also disable OpenGL")
set(OPENGL_ENABLED OFF)
endif()
Expand Down Expand Up @@ -286,7 +287,7 @@ else()
set(CGAL_ENABLED OFF)
endif()

if(Qt5_FOUND)
if(GUI_ENABLED AND Qt5_FOUND)
# Qt5 was built with -reduce-relocations.
if(Qt5_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand All @@ -297,6 +298,11 @@ if(Qt5_FOUND)

# Enable automatic compilation of Qt resource files.
set(CMAKE_AUTORCC ON)
else()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(CUDA_ENABLED AND NOT IS_MSVC)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --compiler-options -fPIC")
endif()
endif()

################################################################################
Expand Down
2 changes: 0 additions & 2 deletions src/feature/sift.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
#include <memory>

#include "FLANN/flann.hpp"
#if !defined(GUI_ENABLED) && !defined(CUDA_ENABLED)
#include "GL/glew.h"
#endif
#include "SiftGPU/SiftGPU.h"
#include "VLFeat/covdet.h"
#include "VLFeat/sift.h"
Expand Down

0 comments on commit ad7953d

Please sign in to comment.