浏览代码

CMake: Configure: Add zlib support.

kestred 12 年之前
父节点
当前提交
6d8ba55bed
共有 3 个文件被更改,包括 43 次插入4 次删除
  1. 1 0
      cmake/modules/FindCg.cmake
  2. 37 0
      cmake/modules/MangleZLIB.cmake
  3. 5 4
      dtool/Configure.cmake

+ 1 - 0
cmake/modules/FindCg.cmake

@@ -1,4 +1,5 @@
 # Filename: FindCg.cmake
+# Author: kestred (8 Dec, 2013)
 #
 # Usage:
 #   find_package(Cg [REQUIRED] [QUIET])

+ 37 - 0
cmake/modules/MangleZLIB.cmake

@@ -0,0 +1,37 @@
+# Filename: MangleZLIB.cmake
+# Author: kestred (9 Dec, 2013)
+#
+# MangleZLIB replaces the output variables of the builtin FindZLIB
+# with vars matching Panda3D's existing config-var names.
+#
+
+if(ZLIB_FOUND)
+	set(FOUND_ZLIB TRUE)
+	set(ZLIB_LIBS ZLIB)
+
+	list(GET ZLIB_INCLUDE_DIRS 0 ZLIB_INCLUDE_DIR)
+	list(GET ZLIB_LIBRARIES 0 ZLIB_LIBRARY)
+	get_filename_component(ZLIB_LIBRARY_DIR "${ZLIB_LIBRARY}" PATH)
+
+	set(ZLIB_IPATH "${ZLIB_INCLUDE_DIR}" CACHE PATH "The path to zlibs's include directory.") # Include path
+	set(ZLIB_LPATH "${ZLIB_LIBRARY_DIR}" CACHE PATH "The path to zlibs's library directory.") # Library path
+	mark_as_advanced(ZLIB_IPATH)
+	mark_as_advanced(ZLIB_LPATH)
+
+	set(ZLIB_VERSION ${ZLIB_VERSION_STRING})
+
+	unset(ZLIB_FOUND)
+	unset(ZLIB_VERSION_STRING)
+	unset(ZLIB_VERSION_MAJOR)
+	unset(ZLIB_VERSION_MINOR)
+	unset(ZLIB_VERSION_PATCH)
+	unset(ZLIB_VERSION_TWEAK)
+	unset(ZLIB_MAJOR_VERSION)
+	unset(ZLIB_MINOR_VERSION)
+	unset(ZLIB_OATCH_VERSION)
+endif()
+
+unset(ZLIB_LIBRARY CACHE)
+unset(ZLIB_LIBRARIES CACHE)
+unset(ZLIB_INCLUDE_DIR CACHE)
+unset(ZLIB_INCLUDE_DIRS CACHE)

+ 5 - 4
dtool/Configure.cmake

@@ -84,6 +84,11 @@ config_package(CGDX10 COMMENT "Cg DX10 API")
 find_package(VRPN)
 config_package(VRPN)
 
+# Find and configure zlib
+find_package(ZLIB)
+mangle_package(ZLIB)
+config_package(ZLIB COMMENT "zlib")
+
 
 
 
@@ -91,10 +96,6 @@ config_package(VRPN)
 # TODO #
 ########
 
-# Find and configure zlib
-#find_package(zlib)
-#config_package(ZLIB COMMENT "zlib")
-
 # Find and configure Miles sound system
 #find_package(RAD_MSS)
 #config_package(RAD_MSS COMMENT "Miles Sound System")