tri-2101010-dlist: test 2101010 with a display list.
[mesa-demos.git] / CMakeLists.txt
blobdbb335925c54fcbbd355ba10b8b0e4de43ff7994
1 cmake_minimum_required (VERSION 2.8)
3 project (mesademos)
5 find_package (OpenGL REQUIRED)
6 find_package (GLUT REQUIRED)
7 find_package (X11)
9 find_library(EGL_egl_LIBRARY EGL /usr/lib)
11 find_library (GLEW_glew_LIBRARY GLEW
12         /usr/lib
15 find_path (GLEW_INCLUDE_DIR GL/glew.h
16       /usr/include/GL
19 if (UNIX)
20         link_libraries(m)
21 endif (UNIX)
23 # On Mac OS X, GLX is provided as a separate OpenGL implementation, different
24 # from the standard OpenGL framework which provides support for GLUT and native
25 # Mac OS X applications.
26 if (X11_FOUND)
27         if (APPLE)
28                 find_path (X11_GL_INCLUDE_PATH GL/glx.h ${X11_INC_SEARCH_PATH})
29                 if (NOT X11_GL_INCLUDE_PATH)
30                         message (WARNING "Could not find GL/glx.h")
31                         set (X11_FOUND FALSE)
32                 endif (NOT X11_GL_INCLUDE_PATH)
33                 set (X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_GL_INCLUDE_PATH})
35                 find_library (X11_GL_LIB GL ${X11_LIB_SEARCH_PATH})
36                 if (NOT X11_GL_LIB)
37                         message (WARNING "Could not find libGL.dylib")
38                         set (X11_FOUND FALSE)
39                 endif (NOT X11_GL_LIB)
41                 find_library (X11_GLU_LIB GLU ${X11_LIB_SEARCH_PATH})
42                 if (NOT X11_GLU_LIB)
43                         message (WARNING "Could not find libGLU.dylib")
44                         set (X11_FOUND FALSE)
45                 endif (NOT X11_GLU_LIB)
46         else ()
47                 set (X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
48                 set (X11_GL_LIB ${OPENGL_gl_LIBRARY})
49                 set (X11_GLU_LIB ${OPENGL_glu_LIBRARY})
50         endif ()
51 endif (X11_FOUND)
53 if (CMAKE_COMPILER_IS_GNUCC)
54         add_definitions(
55                 -Wall
56                 -Wpointer-arith
57                 -Wstrict-prototypes
58                 -Wmissing-prototypes
59                 -Wmissing-declarations
60                 -Wnested-externs
61                 -fno-strict-aliasing
62                 -Wbad-function-cast
63                 #-Wold-style-definition
64                 #-Wdeclaration-after-statement
65         )
66 endif (CMAKE_COMPILER_IS_GNUCC)
68 if (WIN32)
69         # Nobody likes to include windows.h:
70         # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
71         # - GLEW temporarily defines the necessary defines but undefines them later
72         # - certain GLUT distributions don't include it;
73         # - most of our programs are meant to be portable so don't include it.
74         #
75         # We could try to replicate the windows.h definitions required by
76         # GL/gl.h, but the build time savings don't compensate the constant
77         # headaches that brings, so instead we force windows.h to be included
78         # on every file.
79         if (MSVC)
80                 add_definitions (-FIwindows.h)
81         else (MSVC)
82                 add_definitions (--include windows.h)
83         endif (MSVC)
85         # Don't define min/max macros
86         add_definitions (-DNOMINMAX)
88         # MSVC & MinGW only define & use APIENTRY
89         add_definitions (-DGLAPIENTRY=__stdcall)
91         link_libraries (winmm)
92 endif (WIN32)
94 if (MSVC)
95         # Enable math constants defines
96         add_definitions (-D_USE_MATH_DEFINES)
98         # Silence several MSVC pedantic warnings
99         add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
100         add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
101         add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data
102 endif (MSVC)
104 add_definitions(-DDEMOS_DATA_DIR=\"../data/\")
106 add_subdirectory (src)
109 install (FILES index.html DESTINATION doc)
111 set (CPACK_PACKAGE_NAME "mesa-demos")
112 set (CPACK_PACKAGE_VERSION_MAJOR "8")
113 set (CPACK_PACKAGE_VERSION_MINOR "0")
114 set (CPACK_PACKAGE_VERSION_PATCH "1")
116 if (WIN32)
117     set (CPACK_GENERATOR "ZIP")
118 elseif (APPLE)
119     set (CPACK_GENERATOR "DragNDrop")
120     set (CPACK_DMG_FORMAT "UDBZ")
121 else ()
122     set (CPACK_GENERATOR "TBZ2")
123 endif ()
125 include(CPack)