ignore nullptr warning in libstudxml, update to latest beta 9, and switch to submodule

This commit is contained in:
Thomas Fussell 2021-02-20 22:29:59 -04:00
parent e15e47590c
commit 60b2d9cfd1
5 changed files with 85 additions and 1 deletions

3
.gitmodules vendored
View File

@ -0,0 +1,3 @@
[submodule "third-party/libstudxml"]
path = third-party/libstudxml
url = https://git.codesynthesis.com/libstudxml/libstudxml.git

View File

@ -18,7 +18,7 @@ set(XLNT_SOURCE_DIR ${XLNT_ROOT_DIR}/source)
set(THIRD_PARTY_DIR ${XLNT_ROOT_DIR}/third-party) set(THIRD_PARTY_DIR ${XLNT_ROOT_DIR}/third-party)
# Include libstudxml library # Include libstudxml library
add_subdirectory(${THIRD_PARTY_DIR}/libstudxml add_subdirectory(${THIRD_PARTY_DIR}/libstudxml.build
${CMAKE_CURRENT_BINARY_DIR}/third-party/libstudxml) ${CMAKE_CURRENT_BINARY_DIR}/third-party/libstudxml)
if(COVERAGE) if(COVERAGE)

View File

@ -26,6 +26,7 @@
#pragma clang diagnostic ignored "-Wweak-vtables" #pragma clang diagnostic ignored "-Wweak-vtables"
#pragma clang diagnostic ignored "-Wextra-semi" #pragma clang diagnostic ignored "-Wextra-semi"
#pragma clang diagnostic ignored "-Wdeprecated" #pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#include <libstudxml/content.hxx> #include <libstudxml/content.hxx>
#include <libstudxml/parser.hxx> #include <libstudxml/parser.hxx>
#include <libstudxml/qname.hxx> #include <libstudxml/qname.hxx>

1
third-party/libstudxml vendored Submodule

@ -0,0 +1 @@
Subproject commit e729667b0f34a39ce4a61339843af4154648667b

View File

@ -0,0 +1,79 @@
cmake_minimum_required(VERSION 3.1)
project(libstudxml)
# Require C++11 compiler
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(LIBSTUDXML_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libstudxml)
set(LIBSTUDXML_INCLUDE_DIR ${LIBSTUDXML_ROOT_DIR}/../libstudxml)
if(STATIC_CRT)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ucm.cmake)
ucm_set_runtime(STATIC)
endif()
set(LIBSTUDXML
${LIBSTUDXML_ROOT_DIR}/libstudxml/parser.cxx
${LIBSTUDXML_ROOT_DIR}/libstudxml/qname.cxx
${LIBSTUDXML_ROOT_DIR}/libstudxml/serializer.cxx
${LIBSTUDXML_ROOT_DIR}/libstudxml/value-traits.cxx
${LIBSTUDXML_ROOT_DIR}/libstudxml/content
${LIBSTUDXML_ROOT_DIR}/libstudxml/exception
${LIBSTUDXML_ROOT_DIR}/libstudxml/forward
${LIBSTUDXML_ROOT_DIR}/libstudxml/parser
${LIBSTUDXML_ROOT_DIR}/libstudxml/qname
${LIBSTUDXML_ROOT_DIR}/libstudxml/serializer
${LIBSTUDXML_ROOT_DIR}/libstudxml/value-traits)
set(GENX
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/genx/char-props.c
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/genx/genx.c
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/genx/genx.h)
set(EXPAT
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/xmlparse.c
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/xmlrole.c
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/xmltok.c
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/ascii.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/asciitab.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/config.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/expat_external.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/expat.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/iasciitab.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/internal.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/latin1tab.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/nametab.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/utf8tab.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/xmlrole.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/xmltok_impl.h
${LIBSTUDXML_ROOT_DIR}/libstudxml/details/expat/xmltok.h)
add_library(libstudxml OBJECT ${LIBSTUDXML} ${GENX} ${EXPAT})
target_compile_definitions(libstudxml PUBLIC LIBSTUDXML_STATIC_LIB=1)
target_include_directories(libstudxml
PUBLIC ${LIBSTUDXML_ROOT_DIR}
PUBLIC ${EXPAT_INCLUDE_DIRS})
if(STATIC)
target_compile_definitions(libstudxml PUBLIC XML_STATIC=1)
endif()
# Prevent warning C4996 caused by strcpy, strncpy, sprintf in genx
# TODO: would it be better to define this only in genx.c?
if(MSVC)
target_compile_definitions(libstudxml PRIVATE _CRT_SECURE_NO_WARNINGS=1)
endif()
# Build with -fPIC when xlnt is a shared library
# TODO: is this still necessary? try removing
if(NOT STATIC)
set_target_properties(libstudxml PROPERTIES POSITION_INDEPENDENT_CODE 1)
endif()
# When xlnt is a static library, assume expat will be linked statically too
# TODO: is this a valid assumption?
if(STATIC)
target_compile_definitions(libstudxml PUBLIC XML_STATIC=1)
endif()