Browse Source

Add GTK2 support.

kestred 12 years ago
parent
commit
150624b27d
2 changed files with 37 additions and 4 deletions
  1. 31 0
      cmake/modules/MangleGTK2.cmake
  2. 6 4
      dtool/Configure.cmake

+ 31 - 0
cmake/modules/MangleGTK2.cmake

@@ -0,0 +1,31 @@
+# Filename: MangleOpenAL.cmake
+# Author: kestred (28 Nov, 2013)
+#
+# MangleOpenAL replaces the output variables of the builtin FindOpenAL
+# with vars matching Panda3D's existing config-var names.
+#
+
+if(GTK2_FOUND)
+	set(FOUND_GTK TRUE)
+
+	list(GET GTK2_LIBRARIES 0 GTK2_LIBRARY)
+	list(GET GTK2_INCLUDE_DIRS 0 GTK2_INCLUDE_DIR)
+
+	get_filename_component(GTK2_LIBRARY_DIR "${GTK2_LIBRARY}" PATH)
+
+	set(GTK_IPATH "${GTK2_INCLUDE_DIR}" CACHE PATH "The path to gtk-2's include directory.") # Include path
+	set(GTK_LPATH "${GTK2_LIBRARY_DIR}" CACHE PATH "The path to gtk-2's library directory.") # Library path
+	mark_as_advanced(GTK_IPATH)
+	mark_as_advanced(GTK_LPATH)
+
+	unset(GTK2_FOUND)
+	unset(GTK2_INCLUDE_DIR)
+	unset(GTK2_LIBRARY_DIR)
+	unset(GTK2_MAJOR_VERSION)
+	unset(GTK2_MINOR_VERSION)
+	unset(GTK2_PATCH_VERSION)
+endif()
+
+unset(GTK2_LIBRARIES CACHE)
+unset(GTK2_INCLUDE_DIRS CACHE)
+unset(GTK2_DEFINITIONS CACHE)

+ 6 - 4
dtool/Configure.cmake

@@ -111,6 +111,12 @@ find_package(OpenAL QUIET)
 mangle_package(OpenAL)
 config_package(OPENAL COMMENT "OpenAL sound library")
 
+# Find and configure GTK
+find_package(GTK2 QUIET)
+mangle_package(GTK2)
+config_package(GTK COMMENT "gtk+-2")
+
+
 
 ########
 # TODO #
@@ -124,10 +130,6 @@ config_package(OPENAL COMMENT "OpenAL sound library")
 #find_package(SpeedTree)
 #config_package(SPEEDTREE COMMENT "SpeedTree")
 
-# Find and configure GTK
-#find_package(GTK)
-#config_package(GTK COMMENT "gtk+-2")
-
 # Find and configure Freetype
 #find_package(Freetype)
 #config_package(FREETYPE COMMENT "Freetype")