Cmake-ified pugiconfig

This commit is contained in:
Kai Tindall 2020-12-09 18:14:09 +00:00
parent 5a0fd5d85f
commit c6316d3d8f
2 changed files with 38 additions and 28 deletions

View File

@ -27,6 +27,44 @@ option(BUILD_SHARED_AND_STATIC_LIBS "Build both shared and static libraries" OFF
# Technically not needed for this file. This is builtin.
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
# Options from the pugiconfig.hpp file.
option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF)
option(PUGIXML_COMPACT "Enable compact mode" OFF)
option(PUGIXML_NO_XPATH "Disable XPath" OFF)
option(PUGIXML_NO_STL "Disable STL" OFF)
option(PUGIXML_NO_EXCEPTIONS "Disable Exceptions" OFF)
option(PUGIXML_HEADER_ONLY "Switch to header only" OFF)
option(PUGIXML_HAS_LONG_LONG "Enable long long support" OFF)
# Tune these to adjust memory-related behaviour
set(PUGIXML_MEMORY_PAGE_SIZE 32768)
set(PUGIXML_MEMORY_OUTPUT_STACK 10240)
set(PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096)
# Tune this to adjust max nesting for XPath queries
set(PUGIXML_XPATH_DEPTH_LIMIT 1024)
# Set these to control attributes for public classes/functions (Not 100% sure if these will work.)
option(PUGIXML_OVERRIDE_API "Export all public symbols from DLL" OFF)
option(PUGIXML_OVERRIDE_CLASS "Import all classes from DLL" OFF)
option(PUGIXML_OVERRIDE_FUNCTION "Set calling conventions to all public functions to fastcall" OFF)
if(${PUGIXML_OVERRIDE_API})
set(PUGIXML_API __declspec(dllexport))
endif()
if(${PUGIXML_OVERRIDE_CLASS})
set(PUGIXML_CLASS __declspec(dllimport)
endif()
if(${PUGIXML_OVERRIDE_FUNCTION})
set(PUGIXML_FUNCTION __fastcall)
endif()
# End of options
set(BUILD_DEFINES CACHE STRING "Build defines")
# This is used to backport a CMake 3.15 feature, but is also forwards compatible

View File

@ -14,20 +14,6 @@
#ifndef HEADER_PUGICONFIG_HPP
#define HEADER_PUGICONFIG_HPP
// Uncomment this to enable wchar_t mode
// #define PUGIXML_WCHAR_MODE
// Uncomment this to enable compact mode
// #define PUGIXML_COMPACT
// Uncomment this to disable XPath
// #define PUGIXML_NO_XPATH
// Uncomment this to disable STL
// #define PUGIXML_NO_STL
// Uncomment this to disable exceptions
// #define PUGIXML_NO_EXCEPTIONS
// Set this to control attributes for public classes/functions, i.e.:
// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
@ -35,20 +21,6 @@
// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead
// Tune these constants to adjust memory-related behavior
// #define PUGIXML_MEMORY_PAGE_SIZE 32768
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
// Tune this constant to adjust max nesting for XPath queries
// #define PUGIXML_XPATH_DEPTH_LIMIT 1024
// Uncomment this to switch to header-only version
// #define PUGIXML_HEADER_ONLY
// Uncomment this to enable long long support
// #define PUGIXML_HAS_LONG_LONG
#endif
/**