From a922aaa68e8a93a051f14f34827fc0a7d7d6f0c5 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 19 Sep 2013 20:12:32 +0100 Subject: [PATCH] Move bundled Expat to new home. Renamed bundled Expat headers to avoid any possibility of accidental including system headers when using bundled Expat, or vice-versa. Should help with SVN crashes reported by Thomas. --- 3rdparty/CMakeLists.txt | 4 ++ 3rdparty/expat/CMakeLists.txt | 42 +++++++++++++++++++ {simgear/xml => 3rdparty/expat}/Expat.COPYING | 0 {simgear/xml => 3rdparty/expat}/ascii.h | 0 {simgear/xml => 3rdparty/expat}/asciitab.h | 0 .../expat}/expat_config_cmake.in | 0 {simgear/xml => 3rdparty/expat}/hashtable.c | 0 {simgear/xml => 3rdparty/expat}/hashtable.h | 0 {simgear/xml => 3rdparty/expat}/iasciitab.h | 0 {simgear/xml => 3rdparty/expat}/internal.h | 0 {simgear/xml => 3rdparty/expat}/latin1tab.h | 0 {simgear/xml => 3rdparty/expat}/nametab.h | 0 .../xml/expat.h => 3rdparty/expat/sg_expat.h | 0 .../expat/sg_expat_external.h | 0 {simgear/xml => 3rdparty/expat}/utf8tab.h | 0 {simgear/xml => 3rdparty/expat}/xmldef.h | 0 {simgear/xml => 3rdparty/expat}/xmlparse.c | 0 {simgear/xml => 3rdparty/expat}/xmlparse.h | 0 {simgear/xml => 3rdparty/expat}/xmlrole.c | 0 {simgear/xml => 3rdparty/expat}/xmlrole.h | 0 {simgear/xml => 3rdparty/expat}/xmltok.c | 0 {simgear/xml => 3rdparty/expat}/xmltok.h | 0 {simgear/xml => 3rdparty/expat}/xmltok_impl.c | 0 {simgear/xml => 3rdparty/expat}/xmltok_impl.h | 0 {simgear/xml => 3rdparty/expat}/xmltok_ns.c | 0 CMakeLists.txt | 16 +++---- simgear/io/DAVMultiStatus.cxx | 11 ++++- simgear/io/SVNReportParser.cxx | 11 ++++- simgear/xml/CMakeLists.txt | 24 ----------- simgear/xml/easyxml.cxx | 3 +- 30 files changed, 76 insertions(+), 35 deletions(-) create mode 100644 3rdparty/CMakeLists.txt create mode 100644 3rdparty/expat/CMakeLists.txt rename {simgear/xml => 3rdparty/expat}/Expat.COPYING (100%) rename {simgear/xml => 3rdparty/expat}/ascii.h (100%) rename {simgear/xml => 3rdparty/expat}/asciitab.h (100%) rename {simgear/xml => 3rdparty/expat}/expat_config_cmake.in (100%) rename {simgear/xml => 3rdparty/expat}/hashtable.c (100%) rename {simgear/xml => 3rdparty/expat}/hashtable.h (100%) rename {simgear/xml => 3rdparty/expat}/iasciitab.h (100%) rename {simgear/xml => 3rdparty/expat}/internal.h (100%) rename {simgear/xml => 3rdparty/expat}/latin1tab.h (100%) rename {simgear/xml => 3rdparty/expat}/nametab.h (100%) rename simgear/xml/expat.h => 3rdparty/expat/sg_expat.h (100%) rename simgear/xml/expat_external.h => 3rdparty/expat/sg_expat_external.h (100%) rename {simgear/xml => 3rdparty/expat}/utf8tab.h (100%) rename {simgear/xml => 3rdparty/expat}/xmldef.h (100%) rename {simgear/xml => 3rdparty/expat}/xmlparse.c (100%) rename {simgear/xml => 3rdparty/expat}/xmlparse.h (100%) rename {simgear/xml => 3rdparty/expat}/xmlrole.c (100%) rename {simgear/xml => 3rdparty/expat}/xmlrole.h (100%) rename {simgear/xml => 3rdparty/expat}/xmltok.c (100%) rename {simgear/xml => 3rdparty/expat}/xmltok.h (100%) rename {simgear/xml => 3rdparty/expat}/xmltok_impl.c (100%) rename {simgear/xml => 3rdparty/expat}/xmltok_impl.h (100%) rename {simgear/xml => 3rdparty/expat}/xmltok_ns.c (100%) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt new file mode 100644 index 00000000..fb525003 --- /dev/null +++ b/3rdparty/CMakeLists.txt @@ -0,0 +1,4 @@ +if (NOT SYSTEM_EXPAT) + add_subdirectory(expat) +endif() + diff --git a/3rdparty/expat/CMakeLists.txt b/3rdparty/expat/CMakeLists.txt new file mode 100644 index 00000000..ed5bebee --- /dev/null +++ b/3rdparty/expat/CMakeLists.txt @@ -0,0 +1,42 @@ + + +configure_file ( + "${PROJECT_SOURCE_DIR}/3rdparty/expat/expat_config_cmake.in" + "${PROJECT_BINARY_DIR}/3rdparty/expat/expat_config.h" +) + + +set(expat_sources + asciitab.h + hashtable.h + iasciitab.h + latin1tab.h + nametab.h + utf8tab.h + xmldef.h + xmlparse.h + xmlrole.h + xmltok.h + xmltok_impl.h + hashtable.c + xmlparse.c + xmlrole.c + xmltok.c + internal.h + ascii.h + sg_expat.h + sg_expat_external.h + ) + + +# this code will be linked into SimGearCore shared object, so it +# must be compiled with -fPIC too + + +if(SIMGEAR_SHARED AND UNIX) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") +endif() + +add_library(local_expat STATIC ${expat_sources}) + diff --git a/simgear/xml/Expat.COPYING b/3rdparty/expat/Expat.COPYING similarity index 100% rename from simgear/xml/Expat.COPYING rename to 3rdparty/expat/Expat.COPYING diff --git a/simgear/xml/ascii.h b/3rdparty/expat/ascii.h similarity index 100% rename from simgear/xml/ascii.h rename to 3rdparty/expat/ascii.h diff --git a/simgear/xml/asciitab.h b/3rdparty/expat/asciitab.h similarity index 100% rename from simgear/xml/asciitab.h rename to 3rdparty/expat/asciitab.h diff --git a/simgear/xml/expat_config_cmake.in b/3rdparty/expat/expat_config_cmake.in similarity index 100% rename from simgear/xml/expat_config_cmake.in rename to 3rdparty/expat/expat_config_cmake.in diff --git a/simgear/xml/hashtable.c b/3rdparty/expat/hashtable.c similarity index 100% rename from simgear/xml/hashtable.c rename to 3rdparty/expat/hashtable.c diff --git a/simgear/xml/hashtable.h b/3rdparty/expat/hashtable.h similarity index 100% rename from simgear/xml/hashtable.h rename to 3rdparty/expat/hashtable.h diff --git a/simgear/xml/iasciitab.h b/3rdparty/expat/iasciitab.h similarity index 100% rename from simgear/xml/iasciitab.h rename to 3rdparty/expat/iasciitab.h diff --git a/simgear/xml/internal.h b/3rdparty/expat/internal.h similarity index 100% rename from simgear/xml/internal.h rename to 3rdparty/expat/internal.h diff --git a/simgear/xml/latin1tab.h b/3rdparty/expat/latin1tab.h similarity index 100% rename from simgear/xml/latin1tab.h rename to 3rdparty/expat/latin1tab.h diff --git a/simgear/xml/nametab.h b/3rdparty/expat/nametab.h similarity index 100% rename from simgear/xml/nametab.h rename to 3rdparty/expat/nametab.h diff --git a/simgear/xml/expat.h b/3rdparty/expat/sg_expat.h similarity index 100% rename from simgear/xml/expat.h rename to 3rdparty/expat/sg_expat.h diff --git a/simgear/xml/expat_external.h b/3rdparty/expat/sg_expat_external.h similarity index 100% rename from simgear/xml/expat_external.h rename to 3rdparty/expat/sg_expat_external.h diff --git a/simgear/xml/utf8tab.h b/3rdparty/expat/utf8tab.h similarity index 100% rename from simgear/xml/utf8tab.h rename to 3rdparty/expat/utf8tab.h diff --git a/simgear/xml/xmldef.h b/3rdparty/expat/xmldef.h similarity index 100% rename from simgear/xml/xmldef.h rename to 3rdparty/expat/xmldef.h diff --git a/simgear/xml/xmlparse.c b/3rdparty/expat/xmlparse.c similarity index 100% rename from simgear/xml/xmlparse.c rename to 3rdparty/expat/xmlparse.c diff --git a/simgear/xml/xmlparse.h b/3rdparty/expat/xmlparse.h similarity index 100% rename from simgear/xml/xmlparse.h rename to 3rdparty/expat/xmlparse.h diff --git a/simgear/xml/xmlrole.c b/3rdparty/expat/xmlrole.c similarity index 100% rename from simgear/xml/xmlrole.c rename to 3rdparty/expat/xmlrole.c diff --git a/simgear/xml/xmlrole.h b/3rdparty/expat/xmlrole.h similarity index 100% rename from simgear/xml/xmlrole.h rename to 3rdparty/expat/xmlrole.h diff --git a/simgear/xml/xmltok.c b/3rdparty/expat/xmltok.c similarity index 100% rename from simgear/xml/xmltok.c rename to 3rdparty/expat/xmltok.c diff --git a/simgear/xml/xmltok.h b/3rdparty/expat/xmltok.h similarity index 100% rename from simgear/xml/xmltok.h rename to 3rdparty/expat/xmltok.h diff --git a/simgear/xml/xmltok_impl.c b/3rdparty/expat/xmltok_impl.c similarity index 100% rename from simgear/xml/xmltok_impl.c rename to 3rdparty/expat/xmltok_impl.c diff --git a/simgear/xml/xmltok_impl.h b/3rdparty/expat/xmltok_impl.h similarity index 100% rename from simgear/xml/xmltok_impl.h rename to 3rdparty/expat/xmltok_impl.h diff --git a/simgear/xml/xmltok_ns.c b/3rdparty/expat/xmltok_ns.c similarity index 100% rename from simgear/xml/xmltok_ns.c rename to 3rdparty/expat/xmltok_ns.c diff --git a/CMakeLists.txt b/CMakeLists.txt index d9c6f61b..a0112491 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,12 +227,18 @@ if (SYSTEM_EXPAT) message(STATUS "Requested to use system Expat library, forcing SIMGEAR_SHARED to true") set(SIMGEAR_SHARED ON) find_package(EXPAT REQUIRED) - include_directories(${EXPAT_INCLUDE_DIRS}) + else() message(STATUS "Using built-in expat code") add_definitions(-DHAVE_EXPAT_CONFIG_H) + set(EXPAT_INCLUDE_DIRS + ${PROJECT_SOURCE_DIR}/3rdparty/expat + ${PROJECT_BINARY_DIR}/3rdparty/expat) + set(EXPAT_LIBRARIES local_expat) endif(SYSTEM_EXPAT) +include_directories(${EXPAT_INCLUDE_DIRS}) + check_include_file(inttypes.h HAVE_INTTYPES_H) check_include_file(sys/time.h HAVE_SYS_TIME_H) check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H) @@ -346,7 +352,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}") include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include) include_directories(${PROJECT_BINARY_DIR}/simgear) -include_directories(${PROJECT_BINARY_DIR}/simgear/xml) include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} @@ -364,11 +369,6 @@ configure_file ( "${PROJECT_BINARY_DIR}/simgear/simgear_config.h" ) -configure_file ( - "${PROJECT_SOURCE_DIR}/simgear/xml/expat_config_cmake.in" - "${PROJECT_BINARY_DIR}/simgear/xml/expat_config.h" -) - if(ENABLE_TESTS) # enable CTest / make test target message(STATUS "Tests: ENABLED") @@ -402,6 +402,8 @@ if(NOT SIMGEAR_HEADLESS) endif() install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/) + +add_subdirectory(3rdparty) add_subdirectory(simgear) if (NOT EMBEDDED_SIMGEAR) diff --git a/simgear/io/DAVMultiStatus.cxx b/simgear/io/DAVMultiStatus.cxx index 6e1425dc..53b34b67 100644 --- a/simgear/io/DAVMultiStatus.cxx +++ b/simgear/io/DAVMultiStatus.cxx @@ -16,6 +16,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +#ifdef HAVE_CONFIG_H +# include +#endif + #include "DAVMultiStatus.hxx" #include @@ -27,10 +31,15 @@ #include #include "simgear/debug/logstream.hxx" -#include "simgear/xml/xmlparse.h" #include "simgear/misc/strutils.hxx" #include "simgear/structure/exception.hxx" +#ifdef SYSTEM_EXPAT +# include +#else +# include "sg_expat.h" +#endif + using std::string; using namespace simgear; diff --git a/simgear/io/SVNReportParser.cxx b/simgear/io/SVNReportParser.cxx index a6f80224..93695f16 100644 --- a/simgear/io/SVNReportParser.cxx +++ b/simgear/io/SVNReportParser.cxx @@ -16,6 +16,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +#ifdef HAVE_CONFIG_H +# include +#endif + #include "SVNReportParser.hxx" #include @@ -30,11 +34,16 @@ #include "simgear/misc/sg_path.hxx" #include "simgear/misc/sg_dir.hxx" #include "simgear/debug/logstream.hxx" -#include "simgear/xml/xmlparse.h" #include "simgear/xml/easyxml.hxx" #include "simgear/misc/strutils.hxx" #include "simgear/package/md5.h" +#ifdef SYSTEM_EXPAT +# include +#else +# include "sg_expat.h" +#endif + #include "SVNDirectory.hxx" #include "SVNRepository.hxx" #include "DAVMultiStatus.hxx" diff --git a/simgear/xml/CMakeLists.txt b/simgear/xml/CMakeLists.txt index 8a96949d..e2dae9e9 100644 --- a/simgear/xml/CMakeLists.txt +++ b/simgear/xml/CMakeLists.txt @@ -10,28 +10,4 @@ set(SOURCES easyxml.cxx ) -if (NOT SYSTEM_EXPAT) - list(APPEND SOURCES - asciitab.h - hashtable.h - iasciitab.h - latin1tab.h - nametab.h - utf8tab.h - xmldef.h - xmlparse.h - xmlrole.h - xmltok.h - xmltok_impl.h - hashtable.c - xmlparse.c - xmlrole.c - xmltok.c - internal.h - ascii.h - expat.h - expat_external.h - ) -endif() - simgear_component(xml xml "${SOURCES}" "${HEADERS}") diff --git a/simgear/xml/easyxml.cxx b/simgear/xml/easyxml.cxx index c2fc1213..08a39fa4 100644 --- a/simgear/xml/easyxml.cxx +++ b/simgear/xml/easyxml.cxx @@ -17,7 +17,7 @@ #ifdef SYSTEM_EXPAT # include #else -# include "xmlparse.h" +# include "sg_expat.h" #endif #include @@ -136,7 +136,6 @@ XMLAttributesDefault::setValue (const char * name, const char * value) } - //////////////////////////////////////////////////////////////////////// // Attribute list wrapper for Expat. //////////////////////////////////////////////////////////////////////// -- 2.39.5