[Mesa-dev] [PATCH] osdemos: support building via cmake

Eric Engestrom eric.engestrom at imgtec.com
Fri Sep 22 13:28:58 UTC 2017


On Friday, 2017-09-22 11:37:43 +0000, Tommy wrote:
> Uses pkg-config to find osmesa, and builds only if found.

Thanks!

Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom at imgtec.com>

Do you want me to push this for you?

> ---
>  CMakeLists.txt             |  1 +
>  src/CMakeLists.txt         |  4 ++++
>  src/osdemos/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++
>  3 files changed, 36 insertions(+)
>  create mode 100644 src/osdemos/CMakeLists.txt
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index fc1caa05..cda9f3bd 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -24,6 +24,7 @@ if (PKG_CONFIG_FOUND AND NOT WIN32)
>  	pkg_check_modules (GLESV1 glesv1_cm)
>  	pkg_check_modules (GLESV2 glesv2)
>  	pkg_check_modules (VG vg)
> +	pkg_check_modules (OSMESA osmesa)
>  endif ()
>  
>  # Check for FreeGLUT 2.6 or later
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index 4e1c54ee..29a9d4c7 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -25,6 +25,10 @@ if (X11_FOUND)
>  	add_subdirectory (xdemos)
>  endif (X11_FOUND)
>  
> +if (OSMESA_FOUND)
> +	add_subdirectory (osdemos)
> +endif (OSMESA_FOUND)
> +
>  if (WIN32)
>  	add_subdirectory (wgl)
>  endif (WIN32)
> diff --git a/src/osdemos/CMakeLists.txt b/src/osdemos/CMakeLists.txt
> new file mode 100644
> index 00000000..25ded209
> --- /dev/null
> +++ b/src/osdemos/CMakeLists.txt
> @@ -0,0 +1,31 @@
> +include_directories (
> +	${CMAKE_SOURCE_DIR}/src/util
> +	${OSMESA_INCLUDE_DIRS}
> +	${OPENGL_INCLUDE_PATH}
> +)
> +
> +link_directories (
> +	${CMAKE_SOURCE_DIR}/src/util
> +	${OSMESA_LIBRARY_DIRS}
> +)
> +
> +link_libraries (
> +	util
> +	${OSMESA_LIBRARIES}
> +	${OPENGL_gl_LIBRARY}
> +	${OPENGL_glu_LIBRARY}
> +)
> +
> +set (subdir osdemos)
> +
> +set (targets
> +	osdemo
> +	osdemo16
> +	osdemo32
> +)
> +
> +foreach (target ${targets})
> +	add_executable (${subdir}_${target} ${target}.c)
> +	set_target_properties (${subdir}_${target} PROPERTIES OUTPUT_NAME ${target})
> +	install (TARGETS ${subdir}_${target} DESTINATION ${subdir})
> +endforeach (target)
> -- 
> 2.14.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list