Skip to content

Commit

Permalink
Added (unsupported) CMake files (STR #499)
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3829 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed Sep 13, 2004
1 parent 12993c9 commit 1ca225e
Show file tree
Hide file tree
Showing 12 changed files with 1,020 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -3,6 +3,7 @@ CHANGES IN FLTK 1.1.5rc3
- Documentation updates (STR #505, STR #513)
- Updated PNG library source to 1.2.6 + wutil patch.
- Updated ZLIB library source to 1.2.1.
- Added (unsupported) CMake files (STR #499)
- Tooltips would not reappear on the same widget, and
the initial tooltip delay was not used after a tooltip
was shown (STR #465)
Expand Down
54 changes: 54 additions & 0 deletions CMake/CheckFunctionWithHeaderExists.cmake
@@ -0,0 +1,54 @@
#
# Check if the symbol exists in include files
#
# CHECK_FUNCTIONWITHHEADER_EXISTS - macro which checks the symbol exists in include files.
# SYMBOL - symbol
# FILES - include files to check
# VARIABLE - variable to return result
#

MACRO(CHECK_FUNCTIONWITHHEADER_EXISTS SYMBOL FILES VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(CHECK_SYMBOL_EXISTS_CONTENT "/* */\n")
SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
IF(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_SYMBOL_EXISTS_LIBS
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
ENDIF(CMAKE_REQUIRED_LIBRARIES)
FOREACH(FILE ${FILES})
SET(CHECK_SYMBOL_EXISTS_CONTENT
"${CHECK_SYMBOL_EXISTS_CONTENT}#include <${FILE}>\n")
ENDFOREACH(FILE)
SET(CHECK_SYMBOL_EXISTS_CONTENT
"${CHECK_SYMBOL_EXISTS_CONTENT}\nint main()\n{\n${SYMBOL};return 0;\n}\n")

FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.c
"${CHECK_SYMBOL_EXISTS_CONTENT}")

MESSAGE(STATUS "Looking for ${SYMBOL}")
TRY_COMPILE(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.c
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
"${CHECK_SYMBOL_EXISTS_LIBS}"
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
MESSAGE(STATUS "Looking for ${SYMBOL} - found")
SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}")
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
"Determining if the ${SYMBOL} "
"exist passed with the following output:\n"
"${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.c:\n"
"${CHECK_SYMBOL_EXISTS_CONTENT}\n")
ELSE(${VARIABLE})
MESSAGE(STATUS "Looking for ${SYMBOL} - not found.")
SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the ${SYMBOL} "
"exist failed with the following output:\n"
"${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.c:\n"
"${CHECK_SYMBOL_EXISTS_CONTENT}\n")
ENDIF(${VARIABLE})
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_FUNCTIONWITHHEADER_EXISTS)
32 changes: 32 additions & 0 deletions CMake/FLTKConfig.cmake.in
@@ -0,0 +1,32 @@
#-----------------------------------------------------------------------------
#
# FLTKConfig.cmake - FLTK CMake configuration file for external projects.
#
# This file is configured by FLTK and used by the UseFLTK.cmake module
# to load FLTK's settings for an external project.

# The FLTK source tree.
SET(FLTK_SOURCE_DIR "@FLTK_SOURCE_DIR@")

# The FLTK include file directories.
SET(FLTK_EXECUTABLE_DIRS "@FLTK_EXECUTABLE_DIRS@")
SET(FLTK_LIBRARY_DIRS "@FLTK_LIBRARY_DIRS@")
SET(FLTK_LIBRARIES "fltk_images;fltk;fltk_gl;fltk_forms")

# The C and C++ flags added by FLTK to the cmake-configured flags.
SET(FLTK_REQUIRED_C_FLAGS "@FLTK_REQUIRED_C_FLAGS@")
SET(FLTK_REQUIRED_CXX_FLAGS "@FLTK_REQUIRED_CXX_FLAGS@")

# The FLTK version number
SET(FLTK_VERSION_MAJOR "@FLTK_VERSION_MAJOR@")
SET(FLTK_VERSION_MINOR "@FLTK_VERSION_MINOR@")
SET(FLTK_VERSION_PATCH "@FLTK_VERSION_PATCH@")

# The location of the UseFLTK.cmake file.
SET(FLTK_USE_FILE "@FLTK_USE_FILE@")

# The build settings file.
SET(FLTK_BUILD_SETTINGS_FILE "@FLTK_BUILD_SETTINGS_FILE@")

# Whether FLTK was built with shared libraries.
SET(FLTK_BUILD_SHARED "@BUILD_SHARED_LIBS@")
81 changes: 81 additions & 0 deletions CMake/PlatformTests.cxx
@@ -0,0 +1,81 @@
#ifdef HAVE_LIBZ

#include <zlib.h>

int main()
{
unsigned long compressedSize = 0;
unsigned char cd[100];
const unsigned char ud[100] = "";
unsigned long uncompressedSize = 0;

// Call zlib's compress function.
if(compress(cd, &compressedSize, ud, uncompressedSize) != Z_OK)
{
return 0;
}
return 1;
}


#endif

#ifdef HAVE_LIBJPEG

#include <stdio.h>
#include <jpeglib.h>

int main()
{
struct jpeg_decompress_struct cinfo;
jpeg_create_decompress(&cinfo);
jpeg_read_header(&cinfo, TRUE);
return 1;
}

#endif

#ifdef HAVE_LIBPNG
#include <png.h>
int main()
{
png_structp png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
NULL, NULL);
png_infop info_ptr = png_create_info_struct(png_ptr);
png_set_sig_bytes(png_ptr, 8);
png_read_info(png_ptr, info_ptr);

return 0;
}
#endif

#ifdef HAVE_PNG_H
#include <png.h>
int main() { retunr 0;}
#endif

#ifdef HAVE_PNG_GET_VALID
#include <png.h>
int main()
{
png_structp png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
NULL, NULL);
png_infop info_ptr = png_create_info_struct(png_ptr);
png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS);
return 0;
}
#endif

#ifdef HAVE_PNG_SET_TRNS_TO_ALPHA
#include <png.h>
int main()
{
png_structp png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
NULL, NULL);
png_set_tRNS_to_alpha(png_ptr);
return 0;
}
#endif

0 comments on commit 1ca225e

Please sign in to comment.