Commits

Anonymous committed 9f7be65

*** empty log message ***

  • Participants
  • Parent commits 52c9500

Comments (0)

Files changed (3)

 # $Id$
 
+SET(PACKAGE GD)
+SET(PACKAGE_NAME GD)
+
 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3 FATAL_ERROR)
 PROJECT(GD)
 SET(CPACK_PACKAGE_NAME "libgd")
 "^${PROJECT_SOURCE_DIR}/bld/"
 "^${PROJECT_SOURCE_DIR}/autom4te\\\\.cache/"
 )
+
 INCLUDE(CPack)
 SET(CMAKE_MODULE_PATH "${GD_SOURCE_DIR}/cmake/modules")
 
 	ENABLE_TESTING()
 endif(BUILD_TEST)
 
-STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
-IF (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
-	set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0")
-ENDIF (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+if (NOT WIN32)
+	STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
+	IF (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+		set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0")
+	ENDIF (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+endif (NOT WIN32)
 
 if (USE_EXT_GD)
 	message("Using GD at: ${USE_EXT_GD}")
 		message("No gd found")
 	endif (GD_FOUND)
 else (USE_EXT_GD)
+
 	SET(GD_VERSION_MAJOR "2")
 	SET(GD_VERSION_MINOR "1")
 	SET(GD_VERSION_PATCH "0")
 
 	SET(GD_VERSION_INT "20100")
 
-	SET(PACKAGE GD)
-	SET(PACKAGE_NAME GD)
-
 	SET(CMAKE_REQUIRED_INCLUDES "/usr/include" "/usr/local/include")
 
 	message(STATUS "ft2build: ${CMAKE_REQUIRED_INCLUDES}")
 	include(CheckPrototypeExists)
 	SET(FONTCONFIG_FIND_QUIETLY, 1)
 
-	FIND_PACKAGE(PNG REQUIRED)
-	FIND_PACKAGE(ZLIB)
-	FIND_PACKAGE(JPEG)
-	FIND_PACKAGE(TIFF)
+	if (ENABLE_PNG)
+		FIND_PACKAGE(PNG REQUIRED)
+	endif (ENABLE_PNG)
+
+	if (ENABLE_PNG)
+		FIND_PACKAGE(ZLIB)
+	endif (ENABLE_PNG)
+
+	if (ENABLE_JPEG)
+		FIND_PACKAGE(JPEG)
+	endif (ENABLE_JPEG)
+
+	if (ENABLE_TIFF)
+		FIND_PACKAGE(TIFF)
+	endif (ENABLE_TIFF)
+
+	IF (NOT WIN32)
+		FIND_PACKAGE(PTHREAD)
+	ENDIF (NOT WIN32)
+
+	if (ENABLE_FREETYPE)
+		FIND_PACKAGE(Freetype)
+	endif (ENABLE_FREETYPE)
 
-IF (NOT WIN32)
-	FIND_PACKAGE(PTHREAD)
-ENDIF (NOT WIN32)
-	FIND_PACKAGE(Freetype)
-	FIND_PACKAGE(XPM)
+	if (ENABLE_XPM)
+		FIND_PACKAGE(XPM)
+	endif (ENABLE_XPM)
 
-#	FIND_PACKAGE(Fontconfig)
+	if (ENABLE_FONTCONFIG)
+		FIND_PACKAGE(Fontconfig)
+	endif (ENABLE_FONTCONFIG)
 
 	if (FREETYPE_FOUND)
 		INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR})
 
 	if (WIN32)
 		SET(GD_LIB bgd)
-		ADD_DEFINITIONS( -DWIN32 -D_WIN32 -DMSWIN32 -DBGDWIN32)
+		ADD_DEFINITIONS( -DWIN32 -D_WIN32 -DMSWIN32 -DBGDWIN32 -DWINVER=0x0500  -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0600)
 	else(WIN32)
 		SET(GD_LIB gd)
 	endif(WIN32)

examples/CMakeLists.txt

 
 
 SET(TESTS_FILES
-  tiffread
   tgaread
   crop
-	nnquant
 )
 
+if (JPEG_FOUND)
+	SET(TESTS_FILES
+		"${TESTS_FILES}"
+		nnquant
+	)
+endif (JPEG_FOUND)
+
+
+if (TIFF_FOUND)
+	SET(TESTS_FILES
+		"${TESTS_FILES}"
+		tiffread
+	)
+endif (TIFF_FOUND)
+
 FOREACH(test_name ${TESTS_FILES})
 	add_executable(${test_name} "${test_name}.c")
 	target_link_libraries (${test_name} ${GD_LIB})
 		*color = bl;
 		return 2;
 	} else {
-		int r,b,g,a;
+		register int r,b,g,a;
 
-		r = (0.5f + (gdImageRed(im, tl) + gdImageRed(im, tr) + gdImageRed(im, bl) + gdImageRed(im, br)) / 4);
-		g = (0.5f + (gdImageGreen(im, tl) + gdImageGreen(im, tr) + gdImageGreen(im, bl) + gdImageGreen(im, br)) / 4);
-		b = (0.5f + (gdImageBlue(im, tl) + gdImageBlue(im, tr) + gdImageBlue(im, bl) + gdImageBlue(im, br)) / 4);
-		a = (0.5f + (gdImageAlpha(im, tl) + gdImageAlpha(im, tr) + gdImageAlpha(im, bl) + gdImageAlpha(im, br)) / 4);
+		r = (int)(0.5f + (gdImageRed(im, tl) + gdImageRed(im, tr) + gdImageRed(im, bl) + gdImageRed(im, br)) / 4);
+		g = (int)(0.5f + (gdImageGreen(im, tl) + gdImageGreen(im, tr) + gdImageGreen(im, bl) + gdImageGreen(im, br)) / 4);
+		b = (int)(0.5f + (gdImageBlue(im, tl) + gdImageBlue(im, tr) + gdImageBlue(im, bl) + gdImageBlue(im, br)) / 4);
+		a = (int)(0.5f + (gdImageAlpha(im, tl) + gdImageAlpha(im, tr) + gdImageAlpha(im, bl) + gdImageAlpha(im, br)) / 4);
 		*color = gdImageColorClosestAlpha(im, r, g, b, a);
 		return 0;
 	}