]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
gtkglext: build builtin GtkGLExt as cmake external project
authorThomas Debesse <dev@illwieckz.net>
Tue, 15 Dec 2020 12:21:38 +0000 (13:21 +0100)
committerThomas Debesse <dev@illwieckz.net>
Mon, 21 Dec 2020 16:19:09 +0000 (17:19 +0100)
Do:

cmake -G "Unix Makefiles" -S. -Bbuild -DBUILTIN_GTKGLEXT=ON
cmake --build build --parallel $(nproc)

A GtkGLExt tree knonn to build will be downloaded into:

build/gtkglext-prefix/src/gtkglext

and installed into:

build/external

NetRadiant does not build against this builtin GtkGLExt yet.

CMakeLists.txt

index c6cc4464a3dfb724ecb81eaf7a8f43b41535793d..d861842cc3446049a14982c1fc43e8ac9c30cecc 100644 (file)
@@ -1,4 +1,5 @@
-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
 project(NetRadiant C CXX)
 
@@ -161,6 +162,27 @@ if (BUILD_RADIANT)
     endif ()
 endif ()
 
+option(BUILTIN_GTKGLEXT "Builtin GtkGLExt" OFF)
+if (BUILTIN_GTKGLEXT)
+    include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
+
+    execute_process(COMMAND pkg-config --libs gdk-2.0 gtk+-2.0 glib-2.0 gl
+        OUTPUT_VARIABLE GTKGLEXT_LDFLAGS
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+    set(GTKGLEXT_LDFLAGS "-lm ${GTKGLEXT_LDFLAGS}")
+
+    ExternalProject_Add(gtkglext
+        GIT_REPOSITORY https://gitlab.gnome.org/illwieckz/gtkglext.git
+        GIT_TAG fixes
+        BUILD_IN_SOURCE ON
+        CONFIGURE_COMMAND NOCONFIGURE=1 ./autogen.sh
+        CONFIGURE_COMMAND && ./configure --prefix "${CMAKE_BINARY_DIR}/external"
+        BUILD_COMMAND $(MAKE) LDFLAGS=${GTKGLEXT_LDFLAGS}
+        INSTALL_COMMAND $(MAKE) install
+    )
+endif ()
+
 #-----------------------------------------------------------------------
 # Defs
 #-----------------------------------------------------------------------