Hello, Oops, my former patch contained backup files. It's no big issue but it's not nice. This patch only contains the useful stuff.
On Thu, Aug 13, 2009 at 12:13 AM, Pau Garcia i Quiles<[email protected]> wrote: > Hello, > > The attached patch provides a CMake build system for libwv2 trunk. > > I have only tested it on Linux (Kubuntu Jaunty) because on this > computer I don't have Windows. Please, test it and tell me if you find > any issue. Instructions are available in the INSTALL.cmake file. I'd > like to submit it upstream when it's ready. > > On Sun, Aug 9, 2009 at 7:14 PM, C. Boemann<[email protected]> wrote: >> great >> >> On Sunday 09 August 2009 19:13:44 Pau Garcia i Quiles wrote: >>> Hello, >>> >>> > But I would very much appreciate it if you turned it into cmake based. >>> >>> I'm working on it > > > > -- > Pau Garcia i Quiles > http://www.elpauer.org > (Due to my workload, I may need 10 days to answer) > -- Pau Garcia i Quiles http://www.elpauer.org (Due to my workload, I may need 10 days to answer)
diff -rupdN wvware.orig/cmake/FindGLIB2.cmake wvware.cmake/cmake/FindGLIB2.cmake --- wvware.orig/cmake/FindGLIB2.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/cmake/FindGLIB2.cmake 2009-08-09 21:54:32.000000000 +0200 @@ -0,0 +1,50 @@ +# - Try to find the GLIB2 libraries +# Once done this will define +# +# GLIB2_FOUND - system has glib2 +# GLIB2_INCLUDE_DIR - the glib2 include directory +# GLIB2_LIBRARIES - glib2 library + +# Copyright (c) 2008 Laurent Montel, <[email protected]> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) + # Already in cache, be silent + set(GLIB2_FIND_QUIETLY TRUE) +endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) + +if (NOT WIN32) + include(UsePkgConfig) + pkgconfig(glib-2.0 _LibGLIB2IncDir _LibGLIB2LinkDir _LibGLIB2LinkFlags _LibGLIB2Cflags) +endif(NOT WIN32) + +find_path(GLIB2_MAIN_INCLUDE_DIR glib.h + PATH_SUFFIXES glib-2.0 + PATHS ${_LibGLIB2IncDir} ) + +# search the glibconfig.h include dir under the same root where the library is found +find_library(GLIB2_LIBRARIES + NAMES glib-2.0 + PATHS ${_LibGLIB2LinkDir} ) + +get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH) + +find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h + PATH_SUFFIXES glib-2.0/include + PATHS ${_LibGLIB2IncDir} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) + +set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}") + +# not sure if this include dir is optional or required +# for now it is optional +if(GLIB2_INTERNAL_INCLUDE_DIR) + set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}") +endif(GLIB2_INTERNAL_INCLUDE_DIR) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR) + +mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES) diff -rupdN wvware.orig/cmake/FindIconv.cmake wvware.cmake/cmake/FindIconv.cmake --- wvware.orig/cmake/FindIconv.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/cmake/FindIconv.cmake 2009-08-09 18:01:18.000000000 +0200 @@ -0,0 +1,57 @@ +# - Try to find Iconv +# Once done this will define +# +# ICONV_FOUND - system has Iconv +# ICONV_INCLUDE_DIR - the Iconv include directory +# ICONV_LIBRARIES - Link these to use Iconv +# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const +# +include(CheckCXXSourceCompiles) + +IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + # Already in cache, be silent + SET(ICONV_FIND_QUIETLY TRUE) +ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +FIND_PATH(ICONV_INCLUDE_DIR iconv.h) + +FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c) + +IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + SET(ICONV_FOUND TRUE) +ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) +set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) +IF(ICONV_FOUND) + check_cxx_source_compiles(" + #include <iconv.h> + int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; + } +" ICONV_SECOND_ARGUMENT_IS_CONST ) +ENDIF(ICONV_FOUND) +set(CMAKE_REQUIRED_INCLUDES) +set(CMAKE_REQUIRED_LIBRARIES) + +IF(ICONV_FOUND) + IF(NOT ICONV_FIND_QUIETLY) + MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") + ENDIF(NOT ICONV_FIND_QUIETLY) +ELSE(ICONV_FOUND) + IF(Iconv_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Iconv") + ENDIF(Iconv_FIND_REQUIRED) +ENDIF(ICONV_FOUND) + +MARK_AS_ADVANCED( + ICONV_INCLUDE_DIR + ICONV_LIBRARIES + ICONV_SECOND_ARGUMENT_IS_CONST +) diff -rupdN wvware.orig/cmake/FindLIBGSF.cmake wvware.cmake/cmake/FindLIBGSF.cmake --- wvware.orig/cmake/FindLIBGSF.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/cmake/FindLIBGSF.cmake 2009-08-09 21:51:29.000000000 +0200 @@ -0,0 +1,57 @@ +# - Try to find libGSF +# +# Once done this will define +# +# LIBGSF_FOUND - System has LibGSF +# LIBGSF_INCLUDE_DIR - The LibGSF include directory +# LIBGSF_LIBRARIES - The libraries needed to use LibGSF +# LIBGSF_DEFINITIONS - Compiler switches required for using LibGSF +# LIBGSF_GSF_EXECUTABLE - The archive utility +# LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE - The office files thumbnailer for the GNOME desktop +# LIBGSF_GSFVBADUMP_EXECUTABLE - The utility to extract Visual Basic for Applications macros + +# Copyright (c) 2009, Pau Garcia i Quiles <[email protected]> +# Based off FindLibXml2.cmake from CMake 2.6.4 by Alexander Neundorf <[email protected]> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +IF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES) + # in cache already + SET(LIBGSF_FIND_QUIETLY TRUE) +ENDIF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES) + +IF (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PC_LIBGSF libgsf-1) + SET(LIBGSF_DEFINITIONS ${PC_LIBGSF_CFLAGS_OTHER}) +ENDIF (NOT WIN32) + +FIND_PATH(LIBGSF_INCLUDE_DIR gsf/gsf.h + HINTS + ${PC_LIBGSF_INCLUDEDIR} + ${PC_LIBGSF_INCLUDE_DIRS} + PATH_SUFFIXES libgsf-1 + ) + +FIND_LIBRARY(LIBGSF_LIBRARIES NAMES gsf-1 libgsf-1 + HINTS + ${PC_LIBGSF_LIBDIR} + ${PC_LIBGSF_LIBRARY_DIRS} + ) + +FIND_PROGRAM(LIBGSF_GSF_EXECUTABLE gsf) +FIND_PROGRAM(LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE gsf-office-thumbnailer) +FIND_PROGRAM(LIBGSF_GSFVBADUMP_EXECUTABLE gsf-vba-dump) + +INCLUDE(FindPackageHandleStandardArgs) + +# handle the QUIETLY and REQUIRED arguments and set LIBGSF_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGSF DEFAULT_MSG LIBGSF_LIBRARIES LIBGSF_INCLUDE_DIR) + +MARK_AS_ADVANCED(LIBGSF_INCLUDE_DIR LIBGSF_LIBRARIES LIBGSF_GSF_EXECUTABLE LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE LIBGSF_GSFVBADUMP_EXECUTABLE ) + diff -rupdN wvware.orig/cmake/generate_converter.cmake wvware.cmake/cmake/generate_converter.cmake --- wvware.orig/cmake/generate_converter.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/cmake/generate_converter.cmake 2009-08-11 16:44:36.000000000 +0200 @@ -0,0 +1,7 @@ +EXECUTE_PROCESS( COMMAND perl converter.pl generator_wword6.htm generator_wword8.htm + WORKING_DIRECTORY ${GENERATOR_DIR} ) + +SET( generated_files convert.cpp convert.h ) +FOREACH( F ${generated_files} ) + EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ../${F} WORKING_DIRECTORY ${GENERATOR_DIR} ) +ENDFOREACH( F ) diff -rupdN wvware.orig/cmake/generate_scanner.cmake wvware.cmake/cmake/generate_scanner.cmake --- wvware.orig/cmake/generate_scanner.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/cmake/generate_scanner.cmake 2009-08-11 16:47:40.000000000 +0200 @@ -0,0 +1,15 @@ +EXECUTE_PROCESS( COMMAND perl generate.pl generator_wword6.htm Word95 + WORKING_DIRECTORY ${GENERATOR_DIR} ) + +EXECUTE_PROCESS( COMMAND perl generate.pl generator_wword8.htm Word97 + WORKING_DIRECTORY ${GENERATOR_DIR} ) + +SET( generated_files word95_generated.h word95_generated.cpp word97_generated.h word97_generated.cpp ) +FOREACH( F ${generated_files} ) + EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ../${F} WORKING_DIRECTORY ${GENERATOR_DIR} ) +ENDFOREACH( F ) + +SET( generated_tests word95_test.cpp word97_test.cpp ) +FOREACH( T ${generated_tests} ) + EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${T} ../../tests/${T} WORKING_DIRECTORY ${GENERATOR_DIR} ) +ENDFOREACH( T ) diff -rupdN wvware.orig/cmake/MacroCreateLibtoolFile.cmake wvware.cmake/cmake/MacroCreateLibtoolFile.cmake --- wvware.orig/cmake/MacroCreateLibtoolFile.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/cmake/MacroCreateLibtoolFile.cmake 2009-08-12 19:19:49.000000000 +0200 @@ -0,0 +1,53 @@ +# MacroCreateLibtoolFile.cmake +# http://www.cmake.org/Wiki/CMakeMacroLibtoolFile + +MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_value) + GET_TARGET_PROPERTY (${_variable} ${_target} ${_property}) + IF (${_variable} MATCHES NOTFOUND) + SET (${_variable} ${_default_value}) + ENDIF (${_variable} MATCHES NOTFOUND) +ENDMACRO (GET_TARGET_PROPERTY_WITH_DEFAULT) + +MACRO(CREATE_LIBTOOL_FILE _target _install_DIR) + GET_TARGET_PROPERTY(_target_location ${_target} LOCATION) + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_static_lib ${_target} STATIC_LIB "") + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dependency_libs ${_target} LT_DEPENDENCY_LIBS "") + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_current ${_target} LT_VERSION_CURRENT 0) + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_age ${_target} LT_VERSION_AGE 0) + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_revision ${_target} LT_VERSION_REVISION 0) + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_installed ${_target} LT_INSTALLED yes) + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes) + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "") + GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "") + GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE) + GET_FILENAME_COMPONENT(_soname ${_target_location} NAME) + SET(_laname ${PROJECT_BINARY_DIR}/${_laname}.la) + FILE(WRITE ${_laname} "# ${_laname} - a libtool library file\n") + FILE(WRITE ${_laname} "# Generated by CMake ${CMAKE_VERSION} (like GNU libtool)\n") + FILE(WRITE ${_laname} "\n# Please DO NOT delete this file!\n# It is necessary for linking the library with libtool.\n\n" ) + FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n") + FILE(APPEND ${_laname} "dlname='${_soname}'\n\n") + FILE(APPEND ${_laname} "# Names of this library.\n") + FILE(APPEND ${_laname} "library_names='${_soname}.${_target_current}.${_target_age}.${_target_revision} ${_soname}.${_target_current} ${_soname}'\n\n") + FILE(APPEND ${_laname} "# The name of the static archive.\n") + FILE(APPEND ${_laname} "old_library='${_target_static_lib}'\n\n") + FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n") + FILE(APPEND ${_laname} "dependency_libs='${_target_dependency_libs}'\n\n") + FILE(APPEND ${_laname} "# Names of additional weak libraries provided by this library\n") + FILE(APPEND ${_laname} "weak_library_names=''\n\n") + FILE(APPEND ${_laname} "# Version information for ${_laname}.\n") + FILE(APPEND ${_laname} "current=${_target_current}\n") + FILE(APPEND ${_laname} "age=${_target_age}\n") + FILE(APPEND ${_laname} "revision=${_target_revision}\n\n") + FILE(APPEND ${_laname} "# Is this an already installed library?\n") + FILE(APPEND ${_laname} "installed=${_target_installed}\n\n") + FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\n") + FILE(APPEND ${_laname} "shouldnotlink=${_target_shouldnotlink}\n\n") + FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\n") + FILE(APPEND ${_laname} "dlopen='${_target_dlopen}'\n") + FILE(APPEND ${_laname} "dlpreopen='${_target_dlpreopen}'\n\n") + FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n") + FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}${_install_DIR}'\n") +# INSTALL( FILES ${_laname} ${_soname} DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR}) + INSTALL( FILES ${_laname} DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR}) +ENDMACRO(CREATE_LIBTOOL_FILE) diff -rupdN wvware.orig/cmake/TestModernIconv.c wvware.cmake/cmake/TestModernIconv.c --- wvware.orig/cmake/TestModernIconv.c 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/cmake/TestModernIconv.c 2009-08-10 20:13:50.000000000 +0200 @@ -0,0 +1,41 @@ +#ifdef HAVE_ICONV_H +#include <iconv.h> +#endif +#ifdef HAVE_SYS_ICONV_H +#include <sys/iconv.h> +#endif +#include <stdlib.h> + +int check( const char* from, const char* to ) +{ + iconv_t myConverter = iconv_open( to, from ); + + if ( myConverter != (iconv_t)-1 ) { + iconv_close( myConverter ); + return 0; + } + else + return 1; +} + +int main(int argc, char** argv) +{ + const char* from[] = { "CP874", "CP932", "CP936", "CP949", + "CP950", "CP1250", "CP1251", "CP1252", + "CP1253", "CP1254", "CP1255", "CP1256", + "CP1257", "koi8-r", 0 }; + const char* to[] = { "UNICODELITTLE", "UNICODEBIG", 0 }; + int fromIndex = 0; + int toIndex = 0; + + while ( to[ toIndex ] != 0 ) { + while( from[ fromIndex ] != 0 ) { + if ( check( from[ fromIndex ], to[ toIndex ] ) != 0 ) + exit( 1 ); + fromIndex = fromIndex + 1; + } + toIndex = toIndex + 1; + fromIndex = 0; + } + exit( 0 ); +} diff -rupdN wvware.orig/cmake/TestModernZlib.c wvware.cmake/cmake/TestModernZlib.c --- wvware.orig/cmake/TestModernZlib.c 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/cmake/TestModernZlib.c 2009-08-10 20:44:23.000000000 +0200 @@ -0,0 +1,24 @@ +#include <string.h> +#include <zlib.h> + +int version[3] = {0,0,0}; + +static void decode(char *str) +{ + int n; + for (n = 0; n < 3 && str; n++) { + char *pnt = strchr(str, '.'); + if (pnt) *pnt++ = '\0'; + version[n] = atoi(str); + str = pnt; + } +} + +int main(void) { + decode(strdup(zlibVersion())); + return + (version[0] < 1 || + (version[0] == 1 && + (version[1] < 1 || + (version[1] == 1 && version[2] < 4)))); +} diff -rupdN wvware.orig/CMakeLists.txt wvware.cmake/CMakeLists.txt --- wvware.orig/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/CMakeLists.txt 2009-08-13 00:03:16.000000000 +0200 @@ -0,0 +1,199 @@ +PROJECT( wvWare ) + +cmake_minimum_required(VERSION 2.6) + +# wv2 versioning +SET( WV2_MAJOR_VERSION 0 ) +SET( WV2_MINOR_VERSION 3 ) +SET( WV2_MICRO_VERSION 1 ) +SET( WV2_VERSION ${WV2_MAJOR_VERSION}.${WV2_MINOR_VERSION}.${WV2_MICRO_VERSION} ) + +# libtool versioning +SET( LT_VERSION_CURRENT 2 ) +SET( LT_VERSION_REVISION 1 ) +SET( LT_VERSION_AGE 0 ) + +# For automake. Is this required in CMake? (I don't think so) +SET( VERSION ${WV2_VERSION} ) +SET( PACKAGE wv2 ) + +SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${wvWare_SOURCE_DIR}/cmake ) + +FIND_PACKAGE( GLIB2 REQUIRED ) + +FIND_PACKAGE( LIBGSF REQUIRED ) + +FIND_PACKAGE( Iconv REQUIRED ) +IF( ICONV_FOUND ) + SET( HAVE_ICONV_H 1 ) + SET( ICONV_REQUIRES_CONST ${ICONV_SECOND_ARGUMENT_IS_CONST} ) +ENDIF( ICONV_FOUND ) + +OPTION( WITHOUT_ZLIB "Build wv2 without zlib (without compression features)" OFF ) +IF( NOT WITHOUT_ZLIB ) + FIND_PACKAGE( ZLIB REQUIRED ) +ENDIF( NOT WITHOUT_ZLIB ) + +INCLUDE_DIRECTORIES( ${GLIB2_INCLUDE_DIR} ${LIBGSF_INCLUDE_DIR} ${ICONV_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ) + +# +# Iconv checks +# + +INCLUDE( CheckIncludeFile ) + +CHECK_INCLUDE_FILE( sys/iconv.h HAVE_SYS_ICONV_H ) + +# Add "COMPILE_DEFINITIONS definitions" to TRY_RUN only if we have compile definitions + +# Make sure ICONV_COMPILE_DEFINITIONS will never be empty (in case we define neither HAVE_ICONV_H nor HAVE_SYS_ICONV_H), +# otherwise TRY_RUN will fail due to COMPILE_DEFINITIONS being followed by nothing + +SET( ICONV_COMPILE_DEFINITIONS "-DBLAH" ) + +IF( HAVE_ICONV_H ) + SET( ICONV_COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS} "-DHAVE_ICONV_H" ) +ENDIF( HAVE_ICONV_H ) + +IF( HAVE_SYS_ICONV_H ) + SET( ICONV_COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS} "-DHAVE_SYS_ICONV_H" ) +ENDIF( HAVE_SYS_ICONV_H ) + +TRY_RUN( MODERN_ICONV_RUN MODERN_ICONV_COMPILE ${wvWare_BINARY_DIR}/CMakeTmp ${wvWare_SOURCE_DIR}/cmake/TestModernIconv.c COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS} ) + +IF( MODERN_ICONV_RUN GREATER 0 OR NOT MODERN_ICONV_COMPILE ) + MESSAGE( STATUS "wv2 depends on a modern iconv installation, supporting UNICODELITTLE and" ) + MESSAGE( STATUS "UNICODEBIG. The detected iconv version doesn't support these conversions." ) + MESSAGE( STATUS "" ) + MESSAGE( STATUS "Please get a new libiconv from http://www.gnu.org/software/libiconv/" ) + MESSAGE( STATUS "You might want to install the library to some alternative directory, in" ) + MESSAGE( STATUS "order not to overwrite your current installation. Please use the options" ) + MESSAGE( STATUS "-DICONV_INCLUDE_DIR=DIR and -DICONV_LIBRARIES=DIR to specify the location." ) + MESSAGE( STATUS "" ) + MESSAGE( FATAL_ERROR "* * * No iconv support - unable to continue. * * *" ) +ENDIF( MODERN_ICONV_RUN GREATER 0 OR NOT MODERN_ICONV_COMPILE ) + +# +# Various checks +# + +INCLUDE( TestBigEndian ) +TEST_BIG_ENDIAN( WORDS_BIGENDIAN ) + +CHECK_INCLUDE_FILE( dlfcn.h HAVE_DLFCN_H ) +CHECK_INCLUDE_FILE( strings.h HAVE_STRINGS_H ) +CHECK_INCLUDE_FILE( string.h HAVE_STRING_H ) +CHECK_INCLUDE_FILE( math.h HAVE_MATH_H ) +CHECK_INCLUDE_FILE( float.h HAVE_FLOAT_H ) +CHECK_INCLUDE_FILE( ieeefp.h HAVE_IEEEFP_H ) +CHECK_INCLUDE_FILE( errno.h HAVE_ERRNO_H ) +CHECK_INCLUDE_FILE( inttypes.h HAVE_INTTYPES_H ) +CHECK_INCLUDE_FILE( memory.h HAVE_MEMORY_H ) +CHECK_INCLUDE_FILE( stdlib.h HAVE_STDLIB_H ) +CHECK_INCLUDE_FILE( unistd.h HAVE_UNISTD_H ) +CHECK_INCLUDE_FILE( stdint.h HAVE_STDINT_H ) # Not really needed because CHECK_TYPE_SIZE already performs this test +CHECK_INCLUDE_FILE( stdint.h HAVE_STDINT_H ) # Not really needed because CHECK_TYPE_SIZE already performs this test +CHECK_INCLUDE_FILE( sys/types.h HAVE_SYS_TYPES_H ) # Not really needed because CHECK_TYPE_SIZE already performs this test +CHECK_INCLUDE_FILE( sys/stat.h HAVE_SYS_STAT_H ) + +INCLUDE( CheckTypeSize ) +CHECK_TYPE_SIZE( char SIZEOF_CHAR ) +CHECK_TYPE_SIZE( short SIZEOF_SHORT ) +CHECK_TYPE_SIZE( long SIZEOF_LONG ) +CHECK_TYPE_SIZE( int SIZEOF_INT ) +CHECK_TYPE_SIZE( "void *" SIZEOF_VOID_P ) + +INCLUDE( CheckFunctionExists ) +IF( NOT MSVC ) + # libm does not exist on MSVC + SET( CMAKE_REQUIRED_LIBRARIES m ) + SET( CMAKE_REQUIRED_INCLUDES math.h ) +ENDIF( NOT MSVC ) + +CHECK_FUNCTION_EXISTS( isinf HAVE_FUNC_ISINF ) +CHECK_FUNCTION_EXISTS( isnan HAVE_FUNC_ISNAN ) +CHECK_FUNCTION_EXISTS( finite HAVE_FUNC_FINITE ) +CHECK_FUNCTION_EXISTS( _finite HAVE_FUNC__FINITE ) + +# +# Check zlib is modern enough +# + +SET( NEON_ZLIB 0 ) # By default, we are not modern enough +SET( CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES} ) +SET( CMAKE_REQUIRED_INCLUDES zlib.h ) + +CHECK_FUNCTION_EXISTS( inflate ZLIB_HAS_INFLATE ) + +IF( ZLIB_HAS_INFLATE ) + TRY_RUN( MODERN_ZLIB_RUN MODERN_ZLIB_COMPILE ${wvWare_BINARY_DIR}/CMakeTmp ${wvWare_SOURCE_DIR}/cmake/TestModernZlib.c ) +ENDIF( ZLIB_HAS_INFLATE ) + +IF( MODERN_ZLIB_RUN GREATER 0 AND NOT WITHOUT_ZLIB ) + MESSAGE( FATAL_ERROR "Your version of zlib is too old for wv2" ) +ENDIF( MODERN_ZLIB_RUN GREATER 0 AND NOT WITHOUT_ZLIB ) + +# +# Set cflags and ldflags +# + +IF( ZLIB_FOUND ) + SET( _WV2_LDFLAGS ${_WV2_LDFLAGS} ${ZLIB_LIBRARIES} ) + SET( _WV2_CFLAGS ${_WV2_CFLAGS} ${ZLIB_INCLUDE_DIR} ) +ENDIF( ZLIB_FOUND ) + +IF( LIBGSF_FOUND ) + SET( _WV2_LDFLAGS ${_WV2_LDFLAGS} ${LIBGSF_LIBRARIES} ) + SET( _WV2_CFLAGS ${_WV2_CFLAGS} ${LIBGSF_INCLUDE_DIR} ) +ENDIF( LIBGSF_FOUND ) + +IF( ICONV_FOUND ) + SET( _WV2_LDFLAGS ${_WV2_LDFLAGS} ${ICONV_LIBRARIES} ) + SET( _WV2_CFLAGS ${_WV2_CFLAGS} ${ICONV_INCLUDE_DIR} ) +ENDIF( ICONV_FOUND ) + +IF( GLIB2_FOUND ) + SET( _WV2_LDFLAGS ${_WV2_LDFLAGS} ${GLIB2_LIBRARIES} ) + SET( _WV2_CFLAGS ${_WV2_CFLAGS} ${GLIB2_INCLUDE_DIR} ) +ENDIF( GLIB2_FOUND ) + +# +# Clean and prepare +# +LIST( REMOVE_DUPLICATES _WV2_LDFLAGS ) +LIST( REMOVE_DUPLICATES _WV2_CFLAGS ) + +FOREACH( _lib ${_WV2_LDFLAGS} ) + # Remove path to the library and suffixes. Transformation example: libglib-2.0.so => glib-2.0 + STRING( REGEX REPLACE "[\\\\ _\\/\\.a-zA-Z0-9\\-]*\\/lib([_\\.a-zA-Z0-9\\-]*)\\.[_a-zA-Z0-9\\-\\.]*" \\1 _lib_no_path ${_lib} ) + SET( WV2_LDFLAGS "${WV2_LDFLAGS} ${CMAKE_LINK_LIBRARY_FLAG}${_lib_no_path}" ) +ENDFOREACH( _lib ) + +FOREACH( _inc ${_WV2_CFLAGS} ) + SET( WV2_CFLAGS "${WV2_CFLAGS} -I${_inc}" ) +ENDFOREACH( _inc ) + +# Generate configuration files +CONFIGURE_FILE( config.h.cmake ${wvWare_BINARY_DIR}/config.h ) +CONFIGURE_FILE( wv2-config.cmake ${wvWare_BINARY_DIR}/wv2-config @ONLY ) + +# Source directories +ADD_SUBDIRECTORY( src ) +ADD_SUBDIRECTORY( src/generator ) +ADD_SUBDIRECTORY( tests ) + +# Installation (more in src/CMakeLists.txt) + +INSTALL( FILES ${wvWare_BINARY_DIR}/wv2-config + DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + +# "make dist" + +SET(ARCHIVE_NAME ${PACKAGE}-${WV2_VERSION}) +ADD_CUSTOM_TARGET(dist + COMMAND svn export ${wvWare_SOURCE_DIR} ${wvWare_BINARY_DIR}/${ARCHIVE_NAME} + COMMAND tar -C ${wvWare_BINARY_DIR} -c -v -z -f ${ARCHIVE_NAME}.tar.gz ${ARCHIVE_NAME} + COMMAND ${CMAKE_COMMAND} -E remove_directory ${wvWare_BINARY_DIR}/${ARCHIVE_NAME} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff -rupdN wvware.orig/config.h.cmake wvware.cmake/config.h.cmake --- wvware.orig/config.h.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/config.h.cmake 2009-08-09 22:12:29.000000000 +0200 @@ -0,0 +1,113 @@ +/* config.h Generated from config.h.cmake by CMake */ + +#ifndef LIBWV2_CONFIG_H +#define LIBWV2_CONFIG_H + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#cmakedefine HAVE_DLFCN_H 1 + +/* Define to 1 if you have the <errno.h> header file. */ +#cmakedefine HAVE_ERRNO_H + +/* Define to 1 if you have the <float.h> header file. */ +#cmakedefine HAVE_FLOAT_H 1 + +/* Define if you have finite */ +#cmakedefine HAVE_FUNC_FINITE + +/* Define if you have isinf */ +#cmakedefine HAVE_FUNC_ISINF + +/* Define if you have isnan */ +#cmakedefine HAVE_FUNC_ISNAN + +/* Define if you have _finite */ +#cmakedefine HAVE_FUNC__FINITE + +/* Define to 1 if you have the <iconv.h> header file. */ +#cmakedefine HAVE_ICONV_H 1 + +/* Define to 1 if you have the <ieeefp.h> header file. */ +#cmakedefine HAVE_IEEEFP_H 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <math.h> header file. */ +#cmakedefine HAVE_MATH_H 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#cmakedefine HAVE_MEMORY_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#cmakedefine HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#cmakedefine HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#cmakedefine HAVE_STRING_H 1 + +/* Define to 1 if you have the <sys/iconv.h> header file. */ +#cmakedefine HAVE_SYS_ICONV_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#cmakedefine HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if iconv requires const var in argument 2 */ +#cmakedefine ICONV_REQUIRES_CONST 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `char', as computed by sizeof. */ +#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@ + +/* The size of `int', as computed by sizeof. */ +#cmakedefine SIZEOF_INT @SIZEOF_INT@ + +/* The size of `long', as computed by sizeof. */ +#cmakedefine SIZEOF_LONG @SIZEOF_LONG@ + +/* The size of `short', as computed by sizeof. */ +#cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@ + +/* The size of `void *', as computed by sizeof. */ +#cmakedefine SIZEOF_VOID_P @SIZEOF_VOID_P@ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#cmakedefine WORDS_BIGENDIAN 1 + +#ifdef ICONV_REQUIRES_CONST +#define ICONV_CONST const +#else +#define ICONV_CONST +#endif + +#endif /* ! LIBWV2_CONFIG_H */ diff -rupdN wvware.orig/INSTALL.cmake wvware.cmake/INSTALL.cmake --- wvware.orig/INSTALL.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/INSTALL.cmake 2009-08-13 00:09:47.000000000 +0200 @@ -0,0 +1,112 @@ +Basic installation instructions +=============================== + +These are instructions to build wv2 with the CMake build system on any +platform, including cross-compilation. If you are intested in building +wv2 with autotools, please read INSTALL instead. + + +Configuring and building +======================== + +1. Download CMake from http://www.cmake.org or install it by other means (apt, + yum, zypper, the KDE on Windows installer, etc) + +2. The following third party dependencies must be available: + + * GNOME Structured File Library + http://ftp.gnome.org/pub/gnome/sources/libgsf/ + + * glib 2.0 + http://www.gtk.org + + * iconv + http://www.gnu.org/software/libiconv/ + + * zlib + http://www.zlib.net/ + + By default, Zlib is also required, although it is possible to build wv2 + without zlib by using setting the WITHOUT_ZLIB CMake option to ON. + +3. Open the CMake GUI and select the source directory (where the CMakeLists.txt + file is) and the build directory (where you want to build wv2). + + Building in the source directory (i.e. build directory = source directory ) + is possible but ill-advised. + + If you want to build without zlib, change the value of WITHOUT_ZLIB to ON. + +4. Click the 'Configure' button. + + If the build directory does not exist, CMake will ask for your permission to + create it. + +5. CMake will also ask you what build system you want to build with, i. e. Unix + makefiles, Visual Studio solutions, Eclipse project, Borland makefiles, etc. + Depending on what platform you are, you will be offered different build + systems (known as "generators" in CMake slang). + +6. CMake will now look for the third party dependencies. + + On Linux/Unix (including Mac), if third party libraries were installed in + the default locations they will be found automatically. + + On Windows, if you are cross-compiling or if third party libraries are + installed to non-default locations, you will need to browse for the + libraries (on windows, the .lib files) and include directories. Make + sure CMake GUI is in the "Advanced view" mode or you may not see all + missing dependencies. + +7. Once you are done with dependencies, click the 'Generate' button + +8. An appropriate build system will be available in your build directory. + Use it with your toolchain, i.e. + - Go to the build directory and invoke "make" or "nmake", if using makefiles + - Open the Visual Studio solution, if using Visual C++ + - Open the Eclipse project if using Eclipse + etc + +Alternatively to steps 3-7, you may invoke CMake from the command line: + $ cmake /path/to/wv2/sources + or, to build without zlib: + $ cmake -DWITHOUT_ZLIB=ON + + +Building the tests +================== + +By default, only the wv2 library will be built. If you want to compile the tests, +build the "test" target ("make test"). + + +Installing +========== + +Build the "install" target ("make install"). + +On Linux/Unix, the default installation prefix is /usr/local. On Windows, the +default installation prefix is C:\Program Files. To change this, modify the +value of the CMAKE_INSTALL_PREFIX variable in the CMake GUI. + +You can also install to a different location by using the DESTDIR environment +variable ("make install DESTDIR=/opt/mine/wv2") but then wv2-config will +report wrong paths. + + +Regenerating the scanner and converter code +=========================================== + +Build the 'scanner' and 'converter' targets. The 'generated' target is provided +as a convenience and will build both 'scanner' and 'converter'. + +Please note the generated sources are currently generated in the SOURCE +directory, not in the build directory. + + +Generating a distributable source package +========================================= + +Use "make dist" to create a tarball from a Subversion working tree. In the future, +other options (NSIS installer for Windows, .dmg for Mac, Debian and RPM packages +for Linux, etc) may be available. diff -rupdN wvware.orig/src/CMakeLists.txt wvware.cmake/src/CMakeLists.txt --- wvware.orig/src/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/src/CMakeLists.txt 2009-08-12 21:03:12.000000000 +0200 @@ -0,0 +1,107 @@ +INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${wvWare_BINARY_DIR} ) + +# I'd say the 'if' is unneeded because we always CONFIGURE_FILE +IF( EXISTS ${wvWare_BINARY_DIR}/config.h ) + ADD_DEFINITIONS( -DHAVE_CONFIG_H ) +ENDIF( EXISTS ${wvWare_BINARY_DIR}/config.h ) + +SET( wv2_SOURCES + olestorage.cpp + olestream.cpp + word97_generated.cpp + word97_helper.cpp + word95_helper.cpp + word_helper.cpp + word95_generated.cpp + convert.cpp + global.cpp + parser.cpp + parser9x.cpp + parser95.cpp + parser97.cpp + parserfactory.cpp + ustring.cpp + textconverter.cpp + styles.cpp + handlers.cpp + properties97.cpp + fonts.cpp + lists.cpp + paragraphproperties.cpp + headers.cpp + headers95.cpp + headers97.cpp + footnotes97.cpp + functor.cpp + functordata.cpp + associatedstrings.cpp + fields.cpp + utilities.cpp + crc32.c + wvlog.cpp + graphics.cpp + wv2version.cpp + zcodec.cxx + ) + +SET( wv2_HEADERS + olestorage.h + olestream.h + word95_generated.h + word97_generated.h + word_helper.h + parser.h + parserfactory.h + ustring.h + textconverter.h + styles.h + sharedptr.h + convert.h + global.h + handlers.h + fonts.h + lists.h + utilities.h + paragraphproperties.h + functor.h + functordata.h + associatedstrings.h + fields.h + dllmagic.h + wvlog.h + wv2version.h + zcodec.hxx + ) + +ADD_LIBRARY( wv2 SHARED ${wv2_SOURCES} ${wv2_HEADERS} ) +TARGET_LINK_LIBRARIES( wv2 ${ZLIB_LIBRARIES} ${LIBGSF_LIBRARIES} ${ICONV_LIBRARIES} ${GLIB2_LIBRARIES} ) +SET_TARGET_PROPERTIES( wv2 PROPERTIES + SOVERSION ${LT_VERSION_CURRENT} + VERSION ${LT_VERSION_CURRENT}.${LT_VERSION_AGE}.${LT_VERSION_REVISION} + LT_VERSION_CURRENT ${LT_VERSION_CURRENT} + LT_VERSION_AGE ${LT_VERSION_AGE} + LT_VERSION_REVISION ${LT_VERSION_REVISION} + LT_DEPENDENCY_LIBS ${WV2_LDFLAGS} + ) +IF( WIN32 ) + SET_TARGET_PROPERTIES( wv2 PROPERTIES DEFINE_SYMBOL WV2_DLL ) +ENDIF( WIN32 ) + +INSTALL( TARGETS wv2 + EXPORT wvWare + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static +) + +INSTALL( EXPORT wvWare DESTINATION lib/wvWare FILE wv2.cmake ) + +INSTALL( FILES ${wv2_HEADERS} + DESTINATION include/wv2 +) + +# libtool files are useless for Visual C++ and Borland C++ +IF( NOT MSVC AND NOT BORLAND ) + INCLUDE( ${wvWare_SOURCE_DIR}/cmake/MacroCreateLibtoolFile.cmake ) + CREATE_LIBTOOL_FILE( wv2 /lib ) +ENDIF( NOT MSVC AND NOT BORLAND ) diff -rupdN wvware.orig/src/generator/CMakeLists.txt wvware.cmake/src/generator/CMakeLists.txt --- wvware.orig/src/generator/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/src/generator/CMakeLists.txt 2009-08-11 16:56:32.000000000 +0200 @@ -0,0 +1,20 @@ +# The generated files will be in the source directory ( src ) +# IMHO polluting the source directory is a bad idea UNLESS the only +# point of the "make generated" target is to create word9{5,7}_generated.{h,cpp} +# for "make dist" (i. e. for a tarball) +# - Pau + +ADD_CUSTOM_TARGET( scanner + ${CMAKE_COMMAND} + -DGENERATOR_DIR:PATH=${wvWare_SOURCE_DIR}/src/generator + -P ${wvWare_SOURCE_DIR}/cmake/generate_scanner.cmake + ) + +ADD_CUSTOM_TARGET( converter + ${CMAKE_COMMAND} + -DGENERATOR_DIR:PATH=${wvWare_SOURCE_DIR}/src/generator + -P ${wvWare_SOURCE_DIR}/cmake/generate_converter.cmake + ) + + +ADD_CUSTOM_TARGET( generated DEPENDS scanner converter ) diff -rupdN wvware.orig/tests/CMakeLists.txt wvware.cmake/tests/CMakeLists.txt --- wvware.orig/tests/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/tests/CMakeLists.txt 2009-08-11 12:58:46.000000000 +0200 @@ -0,0 +1,48 @@ +IF( EXISTS ${wvWare_BINARY_DIR}/config.h ) + ADD_DEFINITIONS( -DHAVE_CONFIG_H ) +ENDIF( EXISTS ${wvWare_BINARY_DIR}/config.h ) + +INCLUDE_DIRECTORIES( ${wvWare_BINARY_DIR} ${wvWare_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR} ) + +SET( oletest_SOURCES oletest.cpp ) +ADD_EXECUTABLE( oletest EXCLUDE_FROM_ALL ${oletest_SOURCES} ) +TARGET_LINK_LIBRARIES( oletest wv2 ${LIBGSF_LIBRARIES} ) + +SET( word97_test_SOURCES word97_test.cpp ) +ADD_EXECUTABLE( word97_test EXCLUDE_FROM_ALL ${word97_test_SOURCES} ) +TARGET_LINK_LIBRARIES( word97_test wv2 ${LIBGSF_LIBRARIES} ) + +SET( word95_test_SOURCES word95_test.cpp ) +ADD_EXECUTABLE( word95_test EXCLUDE_FROM_ALL ${word95_test_SOURCES} ) +TARGET_LINK_LIBRARIES( word95_test wv2 ${LIBGSF_LIBRARIES} ) + +SET( iconvtest_SOURCES iconvtest.cpp ) +ADD_EXECUTABLE( iconvtest EXCLUDE_FROM_ALL ${iconvtest_SOURCES} ) +TARGET_LINK_LIBRARIES( iconvtest wv2 ${LIBGSF_LIBRARIES} ) + +SET( parsertest_SOURCES parsertest.cpp ) +ADD_EXECUTABLE( parsertest EXCLUDE_FROM_ALL ${parsertest_SOURCES} ) +TARGET_LINK_LIBRARIES( parsertest wv2 ${LIBGSF_LIBRARIES} ) + +SET( parsertest_mem_SOURCES parsertest_mem.cpp ) +ADD_EXECUTABLE( parsertest_mem EXCLUDE_FROM_ALL ${parsertest_mem_SOURCES} ) +TARGET_LINK_LIBRARIES( parsertest_mem wv2 ${LIBGSF_LIBRARIES} ) + +SET( helpertest_SOURCES helpertest.cpp ) +ADD_EXECUTABLE( helpertest EXCLUDE_FROM_ALL ${helpertest_SOURCES} ) +TARGET_LINK_LIBRARIES( helpertest wv2 ${LIBGSF_LIBRARIES} ) + +SET( ustringtest_SOURCES ustringtest.cpp ) +ADD_EXECUTABLE( ustringtest EXCLUDE_FROM_ALL ${ustringtest_SOURCES} ) +TARGET_LINK_LIBRARIES( ustringtest wv2 ${LIBGSF_LIBRARIES} ) + +SET( sharedptrtest_SOURCES sharedptrtest.cpp ) +ADD_EXECUTABLE( sharedptrtest EXCLUDE_FROM_ALL ${sharedptrtest_SOURCES} ) +TARGET_LINK_LIBRARIES( sharedptrtest wv2 ${LIBGSF_LIBRARIES} ) + +SET( handlertest_SOURCES handlertest.cpp ) +ADD_EXECUTABLE( handlertest EXCLUDE_FROM_ALL ${handlertest_SOURCES} ) +TARGET_LINK_LIBRARIES( handlertest wv2 ${LIBGSF_LIBRARIES} ) + +# Add a global 'make test' target +ADD_CUSTOM_TARGET( test DEPENDS oletest word97_test word95_test iconvtest parsertest parsertest_mem helpertest ustringtest sharedptrtest handlertest ) diff -rupdN wvware.orig/wv2-config.cmake wvware.cmake/wv2-config.cmake --- wvware.orig/wv2-config.cmake 1970-01-01 01:00:00.000000000 +0100 +++ wvware.cmake/wv2-config.cmake 2009-08-12 20:15:01.000000000 +0200 @@ -0,0 +1,103 @@ +#!/bin/sh + +pref...@cmake_install_prefix@ +exec_prefix=${prefix} +exec_prefix_set=no + +usage() +{ + cat <<EOF +Usage: wv2-config [OPTIONS] [LIBRARIES] +Options: + [--prefix[=DIR]] + [--exec-prefix[=DIR]] + [--version] + [--libs] + [--cflags] +Libraries/Headers: + wv2 +EOF + exit $1 +} + +if test $# -eq 0; then + usage 1 1>&2 +fi + +lib_wv2=yes + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo_prefix=yes + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo_exec_prefix=yes + ;; + --version) + echo @wv2_major_vers...@.@wv2_minor_vers...@.@WV2_MICRO_VERSION@ + ;; + --cflags) + echo_cflags=yes + ;; + --libs) + echo_libs=yes + ;; + wv2) + lib_wv2=yes + ;; + *) + usage 1 1>&2 + ;; + esac + shift +done + +if test "$echo_prefix" = "yes"; then + echo $prefix +fi + +if test "$echo_exec_prefix" = "yes"; then + echo $exec_prefix +fi + +wv2_libs="@WV2_LDFLAGS@ -lwv2 @WV2_LIBS@" + +if test "$echo_cflags" = "yes"; then + includes="@WV2_CFLAGS@" + if test "$lib_wv2" = "yes"; then + includes="-I${prefix}/include $includes" + fi + echo $includes +fi + +if test "$echo_libs" = "yes"; then + libdirs=-L${exec_prefix}/lib + my_wv2_libs= + for i in $wv2_libs ; do + if test "x$i" != "x-L${exec_prefix}/lib" ; then + if test -z "$my_wv2_libs" ; then + my_wv2_libs="$i" + else + my_wv2_libs="$my_wv2_libs $i" + fi + fi + done + + echo $libdirs $my_wv2_libs +fi
_______________________________________________ Kde-windows mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-windows
