diff --git a/CMakeLists.txt b/CMakeLists.txt index 4759a9424..0ab47b63d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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() @@ -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) @@ -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() ################################################################################ diff --git a/src/feature/sift.cc b/src/feature/sift.cc index be90e2cd9..863251808 100644 --- a/src/feature/sift.cc +++ b/src/feature/sift.cc @@ -36,9 +36,7 @@ #include #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"