]> granicus.if.org Git - libexpat/commitdiff
Added CMake build system.
authorKarl Waclawek <kwaclaw@users.sourceforge.net>
Mon, 5 Mar 2012 14:38:22 +0000 (14:38 +0000)
committerKarl Waclawek <kwaclaw@users.sourceforge.net>
Mon, 5 Mar 2012 14:38:22 +0000 (14:38 +0000)
expat/CMake.README [new file with mode: 0755]
expat/CMakeLists.txt [new file with mode: 0755]
expat/ConfigureChecks.cmake [new file with mode: 0755]
expat/MANIFEST
expat/expat_config.h.cmake [new file with mode: 0755]

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