summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwaclaw <kwaclaw>2012-03-05 14:38:21 +0000
committerkwaclaw <kwaclaw>2012-03-05 14:38:21 +0000
commit41f91e2587205970b0693b4c46712628aa0bc999 (patch)
tree3c4b99b6685d3d762212f17d131e8ad1eac1c56b
parent591ddca0b2abe1f6359b4b772a67d0985d472f01 (diff)
downloadlibexpat-41f91e2587205970b0693b4c46712628aa0bc999.tar.gz
Added CMake build system.
-rwxr-xr-xCMake.README42
-rwxr-xr-xCMakeLists.txt111
-rwxr-xr-xConfigureChecks.cmake44
-rw-r--r--MANIFEST4
-rwxr-xr-xexpat_config.h.cmake91
5 files changed, 292 insertions, 0 deletions
diff --git a/CMake.README b/CMake.README
new file mode 100755
index 0000000..4db6399
--- /dev/null
+++ b/CMake.README
@@ -0,0 +1,42 @@
+== How to build expat with cmake (experimental) ==
+
+The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual
+Studio) and should work on all other platform cmake supports.
+
+Assuming ~/expat-2.1.0 is the source directory of expat, add a subdirectory
+build and change into that directory:
+~/expat-2.1.0$ mkdir build && cd build
+~/expat-2.1.0/build$
+
+From that directory, call cmake first, then call make, make test and
+make install in the usual way:
+~/expat-2.1.0/build$ cmake ..
+-- The C compiler identification is GNU
+-- The CXX compiler identification is GNU
+....
+-- Configuring done
+-- Generating done
+-- Build files have been written to: /home/patrick/expat-2.1.0/build
+
+If you want to specify the install location for your files, append
+-DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call.
+
+~/expat-2.1.0/build$ make && make test && make install
+Scanning dependencies of target expat
+[ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o
+[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o
+....
+-- Installing: /usr/local/lib/pkgconfig/expat.pc
+-- Installing: /usr/local/bin/xmlwf
+-- Installing: /usr/local/share/man/man1/xmlwf.1
+
+For Windows builds, you must make sure to call cmake from an environment where
+your compiler is reachable, that means either you call it from the
+Visual Studio Command Prompt or when using mingw, you must open a cmd.exe and
+make sure that gcc can be called. On Windows, you also might want to specify a
+special Generator for CMake:
+for Visual Studio builds do:
+cmake .. -G "Visual Studio 10" && vcexpress expat.sln
+for mingw builds do:
+cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:\expat-install
+ && gmake && gmake install
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 0000000..0c923ba
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,111 @@
+# This file is copyrighted under the BSD-license for buildsystem files of KDE
+# copyright 2010, Patrick Spendrin <ps_ml@gmx.de>
+
+project(expat)
+
+cmake_minimum_required(VERSION 2.6)
+set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org")
+set(PACKAGE_NAME "expat")
+set(PACKAGE_VERSION "2.1.0")
+set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+set(PACKAGE_TARNAME "${PACKAGE_NAME}")
+
+option(BUILD_tools "build the xmlwf tool for expat library" ON)
+option(BUILD_examples "build the examples for expat library" ON)
+option(BUILD_tests "build the tests for expat library" ON)
+option(BUILD_shared "build a shared expat library" ON)
+
+# configuration options
+set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point")
+option(XML_DTD "Define to make parameter entity parsing functionality available" ON)
+option(XML_NS "Define to make XML Namespaces functionality available" ON)
+
+if(XML_DTD)
+ set(XML_DTD 1)
+else(XML_DTD)
+ set(XML_DTD 0)
+endif(XML_DTD)
+if(XML_NS)
+ set(XML_NS 1)
+else(XML_NS)
+ set(XML_NS 0)
+endif(XML_NS)
+
+if(BUILD_tests)
+ enable_testing()
+endif(BUILD_tests)
+
+include(ConfigureChecks.cmake)
+
+include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib)
+if(MSVC)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996)
+endif(MSVC)
+
+set(expat_SRCS
+ lib/xmlparse.c
+ lib/xmlrole.c
+ lib/xmltok.c
+ lib/xmltok_impl.c
+ lib/xmltok_ns.c
+)
+
+if(WIN32 AND BUILD_shared)
+ set(expat_SRCS ${expat_SRCS} lib/libexpat.def)
+endif(WIN32 AND BUILD_shared)
+
+if(BUILD_shared)
+ set(_SHARED SHARED)
+else(BUILD_shared)
+ set(_SHARED STATIC)
+endif(BUILD_shared)
+
+add_library(expat ${_SHARED} ${expat_SRCS})
+
+install(TARGETS expat RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+
+set(prefix ${CMAKE_INSTALL_PREFIX})
+set(exec_prefix "\${prefix}/bin")
+set(libdir "\${prefix}/lib")
+set(includedir "\${prefix}/include")
+configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc)
+
+install(FILES lib/expat.h lib/expat_external.h DESTINATION include)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig)
+
+
+
+if(BUILD_tools AND NOT WINCE)
+ set(xmlwf_SRCS
+ xmlwf/xmlwf.c
+ xmlwf/xmlfile.c
+ xmlwf/codepage.c
+ xmlwf/readfilemap.c
+ )
+
+ add_executable(xmlwf ${xmlwf_SRCS})
+ target_link_libraries(xmlwf expat)
+ install(TARGETS xmlwf DESTINATION bin)
+ install(FILES doc/xmlwf.1 DESTINATION share/man/man1)
+endif(BUILD_tools AND NOT WINCE)
+
+if(BUILD_examples)
+ add_executable(elements examples/elements.c)
+ target_link_libraries(elements expat)
+
+ add_executable(outline examples/outline.c)
+ target_link_libraries(outline expat)
+endif(BUILD_examples)
+
+if(BUILD_tests)
+ ## these are unittests that can be run on any platform
+ add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c)
+ target_link_libraries(runtests expat)
+ add_test(runtests runtests)
+
+ add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c)
+ target_link_libraries(runtestspp expat)
+ add_test(runtestspp runtestspp)
+endif(BUILD_tests)
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
new file mode 100755
index 0000000..5cdf01e
--- /dev/null
+++ b/ConfigureChecks.cmake
@@ -0,0 +1,44 @@
+include(CheckIncludeFile)
+include(CheckIncludeFiles)
+include(CheckFunctionExists)
+include(CheckSymbolExists)
+include(TestBigEndian)
+
+check_include_file("dlfcn.h" HAVE_DLFCN_H)
+check_include_file("fcntl.h" HAVE_FCNTL_H)
+check_include_file("inttypes.h" HAVE_INTTYPES_H)
+check_include_file("memory.h" HAVE_MEMORY_H)
+check_include_file("stdint.h" HAVE_STDINT_H)
+check_include_file("stdlib.h" HAVE_STDLIB_H)
+check_include_file("strings.h" HAVE_STRINGS_H)
+check_include_file("string.h" HAVE_STRING_H)
+check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
+check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
+check_include_file("unistd.h" HAVE_UNISTD_H)
+
+check_function_exists("getpagesize" HAVE_GETPAGESIZE)
+check_function_exists("bcopy" HAVE_BCOPY)
+check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE)
+check_function_exists("mmap" HAVE_MMAP)
+
+#/* Define to 1 if you have the ANSI C header files. */
+check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
+
+test_big_endian(WORDS_BIGENDIAN)
+#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
+if(WORDS_BIGENDIAN)
+ set(BYTEORDER 4321)
+else(WORDS_BIGENDIAN)
+ set(BYTEORDER 1234)
+endif(WORDS_BIGENDIAN)
+
+if(HAVE_SYS_TYPES_H)
+ check_symbol_exists("off_t" "sys/types.h" OFF_T)
+ check_symbol_exists("size_t" "sys/types.h" SIZE_T)
+else(HAVE_SYS_TYPES_H)
+ set(OFF_T "long")
+ set(SIZE_T "unsigned")
+endif(HAVE_SYS_TYPES_H)
+
+configure_file(expat_config.h.cmake expat_config.h)
+add_definitions(-DHAVE_EXPAT_CONFIG_H)
diff --git a/MANIFEST b/MANIFEST
index c199df1..7a020dc 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -45,14 +45,18 @@ doc/style.css
doc/valid-xhtml10.png
doc/xmlwf.1
doc/xmlwf.sgml
+CMakeLists.txt
+CMake.README
COPYING
Changes
+ConfigureChecks.cmake
MANIFEST
Makefile.in
README
configure
configure.in
expat_config.h.in
+expat_config.h.cmake
expat.pc.in
expat.dsw
aclocal.m4
diff --git a/expat_config.h.cmake b/expat_config.h.cmake
new file mode 100755
index 0000000..e514791
--- /dev/null
+++ b/expat_config.h.cmake
@@ -0,0 +1,91 @@
+/* expat_config.h.in. Generated from configure.in by autoheader. */
+
+/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
+#cmakedefine BYTEORDER @BYTEORDER@
+
+/* Define to 1 if you have the `bcopy' function. */
+#cmakedefine HAVE_BCOPY
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#cmakedefine HAVE_FCNTL_H
+
+/* Define to 1 if you have the `getpagesize' function. */
+#cmakedefine HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `memmove' function. */
+#cmakedefine HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H
+
+/* Define to 1 if you have a working `mmap' system call. */
+#cmakedefine HAVE_MMAP
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS
+
+/* whether byteorder is bigendian */
+#cmakedefine WORDS_BIGENDIAN
+
+/* Define to specify how much context to retain around the current parse
+ point. */
+#cmakedefine XML_CONTEXT_BYTES @XML_CONTEXT_BYTES@
+
+/* Define to make parameter entity parsing functionality available. */
+#cmakedefine XML_DTD
+
+/* Define to make XML Namespaces functionality available. */
+#cmakedefine XML_NS
+
+/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */
+#ifdef _MSC_VER
+# define __func__ __FUNCTION__
+#endif
+
+/* Define to `long' if <sys/types.h> does not define. */
+#cmakedefine off_t @OFF_T@
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#cmakedefine size_t @SIZE_T@