Added macro config header to installation

This commit is contained in:
Chlumsky 2023-11-11 14:59:26 +01:00
parent f04dc6acd3
commit f12d7ca000
21 changed files with 91 additions and 21 deletions

View File

@ -1,4 +1,20 @@
## Version 1.11 (2023-11-11)
- Reworked SVG parser, which now supports multiple paths and other shapes - requires Skia
- Major performance improvements due to inlining certain low-level classes
- A limited version of the standalone executable can now be built without any dependencies
- Fixed `listFontVariationAxes` which previously reported incorrectly scaled values
- Fixed potential crash when generating SDF from an empty `Shape`
- Fixed a small bug in the error correction routine
- Errors now reported to `stderr` rather than `stdout`
- All command line arguments can now also be passed with two dashes instead of one
- Added `-version` argument to print the program's version
- `Shape` can now be loaded from a pointer to FreeType's `FT_Outline`
- Added hidden CMake options to selectively disable PNG, SVG, or variable font support
- Added CMake presets
- Other minor bug fixes
## Version 1.10 (2023-01-15) ## Version 1.10 (2023-01-15)
- Switched to vcpkg as the primary dependency management system - Switched to vcpkg as the primary dependency management system

View File

@ -224,7 +224,38 @@ if(MSDFGEN_INSTALL)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
set(MSDFGEN_CONFIG_PATH "lib/cmake/msdfgen") set(MSDFGEN_CONFIG_PATH "lib/cmake/msdfgen")
# install tree package config # Generate msdfgen-config.h
if(BUILD_SHARED_LIBS AND WIN32)
set(MSDFGEN_PUBLIC_MACRO_VALUE " __declspec(dllimport)")
else()
set(MSDFGEN_PUBLIC_MACRO_VALUE "")
endif()
set(MSDFGEN_ADDITIONAL_DEFINES "")
if(MSDFGEN_USE_CPP11)
set(MSDFGEN_ADDITIONAL_DEFINES "${MSDFGEN_ADDITIONAL_DEFINES}\n#define MSDFGEN_USE_CPP11")
endif()
if(MSDFGEN_USE_OPENMP)
set(MSDFGEN_ADDITIONAL_DEFINES "${MSDFGEN_ADDITIONAL_DEFINES}\n#define MSDFGEN_USE_OPENMP")
endif()
if(NOT MSDFGEN_CORE_ONLY)
set(MSDFGEN_ADDITIONAL_DEFINES "${MSDFGEN_ADDITIONAL_DEFINES}\n#define MSDFGEN_EXTENSIONS")
if(MSDFGEN_USE_SKIA)
set(MSDFGEN_ADDITIONAL_DEFINES "${MSDFGEN_ADDITIONAL_DEFINES}\n#define MSDFGEN_USE_SKIA")
endif()
if(MSDFGEN_DISABLE_SVG)
set(MSDFGEN_ADDITIONAL_DEFINES "${MSDFGEN_ADDITIONAL_DEFINES}\n#define MSDFGEN_DISABLE_SVG")
endif()
if(NOT MSDFGEN_DISABLE_PNG)
set(MSDFGEN_ADDITIONAL_DEFINES "${MSDFGEN_ADDITIONAL_DEFINES}\n#define MSDFGEN_USE_LIBPNG")
else()
set(MSDFGEN_ADDITIONAL_DEFINES "${MSDFGEN_ADDITIONAL_DEFINES}\n#define MSDFGEN_DISABLE_PNG")
endif()
if(MSDFGEN_DISABLE_VARIABLE_FONTS)
set(MSDFGEN_ADDITIONAL_DEFINES "${MSDFGEN_ADDITIONAL_DEFINES}\n#define MSDFGEN_DISABLE_VARIABLE_FONTS")
endif()
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/msdfgen-config.h.in" msdfgen-config.h)
write_basic_package_version_file( write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/msdfgenConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/msdfgenConfigVersion.cmake"
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
@ -232,19 +263,20 @@ if(MSDFGEN_INSTALL)
) )
configure_package_config_file( configure_package_config_file(
cmake/msdfgenConfig.cmake.in "${CMAKE_CURRENT_SOURCE_DIR}/cmake/msdfgenConfig.cmake.in"
${MSDFGEN_CONFIG_PATH}/msdfgenConfig.cmake ${MSDFGEN_CONFIG_PATH}/msdfgenConfig.cmake
INSTALL_DESTINATION ${MSDFGEN_CONFIG_PATH} INSTALL_DESTINATION ${MSDFGEN_CONFIG_PATH}
NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO
) )
# build tree package config
configure_file( configure_file(
cmake/msdfgenConfig.cmake.in "${CMAKE_CURRENT_SOURCE_DIR}/cmake/msdfgenConfig.cmake.in"
msdfgenConfig.cmake msdfgenConfig.cmake
@ONLY @ONLY
) )
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/msdfgen-config.h" DESTINATION include/msdfgen)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/msdfgen-config.h" DESTINATION include/msdfgen/msdfgen)
install(TARGETS msdfgen-core EXPORT msdfgenTargets install(TARGETS msdfgen-core EXPORT msdfgenTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}

12
cmake/msdfgen-config.h.in Normal file
View File

@ -0,0 +1,12 @@
#pragma once
#define MSDFGEN_PUBLIC${MSDFGEN_PUBLIC_MACRO_VALUE}
#define MSDFGEN_EXT_PUBLIC${MSDFGEN_PUBLIC_MACRO_VALUE}
#define MSDFGEN_VERSION ${MSDFGEN_VERSION}
#define MSDFGEN_VERSION_MAJOR ${MSDFGEN_VERSION_MAJOR}
#define MSDFGEN_VERSION_MINOR ${MSDFGEN_VERSION_MINOR}
#define MSDFGEN_VERSION_REVISION ${MSDFGEN_VERSION_REVISION}
#define MSDFGEN_COPYRIGHT_YEAR ${MSDFGEN_COPYRIGHT_YEAR}
${MSDFGEN_ADDITIONAL_DEFINES}

View File

@ -1,12 +1,10 @@
#pragma once #pragma once
#include <cstddef> #include "base.h"
namespace msdfgen { namespace msdfgen {
typedef unsigned char byte;
/// Reference to a 2D image bitmap or a buffer acting as one. Pixel storage not owned or managed by the object. /// Reference to a 2D image bitmap or a buffer acting as one. Pixel storage not owned or managed by the object.
template <typename T, int N = 1> template <typename T, int N = 1>
struct BitmapRef { struct BitmapRef {

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "base.h"
namespace msdfgen { namespace msdfgen {
/// Edge color specifies which color channels an edge belongs to. /// Edge color specifies which color channels an edge belongs to.

View File

@ -1,8 +1,6 @@
#include "EdgeHolder.h" #include "EdgeHolder.h"
#include <cstddef>
namespace msdfgen { namespace msdfgen {
void EdgeHolder::swap(EdgeHolder &a, EdgeHolder &b) { void EdgeHolder::swap(EdgeHolder &a, EdgeHolder &b) {

View File

@ -2,6 +2,7 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include "base.h"
namespace msdfgen { namespace msdfgen {

View File

@ -1,8 +1,6 @@
#include "ShapeDistanceFinder.h" #include "ShapeDistanceFinder.h"
#include <cstddef>
namespace msdfgen { namespace msdfgen {
template <class ContourCombiner> template <class ContourCombiner>

View File

@ -3,6 +3,7 @@
#include <cmath> #include <cmath>
#include <cfloat> #include <cfloat>
#include "base.h"
namespace msdfgen { namespace msdfgen {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <cstddef>
#include <cmath> #include <cmath>
#include "base.h"
namespace msdfgen { namespace msdfgen {

View File

@ -2,6 +2,7 @@
#pragma once #pragma once
#include <cmath> #include <cmath>
#include "base.h"
namespace msdfgen { namespace msdfgen {

16
core/base.h Normal file
View File

@ -0,0 +1,16 @@
#pragma once
// This file needs to be included first for all MSDFgen sources
#ifndef MSDFGEN_PUBLIC
#include <msdfgen/msdfgen-config.h>
#endif
#include <cstddef>
namespace msdfgen {
typedef unsigned char byte;
}

View File

@ -1,7 +1,6 @@
#include "edge-selectors.h" #include "edge-selectors.h"
#include <cstddef>
#include "arithmetics.hpp" #include "arithmetics.hpp"
namespace msdfgen { namespace msdfgen {

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "base.h"
namespace msdfgen { namespace msdfgen {
// ax^2 + bx + c = 0 // ax^2 + bx + c = 0

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <cstddef>
#include "BitmapRef.hpp" #include "BitmapRef.hpp"
#ifndef MSDFGEN_PUBLIC #ifndef MSDFGEN_PUBLIC

View File

@ -1,7 +1,6 @@
#include "../msdfgen.h" #include "../msdfgen.h"
#include <cstddef>
#include <vector> #include <vector>
#include "edge-selectors.h" #include "edge-selectors.h"
#include "contour-combiners.h" #include "contour-combiners.h"

View File

@ -5,8 +5,6 @@
namespace msdfgen { namespace msdfgen {
typedef unsigned char byte;
inline byte pixelFloatToByte(float x) { inline byte pixelFloatToByte(float x) {
return byte(clamp(256.f*x, 255.f)); return byte(clamp(256.f*x, 255.f));
} }

View File

@ -1,12 +1,10 @@
#pragma once #pragma once
#include <cstddef>
#include "../core/Shape.h" #include "../core/Shape.h"
namespace msdfgen { namespace msdfgen {
typedef unsigned char byte;
typedef unsigned unicode_t; typedef unsigned unicode_t;
class FreetypeHandle; class FreetypeHandle;

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <cstddef>
#include "../core/Shape.h" #include "../core/Shape.h"
#ifndef MSDFGEN_DISABLE_SVG #ifndef MSDFGEN_DISABLE_SVG

View File

@ -15,6 +15,7 @@
* *
*/ */
#include "core/base.h"
#include "core/arithmetics.hpp" #include "core/arithmetics.hpp"
#include "core/Vector2.hpp" #include "core/Vector2.hpp"
#include "core/Projection.h" #include "core/Projection.h"

View File

@ -1,7 +1,7 @@
{ {
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/master/docs/vcpkg.schema.json", "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/master/docs/vcpkg.schema.json",
"name": "msdfgen", "name": "msdfgen",
"version": "1.10.0", "version": "1.11.0",
"default-features": [ "default-features": [
"extensions", "extensions",
"geometry-preprocessing", "geometry-preprocessing",