Mostly rewritten CMake files by Michael Surette. They are more complete

than what we had previously, but may need some more testing. The latest
changes (removing old APPLE_QD definitions and code) might need another
update.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7451 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2010-04-05 22:33:58 +00:00
parent 2bf6fa6074
commit a0d26b634a
19 changed files with 1609 additions and 844 deletions

View File

@ -1,5 +1,6 @@
CHANGES IN FLTK 1.3.0
- redesigned CMake files (STR #2317).
- Fixed max. fd calculation, if USE_POLL is enabled (STR #2324)
- Fixed clipping for offscreen rendering (OSX, STR #2330)
- Added printing support (Fl_Printer class and friends) for native

View File

@ -1,54 +0,0 @@
#
# 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)

View File

@ -1,37 +1,38 @@
#-----------------------------------------------------------------------------
#
# 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@")
set(FLTK_FOUND TRUE)
set(FLTK_VERSION @FLTK_VERSION_FULL@)
# The FLTK include file directories.
SET(FLUID_COMMAND "@FLTK_FLUID_COMMAND@")
SET(FLTK_EXECUTABLE_DIRS "@FLTK_EXECUTABLE_DIRS@")
SET(FLTK_LIBRARY_DIRS "@FLTK_LIBRARY_DIRS@")
SET(FLTK_LIBRARIES "@FLTK_LIBRARIES@")
SET(FLTK_INCLUDE_DIRS "@FLTK_INCLUDE_DIRS@")
set(FLTK_FLUID_EXECUTABLE "@PREFIX_BIN@/fluid")
# 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@")
if(NOT "@EXE_LINKER_FLAGS@" STREQUAL "")
set(FLTK_EXE_LINKER_FLAGS "@EXE_LINKER_FLAGS@")
endif(NOT "@EXE_LINKER_FLAGS@" STREQUAL "")
# 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@")
set(FLTK_USE_FILE "@PREFIX_CONFIG@/UseFLTK.cmake")
# Is FLTK using shared libraries?
SET(FLTK_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
SET(FLTK_BUILD_SETTINGS_FILE "@FLTK_BUILD_SETTINGS_FILE@")
set(FLTK_DIR "@PREFIX_CONFIG@")
# The location of the UseFLTK.cmake file.
SET(FLTK11_USE_FILE "@FLTK_USE_FILE@")
set(FLTK_BIN_DIR "@PREFIX_BIN@")
set(FLTK_LIB_DIR "@PREFIX_LIB@")
set(FLTK_INCLUDE_DIR "@PREFIX_INCLUDE@")
set(FLTK_DATA_DIR "@PREFIX_DATA@")
set(FLTK_DOC_DIR "@PREFIX_DOC@")
# The ExodusII library dependencies.
IF(NOT FLTK_NO_LIBRARY_DEPENDS)
INCLUDE("@FLTK_LIBRARY_DEPENDS_FILE@")
ENDIF(NOT FLTK_NO_LIBRARY_DEPENDS)
set(FLTK_SHARED_LIBS_FOUND @OPTION_BUILD_SHARED_LIBS@)
set(FLTK_CAIRO_FOUND @FLTK_CAIRO_FOUND@)
set(FLTK_GL_FOUND @FLTK_GL_FOUND@)
set(FLTK_THREADS_FOUND @FLTK_THREADS_FOUND@)
set(FLTK_PTHREADS_FOUND @FLTK_PTHREADS_FOUND@)
set(FLTK_BUILTIN_JPEG_FOUND @FLTK_BUILTIN_JPEG_FOUND@)
set(FLTK_BUILTIN_ZLIB_FOUND @FLTK_BUILTIN_ZLIB_FOUND@)
set(FLTK_BUILTIN_PNG_FOUND @FLTK_BUILTIN_PNG_FOUND@)
set(FLTK_XINERAMA_FOUND @FLTK_XINERAMA_FOUND@)
set(FLTK_XFT_FOUND @FLTK_XFT_FOUND@)
set(FLTK_XDBE_FOUND @FLTK_XDBE_FOUND@)
include("@PREFIX_CONFIG@/FLTKLibraries.cmake")

View File

@ -1,98 +0,0 @@
#
# "$Id$"
#
# CMake support file to build the FLTK project using CMake (www.cmake.org)
#
# Copyright 1998-2010 by Bill Spitzak and others.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
#
# Please report all bugs and problems on the following page:
#
# http:#www.fltk.org/str.php
#
IF(NOT FLTK11_FOUND)
MESSAGE(FATAL_ERROR "Something went wrong. You are including FLTKUse.cmake but FLTK was not found")
ENDIF(NOT FLTK11_FOUND)
# -------------------------------------------------------------
# This macro automates wrapping of Fluid files
# Specify the output variable name and the list of sources
# The output variable can be directly added to the target.
#
# For example:
# FLTK_WRAP_FLUID(CubeView_SRCS CubeViewUI.fl)
# ADD_EXECUTABLE(CubeView CubeMain.cxx CubeView.cxx CubeView.h ${CubeView_SRCS})
# -------------------------------------------------------------
MACRO(FLTK_WRAP_FLUID VARIABLE)
FOREACH(src ${ARGN})
IF("${src}" MATCHES ".fl$")
GET_FILENAME_COMPONENT(fname ${src} NAME_WE)
GET_FILENAME_COMPONENT(fpath ${src} PATH)
GET_SOURCE_FILE_PROPERTY(gen ${src} GENERATED)
IF(gen)
SET(fluid_name "${src}")
ELSE(gen)
SET(fluid_name "${CMAKE_CURRENT_SOURCE_DIR}/${fpath}/${fname}.fl")
IF(NOT EXISTS "${fluid_name}")
SET(fluid_name "${CMAKE_CURRENT_BINARY_DIR}/${fpath}/${fname}.fl")
IF(NOT EXISTS "${fluid_name}")
SET(fluid_name "${fpath}/${fname}.fl")
IF(NOT EXISTS "${fluid_name}")
MESSAGE(SEND_ERROR "Cannot find Fluid source file: ${fpath}/${fname}.fl")
ENDIF(NOT EXISTS "${fluid_name}")
ENDIF(NOT EXISTS "${fluid_name}")
ENDIF(NOT EXISTS "${fluid_name}")
ENDIF(gen)
SET(cxx_name "${CMAKE_CURRENT_BINARY_DIR}/${fname}.cxx")
SET(h_name "${CMAKE_CURRENT_BINARY_DIR}/${fname}.h")
SET(${VARIABLE} "${${VARIABLE}};${cxx_name}")
ADD_CUSTOM_COMMAND(
OUTPUT ${cxx_name}
DEPENDS "${fluid_name}" "${FLUID_COMMAND}"
COMMAND ${FLUID_COMMAND}
ARGS -c ${fluid_name})
ADD_CUSTOM_COMMAND(
OUTPUT ${h_name}
DEPENDS "${fluid_name}" "${FLUID_COMMAND}"
COMMAND ${FLUID_COMMAND}
ARGS -c ${fluid_name})
ENDIF("${src}" MATCHES ".fl$")
ENDFOREACH(src)
ENDMACRO(FLTK_WRAP_FLUID VARIABLE)
# Make FLTK easier to use
INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIRS})
LINK_DIRECTORIES(${FLTK_LIBRARY_DIRS})
# Load the compiler settings used for FLTK.
IF(FLTK_BUILD_SETTINGS_FILE)
INCLUDE(CMakeImportBuildSettings)
CMAKE_IMPORT_BUILD_SETTINGS(${FLTK_BUILD_SETTINGS_FILE})
ENDIF(FLTK_BUILD_SETTINGS_FILE)
# Add compiler flags needed to use FLTK.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLTK_REQUIRED_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLTK_REQUIRED_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLTK_REQUIRED_EXE_LINKER_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FLTK_REQUIRED_SHARED_LINKER_FLAGS}")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FLTK_REQUIRED_MODULE_LINKER_FLAGS}")
#
# End of "$Id$".
#

View File

@ -1,140 +0,0 @@
//
// "$Id$"
//
// CMake platform tests for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
//
// The platform tests in this file are invoked by the CMake macro
// PERFORM_CMAKE_TEST in CMakeLists.txt (or maybe other files).
//
// Each platform test in this file must begin and end with
// #ifdef FOO
// ...
// #endif
// where FOO is the compiler macro to be tested/defined in config.h.
//
// It must contain a main() function and return 0 if the test succeeded.
//
#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
// This one is probably not used:
#ifdef HAVE_PNG_H
#include <png.h>
int main() { return 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
#ifdef HAVE_SCANDIR_POSIX
#include <dirent.h>
int func (const char *d, dirent ***list, void *sort) {
int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
}
int main() {
return 0;
}
#endif
//
// End of "$Id$".
//

8
CMake/UseFLTK.cmake.in Normal file
View File

@ -0,0 +1,8 @@
#
# automatically generated - do not edit
include_directories("@PREFIX_INCLUDE@")
if(FLTK_EXE_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${FLTK_EXE_LINKER_FLAGS}")
endif(FLTK_EXE_LINKER_FLAGS)

View File

@ -0,0 +1,19 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR
"Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
exec_program("@CMAKE_COMMAND@"
ARGS "-E remove -f \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif(NOT "${rm_retval}" STREQUAL 0)
endforeach(file)

10
CMake/posixScandir.cxx Normal file
View File

@ -0,0 +1,10 @@
#include <dirent.h>
int func (const char *d, dirent ***list, void *sort) {
int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
}
int main() {
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -49,6 +49,7 @@ OTHER CONTRIBUTORS
James Roth
Albrecht Schlosser
Andrea Suatoni
Michael Surette
Paul Sydney
Aaron Ucko
Emanuele Vicentini

27
cairo/CMakeLists.txt Normal file
View File

@ -0,0 +1,27 @@
project(FLTKcairo)
include_directories(${FLTKcairo_SOURCE_DIR})
include_directories(${FLTKcairo_BINARY_DIR})
include_directories(${PKG_CAIRO_INCLUDE_DIRS})
# source files for cairo
set(cairo_SRCS Fl_Cairo.cxx)
#######################################################################
add_library(fltk_cairo ${cairo_SRCS})
if(MSVC)
set_target_properties(fltk_cairo
PROPERTIES
OUTPUT_NAME fltkcairo
DEBUG_OUTPUT_NAME fltkcairod
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_cairo PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
endif(MSVC)
install(TARGETS fltk_cairo
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)

View File

@ -28,8 +28,8 @@
* Where to find files...
*/
#define FLTK_DATADIR "@FLTK_DATADIR@"
#define FLTK_DOCDIR "@FLTK_DOCDIR@"
#define FLTK_DATADIR "@PREFIX_DATA@"
#define FLTK_DOCDIR "@PREFIX_DOC@"
/*
* BORDER_WIDTH:
@ -54,7 +54,7 @@
* OpenGL, and FLTK will be smaller.
*/
#define HAVE_GL @HAVE_GL@
#cmakedefine01 HAVE_GL
/*
* HAVE_GL_GLU_H:
@ -63,7 +63,15 @@
* (many broken Mesa RPMs do not...)
*/
#cmakedefine HAVE_GL_GLU_H @HAVE_GL_GLU_H@
#cmakedefine01 HAVE_GL_GLU_H
/*
* HAVE_GLXGETPROCADDRESSARB:
*
* Do you have the OpenGL glXGetProcAddressARB() function?
*/
#cmakedefine HAVE_GLXGETPROCADDRESSARB
/*
* USE_COLORMAP:
@ -74,13 +82,21 @@
#define USE_COLORMAP 1
/*
* HAVE_XINERAMA
*
* Do we have the Xinerama library to support multi-head displays?
*/
#cmakedefine01 HAVE_XINERAMA
/*
* USE_XFT
*
* Use the new Xft library to draw anti-aliased text.
*/
#define USE_XFT 0
#cmakedefine01 USE_XFT
/*
* HAVE_XDBE:
@ -88,7 +104,7 @@
* Do we have the X double-buffer extension?
*/
#define HAVE_XDBE 0
#cmakedefine01 HAVE_XDBE
/*
* USE_XDBE:
@ -108,19 +124,20 @@
* other operating systems.
*/
#cmakedefine FLTK_APPLE
#ifdef FLTK_APPLE
#cmakedefine FLTK_QUARTZ
#ifdef FLTK_QUARTZ
#define USE_QUARTZ 1
#define __APPLE_QUARTZ__
#undef __APPLE_QD__
#else
#define USE_QUARTZ 0
#undef __APPLE_QUARTZ__
#define __APPLE_QD__
#endif
#endif
#cmakedefine USE_QUARTZ
#cmakedefine __APPLE_QUARTZ__ @__APPLE_QUARTZ__@
#cmakedefine __APPLE_COCOA__ @__APPLE_COCOA__@
#cmakedefine __APPLE_QD__ @__APPLE_QD__@
/*
* USE_X11
*
* Should we use X11 for the current platform
*
*/
#cmakedefine USE_X11 @USE_X11@
/*
* HAVE_OVERLAY:
@ -148,7 +165,7 @@
* Byte order of your machine: 1 = big-endian, 0 = little-endian.
*/
#define WORDS_BIGENDIAN 0
#define WORDS_BIGENDIAN @WORDS_BIGENDIAN@
/*
* U16, U32, U64:
@ -192,7 +209,7 @@
#cmakedefine HAVE_STRLCPY @HAVE_STRLCPY@
/*
* 'locale' functions
* Do we have POSIX locale support?
*/
#cmakedefine HAVE_LOCALE_H @HAVE_LOCALE_H@
@ -204,7 +221,7 @@
* Whether or not select() call has its own header file.
*/
#cmakedefine HAVE_SYS_SELECT_H @HAVE_SYS_SELECT_H@
#cmakedefine01 HAVE_SYS_SELECT_H
/*
* HAVE_SYS_STDTYPES_H:
@ -220,7 +237,7 @@
* Use the poll() call provided on Linux and Irix instead of select()
*/
#define USE_POLL 0
#cmakedefine01 USE_POLL
/*
* Do we have various image libraries?
@ -230,6 +247,23 @@
#cmakedefine HAVE_LIBZ @HAVE_LIBZ@
#cmakedefine HAVE_LIBJPEG @HAVE_LIBJPEG@
/*
* USE_CAIRO
*
* Do we have the cairo library available and want extended cairo use in fltk ?
* will implies to link cairo.lib in all fltk based apps.
*/
#cmakedefine USE_CAIRO @USE_CAIRO@
/*
* HAVE_CAIRO
*
* Do we have the cairo library available?
*/
#cmakedefine HAVE_CAIRO @HAVE_CAIRO@
/*
* Which header file do we include for libpng?
*/
@ -248,19 +282,44 @@
* Do we have POSIX threading?
*/
#cmakedefine CMAKE_USE_PTHREADS
#ifdef CMAKE_USE_PTHREADS
#define HAVE_PTHREAD 1
#else
#define HAVE_PTHREAD 0
#endif
#cmakedefine HAVE_PTHREAD @HAVE_PTHREAD@
#cmakedefine01 HAVE_PTHREAD_H
#cmakedefine CMAKE_HAVE_PTHREAD_H
#ifdef CMAKE_HAVE_PTHREAD_H
#define HAVE_PTHREAD_H 1
/*
* Do we have the ALSA library?
*/
#cmakedefine HAVE_ALSA_ASOUNDLIB_H @HAVE_ALSA_ASOUNDLIB_H@
/*
* Do we have the long long type?
*/
#cmakedefine HAVE_LONG_LONG @HAVE_LONG_LONG@
#ifdef HAVE_LONG_LONG
# define FLTK_LLFMT "%lld"
# define FLTK_LLCAST (long long)
#else
#define HAVE_PTHREAD_H 0
#endif
# define FLTK_LLFMT "%ld"
# define FLTK_LLCAST (long)
#endif /* HAVE_LONG_LONG */
/*
* Do we have the strtoll() function?
*/
#cmakedefine HAVE_STRTOLL @HAVE_STRTOLL@
#ifndef HAVE_STRTOLL
# define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))
#endif /* !HAVE_STRTOLL */
/*
* Do we have the dlsym() function and header?
*/
#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@
#cmakedefine HAVE_DLSYM @HAVE_DLSYM@
/*
* End of "$Id$".

388
fltk-config.cmake.in Normal file
View File

@ -0,0 +1,388 @@
#!/bin/sh
#
# "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $"
#
# FLTK configuration utility.
#
# Copyright 2000-2009 by Bill Spitzak and others.
# Original version Copyright 2000 by James Dean Palmer
# Adapted by Vincent Penne and Michael Sweet
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
#
# Please report all bugs and problems on the following page:
#
# http://www.fltk.org/str.php
#
MAJOR_VERSION=@FLTK_VERSION_MAJOR@
MINOR_VERSION=@FLTK_VERSION_MINOR@
PATCH_VERSION=@FLTK_VERSION_PATCH@
VERSION=@FLTK_VERSION_FULL@
APIVERSION=@FLTK_VERSION@
### BEGIN fltk-config
selfdir=`dirname "$0"`
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
exec_prefix_set=no
bindir=@PREFIX_BIN@
includedir=@CPREFIX_INCLUDE@
libdir=@PREFIX_LIB@
srcdir=.
# compiler names
CC="@CC@"
CXX="@CXX@"
# flags for C++ compiler:
ARCHFLAGS="@OPTION_ARCHFLAGS@"
CFLAGS="@C_FLAGS@"
CXXFLAGS="@CAIROFLAGS@@C_FLAGS@"
LDFLAGS="@LDFLAGS@"
LDLIBS="@LD_LIBS@"
OPTIM="@OPTION_OPTIM@"
CAIROFLAGS="@CAIROFLAGS@"
# Check for local invocation, and update paths accordingly...
if test -f "$selfdir/FL/Fl_Window.H"; then
bindir="$selfdir/fluid"
includedir="$selfdir"
libdir="$selfdir/lib"
if test -f "$libdir/libfltk_jpeg.a"; then
CFLAGS="-I$includedir/jpeg $CFLAGS"
CXXFLAGS="-I$includedir/jpeg $CXXFLAGS"
fi
if test -f "$libdir/libfltk_z.a"; then
CFLAGS="-I$includedir/zlib $CFLAGS"
CXXFLAGS="-I$includedir/zlib $CXXFLAGS"
fi
if test -f "$libdir/libfltk_png.a"; then
CFLAGS="-I$includedir/png $CFLAGS"
CXXFLAGS="-I$includedir/png $CXXFLAGS"
fi
fi
if test -d $includedir/FL/images; then
CFLAGS="-I$includedir/FL/images $CFLAGS"
CXXFLAGS="-I$includedir/FL/images $CXXFLAGS"
fi
if test -f "$libdir/libfltk_cairo.a"; then
CFLAGS="$CAIROFLAGS $CFLAGS"
CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
fi
# libraries to link with:
LIBNAME="@LIBNAME@"
DSONAME="@DSONAME@"
DSOLINK="@DSOLINK@"
IMAGELIBS="@IMAGELIBS@"
STATICIMAGELIBS="@STATICIMAGELIBS@"
CAIROLIBS="@CAIROLIBS@"
SHAREDSUFFIX="@SHAREDSUFFIX@"
usage ()
{
echo "Usage: fltk-config [OPTIONS]
Options:
[--version]
[--api-version]
Options telling what we are doing:
[--use-gl] use GL
[--use-images] use extra image formats (PNG, JPEG)
[--use-glut] use glut compatibility layer
[--use-forms] use forms compatibility layer
[--use-cairo] use cairo graphics lib
Options telling what information we request:
[--cc] return C compiler used to compile FLTK
[--cxx] return C++ compiler used to compile FLTK
[--optim] return compiler optimization used to compile FLTK
[--cflags] return flags to compile C using FLTK
[--cxxflags] return flags to compile C++ using FLTK
[--ldflags] return flags to link against FLTK
[--ldstaticflags] return flags to link against static FLTK library
even if there are DSOs installed
[--libs] return FLTK libraries full path for dependencies
Options to compile and link an application:
[-g] compile the program with debugging information
[-Dname[=value]] compile the program with the given define
[--compile program.cxx]
[--post program] prepare the program for desktop use
"
exit $1
}
if test $# -eq 0; then
usage 1
fi
no_plugins=no
compile=
post=
debug=
# Parse command line options
while test $# -gt 0
do
case "$1" in
-*=*)
optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
;;
*)
optarg=
;;
esac
case $1 in
--version)
echo $VERSION
;;
--api-version)
echo $APIVERSION
;;
--cc)
echo $CC
;;
--cxx)
echo $CXX
;;
--optim)
echo_optim=yes
;;
--use-gl | --use-glut)
use_gl=yes
;;
--use-forms)
use_forms=yes
;;
--use-images)
use_images=yes
;;
--use-cairo)
use_cairo=yes
;;
--cflags)
echo_cflags=yes
;;
--cxxflags)
echo_cxxflags=yes
;;
--ldflags)
echo_ldflags=yes
;;
--ldstaticflags)
echo_ldstaticflags=yes
;;
--libs)
echo_libs=yes
;;
-g)
debug=-g
;;
-D*)
CXXFLAGS="$CXXFLAGS $1"
;;
--compile)
compile="$2"
shift
;;
--post)
post="$2"
shift
;;
*)
echo_help=yes
;;
esac
shift
done
if test "$includedir" != /usr/include; then
includes=-I$includedir
else
includes=
fi
if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
libs=-L$libdir
else
libs=
fi
# Calculate needed libraries
LDSTATIC="$libdir/libfltk.a $LDLIBS"
LDLIBS="-lfltk$SHAREDSUFFIX $LDLIBS"
if test x$use_forms = xyes; then
LDLIBS="-lfltk_forms$SHAREDSUFFIX $LDLIBS"
LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC"
fi
if test x$use_gl = xyes; then
LDLIBS="-lfltk_gl$SHAREDSUFFIX @GLLIB@ $LDLIBS"
LDSTATIC="$libdir/libfltk_gl.a @GLLIB@ $LDSTATIC"
fi
if test x$use_images = xyes; then
LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
LDSTATIC="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC"
fi
if test x$use_cairo = xyes; then
LDLIBS="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS"
LDSTATIC="$libdir/libfltk_cairo.a $CAIROLIBS $LDSTATIC"
fi
LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS"
LDSTATIC="$LDFLAGS $LDSTATIC"
# Answer to user requests
if test -n "$echo_help"; then
usage 1
fi
if test -n "$compile"; then
case "$compile" in
*.cxx)
prog="`basename \"$compile\" .cxx`"
;;
*.cpp)
prog="`basename \"$compile\" .cpp`"
;;
*.cc)
prog="`basename \"$compile\" .cc`"
;;
*.C)
prog="`basename \"$compile\" .C`"
;;
*)
echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
exit 1
;;
esac
post="$prog"
echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
$CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1
fi
if test -n "$post"; then
case "`uname`" in
Darwin)
echo Creating "'$post.app'" bundle for desktop...
id=`echo $post | tr ' ' '_'`
# Make the bundle directory and move the executable there
rm -rf "$post.app/Contents/MacOS"
mkdir -p "$post.app/Contents/MacOS"
mv "$post" "$post.app/Contents/MacOS"
# Make a shell script that runs the bundled executable
echo "#!/bin/sh" >"$post"
echo 'dir="`dirname '"'"'$0'"'"'`"' >>"$post"
echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post"
chmod +x "$post"
# Make the simplest Info.plist needed for an application
cat >"$post.app/Contents/Info.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<plist version="0.9">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>$post</string>
<key>CFBundleIdentifier</key>
<string>org.fltk.$id</string>
<key>CFBundleName</key>
<string>$post</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>
EOF
;;
esac
fi
if test "$echo_cflags" = "yes"; then
echo $includes $CFLAGS
fi
if test "$echo_cxxflags" = "yes"; then
echo $includes $CXXFLAGS
fi
if test "$echo_optim" = "yes"; then
echo $OPTIM
fi
if test "$echo_ldflags" = "yes"; then
my_libs=
libdirs=$libs
for i in $LDLIBS ; do
if test $i != -L$libdir ; then
if test -z "$my_libs" ; then
my_libs="$i"
else
my_libs="$my_libs $i"
fi
fi
done
echo $libdirs $my_libs
fi
if test "$echo_ldstaticflags" = "yes"; then
echo $LDSTATIC
fi
if test "$echo_libs" = "yes"; then
echo $libdir/libfltk.a
if test x$use_forms = xyes; then
echo $libdir/libfltk_forms.a
fi
if test x$use_gl = xyes; then
echo $libdir/libfltk_gl.a
fi
if test x$use_cairo = xyes; then
echo $libdir/libfltk_cairo.a
fi
if test x$use_images = xyes; then
echo $libdir/libfltk_images.a
for lib in fltk_jpeg fltk_png fltk_z; do
if test -f $libdir/lib$lib.a; then
echo $libdir/lib$lib.a
fi
done
fi
fi
#
# End of "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $".
#

View File

@ -1,4 +1,5 @@
SET(CPPFILES
set(CPPFILES
CodeEditor.cxx
Fl_Function_Type.cxx
Fl_Group_Type.cxx
@ -20,11 +21,28 @@ SET(CPPFILES
widget_panel.cxx
)
add_executable(fluid ${CPPFILES})
target_link_libraries(fluid fltk fltk_images fltk_forms)
ADD_EXECUTABLE(fluid ${CPPFILES})
INSTALL_TARGETS(/bin fluid)
TARGET_LINK_LIBRARIES(fluid fltk fltk_images fltk_forms ${FLTK_PLATFORM_DEPENDENT_LIBS})
IF(OPENGL_FOUND)
TARGET_LINK_LIBRARIES(fluid fltk_gl)
ENDIF(OPENGL_FOUND)
# link in optional libraries
if(HAVE_CAIRO)
target_link_libraries(fluid fltk_cairo)
endif(HAVE_CAIRO)
if(FLTK_USE_GL)
target_link_libraries(fluid fltk_gl)
target_link_libraries(fluid ${OPENGL_LIBRARIES})
endif(FLTK_USE_GL)
if(USE_XFT)
target_link_libraries(fluid ${X11_Xft_LIB})
endif(USE_XFT)
if(HAVE_XINERAMA)
target_link_libraries(fluid ${X11_Xinerama_LIB})
endif(HAVE_XINERAMA)
install(TARGETS fluid
EXPORT fltk-install
DESTINATION ${PREFIX_BIN}
)

View File

@ -1,36 +1,51 @@
PROJECT(FLTKJPEG)
project(FLTKJPEG)
INCLUDE_REGULAR_EXPRESSION("^(jchuff|jconfig|jdct|jdhuff|jerror|jinclude|jmemsys|jmorecfg|jpegint|jpeglib|jversion|jpeg).*$")
include_regular_expression("^j.*[.][c|h]$")
INCLUDE_DIRECTORIES(${FLTKJPEG_SOURCE_DIR})
INCLUDE_DIRECTORIES(${FLTKJPEG_BINARY_DIR})
include_directories(${FLTKJPEG_SOURCE_DIR})
include_directories(${FLTKJPEG_BINARY_DIR})
# memmgr back ends: compile only one of these into a working library
# (For now, let's use the mode that requires the image fit into memory.
# This is the recommended mode for Win32 anyway.)
SET(systemdependent_SRCS jmemnobs.c)
set(systemdependent_SRCS jmemnobs.c)
# library object files common to compression and decompression
SET(common_SRCS
jcomapi.c jutils.c jerror.c jmemmgr.c
set(common_SRCS
jcomapi.c jutils.c jerror.c jmemmgr.c
)
# compression library object files
SET(compression_SRCS
jcapimin.c jcapistd.c jctrans.c jcparam.c jdatadst.c jcinit.c
jcmaster.c jcmarker.c jcmainct.c jcprepct.c jccoefct.c jccolor.c
jcsample.c jchuff.c jcphuff.c jcdctmgr.c jfdctfst.c jfdctflt.c
jfdctint.c
set(compression_SRCS
jcapimin.c jcapistd.c jctrans.c jcparam.c jdatadst.c jcinit.c
jcmaster.c jcmarker.c jcmainct.c jcprepct.c jccoefct.c jccolor.c
jcsample.c jchuff.c jcphuff.c jcdctmgr.c jfdctfst.c jfdctflt.c
jfdctint.c
)
# decompression library object files
SET(decompression_SRCS
jdapimin.c jdapistd.c jdtrans.c jdatasrc.c jdmaster.c
jdinput.c jdmarker.c jdhuff.c jdphuff.c jdmainct.c jdcoefct.c
jdpostct.c jddctmgr.c jidctfst.c jidctflt.c jidctint.c jidctred.c
jdsample.c jdcolor.c jquant1.c jquant2.c jdmerge.c
set(decompression_SRCS
jdapimin.c jdapistd.c jdtrans.c jdatasrc.c jdmaster.c
jdinput.c jdmarker.c jdhuff.c jdphuff.c jdmainct.c jdcoefct.c
jdpostct.c jddctmgr.c jidctfst.c jidctflt.c jidctint.c jidctred.c
jdsample.c jdcolor.c jquant1.c jquant2.c jdmerge.c
)
ADD_LIBRARY(fltk_jpeg ${systemdependent_SRCS} ${common_SRCS} ${compression_SRCS} ${decompression_SRCS})
INSTALL_TARGETS(/lib fltk_jpeg)
#######################################################################
add_library(fltk_jpeg ${systemdependent_SRCS} ${common_SRCS} ${compression_SRCS} ${decompression_SRCS})
if(MSVC)
set_target_properties(fltk_jpeg
PROPERTIES
OUTPUT_NAME fltkjpeg
DEBUG_OUTPUT_NAME fltkjpegd
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_jpeg PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
endif(MSVC)
install(TARGETS fltk_jpeg
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)

View File

@ -1,30 +1,35 @@
PROJECT(FLTKPNG)
INCLUDE_REGULAR_EXPRESSION("^png.*$")
project(FLTKPNG)
include_regular_expression("^png.*[.][c|h]$")
INCLUDE_DIRECTORIES(${FLTKZLIB_SOURCE_DIR})
include_directories(${FLTKZLIB_SOURCE_DIR})
include_directories(${ZLIB_INCLUDE_DIR})
IF(ZLIB_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ENDIF(ZLIB_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${FLTKPNG_SOURCE_DIR})
INCLUDE_DIRECTORIES(${FLTKPNG_BINARY_DIR})
include_directories(${FLTKPNG_SOURCE_DIR})
include_directories(${FLTKPNG_BINARY_DIR})
# source files for png
SET(PNG_SRCS
set(PNG_SRCS
pngget.c pngrio.c pngwrite.c
png.c pngmem.c pngrtran.c pngtrans.c pngwtran.c
pngerror.c pngpread.c pngrutil.c pngwutil.c
pngread.c pngset.c pngwio.c
)
)
ADD_LIBRARY(fltk_png ${PNG_SRCS})
INSTALL_TARGETS(/lib fltk_png)
#######################################################################
add_library(fltk_png ${PNG_SRCS})
if(MSVC)
set_target_properties(fltk_png PROPERTIES OUTPUT_NAME fltkpng)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_png PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_png PROPERTIES OUTPUT_NAME fltk_png)
endif(MSVC)
IF(UNIX)
TARGET_LINK_LIBRARIES(fltk_png ${FLTK_ZLIB_LIBRARIES} -lm)
ELSE(UNIX)
TARGET_LINK_LIBRARIES(fltk_png ${FLTK_ZLIB_LIBRARIES})
ENDIF(UNIX)
target_link_libraries(fltk_png ${FLTK_ZLIB_LIBRARIES})
install(TARGETS fltk_png
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)

View File

@ -1,5 +1,8 @@
SET(CPPFILES
include_regular_expression("[.][cxx|c|h]$")
set(CPPFILES
Fl.cxx
Fl_Abstract_Printer.cxx
Fl_Adjuster.cxx
Fl_Bitmap.cxx
Fl_Browser.cxx
@ -14,6 +17,7 @@ SET(CPPFILES
Fl_Clock.cxx
Fl_Color_Chooser.cxx
Fl_Counter.cxx
Fl_Device.cxx
Fl_Dial.cxx
Fl_Double_Window.cxx
Fl_File_Browser.cxx
@ -41,6 +45,7 @@ SET(CPPFILES
Fl_Pack.cxx
Fl_Pixmap.cxx
Fl_Positioner.cxx
Fl_Printer.cxx
Fl_Preferences.cxx
Fl_Progress.cxx
Fl_Repeat_Button.cxx
@ -131,21 +136,25 @@ SET(CPPFILES
fl_show_colormap.cxx
fl_symbols.cxx
fl_vertex.cxx
ps_image.cxx
screen_xywh.cxx
fl_utf8.cxx
fl_encoding_latin1.cxx
fl_encoding_mac_roman.cxx
)
SET(FLCPPFILES
)
set(FLCPPFILES
forms_compatability.cxx
forms_bitmap.cxx
forms_free.cxx
forms_fselect.cxx
forms_pixmap.cxx
forms_timer.cxx
)
SET(GLCPPFILES
)
set(GLCPPFILES
Fl_Gl_Choice.cxx
Fl_Gl_Device_Plugin.cxx
Fl_Gl_Overlay.cxx
Fl_Gl_Window.cxx
freeglut_geometry.cxx
@ -156,8 +165,9 @@ SET(GLCPPFILES
gl_start.cxx
glut_compatability.cxx
glut_font.cxx
)
SET(IMGCPPFILES
)
set(IMGCPPFILES
fl_images_core.cxx
Fl_BMP_Image.cxx
Fl_File_Icon2.cxx
@ -166,10 +176,9 @@ SET(IMGCPPFILES
Fl_JPEG_Image.cxx
Fl_PNG_Image.cxx
Fl_PNM_Image.cxx
)
)
SET(CFILES
fl_call_main.c
set(CFILES
flstring.c
scandir.c
numericsort.c
@ -182,45 +191,256 @@ SET(CFILES
xutf8/utf8Wrap.c
xutf8/keysym2Ucs.c
fl_utf.c
)
)
ADD_LIBRARY(fltk ${CPPFILES} ${CFILES})
INSTALL_TARGETS(/lib fltk)
SET_TARGET_PROPERTIES(fltk
PROPERTIES
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH})
if(APPLE)
set_source_file_properties(Fl.cxx
PROPERTIES COMPILE_FLAGS "-x objective-c++")
endif(APPLE)
TARGET_LINK_LIBRARIES(fltk ${FLTK_PLATFORM_DEPENDENT_LIBS} ${CMAKE_THREAD_LIBS_INIT})
#######################################################################
add_library(fltk STATIC ${CPPFILES} ${CFILES} fl_call_main.c)
set_target_properties(fltk PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(MSVC)
if(OPTION_LARGE_FILE)
set_target_properties(fltk PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif()
set_target_properties(fltk
PROPERTIES
OUTPUT_NAME fltk
DEBUG_OUTPUT_NAME fltkd
)
endif(MSVC)
IF(X11_FOUND)
TARGET_LINK_LIBRARIES(fltk ${X11_LIBRARIES})
ENDIF(X11_FOUND)
if(USE_THREADS)
target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT})
endif(USE_THREADS)
IF(OPENGL_FOUND)
ADD_LIBRARY(fltk_gl ${GLCPPFILES})
INSTALL_TARGETS(/lib fltk_gl)
TARGET_LINK_LIBRARIES(fltk_gl fltk ${OPENGL_LIBRARIES})
SET_TARGET_PROPERTIES(fltk_gl
PROPERTIES
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH})
ENDIF(OPENGL_FOUND)
if(USE_X11)
target_link_libraries(fltk ${X11_LIBRARIES})
endif(USE_X11)
ADD_LIBRARY(fltk_forms ${FLCPPFILES})
INSTALL_TARGETS(/lib fltk_forms)
TARGET_LINK_LIBRARIES(fltk_forms fltk)
SET_TARGET_PROPERTIES(fltk_forms
PROPERTIES
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH})
if(WIN32)
target_link_libraries(fltk comctl32)
endif(WIN32)
ADD_LIBRARY(fltk_images ${IMGCPPFILES})
INSTALL_TARGETS(/lib fltk_images)
TARGET_LINK_LIBRARIES(fltk_images fltk ${FLTK_PNG_LIBRARIES}
if(HAVE_CAIRO)
target_link_libraries(fltk fltk_cairo ${PKG_CAIRO_LIBRARIES})
ENDif(HAVE_CAIRO)
if(USE_XINERAMA)
target_link_libraries(fltk ${X11_Xinerama_LIB})
endif(USE_XINERAMA)
if(USE_XFT)
target_link_libraries(fltk ${X11_Xft_LIB})
endif(USE_XFT)
if(LIB_fontconfig)
target_link_libraries(fltk ${LIB_fontconfig})
endif(LIB_fontconfig)
#######################################################################
add_library(fltk_forms STATIC ${FLCPPFILES})
target_link_libraries(fltk_forms fltk)
set_target_properties(fltk_forms
PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
if(MSVC)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_forms PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif()
set_target_properties(fltk_forms
PROPERTIES
OUTPUT_NAME fltkforms
DEBUG_OUTPUT_NAME fltkformsd
)
endif(MSVC)
#######################################################################
add_library(fltk_images STATIC ${IMGCPPFILES})
target_link_libraries(fltk_images fltk ${FLTK_PNG_LIBRARIES}
${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES})
SET_TARGET_PROPERTIES(fltk_images
PROPERTIES
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH})
set_target_properties(fltk_images PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(MSVC)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_images PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif()
set_target_properties(fltk_images
PROPERTIES
OUTPUT_NAME fltkimages
DEBUG_OUTPUT_NAME fltkimagesd
)
endif(MSVC)
#######################################################################
install(TARGETS fltk fltk_forms fltk_images
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)
#######################################################################
if(OPENGL_FOUND)
add_library(fltk_gl STATIC ${GLCPPFILES})
target_link_libraries(fltk_gl fltk ${OPENGL_LIBRARIES})
set_target_properties(fltk_gl PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(MSVC)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_gl PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif()
set_target_properties(fltk_gl
PROPERTIES
OUTPUT_NAME fltkgl
DEBUG_OUTPUT_NAME fltkgld
)
endif(MSVC)
install(TARGETS fltk_gl
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)
endif(OPENGL_FOUND)
#######################################################################
#######################################################################
if(OPTION_BUILD_SHARED_LIBS)
#######################################################################
add_library(fltk_SHARED SHARED ${CPPFILES} ${CFILES})
set_target_properties(fltk_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH}
)
if(MSVC)
set_target_properties(fltk_SHARED
PROPERTIES
OUTPUT_NAME fltkdll
DEBUG_OUTPUT_NAME fltkdlld
COMPILE_DEFINITIONS "FL_DLL;FL_LIBRARY"
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_SHARED PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_SHARED PROPERTIES OUTPUT_NAME fltk)
endif(MSVC)
if(USE_THREADS)
target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT})
endif(USE_THREADS)
if(USE_X11)
target_link_libraries(fltk_SHARED ${X11_LIBRARIES})
endif(USE_X11)
if(WIN32)
target_link_libraries(fltk_SHARED comctl32)
endif(WIN32)
if(HAVE_CAIRO)
target_link_libraries(fltk_SHARED fltk_cairo ${PKG_CAIRO_LIBRARIES})
ENDif(HAVE_CAIRO)
if(USE_XINERAMA)
target_link_libraries(fltk_SHARED ${X11_Xinerama_LIB})
endif(USE_XINERAMA)
if(USE_XFT)
target_link_libraries(fltk_SHARED ${X11_Xft_LIB})
endif(USE_XFT)
if(LIB_fontconfig)
target_link_libraries(fltk_SHARED ${LIB_fontconfig})
endif(LIB_fontconfig)
#######################################################################
add_library(fltk_forms_SHARED SHARED ${FLCPPFILES})
target_link_libraries(fltk_forms_SHARED fltk)
set_target_properties(fltk_forms_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH}
)
if(MSVC)
set_target_properties(fltk_forms_SHARED
PROPERTIES
OUTPUT_NAME fltkformsdll
DEBUG_OUTPUT_NAME fltkformsdlld
COMPILE_DEFINITIONS "FL_DLL;FL_LIBRARY"
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_forms_SHARED PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_forms_SHARED PROPERTIES OUTPUT_NAME fltk_forms)
endif(MSVC)
if(USE_THREADS)
target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT})
endif(USE_THREADS)
if(USE_X11)
target_link_libraries(fltk_SHARED ${X11_LIBRARIES})
endif(USE_X11)
#######################################################################
add_library(fltk_images_SHARED SHARED ${IMGCPPFILES})
target_link_libraries(fltk_images_SHARED fltk
${FLTK_PNG_LIBRARIES} ${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES}
)
set_target_properties(fltk_images_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH}
)
if(MSVC)
set_target_properties(fltk_images_SHARED
PROPERTIES
OUTPUT_NAME fltkimagesdll
DEBUG_OUTPUT_NAME fltkimagesdlld
COMPILE_DEFINITIONS "FL_DLL;FL_LIBRARY"
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_images_SHARED PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_images_SHARED PROPERTIES OUTPUT_NAME fltk_images)
endif(MSVC)
#######################################################################
install(TARGETS fltk_SHARED fltk_forms_SHARED fltk_images_SHARED
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)
#######################################################################
if(OPENGL_FOUND)
add_library(fltk_gl_SHARED SHARED ${GLCPPFILES})
target_link_libraries(fltk_gl_SHARED fltk ${OPENGL_LIBRARIES})
set_target_properties(fltk_gl_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
SOVERSION ${FLTK_VERSION_PATCH}
)
if(MSVC)
set_target_properties(fltk_gl_SHARED
PROPERTIES
OUTPUT_NAME fltkgldll
DEBUG_OUTPUT_NAME fltkgldlld
COMPILE_DEFINITIONS "FL_DLL;FL_LIBRARY"
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_gl_SHARED PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
else()
set_target_properties(fltk_gl_SHARED PROPERTIES OUTPUT_NAME fltk_gl)
endif(MSVC)
install(TARGETS fltk_gl_SHARED
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)
endif(OPENGL_FOUND)
endif(OPTION_BUILD_SHARED_LIBS)

View File

@ -1,31 +1,45 @@
MACRO(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
SET(srcs)
FOREACH(src ${SOURCES})
IF("${src}" MATCHES ".fl$")
GET_FILENAME_COMPONENT(fname ${src} NAME_WE)
SET(fluid_name "${CMAKE_CURRENT_SOURCE_DIR}/${fname}.fl")
SET(cxx_name "${CMAKE_CURRENT_BINARY_DIR}/${fname}.cxx")
SET(h_name "${CMAKE_CURRENT_BINARY_DIR}/${fname}.cxx")
SET(srcs ${srcs} "${cxx_name}")
ADD_CUSTOM_COMMAND(
OUTPUT ${cxx_name}
DEPENDS "${fluid_name}" "${FLUID_COMMAND}"
COMMAND ${FLUID_COMMAND}
ARGS -c ${fluid_name})
ADD_CUSTOM_COMMAND(
OUTPUT ${h_name}
DEPENDS "${fluid_name}" "${FLUID_COMMAND}"
COMMAND ${FLUID_COMMAND}
ARGS -c ${fluid_name})
ELSE("${src}" MATCHES ".fl$")
SET(srcs ${srcs} ${src})
ENDIF("${src}" MATCHES ".fl$")
ENDFOREACH(src)
ADD_EXECUTABLE(${NAME} ${srcs})
TARGET_LINK_LIBRARIES(${NAME} ${LIBRARIES})
ENDMACRO(CREATE_EXAMPLE)
set(EXECUTABLE_OUTPUT_PATH ${FLTK_BINARY_DIR}/bin/examples)
INCLUDE_DIRECTORIES(
macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
set(srcs)
set(flsrcs)
foreach(src ${SOURCES})
if("${src}" MATCHES ".fl$")
list(APPEND flsrcs ${src})
else()
list(APPEND srcs ${src})
endif("${src}" MATCHES ".fl$")
endforeach(src)
if(flsrcs)
fltk_wrap_ui(${NAME} ${flsrcs})
endif(flsrcs)
add_executable(${NAME} WIN32 ${srcs} ${${NAME}_FLTK_UI_SRCS})
if(flsrcs)
add_dependencies(${NAME} ${FLTK_FLUID_EXECUTABLE})
endif(flsrcs)
target_link_libraries(${NAME} ${LIBRARIES})
# link in optional libraries
if(HAVE_CAIRO)
target_link_libraries(${NAME} fltk_cairo)
endif(HAVE_CAIRO)
if(USE_XFT)
target_link_libraries(${NAME} ${X11_Xft_LIB})
endif(USE_XFT)
if(HAVE_XINERAMA)
target_link_libraries(${NAME} ${X11_Xinerama_LIB})
endif(HAVE_XINERAMA)
install(TARGETS ${NAME}
DESTINATION ${PREFIX_DOC}/examples
)
endmacro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
@ -45,6 +59,7 @@ CREATE_EXAMPLE(color_chooser color_chooser.cxx fltk)
CREATE_EXAMPLE(cursor cursor.cxx fltk)
CREATE_EXAMPLE(curve curve.cxx fltk)
CREATE_EXAMPLE(demo demo.cxx "fltk;fltk_forms")
CREATE_EXAMPLE(device device.cxx fltk)
CREATE_EXAMPLE(doublebuffer doublebuffer.cxx fltk)
CREATE_EXAMPLE(editor editor.cxx fltk)
CREATE_EXAMPLE(fast_slow fast_slow.fl fltk)
@ -85,11 +100,12 @@ CREATE_EXAMPLE(threads threads.cxx fltk)
CREATE_EXAMPLE(tile tile.cxx fltk)
CREATE_EXAMPLE(tiled_image tiled_image.cxx fltk)
CREATE_EXAMPLE(tree tree.cxx fltk)
CREATE_EXAMPLE(utf8 utf8.cxx fltk)
CREATE_EXAMPLE(valuators valuators.fl fltk)
CREATE_EXAMPLE(unittests unittests.cxx fltk)
# OpenGL demos...
IF(OPENGL_FOUND)
if(OPENGL_FOUND)
CREATE_EXAMPLE(CubeView "CubeMain.cxx;CubeView.cxx;CubeViewUI.fl" "fltk;fltk_gl")
CREATE_EXAMPLE(cube cube.cxx "fltk;fltk_gl;${OPENGL_LIBRARIES}")
CREATE_EXAMPLE(fractals "fractals.cxx;fracviewer.cxx" "fltk;fltk_gl")
@ -97,4 +113,5 @@ CREATE_EXAMPLE(fullscreen fullscreen.cxx "fltk;fltk_gl")
CREATE_EXAMPLE(glpuzzle glpuzzle.cxx "fltk;fltk_gl;${OPENGL_LIBRARIES}")
CREATE_EXAMPLE(gl_overlay gl_overlay.cxx "fltk;fltk_gl;${OPENGL_LIBRARIES}")
CREATE_EXAMPLE(shape shape.cxx "fltk;fltk_gl;${OPENGL_LIBRARIES}")
ENDIF(OPENGL_FOUND)
endif(OPENGL_FOUND)

View File

@ -1,15 +1,30 @@
PROJECT(FLTKZLIB)
INCLUDE_REGULAR_EXPRESSION("^(deflate|inf|trees|zconf|zlib|zutil).*$")
project(FLTKZLIB)
include_regular_expression(regex_match "[.][h|c]$")
INCLUDE_DIRECTORIES(${FLTKZLIB_SOURCE_DIR})
INCLUDE_DIRECTORIES(${FLTKZLIB_BINARY_DIR})
include_directories(${FLTKZLIB_SOURCE_DIR})
include_directories(${FLTKZLIB_BINARY_DIR})
# source files for zlib
SET(ZLIB_SRCS
adler32.c compress.c crc32.c deflate.c gzio.c inffast.c
inflate.c inftrees.c trees.c uncompr.c zutil.c
set(ZLIB_SRCS
adler32.c compress.c crc32.c deflate.c gzio.c inffast.c
inflate.c inftrees.c trees.c uncompr.c zutil.c
)
ADD_LIBRARY(fltk_zlib ${ZLIB_SRCS})
INSTALL_TARGETS(/lib fltk_zlib)
#######################################################################
add_library(fltk_z ${ZLIB_SRCS})
if(MSVC)
set_target_properties(fltk_z
PROPERTIES
OUTPUT_NAME zlib
DEBUG_OUTPUT_NAME zlibd
)
if(OPTION_LARGE_FILE)
set_target_properties(fltk_z PROPERTIES LINK_FLAGS /LARGEADDRESSAWARE)
endif(OPTION_LARGE_FILE)
endif(MSVC)
install(TARGETS fltk_z
EXPORT fltk-install
DESTINATION ${PREFIX_LIB}
)