Closed jangxx closed 4 years ago
Indeed there is, setting VSNRAY_GRAPHICS_API:STRING=None
with cmake. I'm just seeing though that this is currently defunct and won't even compile. Going to fix it and let you know.
Note when you don't use the graphics API you're actually good just using what's in the headers. The library just contains the graphics API stuff and CUDA/GL interop. Only downside is you can't install through make install
then.
Headless is still an important use-case, also to me, and should work right out of the box. I'll have a look at what needs to be done to support that a little better!
Marking this as an enhancement, should be documented how to disable the graphics API.
Thanks for the quick reply! Indeed, I already tried setting VSNRAY_GRAPHICS_API
to "None" in the CMakeLists directly, but Cmake threw the same error unfortunately. I'll try to get the header include working for now, so thanks for the info.
Actually for me, cmake will run through fine (i.e. with graphics API None and viewer disabled). It only fails to compile as the OpenGL integral types aren't defined.
Have you tried it on a fresh system/VM where GLEW is actually not installed? Maybe there are some wrong conditionals within the Cmake files, so that GLEW is always required, even though it's not actually used in the build process. On my server, setting the options does not actually change anything, so
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-std=c++11 -msse4.1"
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-std=c++11 -msse4.1" -DVSNRAY_ENABLE_VIEWER=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-std=c++11 -msse4.1" -DVSNRAY_ENABLE_VIEWER=OFF -DVSNRAY_GRAPHICS_API:STRING=None
all lead to the exact same output:
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- iostreams
-- system
-- thread
-- regex
-- chrono
-- date_time
-- atomic
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.10/Modules/FindGLEW.cmake:38 (find_package_handle_standard_args)
src/common/CMakeLists.txt:10 (find_package)
Good point, indeed I just checked that VSNRAY_HAVE_GLEW
and VSNRAY_HAVE_OPENGLES
are 0
in the config header. Seems like there's a REQUIRED
where GLEW is pulled in that should be removed.
As of https://github.com/szellmann/visionaray/commit/19055df095a967b72a16ab3a05bccee92f1f6f98 it should be possible to compile w/o OpenGL.
To do so, you have to set the following with cmake:
VSNRAY_ENABLE_COMMON=OFF
VSNRAY_ENABLE_VIEWER=OFF
VSNRAY_GRAPHICS_API=None
libvisionaray-common depends quite a bit on OpenGL so I find that too cumbersome to make that an optional dependency. Might do so in the future though.
I just tried it with the latest version and it works great! The library builds, make install
works and I can use it seamlessly in my project. Thanks again for the quick response.
I'm trying to build the library on a headless server without any Xorg libraries installed. Unfortunately, Cmake always complains about missing GLEW this way, even if I pass
-DVSNRAY_ENABLE_VIEWER=OFF
to disable the model viewer. As far as I understand it, the model viewer is the only component which uses GLEW, right? Is there something else I can disable to get around the GLEW requirement? I really don't want to install all the unnecessary Xorg libraries on the server just to do some offline rendering.Edit: The server is running Ubuntu 18.04.4.