use the macro USE_GLUT

This commit is contained in:
Krishna Vedala
2020-07-07 10:08:15 -04:00
parent ffba9bca91
commit 2980071f73
2 changed files with 5 additions and 4 deletions

View File

@@ -50,8 +50,7 @@ foreach( testsourcefile ${APP_SOURCES} )
target_include_directories(${testname} PRIVATE ${GLUT_INCLUDE_DIRS})
target_link_libraries(${testname} PRIVATE OpenGL::GL ${GLUT_LIBRARIES})
endif()
else(OpenGL_FOUND)
target_compile_definitions(${testname} PRIVATE NO_OPENGL)
target_compile_definitions(${testname} PRIVATE USE_GLUT)
endif(OpenGL_FOUND)
if(APPLE)

View File

@@ -25,11 +25,13 @@
#ifdef _OPENMP
#include <omp.h>
#endif
#ifdef USE_GLUT
#ifdef __APPLE__
#include <GLUT/glut.h> // include path on Macs is different
#else
#include <GL/glut.h>
#endif // __APPLE__
#endif
/**
* @namespace spirograph Functions related to spirograph.cpp
@@ -112,7 +114,7 @@ void test() {
fp.close();
}
#ifndef NO_OPENGL
#ifdef USE_GLUT
/** A wrapper that is not available in all GLUT implementations.
*/
static inline void glutBitmapString(void *font, char *message) {
@@ -219,7 +221,7 @@ void timer_cb(int t) {
int main(int argc, char **argv) {
spirograph::test();
#ifndef NO_OPENGL
#ifdef USE_GLUT
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Spirograph");