Demos (master): cmake: Build the remainder of egl subtree.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Thu Nov 24 21:44:52 UTC 2011
Module: Demos
Branch: master
Commit: 1983ede372d373169c4c1b51f59be044a710f714
URL: http://cgit.freedesktop.org/mesa/demos/commit/?id=1983ede372d373169c4c1b51f59be044a710f714
Author: Jose Fonseca <jfonseca at hera>
Date: Thu Nov 24 21:40:57 2011 +0000
cmake: Build the remainder of egl subtree.
---
CMakeLists.txt | 11 +++++-
src/CMakeLists.txt | 10 +++---
src/egl/CMakeLists.txt | 20 ++++++++++-
src/egl/eglut/CMakeLists.txt | 24 +++++++-----
src/egl/oes_vg/CMakeLists.txt | 20 ++++++++++
src/egl/opengl/CMakeLists.txt | 4 +-
src/egl/opengles1/CMakeLists.txt | 62 +++++++++++++++++++++++++++++++++
src/egl/opengles2/CMakeLists.txt | 40 +++++++++++++++++++++
src/egl/openvg/CMakeLists.txt | 44 +++++++++++++++++++++++
src/egl/openvg/trivial/CMakeLists.txt | 50 ++++++++++++++++++++++++++
10 files changed, 265 insertions(+), 20 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d07215f..90a9841 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,12 +2,12 @@ cmake_minimum_required (VERSION 2.8)
project (mesademos)
+include (FindPkgConfig)
+
find_package (OpenGL REQUIRED)
find_package (GLUT REQUIRED)
find_package (X11)
-find_library(EGL_egl_LIBRARY EGL /usr/lib)
-
find_library (GLEW_glew_LIBRARY GLEW
/usr/lib
)
@@ -16,6 +16,13 @@ find_path (GLEW_INCLUDE_DIR GL/glew.h
/usr/include/GL
)
+if (NOT WIN32)
+ pkg_check_modules (EGL egl)
+ pkg_check_modules (GLESV1 glesv1_cm)
+ pkg_check_modules (GLESV2 glesv2)
+ pkg_check_modules (VG vg)
+endif ()
+
if (UNIX)
link_libraries(m)
endif (UNIX)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1e0f695..13da6b6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,16 +16,16 @@ add_subdirectory (vpglsl)
add_subdirectory (gs)
add_subdirectory (slang)
-if(EGL_egl_LIBRARY)
- add_subdirectory(egl)
-endif(EGL_egl_LIBRARY)
+if (EGL_FOUND)
+ add_subdirectory(egl)
+endif ()
if (X11_FOUND)
add_subdirectory (xdemos)
endif (X11_FOUND)
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (WIN32)
add_subdirectory (wgl)
-endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+endif (WIN32)
add_subdirectory (data)
diff --git a/src/egl/CMakeLists.txt b/src/egl/CMakeLists.txt
index 0318575..2a2b6fa 100644
--- a/src/egl/CMakeLists.txt
+++ b/src/egl/CMakeLists.txt
@@ -1,2 +1,20 @@
+
add_subdirectory(eglut)
-add_subdirectory(opengl)
\ No newline at end of file
+
+add_subdirectory(opengl)
+
+if (GLESV1_FOUND)
+ add_subdirectory(opengles1)
+endif ()
+
+if (GLESV2_FOUND)
+ add_subdirectory(opengles2)
+endif ()
+
+if (VG_FOUND)
+ add_subdirectory(openvg)
+endif ()
+
+if (GLESV1_FOUND AND VG_FOUND)
+ add_subdirectory(oes_vg)
+endif ()
diff --git a/src/egl/eglut/CMakeLists.txt b/src/egl/eglut/CMakeLists.txt
index d86b59a..a885977 100644
--- a/src/egl/eglut/CMakeLists.txt
+++ b/src/egl/eglut/CMakeLists.txt
@@ -1,13 +1,17 @@
-if(X11_FOUND)
- add_library(eglut_x11 eglut.h eglut.c eglutint.h eglut_x11.c)
- target_link_libraries(eglut_x11 ${EGL_egl_LIBRARY} ${X11_X11_LIB})
- if (BUILD_SHARED_LIBS)
- install (TARGETS eglut_x11 DESTINATION ${LIBDIR})
- endif (BUILD_SHARED_LIBS)
-endif(X11_FOUND)
+include_directories (
+ ${EGL_INCLUDE_DIRS}
+)
-add_library(eglut_screen eglut.h eglut.c eglutint.h eglut_screen.c)
-target_link_libraries(eglut_screen ${EGL_egl_LIBRARY})
+if (X11_FOUND)
+ add_library (eglut_x11 eglut.h eglut.c eglutint.h eglut_x11.c)
+ target_link_libraries (eglut_x11 ${EGL_LIBRARIES} ${X11_X11_LIB})
+ if (BUILD_SHARED_LIBS)
+ install (TARGETS eglut_x11 DESTINATION ${LIBDIR})
+ endif (BUILD_SHARED_LIBS)
+endif (X11_FOUND)
+
+add_library (eglut_screen eglut.h eglut.c eglutint.h eglut_screen.c)
+target_link_libraries (eglut_screen ${EGL_LIBRARIES})
if (BUILD_SHARED_LIBS)
- install (TARGETS eglut_screen DESTINATION ${LIBDIR})
+ install (TARGETS eglut_screen DESTINATION ${LIBDIR})
endif (BUILD_SHARED_LIBS)
diff --git a/src/egl/oes_vg/CMakeLists.txt b/src/egl/oes_vg/CMakeLists.txt
new file mode 100644
index 0000000..fcc1291
--- /dev/null
+++ b/src/egl/oes_vg/CMakeLists.txt
@@ -0,0 +1,20 @@
+include_directories(
+ ${EGL_INCLUDE_DIRS}
+ ${GLESV1_INCLUDE_DIRS}
+ ${VG_INCLUDE_DIRS}
+)
+
+set (subdir egl/oes_vg)
+
+set (targets
+ tex2vgimage
+ vgimage2tex
+)
+
+if (X11_FOUND)
+ foreach (target ${targets})
+ add_executable (${target} ${target}.c)
+ target_link_libraries (${target} ${VG_LIBRARIES} ${GLESV1_LIBRARIES} ${EGL_LIBRARIES} ${X11_X11_LIB})
+ install (TARGETS ${target} DESTINATION ${subdir})
+ endforeach (target)
+endif ()
diff --git a/src/egl/opengl/CMakeLists.txt b/src/egl/opengl/CMakeLists.txt
index 854f64a..04fb6dd 100644
--- a/src/egl/opengl/CMakeLists.txt
+++ b/src/egl/opengl/CMakeLists.txt
@@ -1,12 +1,12 @@
include_directories(
${CMAKE_SOURCE_DIR}/src/egl/eglut
${CMAKE_SOURCE_DIR}/src/util
- ${EGL_INCLUDE_DIR}
+ ${EGL_INCLUDE_DIRS}
${OPENGL_INCLUDE_PATH}
)
link_libraries (
- ${EGL_egl_LIBRARY}
+ ${EGL_LIBRARIES}
${OPENGL_gl_LIBRARY}
)
diff --git a/src/egl/opengles1/CMakeLists.txt b/src/egl/opengles1/CMakeLists.txt
new file mode 100644
index 0000000..9f9a758
--- /dev/null
+++ b/src/egl/opengles1/CMakeLists.txt
@@ -0,0 +1,62 @@
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/egl/eglut
+ ${CMAKE_SOURCE_DIR}/src/util
+ ${EGL_INCLUDE_DIRS}
+ ${GLESV1_INCLUDE_DIRS}
+)
+
+set (subdir egl/opengles1)
+
+set (targets
+ bindtex
+ es1_info
+ msaa
+ pbuffer
+ render_tex
+ texture_from_pixmap
+ two_win
+)
+
+if (X11_FOUND)
+ foreach (target ${targets})
+ add_executable (${target} ${target}.c)
+ target_link_libraries (${target} ${EGL_LIBRARIES} ${GLESV1_LIBRARIES} ${X11_X11_LIB})
+ install (TARGETS ${target} DESTINATION ${subdir})
+ endforeach (target)
+endif ()
+
+
+# Targets that can be built both for fullscreen EGL and X11
+
+
+set (targets
+ drawtex
+ gears
+ torus
+ tri
+)
+
+foreach (target ${targets})
+ add_executable (${target}_screen ${target}.c)
+ target_link_libraries (${target}_screen eglut_screen ${GLESV1_LIBRARIES})
+ install (TARGETS ${target}_screen DESTINATION ${subdir})
+
+ if (X11_FOUND)
+ add_executable (${target}_x11 ${target}.c)
+ target_link_libraries (${target}_x11 eglut_x11 ${GLESV1_LIBRARIES})
+ install (TARGETS ${target}_x11 DESTINATION ${subdir})
+ endif ()
+endforeach (target)
+
+if (X11_FOUND)
+ # intentionally not link to GLESV1_LIBS
+ add_executable (clear clear.c)
+ target_link_libraries (clear eglut_x11)
+ install (TARGETS clear DESTINATION ${subdir})
+endif ()
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+ add_executable (eglfbdev eglfbdev.c)
+ target_link_libraries (eglfbdev ${EGL_LIBRARIES} ${GLESV1_LIBRARIES})
+ install (TARGETS eglfbdev DESTINATION ${subdir})
+endif ()
diff --git a/src/egl/opengles2/CMakeLists.txt b/src/egl/opengles2/CMakeLists.txt
new file mode 100644
index 0000000..227ba66
--- /dev/null
+++ b/src/egl/opengles2/CMakeLists.txt
@@ -0,0 +1,40 @@
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/egl/eglut
+ ${CMAKE_SOURCE_DIR}/src/util
+ ${EGL_INCLUDE_DIRS}
+ ${GLESV2_INCLUDE_DIRS}
+)
+
+set (subdir egl/opengles2)
+
+set (targets
+ es2_info
+ es2tri
+)
+
+if (X11_FOUND)
+ foreach (target ${targets})
+ add_executable (${target} ${target}.c)
+ target_link_libraries (${target} ${EGL_LIBRARIES} ${GLESV2_LIBRARIES} ${X11_X11_LIB})
+ install (TARGETS ${target} DESTINATION ${subdir})
+ endforeach (target)
+endif ()
+
+
+# Targets that can be built both for fullscreen EGL and X11
+
+set (targets
+ es2gears
+)
+
+foreach (target ${targets})
+ add_executable (${target}_screen ${target}.c)
+ target_link_libraries (${target}_screen eglut_screen ${GLESV2_LIBRARIES})
+ install (TARGETS ${target}_screen DESTINATION ${subdir})
+
+ if (X11_FOUND)
+ add_executable (${target}_x11 ${target}.c)
+ target_link_libraries (${target}_x11 eglut_x11 ${GLESV2_LIBRARIES})
+ install (TARGETS ${target}_x11 DESTINATION ${subdir})
+ endif ()
+endforeach (target)
diff --git a/src/egl/openvg/CMakeLists.txt b/src/egl/openvg/CMakeLists.txt
new file mode 100644
index 0000000..adcc755
--- /dev/null
+++ b/src/egl/openvg/CMakeLists.txt
@@ -0,0 +1,44 @@
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/egl/eglut
+ ${CMAKE_SOURCE_DIR}/src/util
+ ${EGL_INCLUDE_DIRS}
+ ${VG_INCLUDE_DIRS}
+)
+
+set (subdir egl/openvg)
+
+if (X11_FOUND)
+ foreach (target ${targets})
+ add_executable (text text.c)
+ target_link_libraries (text ${EGL_LIBRARIES} ${VG_LIBRARIES} ${X11_X11_LIB})
+ install (TARGETS text DESTINATION ${subdir})
+ endforeach (target)
+endif ()
+
+
+# Targets that can be built both for fullscreen EGL and X11
+
+set (targets
+ lion
+ sp
+)
+
+foreach (target ${targets})
+ set (sources ${target}.c)
+
+ if (${target} STREQUAL lion)
+ set (sources ${sources} lion-render.c)
+ endif ()
+
+ add_executable (${target}_screen ${sources})
+ target_link_libraries (${target}_screen eglut_screen ${VG_LIBRARIES})
+ install (TARGETS ${target}_screen DESTINATION ${subdir})
+
+ if (X11_FOUND)
+ add_executable (${target}_x11 ${sources})
+ target_link_libraries (${target}_x11 eglut_x11 ${VG_LIBRARIES})
+ install (TARGETS ${target}_x11 DESTINATION ${subdir})
+ endif ()
+endforeach (target)
+
+add_subdirectory (trivial)
diff --git a/src/egl/openvg/trivial/CMakeLists.txt b/src/egl/openvg/trivial/CMakeLists.txt
new file mode 100644
index 0000000..1cf4811
--- /dev/null
+++ b/src/egl/openvg/trivial/CMakeLists.txt
@@ -0,0 +1,50 @@
+include_directories(
+ ${EGL_INCLUDE_DIRS}
+ ${VG_INCLUDE_DIRS}
+)
+
+set (subdir egl/openvg/trivial)
+
+add_library (common STATIC eglcommon)
+
+set (targets
+ arc
+ cap
+ blend
+ clear
+ color_transform
+ coord
+ dash
+ ellipse
+ filter
+ gradorigin
+ image
+ layer
+ lineto
+ lingrad
+ lookup
+ mask4
+ mask
+ mask_render
+ paint
+ path3
+ radialgrad
+ readpixels
+ roundedrect
+ star-nonzero
+ star-oddeven
+ stroke2
+ stroke
+# VGU is broken on current mesa master
+# vguarc
+)
+
+foreach (target ${targets})
+
+ if (X11_FOUND)
+ add_executable (openvg_${target} ${target}.c)
+ target_link_libraries (openvg_${target} common ${VG_LIBRARIES} ${EGL_LIBRARIES} ${X11_X11_LIB})
+ set_target_properties (openvg_${target} PROPERTIES OUTPUT_NAME ${target})
+ install (TARGETS openvg_${target} DESTINATION ${subdir})
+ endif ()
+endforeach (target)
More information about the mesa-commit
mailing list