mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-01-30 16:38:41 +03:00
update
This commit is contained in:
28
.dockerignore
Normal file
28
.dockerignore
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
Build
|
||||||
|
Build.bat
|
||||||
|
/build/
|
||||||
|
deps/build
|
||||||
|
MYMETA.json
|
||||||
|
MYMETA.yml
|
||||||
|
_build
|
||||||
|
blib
|
||||||
|
xs/buildtmp
|
||||||
|
*.o
|
||||||
|
*.log
|
||||||
|
MANIFEST.bak
|
||||||
|
xs/MANIFEST.bak
|
||||||
|
xs/assertlib*
|
||||||
|
.init_bundle.ini
|
||||||
|
.vs/*
|
||||||
|
local-lib
|
||||||
|
/src/TAGS
|
||||||
|
/.vscode/
|
||||||
|
build-linux/*
|
||||||
|
deps/build-linux/*
|
||||||
|
**/.DS_Store
|
||||||
|
install_*
|
||||||
|
build_*/
|
||||||
|
SVG
|
||||||
|
Dockerfile
|
||||||
|
DockerBuild.sh
|
||||||
|
DockerRun.sh
|
||||||
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Build
|
||||||
|
Build.bat
|
||||||
|
/build/
|
||||||
|
/build2022/
|
||||||
|
deps/build
|
||||||
|
MYMETA.json
|
||||||
|
MYMETA.yml
|
||||||
|
_build
|
||||||
|
blib
|
||||||
|
xs/buildtmp
|
||||||
|
*.o
|
||||||
|
*.log
|
||||||
|
MANIFEST.bak
|
||||||
|
xs/MANIFEST.bak
|
||||||
|
xs/assertlib*
|
||||||
|
.init_bundle.ini
|
||||||
|
.vs/*
|
||||||
|
local-lib
|
||||||
|
/src/TAGS
|
||||||
|
/.vscode/
|
||||||
|
build-linux/*
|
||||||
|
deps/build-linux/*
|
||||||
|
**/.DS_Store
|
||||||
|
install_*
|
||||||
|
build_*/
|
||||||
|
SVG
|
||||||
|
**/process_full/
|
||||||
|
**/machine_full/
|
||||||
|
**/filament_full/
|
||||||
132
Build.PL
Normal file
132
Build.PL
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
print "This script is currently used for installing Perl dependenices for running\n";
|
||||||
|
print "the libslic3r unit / integration tests through Perl prove.\n";
|
||||||
|
print "If you don't plan to run the unit / integration tests, you don't need to\n";
|
||||||
|
print "install these dependencies to build and run QIDISlicer.\n";
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Config;
|
||||||
|
use File::Spec;
|
||||||
|
|
||||||
|
my %prereqs = qw(
|
||||||
|
Devel::CheckLib 0
|
||||||
|
ExtUtils::MakeMaker 6.80
|
||||||
|
ExtUtils::ParseXS 3.22
|
||||||
|
ExtUtils::XSpp 0
|
||||||
|
ExtUtils::XSpp::Cmd 0
|
||||||
|
ExtUtils::CppGuess 0
|
||||||
|
ExtUtils::Typemaps 0
|
||||||
|
ExtUtils::Typemaps::Basic 0
|
||||||
|
File::Basename 0
|
||||||
|
File::Spec 0
|
||||||
|
Getopt::Long 0
|
||||||
|
Module::Build::WithXSpp 0.14
|
||||||
|
Moo 1.003001
|
||||||
|
POSIX 0
|
||||||
|
Scalar::Util 0
|
||||||
|
Test::More 0
|
||||||
|
IO::Scalar 0
|
||||||
|
Time::HiRes 0
|
||||||
|
);
|
||||||
|
my %recommends = qw(
|
||||||
|
Class::XSAccessor 0
|
||||||
|
Test::Harness 0
|
||||||
|
);
|
||||||
|
|
||||||
|
my $sudo = grep { $_ eq '--sudo' } @ARGV;
|
||||||
|
my $nolocal = grep { $_ eq '--nolocal' } @ARGV;
|
||||||
|
|
||||||
|
my @missing_prereqs = ();
|
||||||
|
if ($ENV{SLIC3R_NO_AUTO}) {
|
||||||
|
foreach my $module (sort keys %prereqs) {
|
||||||
|
my $version = $prereqs{$module};
|
||||||
|
next if eval "use $module $version; 1";
|
||||||
|
push @missing_prereqs, $module if exists $prereqs{$module};
|
||||||
|
print "Missing prerequisite $module $version\n";
|
||||||
|
}
|
||||||
|
foreach my $module (sort keys %recommends) {
|
||||||
|
my $version = $recommends{$module};
|
||||||
|
next if eval "use $module $version; 1";
|
||||||
|
print "Missing optional $module $version\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
my @try = (
|
||||||
|
$ENV{CPANM} // (),
|
||||||
|
File::Spec->catfile($Config{sitebin}, 'cpanm'),
|
||||||
|
File::Spec->catfile($Config{installscript}, 'cpanm'),
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cpanm;
|
||||||
|
foreach my $path (@try) {
|
||||||
|
if (-e $path) { # don't use -x because it fails on Windows
|
||||||
|
$cpanm = $path;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$cpanm) {
|
||||||
|
if ($^O =~ /^(?:darwin|linux)$/ && system(qw(which cpanm)) == 0) {
|
||||||
|
$cpanm = 'cpanm';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
die <<'EOF'
|
||||||
|
cpanm was not found. Please install it before running this script.
|
||||||
|
|
||||||
|
There are several ways to install cpanm, try one of these:
|
||||||
|
|
||||||
|
apt-get install cpanminus
|
||||||
|
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
|
||||||
|
cpan App::cpanminus
|
||||||
|
|
||||||
|
If it is installed in a non-standard location you can do:
|
||||||
|
|
||||||
|
CPANM=/path/to/cpanm perl Build.PL
|
||||||
|
|
||||||
|
EOF
|
||||||
|
if !$cpanm;
|
||||||
|
my @cpanm_args = ();
|
||||||
|
push @cpanm_args, "--sudo" if $sudo;
|
||||||
|
|
||||||
|
# install local::lib without --local-lib otherwise it's not usable afterwards
|
||||||
|
if (!eval "use local::lib qw(local-lib); 1") {
|
||||||
|
my $res = system $cpanm, @cpanm_args, 'local::lib';
|
||||||
|
warn "Warning: local::lib is required. You might need to run the `cpanm --sudo local::lib` command in order to install it.\n"
|
||||||
|
if $res != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
push @cpanm_args, ('--local-lib', 'local-lib') if ! $nolocal;
|
||||||
|
|
||||||
|
# make sure our cpanm is updated (old ones don't support the ~ syntax)
|
||||||
|
system $cpanm, @cpanm_args, 'App::cpanminus';
|
||||||
|
|
||||||
|
my %modules = (%prereqs, %recommends);
|
||||||
|
foreach my $module (sort keys %modules) {
|
||||||
|
my $version = $modules{$module};
|
||||||
|
my @cmd = ($cpanm, @cpanm_args);
|
||||||
|
|
||||||
|
# temporary workaround for upstream bug in test
|
||||||
|
push @cmd, '--notest'
|
||||||
|
if $module =~ /^(?:OpenGL|Test::Harness)$/;
|
||||||
|
|
||||||
|
push @cmd, "$module~$version";
|
||||||
|
|
||||||
|
my $res = system @cmd;
|
||||||
|
if ($res != 0) {
|
||||||
|
if (exists $prereqs{$module}) {
|
||||||
|
push @missing_prereqs, $module;
|
||||||
|
} else {
|
||||||
|
printf "Don't worry, this module is optional.\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
print "In the next step, you need to build the QIDIStudio C++ library.\n";
|
||||||
|
print "1) Create a build directory and change to it\n";
|
||||||
|
print "2) run cmake .. -DCMAKE_BUILD_TYPE=Release\n";
|
||||||
|
print "3) run make\n";
|
||||||
|
print "4) to execute the automatic tests, run ctest --verbose\n";
|
||||||
|
__END__
|
||||||
269
BuildLinux.sh
Normal file
269
BuildLinux.sh
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e # exit on first error
|
||||||
|
|
||||||
|
export ROOT=`pwd`
|
||||||
|
export NCORES=`nproc --all`
|
||||||
|
export CMAKE_BUILD_PARALLEL_LEVEL=${NCORES}
|
||||||
|
FOUND_GTK2=$(dpkg -l libgtk* | grep gtk2)
|
||||||
|
FOUND_GTK3=$(dpkg -l libgtk* | grep gtk-3)
|
||||||
|
|
||||||
|
function check_available_memory_and_disk() {
|
||||||
|
FREE_MEM_GB=$(free -g -t | grep 'Mem' | rev | cut -d" " -f1 | rev)
|
||||||
|
MIN_MEM_GB=10
|
||||||
|
|
||||||
|
FREE_DISK_KB=$(df -k . | tail -1 | awk '{print $4}')
|
||||||
|
MIN_DISK_KB=$((10 * 1024 * 1024))
|
||||||
|
|
||||||
|
if [ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]; then
|
||||||
|
echo -e "\nERROR: QIDI Studio Builder requires at least ${MIN_MEM_GB}G of 'available' mem (systen has only ${FREE_MEM_GB}G available)"
|
||||||
|
echo && free -h && echo
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]]; then
|
||||||
|
echo -e "\nERROR: QIDI Studio Builder requires at least $(echo $MIN_DISK_KB |awk '{ printf "%.1fG\n", $1/1024/1024; }') (systen has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)"
|
||||||
|
echo && df -h . && echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
unset name
|
||||||
|
while getopts ":dsiuhgbr" opt; do
|
||||||
|
case ${opt} in
|
||||||
|
u )
|
||||||
|
UPDATE_LIB="1"
|
||||||
|
;;
|
||||||
|
i )
|
||||||
|
BUILD_IMAGE="1"
|
||||||
|
;;
|
||||||
|
d )
|
||||||
|
BUILD_DEPS="1"
|
||||||
|
;;
|
||||||
|
s )
|
||||||
|
BUILD_QIDI_STUDIO="1"
|
||||||
|
;;
|
||||||
|
b )
|
||||||
|
BUILD_DEBUG="1"
|
||||||
|
;;
|
||||||
|
g )
|
||||||
|
FOUND_GTK3=""
|
||||||
|
;;
|
||||||
|
r )
|
||||||
|
SKIP_RAM_CHECK="1"
|
||||||
|
;;
|
||||||
|
h ) echo "Usage: ./BuildLinux.sh [-i][-u][-d][-s][-b][-g]"
|
||||||
|
echo " -i: Generate appimage (optional)"
|
||||||
|
echo " -g: force gtk2 build"
|
||||||
|
echo " -b: build in debug mode"
|
||||||
|
echo " -d: build deps (optional)"
|
||||||
|
echo " -s: build qidi-studio (optional)"
|
||||||
|
echo " -u: only update clock & dependency packets (optional and need sudo)"
|
||||||
|
echo " -r: skip free ram check (low ram compiling)"
|
||||||
|
echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'"
|
||||||
|
echo " and then './BuildLinux.sh -dsi'"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $OPTIND -eq 1 ]
|
||||||
|
then
|
||||||
|
echo "Usage: ./BuildLinux.sh [-i][-u][-d][-s][-b][-g]"
|
||||||
|
echo " -i: Generate appimage (optional)"
|
||||||
|
echo " -g: force gtk2 build"
|
||||||
|
echo " -b: build in debug mode"
|
||||||
|
echo " -d: build deps (optional)"
|
||||||
|
echo " -s: build qidi-studio (optional)"
|
||||||
|
echo " -u: only update clock & dependency packets (optional and need sudo)"
|
||||||
|
echo " -r: skip free ram check (low ram compiling)"
|
||||||
|
echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'"
|
||||||
|
echo " and then './BuildLinux.sh -dsi'"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# mkdir build
|
||||||
|
if [ ! -d "build" ]
|
||||||
|
then
|
||||||
|
mkdir build
|
||||||
|
fi
|
||||||
|
|
||||||
|
#FIXME: require root for -u option
|
||||||
|
if [[ -n "$UPDATE_LIB" ]]
|
||||||
|
then
|
||||||
|
echo -n -e "Updating linux ...\n"
|
||||||
|
# hwclock -s # DeftDawg: Why does SuperSlicer want to do this?
|
||||||
|
apt update
|
||||||
|
if [[ -z "$FOUND_GTK3" ]]
|
||||||
|
then
|
||||||
|
echo -e "\nInstalling: libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git\n"
|
||||||
|
apt install -y libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git
|
||||||
|
else
|
||||||
|
echo -e "\nFind libgtk-3, installing: libgtk-3-dev libglew-dev libudev-dev libdbus-1-dev cmake git\n"
|
||||||
|
apt install -y libgtk-3-dev libglew-dev libudev-dev libdbus-1-dev cmake git
|
||||||
|
fi
|
||||||
|
# for ubuntu 22.04:
|
||||||
|
ubu_version="$(cat /etc/issue)"
|
||||||
|
if [[ $ubu_version == "Ubuntu 22.04"* ]]
|
||||||
|
then
|
||||||
|
apt install -y curl libssl-dev libcurl4-openssl-dev m4
|
||||||
|
elif [[ $ubu_version == "Ubuntu 24.04"* ]]
|
||||||
|
then
|
||||||
|
NEW_SOURCE="deb http://gb.archive.ubuntu.com/ubuntu jammy main"
|
||||||
|
if grep -qF -- "$NEW_SOURCE" /etc/apt/sources.list; then
|
||||||
|
echo "source exist: $NEW_SOURCE"
|
||||||
|
else
|
||||||
|
echo "$NEW_SOURCE" | sudo tee -a /etc/apt/sources.list > /dev/null
|
||||||
|
fi
|
||||||
|
apt update
|
||||||
|
fi
|
||||||
|
if [[ -n "$BUILD_DEBUG" ]]
|
||||||
|
then
|
||||||
|
echo -e "\nInstalling: libssl-dev libcurl4-openssl-dev\n"
|
||||||
|
apt install -y libssl-dev libcurl4-openssl-dev
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Addtional Dev packages for QIDI Studio
|
||||||
|
export REQUIRED_DEV_PACKAGES="libgstreamerd-3-dev libsecret-1-dev libwebkit2gtk-4.0-dev libosmesa6-dev libssl-dev libcurl4-openssl-dev eglexternalplatform-dev libudev-dev libdbus-1-dev extra-cmake-modules"
|
||||||
|
# libwebkit2gtk-4.1-dev ??
|
||||||
|
export DEV_PACKAGES_COUNT=$(echo ${REQUIRED_DEV_PACKAGES} | wc -w)
|
||||||
|
if [ $(dpkg --get-selections | grep -E "$(echo ${REQUIRED_DEV_PACKAGES} | tr ' ' '|')" | wc -l) -lt ${DEV_PACKAGES_COUNT} ]; then
|
||||||
|
sudo apt install -y ${REQUIRED_DEV_PACKAGES} git cmake wget file
|
||||||
|
fi
|
||||||
|
echo -e "done\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
FOUND_GTK2_DEV=$(dpkg -l libgtk* | grep gtk2.0-dev || echo '')
|
||||||
|
FOUND_GTK3_DEV=$(dpkg -l libgtk* | grep gtk-3-dev || echo '')
|
||||||
|
echo "FOUND_GTK2=$FOUND_GTK2)"
|
||||||
|
if [[ -z "$FOUND_GTK2_DEV" ]]
|
||||||
|
then
|
||||||
|
if [[ -z "$FOUND_GTK3_DEV" ]]
|
||||||
|
then
|
||||||
|
echo "Error, you must install the dependencies before."
|
||||||
|
echo "Use option -u with sudo"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[1/9] Updating submodules..."
|
||||||
|
{
|
||||||
|
# update submodule profiles
|
||||||
|
pushd resources/profiles
|
||||||
|
git submodule update --init
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "[2/9] Changing date in version..."
|
||||||
|
{
|
||||||
|
# change date in version
|
||||||
|
sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc
|
||||||
|
}
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
# mkdir in deps
|
||||||
|
if [ ! -d "deps/build" ]
|
||||||
|
then
|
||||||
|
mkdir deps/build
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ -n "$SKIP_RAM_CHECK" ]]
|
||||||
|
then
|
||||||
|
check_available_memory_and_disk
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$BUILD_DEPS" ]]
|
||||||
|
then
|
||||||
|
echo "[3/9] Configuring dependencies..."
|
||||||
|
BUILD_ARGS=""
|
||||||
|
if [[ -n "$FOUND_GTK3_DEV" ]]
|
||||||
|
then
|
||||||
|
BUILD_ARGS="-DDEP_WX_GTK3=ON"
|
||||||
|
fi
|
||||||
|
if [[ -n "$BUILD_DEBUG" ]]
|
||||||
|
then
|
||||||
|
# have to build deps with debug & release or the cmake won't find evrything it needs
|
||||||
|
mkdir deps/build/release
|
||||||
|
pushd deps/build/release
|
||||||
|
cmake ../.. -DDESTDIR="../destdir" $BUILD_ARGS
|
||||||
|
make -j$NCORES
|
||||||
|
popd
|
||||||
|
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cmake deps
|
||||||
|
pushd deps/build
|
||||||
|
cmake .. $BUILD_ARGS
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
# make deps
|
||||||
|
echo "[4/9] Building dependencies..."
|
||||||
|
make -j$NCORES
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
# rename wxscintilla # TODO: DeftDawg: Does QIDIStudio need this?
|
||||||
|
# echo "[5/9] Renaming wxscintilla library..."
|
||||||
|
# pushd destdir/usr/local/lib
|
||||||
|
# if [[ -z "$FOUND_GTK3_DEV" ]]
|
||||||
|
# then
|
||||||
|
# cp libwxscintilla-3.1.a libwx_gtk2u_scintilla-3.1.a
|
||||||
|
# else
|
||||||
|
# cp libwxscintilla-3.1.a libwx_gtk3u_scintilla-3.1.a
|
||||||
|
# fi
|
||||||
|
# popd
|
||||||
|
# echo "done"
|
||||||
|
|
||||||
|
# FIXME: only clean deps if compiling succeeds; otherwise reruns waste tonnes of time!
|
||||||
|
# clean deps
|
||||||
|
# echo "[6/9] Cleaning dependencies..."
|
||||||
|
# rm -rf dep_*
|
||||||
|
popd
|
||||||
|
echo "done"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$BUILD_QIDI_STUDIO" ]]
|
||||||
|
then
|
||||||
|
echo "[7/9] Configuring Slic3r..."
|
||||||
|
BUILD_ARGS=""
|
||||||
|
if [[ -n "$FOUND_GTK3_DEV" ]]
|
||||||
|
then
|
||||||
|
BUILD_ARGS="-DSLIC3R_GTK=3"
|
||||||
|
fi
|
||||||
|
if [[ -n "$BUILD_DEBUG" ]]
|
||||||
|
then
|
||||||
|
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug -DQDT_INTERNAL_TESTING=1"
|
||||||
|
else
|
||||||
|
BUILD_ARGS="${BUILD_ARGS} -DQDT_RELEASE_TO_PUBLIC=1 -DQDT_INTERNAL_TESTING=0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cmake
|
||||||
|
pushd build
|
||||||
|
cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DSLIC3R_STATIC=1 ${BUILD_ARGS}
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
# make Slic3r
|
||||||
|
echo "[8/9] Building Slic3r..."
|
||||||
|
make -j$NCORES QIDIStudio # Slic3r
|
||||||
|
|
||||||
|
# make .mo
|
||||||
|
# make gettext_po_to_mo # FIXME: DeftDawg: complains about msgfmt not existing even in SuperSlicer, did this ever work?
|
||||||
|
|
||||||
|
popd
|
||||||
|
echo "done"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -e $ROOT/build/src/BuildLinuxImage.sh ]]; then
|
||||||
|
# Give proper permissions to script
|
||||||
|
chmod 755 $ROOT/build/src/BuildLinuxImage.sh
|
||||||
|
|
||||||
|
echo "[9/9] Generating Linux app..."
|
||||||
|
pushd build
|
||||||
|
if [[ -n "$BUILD_IMAGE" ]]
|
||||||
|
then
|
||||||
|
$ROOT/build/src/BuildLinuxImage.sh -i
|
||||||
|
else
|
||||||
|
$ROOT/build/src/BuildLinuxImage.sh
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
echo "done"
|
||||||
|
fi
|
||||||
717
CMakeLists.txt
Normal file
717
CMakeLists.txt
Normal file
@@ -0,0 +1,717 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
project(QIDIStudio)
|
||||||
|
|
||||||
|
include("version.inc")
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
|
set(SLIC3R_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
|
||||||
|
file(TO_NATIVE_PATH "${SLIC3R_RESOURCES_DIR}" SLIC3R_RESOURCES_DIR_WIN)
|
||||||
|
|
||||||
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
message(STATUS "No build type selected, default to Release")
|
||||||
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED ENV{SLIC3R_STATIC})
|
||||||
|
set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
|
||||||
|
else()
|
||||||
|
if (MSVC OR MINGW OR APPLE)
|
||||||
|
set(SLIC3R_STATIC_INITIAL 1)
|
||||||
|
else()
|
||||||
|
set(SLIC3R_STATIC_INITIAL 0)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(SLIC3R_STATIC "Compile QIDIStudio with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
|
||||||
|
option(SLIC3R_GUI "Compile QIDIStudio with GUI components (OpenGL, wxWidgets)" 1)
|
||||||
|
option(SLIC3R_FHS "Assume QIDIStudio is to be installed in a FHS directory structure" 0)
|
||||||
|
option(SLIC3R_WX_STABLE "Build against wxWidgets stable (3.0) as oppsed to dev (3.1) on Linux" 0)
|
||||||
|
option(SLIC3R_PROFILE "Compile QIDIStudio with an invasive Shiny profiler" 0)
|
||||||
|
option(SLIC3R_PCH "Use precompiled headers" 1)
|
||||||
|
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
|
||||||
|
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
|
||||||
|
option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0)
|
||||||
|
option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0)
|
||||||
|
# If SLIC3R_FHS is 1 -> SLIC3R_DESKTOP_INTEGRATION is always 0, othrewise variable.
|
||||||
|
CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
|
||||||
|
|
||||||
|
set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")
|
||||||
|
|
||||||
|
set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")
|
||||||
|
|
||||||
|
set(IS_CROSS_COMPILE FALSE)
|
||||||
|
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
set(CMAKE_FIND_FRAMEWORK LAST)
|
||||||
|
set(CMAKE_FIND_APPBUNDLE LAST)
|
||||||
|
list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx)
|
||||||
|
if (CMAKE_OSX_ARCHITECTURES AND _arch_idx LESS 0)
|
||||||
|
set(IS_CROSS_COMPILE TRUE)
|
||||||
|
endif ()
|
||||||
|
if (CMAKE_MACOSX_BUNDLE)
|
||||||
|
set(CMAKE_INSTALL_RPATH @executable_path/../Frameworks)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Proposal for C++ unit tests and sandboxes
|
||||||
|
option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF)
|
||||||
|
option(SLIC3R_BUILD_TESTS "Build unit tests" OFF)
|
||||||
|
|
||||||
|
if (IS_CROSS_COMPILE)
|
||||||
|
message("Detected cross compilation setup. Tests and encoding checks will be forcedly disabled!")
|
||||||
|
set(SLIC3R_PERL_XS OFF CACHE BOOL "" FORCE)
|
||||||
|
set(SLIC3R_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Print out the SLIC3R_* cache options
|
||||||
|
get_cmake_property(_cache_vars CACHE_VARIABLES)
|
||||||
|
list (SORT _cache_vars)
|
||||||
|
foreach (_cache_var ${_cache_vars})
|
||||||
|
if("${_cache_var}" MATCHES "^SLIC3R_")
|
||||||
|
message(STATUS "${_cache_var}: ${${_cache_var}}")
|
||||||
|
endif ()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if (SLIC3R_GUI)
|
||||||
|
add_definitions(-DSLIC3R_GUI)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(SLIC3R_DESKTOP_INTEGRATION)
|
||||||
|
add_definitions(-DSLIC3R_DESKTOP_INTEGRATION)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||||
|
set(IS_CLANG_CL TRUE)
|
||||||
|
|
||||||
|
# clang-cl can interpret SYSTEM header paths if -imsvc is used
|
||||||
|
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-imsvc")
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \
|
||||||
|
-Wno-old-style-cast -Wno-reserved-id-macro -Wno-c++98-compat-pedantic")
|
||||||
|
else ()
|
||||||
|
set(IS_CLANG_CL FALSE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
if (SLIC3R_MSVC_COMPILE_PARALLEL AND NOT IS_CLANG_CL)
|
||||||
|
add_compile_options(/MP)
|
||||||
|
endif ()
|
||||||
|
# /bigobj (Increase Number of Sections in .Obj file)
|
||||||
|
# error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm90' or greater
|
||||||
|
# Generate symbols at every build target, even for the release.
|
||||||
|
add_compile_options(-bigobj -Zm520 /Zi)
|
||||||
|
# Disable STL4007: Many result_type typedefs and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17.
|
||||||
|
#FIXME Remove this line after eigen library adapts to the new C++17 adaptor rules.
|
||||||
|
add_compile_options(-D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING)
|
||||||
|
# Disable warnings on conversion from unsigned to signed (possible loss of data)
|
||||||
|
# C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data. An integer type is converted to a smaller integer type.
|
||||||
|
# C4267: The compiler detected a conversion from size_t to a smaller type.
|
||||||
|
add_compile_options(/wd4244 /wd4267)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# https://github.com/SoftFever/OrcaSlicer/issues/2233
|
||||||
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 15)
|
||||||
|
add_compile_definitions(BOOST_NO_CXX98_FUNCTION_BASE _HAS_AUTO_PTR_ETC=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MINGW)
|
||||||
|
add_compile_options(-Wa,-mbig-obj)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
# ARMs (Raspberry PI) use an unsigned char by default. Let's make it consistent for QIDIStudio on all platforms.
|
||||||
|
add_compile_options(-fsigned-char)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Display and check CMAKE_PREFIX_PATH
|
||||||
|
message(STATUS "SLIC3R_STATIC: ${SLIC3R_STATIC}")
|
||||||
|
if (NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")
|
||||||
|
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH} (from cache or command line)")
|
||||||
|
set(PREFIX_PATH_CHECK ${CMAKE_PREFIX_PATH})
|
||||||
|
elseif (NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
|
||||||
|
message(STATUS "CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH} (from environment)")
|
||||||
|
set(PREFIX_PATH_CHECK $ENV{CMAKE_PREFIX_PATH})
|
||||||
|
else ()
|
||||||
|
message(STATUS "CMAKE_PREFIX_PATH: (default)")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
foreach (DIR ${PREFIX_PATH_CHECK})
|
||||||
|
if (NOT EXISTS "${DIR}")
|
||||||
|
message(WARNING "CMAKE_PREFIX_PATH element doesn't exist: ${DIR}")
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
# Add our own cmake module path.
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
|
||||||
|
message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
|
||||||
|
message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
|
||||||
|
|
||||||
|
enable_testing ()
|
||||||
|
|
||||||
|
# Enable C++17 language standard.
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
# Add DEBUG flags to debug builds.
|
||||||
|
add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# To be able to link libslic3r with the Perl XS module.
|
||||||
|
# Once we get rid of Perl and libslic3r is linked statically, we can get rid of -fPIC
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
# WIN10SDK_PATH is used to point CMake to the WIN10 SDK installation directory.
|
||||||
|
# We pick it from environment if it is not defined in another way
|
||||||
|
if(WIN32)
|
||||||
|
if(NOT DEFINED WIN10SDK_PATH)
|
||||||
|
if(DEFINED ENV{WIN10SDK_PATH})
|
||||||
|
set(WIN10SDK_PATH "$ENV{WIN10SDK_PATH}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(DEFINED WIN10SDK_PATH)
|
||||||
|
#QDS: modify win10sdk_path
|
||||||
|
if (EXISTS "${WIN10SDK_PATH}/winrt/windows.graphics.printing3d.h")
|
||||||
|
set(WIN10SDK_INCLUDE_PATH "${WIN10SDK_PATH}")
|
||||||
|
else()
|
||||||
|
message("WIN10SDK_PATH is invalid: ${WIN10SDK_PATH}")
|
||||||
|
message("${WIN10SDK_PATH}/winrt/windows.graphics.printing3d.h was not found")
|
||||||
|
message("STL fixing by the Netfabb service will not be compiled")
|
||||||
|
unset(WIN10SDK_PATH)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# Try to use the default Windows 10 SDK path.
|
||||||
|
set(WIN10SDK_INCLUDE_PATH "$ENV{WindowsSdkDir}/Include/$ENV{WindowsSDKVersion}")
|
||||||
|
if (NOT EXISTS "${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h")
|
||||||
|
message("${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h was not found")
|
||||||
|
message("STL fixing by the Netfabb service will not be compiled")
|
||||||
|
unset(WIN10SDK_INCLUDE_PATH)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(WIN10SDK_INCLUDE_PATH)
|
||||||
|
message("Building with Win10 Netfabb STL fixing service support")
|
||||||
|
add_definitions(-DHAS_WIN10SDK)
|
||||||
|
include_directories("${WIN10SDK_INCLUDE_PATH}")
|
||||||
|
else()
|
||||||
|
message("Building without Win10 Netfabb STL fixing service support")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}")
|
||||||
|
if (CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||||
|
message("OS X Deployment Target: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||||
|
else ()
|
||||||
|
message("OS X Deployment Target: (default)")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
|
# Boost on Raspberry-Pi does not link to pthreads.
|
||||||
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
find_package(DBus REQUIRED)
|
||||||
|
include_directories(${DBUS_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
||||||
|
# Adding -fext-numeric-literals to enable GCC extensions on definitions of quad float literals, which are required by Boost.
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
|
||||||
|
if (NOT MINGW)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
||||||
|
endif ()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder" )
|
||||||
|
|
||||||
|
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
|
||||||
|
add_compile_options(-Werror=return-type)
|
||||||
|
|
||||||
|
# removes LOTS of extraneous Eigen warnings (GCC only supports it since 6.1)
|
||||||
|
# https://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221
|
||||||
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
||||||
|
add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Clang reports legacy OpenGL calls as deprecated. Turn off the warning for now
|
||||||
|
# to reduce the clutter, we know about this one. It should be reenabled after
|
||||||
|
# we finally get rid of the deprecated code.
|
||||||
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
|
add_compile_options(-Wno-deprecated-declarations)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
|
||||||
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
|
||||||
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
|
||||||
|
# We will turn the warning of for GCC for now:
|
||||||
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
add_compile_options(-Wno-unknown-pragmas)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (SLIC3R_ASAN)
|
||||||
|
# ASAN should be available on MSVC starting with Visual Studio 2019 16.9
|
||||||
|
# https://devblogs.microsoft.com/cppblog/address-sanitizer-for-msvc-now-generally-available/
|
||||||
|
add_compile_options(-fsanitize=address)
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
add_compile_options(-fno-omit-frame-pointer)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=partial-availability -Werror=unguarded-availability -Werror=unguarded-availability-new")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=partial-availability -Werror=unguarded-availability -Werror=unguarded-availability-new")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# 添加编译选项,忽略警告 C4305 (格式转换截断)
|
||||||
|
add_compile_options(/wd4305)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Where all the bundled libraries reside?
|
||||||
|
set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
set(LIBDIR_BIN ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
|
message(STATUS "LIBDIR: ${LIBDIR}")
|
||||||
|
message(STATUS "LIBDIR_BIN: ${LIBDIR_BIN}")
|
||||||
|
|
||||||
|
# For the bundled boost libraries (boost::nowide)
|
||||||
|
include_directories(${LIBDIR})
|
||||||
|
# For generated header files
|
||||||
|
include_directories(${LIBDIR_BIN}/platform)
|
||||||
|
# For ligigl
|
||||||
|
include_directories(${LIBDIR}/libigl)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
|
||||||
|
if(MSVC)
|
||||||
|
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
|
||||||
|
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 -DBOOST_SYSTEM_USE_UTF8 )
|
||||||
|
# Force the source code encoding to UTF-8. See QIDIStudio GH pull request #5583
|
||||||
|
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||||
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||||
|
endif(MSVC)
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO)
|
||||||
|
|
||||||
|
# Disable unsafe implicit wxString to const char* / std::string and vice versa. This implicit conversion breaks the UTF-8 encoding quite often.
|
||||||
|
add_definitions(-DwxNO_UNSAFE_WXSTRING_CONV)
|
||||||
|
|
||||||
|
if (SLIC3R_PROFILE)
|
||||||
|
message("QIDIStudio will be built with a Shiny invasive profiler")
|
||||||
|
add_definitions(-DSLIC3R_PROFILE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Disable optimization even with debugging on.
|
||||||
|
if (0)
|
||||||
|
message(STATUS "Perl compiled without optimization. Disabling optimization for the QIDIStudio build.")
|
||||||
|
message("Old CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
message("Old CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
message("Old CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
|
||||||
|
set(CMAKE_CXX_FLAGS "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
|
||||||
|
set(CMAKE_C_FLAGS "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find and configure boost
|
||||||
|
if(SLIC3R_STATIC)
|
||||||
|
# Use static boost libraries.
|
||||||
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
# Use boost libraries linked statically to the C++ runtime.
|
||||||
|
# set(Boost_USE_STATIC_RUNTIME ON)
|
||||||
|
endif()
|
||||||
|
#set(Boost_DEBUG ON)
|
||||||
|
# set(Boost_COMPILER "-mgw81")
|
||||||
|
# boost::process was introduced first in version 1.64.0,
|
||||||
|
# boost::beast::detail::base64 was introduced first in version 1.66.0
|
||||||
|
set(MINIMUM_BOOST_VERSION "1.66.0")
|
||||||
|
set(_boost_components "system;filesystem;thread;log;locale;regex;chrono;atomic;date_time;iostreams")
|
||||||
|
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components})
|
||||||
|
|
||||||
|
add_library(boost_libs INTERFACE)
|
||||||
|
add_library(boost_headeronly INTERFACE)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
# BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339
|
||||||
|
target_compile_definitions(boost_headeronly INTERFACE BOOST_ASIO_DISABLE_KQUEUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT SLIC3R_STATIC)
|
||||||
|
target_compile_definitions(boost_headeronly INTERFACE BOOST_LOG_DYN_LINK)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
function(slic3r_remap_configs targets from_Cfg to_Cfg)
|
||||||
|
if(MSVC)
|
||||||
|
string(TOUPPER ${from_Cfg} from_CFG)
|
||||||
|
|
||||||
|
foreach(tgt ${targets})
|
||||||
|
if(TARGET ${tgt})
|
||||||
|
set_target_properties(${tgt} PROPERTIES MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(TARGET Boost::system)
|
||||||
|
message(STATUS "Boost::boost exists")
|
||||||
|
target_link_libraries(boost_headeronly INTERFACE Boost::boost)
|
||||||
|
|
||||||
|
# Only from cmake 3.12
|
||||||
|
# list(TRANSFORM _boost_components PREPEND Boost:: OUTPUT_VARIABLE _boost_targets)
|
||||||
|
set(_boost_targets "")
|
||||||
|
foreach(comp ${_boost_components})
|
||||||
|
list(APPEND _boost_targets "Boost::${comp}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
target_link_libraries(boost_libs INTERFACE
|
||||||
|
boost_headeronly # includes the custom compile definitions as well
|
||||||
|
${_boost_targets}
|
||||||
|
)
|
||||||
|
slic3r_remap_configs("${_boost_targets}" RelWithDebInfo Release)
|
||||||
|
else()
|
||||||
|
target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Find and configure intel-tbb
|
||||||
|
if(SLIC3R_STATIC)
|
||||||
|
set(TBB_STATIC 1)
|
||||||
|
endif()
|
||||||
|
set(TBB_DEBUG 1)
|
||||||
|
find_package(TBB REQUIRED)
|
||||||
|
# include_directories(${TBB_INCLUDE_DIRS})
|
||||||
|
# add_definitions(${TBB_DEFINITIONS})
|
||||||
|
# if(MSVC)
|
||||||
|
# # Suppress implicit linking of the TBB libraries by the Visual Studio compiler.
|
||||||
|
# add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE)
|
||||||
|
# endif()
|
||||||
|
# The Intel TBB library will use the std::exception_ptr feature of C++11.
|
||||||
|
# add_definitions(-DTBB_USE_CAPTURED_EXCEPTION=0)
|
||||||
|
|
||||||
|
find_package(OpenSSL REQUIRED)
|
||||||
|
if (APPLE)
|
||||||
|
find_package(CURL CONFIG REQUIRED)
|
||||||
|
else()
|
||||||
|
find_package(CURL REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(libcurl INTERFACE)
|
||||||
|
target_link_libraries(libcurl INTERFACE CURL::libcurl)
|
||||||
|
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
target_link_libraries(libcurl INTERFACE ZLIB::ZLIB)
|
||||||
|
|
||||||
|
# Fixing curl's cmake config script bugs
|
||||||
|
if (NOT WIN32)
|
||||||
|
# Required by libcurl
|
||||||
|
#find_package(ZLIB REQUIRED)
|
||||||
|
#target_link_libraries(libcurl INTERFACE ZLIB::ZLIB)
|
||||||
|
#find_package(Libssh2 REQUIRED)
|
||||||
|
#target_link_libraries(libcurl INTERFACE Libssh2::libssh2)
|
||||||
|
else()
|
||||||
|
target_link_libraries(libcurl INTERFACE crypt32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_CURL)
|
||||||
|
if (NOT APPLE)
|
||||||
|
# libcurl is always linked dynamically to the system libcurl on OSX.
|
||||||
|
# On other systems, libcurl is linked statically if SLIC3R_STATIC is set.
|
||||||
|
target_compile_definitions(libcurl INTERFACE CURL_STATICLIB)
|
||||||
|
endif()
|
||||||
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
# As of now, our build system produces a statically linked libcurl,
|
||||||
|
# which links the OpenSSL library dynamically.
|
||||||
|
find_package(OpenSSL REQUIRED)
|
||||||
|
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
|
||||||
|
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")
|
||||||
|
target_include_directories(libcurl INTERFACE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
target_link_libraries(libcurl INTERFACE ${OPENSSL_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
## OPTIONAL packages
|
||||||
|
|
||||||
|
# Find eigen3 or use bundled version
|
||||||
|
if (NOT SLIC3R_STATIC)
|
||||||
|
find_package(Eigen3 3.3)
|
||||||
|
endif ()
|
||||||
|
if (NOT EIGEN3_FOUND)
|
||||||
|
set(EIGEN3_FOUND 1)
|
||||||
|
set(EIGEN3_INCLUDE_DIR ${LIBDIR}/eigen/)
|
||||||
|
endif ()
|
||||||
|
include_directories(BEFORE SYSTEM ${EIGEN3_INCLUDE_DIR})
|
||||||
|
|
||||||
|
# Find expat or use bundled version
|
||||||
|
# Always use the system libexpat on Linux.
|
||||||
|
|
||||||
|
find_package(EXPAT)
|
||||||
|
|
||||||
|
if (NOT EXPAT_FOUND)
|
||||||
|
add_library(expat STATIC
|
||||||
|
${LIBDIR}/expat/xmlparse.c
|
||||||
|
${LIBDIR}/expat/xmlrole.c
|
||||||
|
${LIBDIR}/expat/xmltok.c
|
||||||
|
)
|
||||||
|
set(EXPAT_FOUND 1)
|
||||||
|
set(EXPAT_INCLUDE_DIRS ${LIBDIR}/expat/)
|
||||||
|
set(EXPAT_LIBRARIES expat)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
find_package(PNG REQUIRED)
|
||||||
|
|
||||||
|
set(OpenGL_GL_PREFERENCE "LEGACY")
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
# Find glew or use bundled version
|
||||||
|
if (SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_GLEW)
|
||||||
|
set(GLEW_USE_STATIC_LIBS ON)
|
||||||
|
set(GLEW_VERBOSE ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(GLEW REQUIRED)
|
||||||
|
|
||||||
|
find_package(glfw3 REQUIRED)
|
||||||
|
|
||||||
|
# Find the Cereal serialization library
|
||||||
|
find_package(cereal REQUIRED)
|
||||||
|
|
||||||
|
# l10n
|
||||||
|
set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/i18n")
|
||||||
|
set(QDT_L18N_DIR "${CMAKE_CURRENT_SOURCE_DIR}/qdt/i18n")
|
||||||
|
add_custom_target(gettext_make_pot
|
||||||
|
COMMAND xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost
|
||||||
|
-f "${QDT_L18N_DIR}/list.txt"
|
||||||
|
-o "${QDT_L18N_DIR}/QIDIStudio.pot"
|
||||||
|
COMMAND hintsToPot ${SLIC3R_RESOURCES_DIR} ${QDT_L18N_DIR}
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
COMMENT "Generate pot file from strings in the source tree"
|
||||||
|
)
|
||||||
|
add_custom_target(gettext_merge_po_with_pot
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
COMMENT "Merge localization po with new generted pot file"
|
||||||
|
)
|
||||||
|
file(GLOB QDT_L10N_PO_FILES "${QDT_L18N_DIR}/*/QIDIStudio*.po")
|
||||||
|
foreach(po_file ${QDT_L10N_PO_FILES})
|
||||||
|
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
|
||||||
|
SET(po_new_file "${po_dir}/QIDIStudio_.po")
|
||||||
|
add_custom_command(
|
||||||
|
TARGET gettext_merge_po_with_pot PRE_BUILD
|
||||||
|
COMMAND msgmerge -N -o ${po_file} ${po_file} "${QDT_L18N_DIR}/QIDIStudio.pot"
|
||||||
|
DEPENDS ${po_file}
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
add_custom_target(gettext_po_to_mo
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
COMMENT "Generate localization po files (binary) from mo files (texts)"
|
||||||
|
)
|
||||||
|
file(GLOB L10N_PO_FILES "${QDT_L18N_DIR}/*/QIDIStudio*.po")
|
||||||
|
foreach(po_file ${QDT_L10N_PO_FILES})
|
||||||
|
GET_FILENAME_COMPONENT(SECOND_FOLDER_ABSOLUTE ${po_file} DIRECTORY)
|
||||||
|
string(REGEX REPLACE ".*/(.*)" "\\1" po_dir "${SECOND_FOLDER_ABSOLUTE}" )
|
||||||
|
SET(mo_file "${L10N_DIR}/${po_dir}/QIDIStudio.mo")
|
||||||
|
add_custom_command(
|
||||||
|
TARGET gettext_po_to_mo PRE_BUILD
|
||||||
|
COMMAND msgfmt ARGS --check-format -o ${mo_file} ${po_file}
|
||||||
|
#COMMAND msgfmt ARGS --check-compatibility -o ${mo_file} ${po_file}
|
||||||
|
DEPENDS ${po_file}
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# copy pt-BR/QidiStudio.mo to pt_br/
|
||||||
|
SET(PT_BR "${L10N_DIR}/pt-BR/QIDIStudio.mo")
|
||||||
|
SET(PT_BR_DST "${L10N_DIR}/pt_br/")
|
||||||
|
add_custom_command(
|
||||||
|
TARGET gettext_po_to_mo POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PT_BR} ${PT_BR_DST}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(NLopt 1.4 REQUIRED)
|
||||||
|
|
||||||
|
|
||||||
|
if(SLIC3R_STATIC)
|
||||||
|
set(OPENVDB_USE_STATIC_LIBS ON)
|
||||||
|
set(USE_BLOSC TRUE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
find_package(OpenVDB 5.0 COMPONENTS openvdb)
|
||||||
|
if(OpenVDB_FOUND)
|
||||||
|
slic3r_remap_configs(IlmBase::Half RelWithDebInfo Release)
|
||||||
|
slic3r_remap_configs(Blosc::blosc RelWithDebInfo Release)
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "OpenVDB could not be found with the bundled find module. "
|
||||||
|
"You can try to specify the find module location of your "
|
||||||
|
"OpenVDB installation with the OPENVDB_FIND_MODULE_PATH cache variable.")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
set(TOP_LEVEL_PROJECT_DIR ${PROJECT_SOURCE_DIR})
|
||||||
|
function(qidistudio_copy_dlls target config postfix output_dlls)
|
||||||
|
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||||
|
set(_bits 64)
|
||||||
|
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||||||
|
set(_bits 32)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
get_target_property(_alt_out_dir ${target} RUNTIME_OUTPUT_DIRECTORY)
|
||||||
|
|
||||||
|
if (_alt_out_dir)
|
||||||
|
set (_out_dir "${_alt_out_dir}")
|
||||||
|
message ("set out_dir to _alt_out_dir: ${_out_dir}")
|
||||||
|
elseif (_is_multi)
|
||||||
|
set(_out_dir "${CMAKE_CURRENT_BINARY_DIR}/${config}")
|
||||||
|
message ("set out_dir to CMAKE_CURRENT_BINARY_DIR/config: ${_out_dir}")
|
||||||
|
else ()
|
||||||
|
set(_out_dir "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
message ("set out_dir to CMAKE_CURRENT_BINARY_DIR: ${_out_dir}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
file(COPY ${TOP_LEVEL_PROJECT_DIR}/deps/GMP/gmp/lib/win${_bits}/libgmp-10.dll
|
||||||
|
${TOP_LEVEL_PROJECT_DIR}/deps/MPFR/mpfr/lib/win${_bits}/libmpfr-4.dll
|
||||||
|
${TOP_LEVEL_PROJECT_DIR}/deps/WebView2/lib/win${_bits}/WebView2Loader.dll
|
||||||
|
DESTINATION ${_out_dir})
|
||||||
|
|
||||||
|
file(COPY ${CMAKE_PREFIX_PATH}/bin/occt/TKBO.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKBRep.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKCAF.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKCDF.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKernel.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKG2d.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKG3d.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKGeomAlgo.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKGeomBase.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKHLR.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKLCAF.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKMath.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKMesh.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKPrim.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKService.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKShHealing.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKSTEP.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKSTEP209.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKSTEPAttr.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKSTEPBase.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKTopAlgo.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKV3d.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKVCAF.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKXCAF.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKXDESTEP.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/occt/TKXSBase.dll
|
||||||
|
${CMAKE_PREFIX_PATH}/bin/freetype.dll
|
||||||
|
DESTINATION ${_out_dir})
|
||||||
|
|
||||||
|
set(${output_dlls}
|
||||||
|
${_out_dir}/libgmp-10.dll
|
||||||
|
${_out_dir}/libmpfr-4.dll
|
||||||
|
${_out_dir}/WebView2Loader.dll
|
||||||
|
|
||||||
|
${_out_dir}/TKBO.dll
|
||||||
|
${_out_dir}/TKBRep.dll
|
||||||
|
${_out_dir}/TKCAF.dll
|
||||||
|
${_out_dir}/TKCDF.dll
|
||||||
|
${_out_dir}/TKernel.dll
|
||||||
|
${_out_dir}/TKG2d.dll
|
||||||
|
${_out_dir}/TKG3d.dll
|
||||||
|
${_out_dir}/TKGeomAlgo.dll
|
||||||
|
${_out_dir}/TKGeomBase.dll
|
||||||
|
${_out_dir}/TKHLR.dll
|
||||||
|
${_out_dir}/TKLCAF.dll
|
||||||
|
${_out_dir}/TKMath.dll
|
||||||
|
${_out_dir}/TKMesh.dll
|
||||||
|
${_out_dir}/TKPrim.dll
|
||||||
|
${_out_dir}/TKService.dll
|
||||||
|
${_out_dir}/TKShHealing.dll
|
||||||
|
${_out_dir}/TKSTEP.dll
|
||||||
|
${_out_dir}/TKSTEP209.dll
|
||||||
|
${_out_dir}/TKSTEPAttr.dll
|
||||||
|
${_out_dir}/TKSTEPBase.dll
|
||||||
|
${_out_dir}/TKTopAlgo.dll
|
||||||
|
${_out_dir}/TKV3d.dll
|
||||||
|
${_out_dir}/TKVCAF.dll
|
||||||
|
${_out_dir}/TKXCAF.dll
|
||||||
|
${_out_dir}/TKXDESTEP.dll
|
||||||
|
${_out_dir}/TKXSBase.dll
|
||||||
|
|
||||||
|
${_out_dir}/freetype.dll
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# libslic3r, QIDIStudio GUI and the QIDIStudio executable.
|
||||||
|
add_subdirectory(src)
|
||||||
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT QIDIStudio_app_gui)
|
||||||
|
|
||||||
|
add_dependencies(gettext_make_pot hintsToPot)
|
||||||
|
|
||||||
|
# Perl bindings, currently only used for the unit / integration tests of libslic3r.
|
||||||
|
# Also runs the unit / integration tests.
|
||||||
|
#FIXME Port the tests into C++ to finally get rid of the Perl!
|
||||||
|
if (SLIC3R_PERL_XS)
|
||||||
|
add_subdirectory(xs)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(SLIC3R_BUILD_SANDBOXES)
|
||||||
|
add_subdirectory(sandboxes)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SLIC3R_BUILD_TESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT WIN32 AND NOT APPLE)
|
||||||
|
set(SLIC3R_APP_CMD "qidi-studio")
|
||||||
|
configure_file(${LIBDIR}/platform/unix/build_appimage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_appimage.sh @ONLY)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(BUILD_QDS_TEST_TOOLS "Build qds test tools" OFF)
|
||||||
|
if(BUILD_QDS_TEST_TOOLS)
|
||||||
|
add_subdirectory(qds_test_tools)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Resources install target, configure fhs.hpp on UNIX
|
||||||
|
if (WIN32)
|
||||||
|
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources")
|
||||||
|
elseif (SLIC3R_FHS)
|
||||||
|
# CMAKE_INSTALL_FULL_DATAROOTDIR: read-only architecture-independent data root (share)
|
||||||
|
set(SLIC3R_FHS_RESOURCES "${CMAKE_INSTALL_FULL_DATAROOTDIR}/QIDIStudio")
|
||||||
|
install(DIRECTORY ${SLIC3R_RESOURCES_DIR}/ DESTINATION ${SLIC3R_FHS_RESOURCES}
|
||||||
|
PATTERN "*/udev" EXCLUDE
|
||||||
|
)
|
||||||
|
install(FILES src/platform/unix/QIDIStudio.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
||||||
|
foreach(SIZE 32 128 192)
|
||||||
|
install(FILES ${SLIC3R_RESOURCES_DIR}/images/QIDIStudio_${SIZE}px.png
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME QIDIStudio.png
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
elseif (CMAKE_MACOSX_BUNDLE)
|
||||||
|
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/QIDIStudio.app/Contents/resources")
|
||||||
|
else ()
|
||||||
|
install(FILES src/platform/unix/QIDIStudio.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/applications)
|
||||||
|
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
configure_file(${LIBDIR}/platform/unix/fhs.hpp.in ${LIBDIR_BIN}/platform/unix/fhs.hpp)
|
||||||
71
Containerfile
Normal file
71
Containerfile
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# Build QIDI Slicer in a container
|
||||||
|
#
|
||||||
|
# Build an AppImage using rootless Podman (refer to https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md):
|
||||||
|
# rm -rf build; podman build . -t qidi-studio-builder && podman run --rm localhost/qidi-studio-builder /bin/bash -c 'tar -c $(find build | grep ubu64.AppImage | head -1)' | tar -xv
|
||||||
|
#
|
||||||
|
# Troubleshooting the build container:
|
||||||
|
# podman run -it --name qidi-studio-builder localhost/qidi-studio-builder /bin/bash
|
||||||
|
#
|
||||||
|
# Debugging the resulting AppImage:
|
||||||
|
# 1) Install `gdb`
|
||||||
|
# 2) In a terminal in the same directory as the AppImage, start it with following:
|
||||||
|
# echo -e "run\nbt\nquit" | gdb ./QIDIStudio_ubu64.AppImage
|
||||||
|
# 3) Find related issue using backtrace output for clues and add backtrace to it on github
|
||||||
|
#
|
||||||
|
# Docker alternative AppImage build syntax (use this if you can't install podman):
|
||||||
|
# rm -rf build; docker build . --file Containerfile -t qidi-studio-builder; docker run --rm qidi-studio-builder /bin/bash -c 'tar -c $(find build | grep ubu64.AppImage | head -1)' | tar -xv
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# TODO: bind mount QIDIStudio to inside the container instead of COPY to enable faster rebuilds during dev work.
|
||||||
|
|
||||||
|
FROM docker.io/ubuntu:22.04
|
||||||
|
LABEL maintainer "DeftDawg <DeftDawg@gmail.com>"
|
||||||
|
ARG BUILD_LINUX_EXTRA_ARGS=""
|
||||||
|
|
||||||
|
# Disable interactive package configuration
|
||||||
|
RUN apt-get update && \
|
||||||
|
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||||
|
|
||||||
|
# Add a deb-src
|
||||||
|
RUN echo deb-src http://archive.ubuntu.com/ubuntu \
|
||||||
|
$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2) main universe>> /etc/apt/sources.list
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git \
|
||||||
|
build-essential \
|
||||||
|
autoconf pkgconf m4 \
|
||||||
|
cmake extra-cmake-modules \
|
||||||
|
libglu1-mesa-dev libglu1-mesa-dev \
|
||||||
|
libwayland-dev libxkbcommon-dev wayland-protocols \
|
||||||
|
eglexternalplatform-dev libglew-dev \
|
||||||
|
libgtk-3-dev \
|
||||||
|
libdbus-1-dev \
|
||||||
|
libcairo2-dev \
|
||||||
|
libgtk-3-dev libwebkit2gtk-4.0-dev \
|
||||||
|
libsoup2.4-dev \
|
||||||
|
libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-base1.0-dev libgstreamerd-3-dev \
|
||||||
|
libosmesa6-dev \
|
||||||
|
libssl3 libssl-dev libcurl4-openssl-dev libsecret-1-dev \
|
||||||
|
libudev-dev \
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
file \
|
||||||
|
sudo
|
||||||
|
|
||||||
|
COPY ./ QIDIStudio
|
||||||
|
|
||||||
|
WORKDIR QIDIStudio
|
||||||
|
|
||||||
|
# These can run together, but we run them seperate for podman caching
|
||||||
|
# Update System dependencies
|
||||||
|
RUN ./BuildLinux.sh -u ${BUILD_LINUX_EXTRA_ARGS}
|
||||||
|
|
||||||
|
# Build dependencies in ./deps
|
||||||
|
RUN ./BuildLinux.sh -d ${BUILD_LINUX_EXTRA_ARGS}
|
||||||
|
|
||||||
|
# Build slic3r
|
||||||
|
RUN ./BuildLinux.sh -s ${BUILD_LINUX_EXTRA_ARGS}
|
||||||
|
|
||||||
|
# Build AppImage
|
||||||
|
ENV container podman
|
||||||
|
RUN ./BuildLinux.sh -i ${BUILD_LINUX_EXTRA_ARGS}
|
||||||
15
DockerBuild.sh
Normal file
15
DockerBuild.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PROJECT_ROOT=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# Wishlist hint: For developers, creating a Docker Compose
|
||||||
|
# setup with persistent volumes for the build & deps directories
|
||||||
|
# would speed up recompile times significantly. For end users,
|
||||||
|
# the simplicity of a single Docker image and a one-time compilation
|
||||||
|
# seems better.
|
||||||
|
docker build -t qidistudio \
|
||||||
|
--build-arg USER=$USER \
|
||||||
|
--build-arg UID=$(id -u) \
|
||||||
|
--build-arg GID=$(id -g) \
|
||||||
|
$PROJECT_ROOT
|
||||||
25
DockerRun.sh
Normal file
25
DockerRun.sh
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -x
|
||||||
|
# Just in case, here's some other things that might help:
|
||||||
|
# Force the container's hostname to be the same as your workstation
|
||||||
|
# -h $HOSTNAME \
|
||||||
|
# If there's problems with the X display, try this
|
||||||
|
# -v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||||
|
docker run \
|
||||||
|
`# Use the hosts networking. Printer wifi and also dbus communication` \
|
||||||
|
--net=host \
|
||||||
|
`# Some X installs will not have permissions to talk to sockets for shared memory` \
|
||||||
|
--ipc host \
|
||||||
|
`# Run as your workstations username to keep permissions the same` \
|
||||||
|
-u $USER \
|
||||||
|
`# Bind mount your home directory into the container for loading/saving files` \
|
||||||
|
-v $HOME:/home/$USER \
|
||||||
|
`# Pass the X display number to the container` \
|
||||||
|
-e DISPLAY=$DISPLAY \
|
||||||
|
`# It seems that libGL and dbus things need privileged mode` \
|
||||||
|
--privileged=true \
|
||||||
|
`# Attach tty for running qidi with command line things` \
|
||||||
|
-ti \
|
||||||
|
`# Pass all parameters from this script to the qidi ENTRYPOINT binary` \
|
||||||
|
qidistudio $*
|
||||||
|
|
||||||
94
Dockerfile
Normal file
94
Dockerfile
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
FROM docker.io/ubuntu:22.04
|
||||||
|
LABEL maintainer "DeftDawg <DeftDawg@gmail.com>"
|
||||||
|
|
||||||
|
# Disable interactive package configuration
|
||||||
|
RUN apt-get update && \
|
||||||
|
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||||
|
|
||||||
|
# Add a deb-src
|
||||||
|
RUN echo deb-src http://archive.ubuntu.com/ubuntu \
|
||||||
|
$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2) main universe>> /etc/apt/sources.list
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
autoconf \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
curl \
|
||||||
|
eglexternalplatform-dev \
|
||||||
|
extra-cmake-modules \
|
||||||
|
file \
|
||||||
|
git \
|
||||||
|
gstreamer1.0-plugins-bad \
|
||||||
|
gstreamer1.0-libav \
|
||||||
|
libcairo2-dev \
|
||||||
|
libcurl4-openssl-dev \
|
||||||
|
libdbus-1-dev \
|
||||||
|
libglew-dev \
|
||||||
|
libglu1-mesa-dev \
|
||||||
|
libglu1-mesa-dev \
|
||||||
|
libgstreamer1.0-dev \
|
||||||
|
libgstreamerd-3-dev \
|
||||||
|
libgstreamer-plugins-base1.0-dev \
|
||||||
|
libgstreamer-plugins-good1.0-dev \
|
||||||
|
libgtk-3-dev \
|
||||||
|
libgtk-3-dev \
|
||||||
|
libosmesa6-dev \
|
||||||
|
libsecret-1-dev \
|
||||||
|
libsoup2.4-dev \
|
||||||
|
libssl3 \
|
||||||
|
libssl-dev \
|
||||||
|
libudev-dev \
|
||||||
|
libwayland-dev \
|
||||||
|
libwebkit2gtk-4.0-dev \
|
||||||
|
libxkbcommon-dev \
|
||||||
|
locales \
|
||||||
|
locales-all \
|
||||||
|
m4 \
|
||||||
|
pkgconf \
|
||||||
|
sudo \
|
||||||
|
wayland-protocols \
|
||||||
|
wget
|
||||||
|
|
||||||
|
# Change your locale here if you want. See the output
|
||||||
|
# of `locale -a` to pick the correct string formatting.
|
||||||
|
ENV LC_ALL=en_US.utf8
|
||||||
|
RUN locale-gen $LC_ALL
|
||||||
|
|
||||||
|
# Set this so that QIDI Studio doesn't complain about
|
||||||
|
# the CA cert path on every startup
|
||||||
|
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
|
||||||
|
|
||||||
|
COPY ./ QIDIStudio
|
||||||
|
|
||||||
|
WORKDIR QIDIStudio
|
||||||
|
|
||||||
|
# These can run together, but we run them seperate for podman caching
|
||||||
|
# Update System dependencies
|
||||||
|
RUN ./BuildLinux.sh -u
|
||||||
|
|
||||||
|
# Build dependencies in ./deps
|
||||||
|
RUN ./BuildLinux.sh -d
|
||||||
|
|
||||||
|
# Build slic3r
|
||||||
|
RUN ./BuildLinux.sh -s
|
||||||
|
|
||||||
|
# Build AppImage
|
||||||
|
ENV container podman
|
||||||
|
RUN ./BuildLinux.sh -i
|
||||||
|
|
||||||
|
# It's easier to run QIDI Studio as the same username,
|
||||||
|
# UID and GID as your workstation. Since we bind mount
|
||||||
|
# your home directory into the container, it's handy
|
||||||
|
# to keep permissions the same. Just in case, defaults
|
||||||
|
# are root.
|
||||||
|
SHELL ["/bin/bash", "-l", "-c"]
|
||||||
|
ARG USER=root
|
||||||
|
ARG UID=0
|
||||||
|
ARG GID=0
|
||||||
|
RUN [[ "$UID" != "0" ]] \
|
||||||
|
&& groupadd -f -g $GID $USER \
|
||||||
|
&& useradd -u $UID -g $GID $USER
|
||||||
|
|
||||||
|
# Using an entrypoint instead of CMD because the binary
|
||||||
|
# accepts several command line arguments.
|
||||||
|
ENTRYPOINT ["/QIDIStudio/build/package/bin/qidi-studio"]
|
||||||
BIN
QIDIStudio.mo
Normal file
BIN
QIDIStudio.mo
Normal file
Binary file not shown.
103
QIDIStudio.sublime-project
Normal file
103
QIDIStudio.sublime-project
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"build_systems":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "List",
|
||||||
|
//"file_regex": " at ([^-\\s]*) line ([0-9]*)",
|
||||||
|
// "file_regex": " at (D\\:\\/src\\/Slic3r\\/.*?) line ([0-9]*)",
|
||||||
|
"shell_cmd": "ls -l"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Run",
|
||||||
|
"working_dir": "$project_path",
|
||||||
|
"file_regex": " at (.*?) line ([0-9]*)",
|
||||||
|
// "shell_cmd": "chdir & perl slic3r.pl --DataDir \"C:\\Users\\Public\\Documents\\Prusa3D\\Slic3r settings MK2\" --gui \"..\\Slic3r-tests\\gap fill torture 20 -rt.stl\""
|
||||||
|
"shell_cmd": "chdir & perl slic3r.pl"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "full",
|
||||||
|
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||||
|
"shell_cmd": "chdir & perl Build.pl"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xs",
|
||||||
|
"working_dir": "$project_path/build",
|
||||||
|
// for Visual Studio:
|
||||||
|
"file_regex": "^(..[^:]*)\\(([0-9]+)\\)(.*)$",
|
||||||
|
// For GCC:
|
||||||
|
// "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||||
|
"shell_cmd": "chdir & ninja -j 6 -v",
|
||||||
|
"env": {
|
||||||
|
// "PATH": "C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\amd64;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\BIN\\amd64;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools;%PATH%;c:\\wperl64d\\site\\bin;c:\\wperl64d\\bin",
|
||||||
|
// "PERL_CPANM_HOME": "c:\\wperl64d\\cpanm",
|
||||||
|
// "WXDIR": "D:\\src-perl\\wxWidgets-3.0.3-beta1",
|
||||||
|
// "BOOST_DIR": "D:\\src-perl\\boost_1_61_0",
|
||||||
|
// "BOOST_INCLUDEDIR": "D:\\src-perl\\boost_1_61_0",
|
||||||
|
// "BOOST_LIBRARYDIR": "D:\\src-perl\\boost_1_61_0\\stage\\x64\\lib",
|
||||||
|
// "SLIC3R_STATIC": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xs & run",
|
||||||
|
"working_dir": "$project_path/build",
|
||||||
|
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||||
|
"shell_cmd": "chdir & ninja -j 6 & cd .. & perl slic3r.pl --gui \"..\\Slic3r-tests\\star3-big2.stl\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Slic3r - clean",
|
||||||
|
"working_dir": "$project_path/build",
|
||||||
|
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
|
||||||
|
"shell_cmd": ["chdir & ninja clean"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "run tests",
|
||||||
|
"working_dir": "$project_path/build",
|
||||||
|
// for Visual Studio:
|
||||||
|
"file_regex": "^(..[^:]*)\\(([0-9]+)\\)(.*)$",
|
||||||
|
"shell_cmd": "chdir & ctest --verbose"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Clean & Configure",
|
||||||
|
"working_dir": "$project_path",
|
||||||
|
// for Visual Studio:
|
||||||
|
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
|
||||||
|
"shell_cmd": "chdir & rmdir /S /Q build & mkdir build & cd build & cmake -G Ninja .. -DCMAKE_COLOR_MAKEFILE=OFF -DCMAKE_RULE_PROGRESS=OFF -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Configure",
|
||||||
|
"working_dir": "$project_path/build",
|
||||||
|
// for Visual Studio:
|
||||||
|
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
|
||||||
|
"shell_cmd": "cmake -G Ninja .. -DCMAKE_COLOR_MAKEFILE=OFF -DCMAKE_RULE_PROGRESS=OFF -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"folders":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"path": ".",
|
||||||
|
// "folder_exclude_patterns": [".svn", "._d", ".metadata", ".settings"],
|
||||||
|
"file_exclude_patterns": ["XS.c", "*.pch", "*.ilk", "*.js" ]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"settings":
|
||||||
|
{
|
||||||
|
"sublimegdb_workingdir": "${folder:${project_path:run}}",
|
||||||
|
// NOTE: You MUST provide --interpreter=mi for the plugin to work
|
||||||
|
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -ex 'target localhost:2345'",
|
||||||
|
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl --args perl slic3r.pl",
|
||||||
|
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl --args slic3r.pl ",
|
||||||
|
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -e C:\\Strawberry\\perl\\bin\\perl.exe -s C:\\Strawberry\\perl\\site\\lib\\auto\\Slic3r\\XS\\XS.xs.dll --args perl slic3r.pl -j 1 --gui D:\\src\\Slic3r-tests\\star3-big.stl",
|
||||||
|
"sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl.exe --args perl slic3r.pl -j 1 --gui", // D:\\src\\Slic3r-tests\\star3-big.stl",
|
||||||
|
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -x slic3r.gdb",
|
||||||
|
// "arguments": "slic3r -j 1 --gui ../Slic3r-tests/star3-big.stl",
|
||||||
|
// "arguments": "../slic3r.pl -j 1 --gui",
|
||||||
|
// "sublimegdb_exec_cmd": "-exec-continue",
|
||||||
|
|
||||||
|
// Add "pending breakpoints" for symbols that are dynamically loaded from
|
||||||
|
// external shared libraries
|
||||||
|
"debug_ext" : true,
|
||||||
|
"run_after_init": false,
|
||||||
|
"close_views": false
|
||||||
|
}
|
||||||
|
}
|
||||||
495
build_win.bat
Normal file
495
build_win.bat
Normal file
@@ -0,0 +1,495 @@
|
|||||||
|
@setlocal disableDelayedExpansion enableExtensions
|
||||||
|
@IF "%PS_ECHO_ON%" NEQ "" (echo on) ELSE (echo off)
|
||||||
|
@GOTO :MAIN
|
||||||
|
:HELP
|
||||||
|
@ECHO.
|
||||||
|
@ECHO Performs initial build or rebuild of the app (build) and deps (build/deps).
|
||||||
|
@ECHO Default options are determined from build directories and system state.
|
||||||
|
@ECHO.
|
||||||
|
@ECHO Usage: build_win [-ARCH ^<arch^>] [-CONFIG ^<config^>] [-VERSION ^<version^>]
|
||||||
|
@ECHO [-PRODUCT ^<product^>] [-DESTDIR ^<directory^>]
|
||||||
|
@ECHO [-STEPS ^<all^|all-dirty^|app^|app-dirty^|deps^|deps-dirty^>]
|
||||||
|
@ECHO [-RUN ^<console^|custom^|none^|viewer^|window^>]
|
||||||
|
@ECHO.
|
||||||
|
@ECHO -a -ARCH Target processor architecture
|
||||||
|
@ECHO Default: %PS_ARCH_HOST%
|
||||||
|
@ECHO -c -CONFIG MSVC project config
|
||||||
|
@ECHO Default: %PS_CONFIG_DEFAULT%
|
||||||
|
@ECHO -v -VERSION Major version number of MSVC installation to use for build
|
||||||
|
@ECHO Default: %PS_VERSION_SUPPORTED%
|
||||||
|
@ECHO -p -PRODUCT Product ID of MSVC installation to use for build
|
||||||
|
@ECHO Default: %PS_PRODUCT_DEFAULT%
|
||||||
|
@ECHO -s -STEPS Performs only the specified build steps:
|
||||||
|
@ECHO all - clean and build deps and app
|
||||||
|
@ECHO all-dirty - build deps and app without cleaning
|
||||||
|
@ECHO app - clean and build main applications
|
||||||
|
@ECHO app-dirty - build main applications without cleaning
|
||||||
|
@ECHO deps - clean and build deps
|
||||||
|
@ECHO deps-dirty - build deps without cleaning
|
||||||
|
@ECHO Default: %PS_STEPS_DEFAULT%
|
||||||
|
@ECHO -r -RUN Specifies what to perform at the run step:
|
||||||
|
@ECHO console - run and wait on qidi-studio-console.exe
|
||||||
|
@ECHO custom - run and wait on your custom build/%PS_CUSTOM_RUN_FILE%
|
||||||
|
@ECHO ide - open project in Visual Studio if not open (no wait)
|
||||||
|
@ECHO none - run step does nothing
|
||||||
|
@ECHO viewer - run qidi-gcodeviewer.exe (no wait)
|
||||||
|
@ECHO window - run qidi-studio.exe (no wait)
|
||||||
|
@ECHO Default: none
|
||||||
|
@ECHO -d -DESTDIR Deps destination directory
|
||||||
|
@ECHO Warning: Changing destdir path will not delete the old destdir.
|
||||||
|
@ECHO Default: %PS_DESTDIR_DEFAULT_MSG%
|
||||||
|
@ECHO.
|
||||||
|
@ECHO Examples:
|
||||||
|
@ECHO.
|
||||||
|
@ECHO Initial build: build_win -d "c:\src\QIDISlicer-deps"
|
||||||
|
@ECHO Build post deps change: build_win -s all
|
||||||
|
@ECHO App dirty build: build_win
|
||||||
|
@ECHO App dirty build ^& run: build_win -r console
|
||||||
|
@ECHO All clean build ^& run: build_win -s all -r console -d "deps\build\out_deps"
|
||||||
|
@ECHO.
|
||||||
|
GOTO :END
|
||||||
|
|
||||||
|
:MAIN
|
||||||
|
REM Script constants
|
||||||
|
SET START_TIME=%TIME%
|
||||||
|
SET PS_START_DIR=%CD%
|
||||||
|
SET PS_SOLUTION_NAME=QIDIStudio
|
||||||
|
SET PS_CHOICE_TIMEOUT=30
|
||||||
|
SET PS_CUSTOM_RUN_FILE=custom_run.bat
|
||||||
|
SET PS_DEPS_PATH_FILE_NAME=.DEPS_PATH.txt
|
||||||
|
SET PS_DEPS_PATH_FILE=%~dp0deps\build\%PS_DEPS_PATH_FILE_NAME%
|
||||||
|
SET PS_CONFIG_LIST="Debug;MinSizeRel;Release;RelWithDebInfo"
|
||||||
|
|
||||||
|
REM The officially supported toolchain version is 16 (Visual Studio 2019)
|
||||||
|
REM TODO: Update versions after Boost gets rolled to 1.78 or later
|
||||||
|
SET PS_VERSION_SUPPORTED=16
|
||||||
|
SET PS_VERSION_EXCEEDED=17
|
||||||
|
SET VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
|
||||||
|
IF NOT EXIST "%VSWHERE%" SET VSWHERE=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe
|
||||||
|
FOR /F "tokens=4 USEBACKQ delims=." %%I IN (`"%VSWHERE%" -nologo -property productId`) DO SET PS_PRODUCT_DEFAULT=%%I
|
||||||
|
IF "%PS_PRODUCT_DEFAULT%" EQU "" (
|
||||||
|
SET EXIT_STATUS=-1
|
||||||
|
@ECHO ERROR: No Visual Studio installation found. 1>&2
|
||||||
|
GOTO :HELP
|
||||||
|
)
|
||||||
|
REM Default to the latest supported version if multiple are available
|
||||||
|
FOR /F "tokens=1 USEBACKQ delims=." %%I IN (
|
||||||
|
`^""%VSWHERE%" -version "[%PS_VERSION_SUPPORTED%,%PS_VERSION_EXCEEDED%)" -latest -nologo -property catalog_buildVersion^"`
|
||||||
|
) DO SET PS_VERSION_SUPPORTED=%%I
|
||||||
|
|
||||||
|
REM Probe build directories and system state for reasonable default arguments
|
||||||
|
pushd %~dp0
|
||||||
|
SET PS_CONFIG=RelWithDebInfo
|
||||||
|
SET PS_ARCH=%PROCESSOR_ARCHITECTURE:amd64=x64%
|
||||||
|
CALL :TOLOWER PS_ARCH
|
||||||
|
SET PS_RUN=none
|
||||||
|
SET PS_DESTDIR=
|
||||||
|
SET PS_VERSION=
|
||||||
|
SET PS_PRODUCT=%PS_PRODUCT_DEFAULT%
|
||||||
|
CALL :RESOLVE_DESTDIR_CACHE
|
||||||
|
|
||||||
|
REM Set up parameters used by help menu
|
||||||
|
SET EXIT_STATUS=0
|
||||||
|
SET PS_CONFIG_DEFAULT=%PS_CONFIG%
|
||||||
|
SET PS_ARCH_HOST=%PS_ARCH%
|
||||||
|
(echo " -help /help -h /h -? /? ")| findstr /I /C:" %~1 ">nul && GOTO :HELP
|
||||||
|
|
||||||
|
REM Parse arguments
|
||||||
|
SET EXIT_STATUS=1
|
||||||
|
SET PS_CURRENT_STEP=arguments
|
||||||
|
SET PARSER_STATE=
|
||||||
|
SET PARSER_FAIL=
|
||||||
|
FOR %%I in (%*) DO CALL :PARSE_OPTION "ARCH CONFIG DESTDIR STEPS RUN VERSION PRODUCT" PARSER_STATE "%%~I"
|
||||||
|
IF "%PARSER_FAIL%" NEQ "" (
|
||||||
|
@ECHO ERROR: Invalid switch: %PARSER_FAIL% 1>&2
|
||||||
|
GOTO :HELP
|
||||||
|
)ELSE IF "%PARSER_STATE%" NEQ "" (
|
||||||
|
@ECHO ERROR: Missing parameter for: %PARSER_STATE% 1>&2
|
||||||
|
GOTO :HELP
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Validate arguments
|
||||||
|
SET PS_ASK_TO_CONTINUE=
|
||||||
|
CALL :TOLOWER PS_ARCH
|
||||||
|
SET PS_ARCH=%PS_ARCH:amd64=x64%
|
||||||
|
CALL :PARSE_OPTION_VALUE %PS_CONFIG_LIST:;= % PS_CONFIG
|
||||||
|
IF "%PS_CONFIG%" EQU "" GOTO :HELP
|
||||||
|
REM RESOLVE_DESTDIR_CACHE must go after PS_ARCH and PS_CONFIG, but before PS STEPS
|
||||||
|
CALL :RESOLVE_DESTDIR_CACHE
|
||||||
|
IF "%PS_STEPS%" EQU "" SET PS_STEPS=%PS_STEPS_DEFAULT%
|
||||||
|
CALL :PARSE_OPTION_VALUE "all all-dirty deps-dirty deps app-dirty app app-cmake" PS_STEPS
|
||||||
|
IF "%PS_STEPS%" EQU "" GOTO :HELP
|
||||||
|
(echo %PS_STEPS%)| findstr /I /C:"dirty">nul && SET PS_STEPS_DIRTY=1 || SET PS_STEPS_DIRTY=
|
||||||
|
IF "%PS_STEPS%" EQU "app-cmake" SET PS_STEPS_DIRTY=1
|
||||||
|
IF "%PS_DESTDIR%" EQU "" SET PS_DESTDIR=%PS_DESTDIR_CACHED%
|
||||||
|
IF "%PS_DESTDIR%" EQU "" (
|
||||||
|
@ECHO ERROR: Parameter required: -DESTDIR 1>&2
|
||||||
|
GOTO :HELP
|
||||||
|
)
|
||||||
|
CALL :CANONICALIZE_PATH PS_DESTDIR "%PS_START_DIR%"
|
||||||
|
IF "%PS_DESTDIR%" NEQ "%PS_DESTDIR_CACHED%" (
|
||||||
|
(echo "all deps all-dirty deps-dirty")| findstr /I /C:"%PS_STEPS%">nul || (
|
||||||
|
IF EXIST "%PS_DESTDIR%" (
|
||||||
|
@ECHO WARNING: DESTDIR does not match cache: 1>&2
|
||||||
|
@ECHO WARNING: new: %PS_DESTDIR% 1>&2
|
||||||
|
@ECHO WARNING: old: %PS_DESTDIR_CACHED% 1>&2
|
||||||
|
SET PS_ASK_TO_CONTINUE=1
|
||||||
|
) ELSE (
|
||||||
|
@ECHO ERROR: Invalid parameter: DESTDIR=%PS_DESTDIR% 1>&2
|
||||||
|
GOTO :HELP
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
SET PS_DESTDIR_DEFAULT_MSG=
|
||||||
|
CALL :PARSE_OPTION_VALUE "console custom ide none viewer window" PS_RUN
|
||||||
|
IF "%PS_RUN%" EQU "" GOTO :HELP
|
||||||
|
IF "%PS_RUN%" NEQ "none" IF "%PS_STEPS:~0,4%" EQU "deps" (
|
||||||
|
@ECHO ERROR: RUN=%PS_RUN% specified with STEPS=%PS_STEPS%
|
||||||
|
@ECHO ERROR: RUN=none is the only valid option for STEPS "deps" or "deps-dirty"
|
||||||
|
GOTO :HELP
|
||||||
|
)
|
||||||
|
IF DEFINED PS_VERSION (
|
||||||
|
SET /A PS_VERSION_EXCEEDED=%PS_VERSION% + 1
|
||||||
|
) ELSE SET PS_VERSION=%PS_VERSION_SUPPORTED%
|
||||||
|
SET MSVC_FILTER=-products Microsoft.VisualStudio.Product.%PS_PRODUCT% -version "[%PS_VERSION%,%PS_VERSION_EXCEEDED%)"
|
||||||
|
FOR /F "tokens=* USEBACKQ" %%I IN (`^""%VSWHERE%" %MSVC_FILTER% -nologo -property installationPath^"`) DO SET MSVC_DIR=%%I
|
||||||
|
IF NOT EXIST "%MSVC_DIR%" (
|
||||||
|
@ECHO ERROR: Compatible Visual Studio installation not found. 1>&2
|
||||||
|
GOTO :HELP
|
||||||
|
)
|
||||||
|
REM Give the user a chance to cancel if we found something odd.
|
||||||
|
IF "%PS_ASK_TO_CONTINUE%" EQU "" GOTO :BUILD_ENV
|
||||||
|
@ECHO.
|
||||||
|
@ECHO Unexpected parameters detected. Build paused for %PS_CHOICE_TIMEOUT% seconds.
|
||||||
|
choice /T %PS_CHOICE_TIMEOUT% /C YN /D N /M "Continue"
|
||||||
|
IF %ERRORLEVEL% NEQ 1 GOTO :HELP
|
||||||
|
|
||||||
|
REM Set up MSVC environment
|
||||||
|
:BUILD_ENV
|
||||||
|
SET EXIT_STATUS=2
|
||||||
|
SET PS_CURRENT_STEP=environment
|
||||||
|
@ECHO **********************************************************************
|
||||||
|
@ECHO ** Build Config: %PS_CONFIG%
|
||||||
|
@ECHO ** Target Arch: %PS_ARCH%
|
||||||
|
@ECHO ** Build Steps: %PS_STEPS%
|
||||||
|
@ECHO ** Run App: %PS_RUN%
|
||||||
|
@ECHO ** Deps path: %PS_DESTDIR%
|
||||||
|
@ECHO ** Using Microsoft Visual Studio installation found at:
|
||||||
|
@ECHO ** %MSVC_DIR%
|
||||||
|
CALL "%MSVC_DIR%\Common7\Tools\vsdevcmd.bat" -arch=%PS_ARCH% -host_arch=%PS_ARCH_HOST% -app_platform=Desktop
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO :END
|
||||||
|
REM Need to reset the echo state after vsdevcmd.bat clobbers it.
|
||||||
|
@IF "%PS_ECHO_ON%" NEQ "" (echo on) ELSE (echo off)
|
||||||
|
IF "%PS_DRY_RUN_ONLY%" NEQ "" (
|
||||||
|
@ECHO Script terminated early because PS_DRY_RUN_ONLY is set. 1>&2
|
||||||
|
GOTO :END
|
||||||
|
)
|
||||||
|
IF /I "%PS_STEPS:~0,3%" EQU "app" GOTO :BUILD_APP
|
||||||
|
|
||||||
|
REM Build deps
|
||||||
|
:BUILD_DEPS
|
||||||
|
SET EXIT_STATUS=3
|
||||||
|
SET PS_CURRENT_STEP=deps
|
||||||
|
IF "%PS_STEPS_DIRTY%" EQU "" (
|
||||||
|
CALL :MAKE_OR_CLEAN_DIRECTORY deps\build "%PS_DEPS_PATH_FILE_NAME%" .vs
|
||||||
|
CALL :MAKE_OR_CLEAN_DIRECTORY "%PS_DESTDIR%"
|
||||||
|
)
|
||||||
|
cd deps\build || GOTO :END
|
||||||
|
cmake.exe .. -DDESTDIR="%PS_DESTDIR%"
|
||||||
|
IF %ERRORLEVEL% NEQ 0 IF "%PS_STEPS_DIRTY%" NEQ "" (
|
||||||
|
(del CMakeCache.txt && cmake.exe .. -DDESTDIR="%PS_DESTDIR%") || GOTO :END
|
||||||
|
) ELSE GOTO :END
|
||||||
|
(echo %PS_DESTDIR%)> "%PS_DEPS_PATH_FILE%"
|
||||||
|
msbuild /m ALL_BUILD.vcxproj /p:Configuration=%PS_CONFIG% /v:quiet || GOTO :END
|
||||||
|
cd ..\..
|
||||||
|
IF /I "%PS_STEPS:~0,4%" EQU "deps" GOTO :RUN_APP
|
||||||
|
|
||||||
|
REM Build app
|
||||||
|
:BUILD_APP
|
||||||
|
SET EXIT_STATUS=4
|
||||||
|
SET PS_CURRENT_STEP=app
|
||||||
|
IF "%PS_STEPS_DIRTY%" EQU "" CALL :MAKE_OR_CLEAN_DIRECTORY build "%PS_CUSTOM_RUN_FILE%" .vs
|
||||||
|
cd build || GOTO :END
|
||||||
|
REM Make sure we have a custom batch file skeleton for the run stage
|
||||||
|
set PS_CUSTOM_BAT=%PS_CUSTOM_RUN_FILE%
|
||||||
|
CALL :CANONICALIZE_PATH PS_CUSTOM_BAT
|
||||||
|
IF NOT EXIST %PS_CUSTOM_BAT% CALL :WRITE_CUSTOM_SCRIPT_SKELETON %PS_CUSTOM_BAT%
|
||||||
|
SET PS_PROJECT_IS_OPEN=
|
||||||
|
FOR /F "tokens=2 delims=," %%I in (
|
||||||
|
'tasklist /V /FI "IMAGENAME eq devenv.exe " /NH /FO CSV ^| find "%PS_SOLUTION_NAME%"'
|
||||||
|
) do SET PS_PROJECT_IS_OPEN=%%~I
|
||||||
|
cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG_LIST%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 IF "%PS_STEPS_DIRTY%" NEQ "" (
|
||||||
|
(del CMakeCache.txt && cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG_LIST%) || GOTO :END
|
||||||
|
) ELSE GOTO :END
|
||||||
|
REM Skip the build step if we're using the undocumented app-cmake to regenerate the full config from inside devenv
|
||||||
|
IF "%PS_STEPS%" NEQ "app-cmake" msbuild /m ALL_BUILD.vcxproj /p:Configuration=%PS_CONFIG% /v:quiet || GOTO :END
|
||||||
|
(echo %PS_DESTDIR%)> "%PS_DEPS_PATH_FILE_FOR_CONFIG%"
|
||||||
|
|
||||||
|
REM Run app
|
||||||
|
:RUN_APP
|
||||||
|
REM All build steps complete.
|
||||||
|
CALL :DIFF_TIME ELAPSED_TIME %START_TIME% %TIME%
|
||||||
|
IF "%PS_CURRENT_STEP%" NEQ "arguments" (
|
||||||
|
@ECHO.
|
||||||
|
@ECHO Total Build Time Elapsed %ELAPSED_TIME%
|
||||||
|
)
|
||||||
|
SET EXIT_STATUS=5
|
||||||
|
SET PS_CURRENT_STEP=run
|
||||||
|
IF "%PS_RUN%" EQU "none" GOTO :PROLOGUE
|
||||||
|
cd src\%PS_CONFIG% || GOTO :END
|
||||||
|
SET PS_PROJECT_IS_OPEN=
|
||||||
|
FOR /F "tokens=2 delims=," %%I in (
|
||||||
|
'tasklist /V /FI "IMAGENAME eq devenv.exe " /NH /FO CSV ^| find "%PS_SOLUTION_NAME%"'
|
||||||
|
) do SET PS_PROJECT_IS_OPEN=%%~I
|
||||||
|
@ECHO.
|
||||||
|
@ECHO Running %PS_RUN% application...
|
||||||
|
@REM icacls below is just a hack for file-not-found error handling
|
||||||
|
IF "%PS_RUN%" EQU "console" (
|
||||||
|
icacls qidi-studio-console.exe >nul || GOTO :END
|
||||||
|
start /wait /b qidi-studio-console.exe
|
||||||
|
) ELSE IF "%PS_RUN%" EQU "window" (
|
||||||
|
icacls qidi-studio.exe >nul || GOTO :END
|
||||||
|
start qidi-studio.exe
|
||||||
|
) ELSE IF "%PS_RUN%" EQU "viewer" (
|
||||||
|
icacls qidi-gcodeviewer.exe >nul || GOTO :END
|
||||||
|
start qidi-gcodeviewer.exe
|
||||||
|
) ELSE IF "%PS_RUN%" EQU "custom" (
|
||||||
|
icacls %PS_CUSTOM_BAT% >nul || GOTO :END
|
||||||
|
CALL %PS_CUSTOM_BAT%
|
||||||
|
) ELSE IF "%PS_RUN%" EQU "ide" (
|
||||||
|
IF "%PS_PROJECT_IS_OPEN%" NEQ "" (
|
||||||
|
@ECHO WARNING: Solution is already open in Visual Studio. Skipping ide run step. 1>&2
|
||||||
|
) ELSE (
|
||||||
|
@ECHO Preparing to run Visual Studio...
|
||||||
|
cd ..\.. || GOTO :END
|
||||||
|
REM This hack generates a single config for MSVS, guaranteeing it gets set as the active config.
|
||||||
|
cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG% > nul 2> nul || GOTO :END
|
||||||
|
REM Now launch devenv with the single config (setting it active) and a /command switch to re-run cmake and generate the full config list
|
||||||
|
start devenv.exe %PS_SOLUTION_NAME%.sln /command ^"shell /o ^^^"%~f0^^^" -d ^^^"%PS_DESTDIR%^^^" -c %PS_CONFIG% -a %PS_ARCH% -r none -s app-cmake^"
|
||||||
|
REM If devenv fails to launch just directly regenerate the full config list.
|
||||||
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
|
cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG_LIST% 2> nul 1> nul || GOTO :END
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM ********** DON'T ADD ANY CODE BETWEEN THESE TWO SECTIONS **********
|
||||||
|
@REM RUN_APP may hand off control, so let exit codes fall through to PROLOGUE.
|
||||||
|
|
||||||
|
:PROLOGUE
|
||||||
|
SET EXIT_STATUS=%ERRORLEVEL%
|
||||||
|
:END
|
||||||
|
@IF "%PS_ECHO_ON%%PS_DRY_RUN_ONLY%" NEQ "" (
|
||||||
|
@ECHO **********************************************************************
|
||||||
|
@ECHO ** Script Parameters:
|
||||||
|
@ECHO **********************************************************************
|
||||||
|
@SET PS_
|
||||||
|
)
|
||||||
|
IF "%EXIT_STATUS%" NEQ "0" (
|
||||||
|
IF "%PS_CURRENT_STEP%" NEQ "arguments" (
|
||||||
|
@ECHO.
|
||||||
|
@ECHO ERROR: *** Build process failed at %PS_CURRENT_STEP% step. *** 1>&2
|
||||||
|
)
|
||||||
|
) ELSE (
|
||||||
|
@ECHO All steps completed successfully.
|
||||||
|
)
|
||||||
|
popd
|
||||||
|
exit /B %EXIT_STATUS%
|
||||||
|
|
||||||
|
GOTO :EOF
|
||||||
|
REM Functions and stubs start here.
|
||||||
|
|
||||||
|
:RESOLVE_DESTDIR_CACHE
|
||||||
|
@REM Resolves all DESTDIR cache values and sets PS_STEPS_DEFAULT
|
||||||
|
@REM Note: This just sets global variables, so it doesn't use setlocal.
|
||||||
|
SET PS_DEPS_PATH_FILE_FOR_CONFIG=%~dp0build\.vs\%PS_ARCH%\%PS_CONFIG%\%PS_DEPS_PATH_FILE_NAME%
|
||||||
|
mkdir "%~dp0build\.vs\%PS_ARCH%\%PS_CONFIG%" > nul 2> nul
|
||||||
|
REM Copy a legacy file if we don't have one in the proper location.
|
||||||
|
echo f|xcopy /D "%~dp0build\%PS_ARCH%\%PS_CONFIG%\%PS_DEPS_PATH_FILE_NAME%" "%PS_DEPS_PATH_FILE_FOR_CONFIG%" > nul 2> nul
|
||||||
|
CALL :CANONICALIZE_PATH PS_DEPS_PATH_FILE_FOR_CONFIG
|
||||||
|
IF EXIST "%PS_DEPS_PATH_FILE_FOR_CONFIG%" (
|
||||||
|
FOR /F "tokens=* USEBACKQ" %%I IN ("%PS_DEPS_PATH_FILE_FOR_CONFIG%") DO (
|
||||||
|
SET PS_DESTDIR_CACHED=%%I
|
||||||
|
SET PS_DESTDIR_DEFAULT_MSG=%%I
|
||||||
|
)
|
||||||
|
SET PS_STEPS_DEFAULT=app-dirty
|
||||||
|
) ELSE IF EXIST "%PS_DEPS_PATH_FILE%" (
|
||||||
|
FOR /F "tokens=* USEBACKQ" %%I IN ("%PS_DEPS_PATH_FILE%") DO (
|
||||||
|
SET PS_DESTDIR_CACHED=%%I
|
||||||
|
SET PS_DESTDIR_DEFAULT_MSG=%%I
|
||||||
|
)
|
||||||
|
SET PS_STEPS_DEFAULT=app
|
||||||
|
) ELSE (
|
||||||
|
SET PS_DESTDIR_CACHED=
|
||||||
|
SET PS_DESTDIR_DEFAULT_MSG=Cache missing. Argument required.
|
||||||
|
SET PS_STEPS_DEFAULT=all
|
||||||
|
)
|
||||||
|
GOTO :EOF
|
||||||
|
|
||||||
|
:PARSE_OPTION
|
||||||
|
@REM Argument parser called for each argument
|
||||||
|
@REM %1 - Valid option list
|
||||||
|
@REM %2 - Variable name for parser state; must be unset when parsing finished
|
||||||
|
@REM %3 - Current argument value
|
||||||
|
@REM PARSER_FAIL will be set on an error
|
||||||
|
@REM Note: Must avoid delayed expansion since filenames may contain ! character
|
||||||
|
setlocal disableDelayedExpansion
|
||||||
|
IF "%PARSER_FAIL%" NEQ "" GOTO :EOF
|
||||||
|
CALL SET LAST_ARG=%%%2%%
|
||||||
|
IF "%LAST_ARG%" EQU "" (
|
||||||
|
CALL :PARSE_OPTION_NAME %1 %~2 %~3 1
|
||||||
|
SET ARG_TYPE=NAME
|
||||||
|
) ELSE (
|
||||||
|
SET PS_SET_COMMAND=SET PS_%LAST_ARG%=%~3
|
||||||
|
SET ARG_TYPE=LAST_ARG
|
||||||
|
SET %~2=
|
||||||
|
)
|
||||||
|
CALL SET LAST_ARG=%%%2%%
|
||||||
|
IF "%LAST_ARG%%ARG_TYPE%" EQU "NAME" SET PARSER_FAIL=%~3
|
||||||
|
(
|
||||||
|
endlocal
|
||||||
|
SET PARSER_FAIL=%PARSER_FAIL%
|
||||||
|
SET %~2=%LAST_ARG%
|
||||||
|
%PS_SET_COMMAND%
|
||||||
|
)
|
||||||
|
GOTO :EOF
|
||||||
|
|
||||||
|
:PARSE_OPTION_VALUE
|
||||||
|
setlocal disableDelayedExpansion
|
||||||
|
@REM Parses value and verifies it is within the supplied list
|
||||||
|
@REM %1 - Valid option list
|
||||||
|
@REM %2 - In/out variable name; unset on error
|
||||||
|
CALL SET NAME=%~2
|
||||||
|
CALL SET SAVED_VALUE=%%%NAME%%%
|
||||||
|
CALL :PARSE_OPTION_NAME %1 %NAME% -%SAVED_VALUE%
|
||||||
|
CALL SET NEW_VALUE=%%%NAME%%%
|
||||||
|
IF "%NEW_VALUE%" EQU "" (
|
||||||
|
@ECHO ERROR: Invalid parameter: %NAME:~3%=%SAVED_VALUE% 1>&2
|
||||||
|
)
|
||||||
|
endlocal & SET %NAME%=%NEW_VALUE%
|
||||||
|
GOTO :EOF
|
||||||
|
|
||||||
|
:PARSE_OPTION_NAME
|
||||||
|
@REM Parses an option name
|
||||||
|
@REM %1 - Valid option list
|
||||||
|
@REM %2 - Out variable name; unset on error
|
||||||
|
@REM %3 - Current argument value
|
||||||
|
@REM %4 - Boolean indicating single character switches are valid
|
||||||
|
@REM Note: Delayed expansion safe because ! character is invalid in option name
|
||||||
|
setlocal enableDelayedExpansion
|
||||||
|
IF "%4" NEQ "" FOR %%I IN (%~1) DO @(
|
||||||
|
SET SHORT_NAME=%%~I
|
||||||
|
SET SHORT_ARG_!SHORT_NAME:~0,1!=%%~I
|
||||||
|
)
|
||||||
|
@SET OPTION_NAME=%~3
|
||||||
|
@(echo %OPTION_NAME%)| findstr /R /C:"[-/]..*">nul || GOTO :PARSE_OPTION_NAME_FAIL
|
||||||
|
@SET OPTION_NAME=%OPTION_NAME:~1%
|
||||||
|
IF "%4" NEQ "" (
|
||||||
|
IF "%OPTION_NAME%" EQU "%OPTION_NAME:~0,1%" (
|
||||||
|
IF "!SHORT_ARG_%OPTION_NAME:~0,1%!" NEQ "" SET OPTION_NAME=!SHORT_ARG_%OPTION_NAME:~0,1%!
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@(echo %OPTION_NAME%)| findstr /R /C:".[ ][ ]*.">nul && GOTO :PARSE_OPTION_NAME_FAIL
|
||||||
|
@(echo %~1 )| findstr /I /C:" %OPTION_NAME% ">nul || GOTO :PARSE_OPTION_NAME_FAIL
|
||||||
|
FOR %%I IN (%~1) DO SET OPTION_NAME=!OPTION_NAME:%%~I=%%~I!
|
||||||
|
endlocal & SET %~2=%OPTION_NAME%
|
||||||
|
GOTO :EOF
|
||||||
|
:PARSE_OPTION_NAME_FAIL
|
||||||
|
endlocal & SET %~2=
|
||||||
|
GOTO :EOF
|
||||||
|
|
||||||
|
:MAKE_OR_CLEAN_DIRECTORY
|
||||||
|
@REM Create directory if it doesn't exist or clean it if it does
|
||||||
|
@REM %1 - Directory path to clean or create
|
||||||
|
@REM %* - Optional list of files/dirs to keep (in the base directory only)
|
||||||
|
setlocal disableDelayedExpansion
|
||||||
|
IF NOT EXIST "%~1" (
|
||||||
|
@ECHO Creating %~1
|
||||||
|
mkdir "%~1" && (
|
||||||
|
endlocal
|
||||||
|
GOTO :EOF
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@ECHO Cleaning %~1 ...
|
||||||
|
SET KEEP_LIST=
|
||||||
|
:MAKE_OR_CLEAN_DIRECTORY_ARG_LOOP
|
||||||
|
IF "%~2" NEQ "" (
|
||||||
|
SET KEEP_LIST=%KEEP_LIST% "%~2"
|
||||||
|
SHIFT /2
|
||||||
|
GOTO :MAKE_OR_CLEAN_DIRECTORY_ARG_LOOP
|
||||||
|
)
|
||||||
|
for /F "usebackq delims=" %%I in (`dir /a /b "%~1"`) do (
|
||||||
|
(echo %KEEP_LIST%)| findstr /I /L /C:"\"%%I\"">nul || (
|
||||||
|
rmdir /s /q "%~1\%%I" 2>nul ) || del /q /f "%~1\%%I"
|
||||||
|
)
|
||||||
|
endlocal
|
||||||
|
GOTO :EOF
|
||||||
|
|
||||||
|
:TOLOWER
|
||||||
|
@REM Converts supplied environment variable to lowercase
|
||||||
|
@REM %1 - Input/output variable name
|
||||||
|
@REM Note: This is slow on very long strings, but is used only on very short ones
|
||||||
|
setlocal disableDelayedExpansion
|
||||||
|
@FOR %%b IN (a b c d e f g h i j k l m n o p q r s t u v w x y z) DO @CALL set %~1=%%%1:%%b=%%b%%
|
||||||
|
@CALL SET OUTPUT=%%%~1%%
|
||||||
|
endlocal & SET %~1=%OUTPUT%
|
||||||
|
GOTO :EOF
|
||||||
|
|
||||||
|
:CANONICALIZE_PATH
|
||||||
|
@REM Canonicalizes the path in the supplied variable
|
||||||
|
@REM %1 - Input/output variable containing path to canonicalize
|
||||||
|
@REM %2 - Optional base directory
|
||||||
|
setlocal
|
||||||
|
CALL :CANONICALIZE_PATH_INNER %1 %%%~1%% %2
|
||||||
|
endlocal & SET %~1=%OUTPUT%
|
||||||
|
GOTO :EOF
|
||||||
|
:CANONICALIZE_PATH_INNER
|
||||||
|
if "%~3" NEQ "" (pushd %3 || GOTO :EOF)
|
||||||
|
SET OUTPUT=%~f2
|
||||||
|
if "%~3" NEQ "" popd
|
||||||
|
GOTO :EOF
|
||||||
|
|
||||||
|
:DIFF_TIME
|
||||||
|
@REM Calculates elapsed time between two timestamps (TIME environment variable format)
|
||||||
|
@REM %1 - Output variable
|
||||||
|
@REM %2 - Start time
|
||||||
|
@REM %3 - End time
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
set START_ARG=%2
|
||||||
|
set END_ARG=%3
|
||||||
|
set END=!END_ARG:%TIME:~8,1%=%%100)*100+1!
|
||||||
|
set START=!START_ARG:%TIME:~8,1%=%%100)*100+1!
|
||||||
|
set /A DIFF=((((10!END:%TIME:~2,1%=%%100)*60+1!%%100)-((((10!START:%TIME:~2,1%=%%100)*60+1!%%100), DIFF-=(DIFF^>^>31)*24*60*60*100
|
||||||
|
set /A CC=DIFF%%100+100,DIFF/=100,SS=DIFF%%60+100,DIFF/=60,MM=DIFF%%60+100,HH=DIFF/60+100
|
||||||
|
@endlocal & set %1=%HH:~1%%TIME:~2,1%%MM:~1%%TIME:~2,1%%SS:~1%%TIME:~8,1%%CC:~1%
|
||||||
|
@GOTO :EOF
|
||||||
|
|
||||||
|
:WRITE_CUSTOM_SCRIPT_SKELETON
|
||||||
|
@REM Writes the following text to the supplied file
|
||||||
|
@REM %1 - Output filename
|
||||||
|
setlocal
|
||||||
|
@(
|
||||||
|
ECHO @ECHO.
|
||||||
|
ECHO @ECHO ********************************************************************************
|
||||||
|
ECHO @ECHO ** This is a custom run script skeleton.
|
||||||
|
ECHO @ECHO ********************************************************************************
|
||||||
|
ECHO @ECHO.
|
||||||
|
ECHO @ECHO ********************************************************************************
|
||||||
|
ECHO @ECHO ** The working directory is:
|
||||||
|
ECHO @ECHO ********************************************************************************
|
||||||
|
ECHO dir
|
||||||
|
ECHO @ECHO.
|
||||||
|
ECHO @ECHO ********************************************************************************
|
||||||
|
ECHO @ECHO ** The environment is:
|
||||||
|
ECHO @ECHO ********************************************************************************
|
||||||
|
ECHO set
|
||||||
|
ECHO @ECHO.
|
||||||
|
ECHO @ECHO ********************************************************************************
|
||||||
|
ECHO @ECHO ** Edit or replace this script to run custom steps after a successful build:
|
||||||
|
ECHO @ECHO ** %~1
|
||||||
|
ECHO @ECHO ********************************************************************************
|
||||||
|
ECHO @ECHO.
|
||||||
|
) > "%~1"
|
||||||
|
endlocal
|
||||||
|
GOTO :EOF
|
||||||
175
cmake/modules/Catch2/Catch.cmake
Normal file
175
cmake/modules/Catch2/Catch.cmake
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
Catch
|
||||||
|
-----
|
||||||
|
|
||||||
|
This module defines a function to help use the Catch test framework.
|
||||||
|
|
||||||
|
The :command:`catch_discover_tests` discovers tests by asking the compiled test
|
||||||
|
executable to enumerate its tests. This does not require CMake to be re-run
|
||||||
|
when tests change. However, it may not work in a cross-compiling environment,
|
||||||
|
and setting test properties is less convenient.
|
||||||
|
|
||||||
|
This command is intended to replace use of :command:`add_test` to register
|
||||||
|
tests, and will create a separate CTest test for each Catch test case. Note
|
||||||
|
that this is in some cases less efficient, as common set-up and tear-down logic
|
||||||
|
cannot be shared by multiple test cases executing in the same instance.
|
||||||
|
However, it provides more fine-grained pass/fail information to CTest, which is
|
||||||
|
usually considered as more beneficial. By default, the CTest test name is the
|
||||||
|
same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||||
|
|
||||||
|
.. command:: catch_discover_tests
|
||||||
|
|
||||||
|
Automatically add tests with CTest by querying the compiled test executable
|
||||||
|
for available tests::
|
||||||
|
|
||||||
|
catch_discover_tests(target
|
||||||
|
[TEST_SPEC arg1...]
|
||||||
|
[EXTRA_ARGS arg1...]
|
||||||
|
[WORKING_DIRECTORY dir]
|
||||||
|
[TEST_PREFIX prefix]
|
||||||
|
[TEST_SUFFIX suffix]
|
||||||
|
[PROPERTIES name1 value1...]
|
||||||
|
[TEST_LIST var]
|
||||||
|
)
|
||||||
|
|
||||||
|
``catch_discover_tests`` sets up a post-build command on the test executable
|
||||||
|
that generates the list of tests by parsing the output from running the test
|
||||||
|
with the ``--list-test-names-only`` argument. This ensures that the full
|
||||||
|
list of tests is obtained. Since test discovery occurs at build time, it is
|
||||||
|
not necessary to re-run CMake when the list of tests changes.
|
||||||
|
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
|
||||||
|
in order to function in a cross-compiling environment.
|
||||||
|
|
||||||
|
Additionally, setting properties on tests is somewhat less convenient, since
|
||||||
|
the tests are not available at CMake time. Additional test properties may be
|
||||||
|
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
|
||||||
|
more fine-grained test control is needed, custom content may be provided
|
||||||
|
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
|
||||||
|
directory property. The set of discovered tests is made accessible to such a
|
||||||
|
script via the ``<target>_TESTS`` variable.
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
|
||||||
|
``target``
|
||||||
|
Specifies the Catch executable, which must be a known CMake executable
|
||||||
|
target. CMake will substitute the location of the built executable when
|
||||||
|
running the test.
|
||||||
|
|
||||||
|
``TEST_SPEC arg1...``
|
||||||
|
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
||||||
|
pass to the Catch executable with the ``--list-test-names-only`` argument.
|
||||||
|
|
||||||
|
``EXTRA_ARGS arg1...``
|
||||||
|
Any extra arguments to pass on the command line to each test case.
|
||||||
|
|
||||||
|
``WORKING_DIRECTORY dir``
|
||||||
|
Specifies the directory in which to run the discovered test cases. If this
|
||||||
|
option is not provided, the current binary directory is used.
|
||||||
|
|
||||||
|
``TEST_PREFIX prefix``
|
||||||
|
Specifies a ``prefix`` to be prepended to the name of each discovered test
|
||||||
|
case. This can be useful when the same test executable is being used in
|
||||||
|
multiple calls to ``catch_discover_tests()`` but with different
|
||||||
|
``TEST_SPEC`` or ``EXTRA_ARGS``.
|
||||||
|
|
||||||
|
``TEST_SUFFIX suffix``
|
||||||
|
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
|
||||||
|
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
|
||||||
|
be specified.
|
||||||
|
|
||||||
|
``PROPERTIES name1 value1...``
|
||||||
|
Specifies additional properties to be set on all tests discovered by this
|
||||||
|
invocation of ``catch_discover_tests``.
|
||||||
|
|
||||||
|
``TEST_LIST var``
|
||||||
|
Make the list of tests available in the variable ``var``, rather than the
|
||||||
|
default ``<target>_TESTS``. This can be useful when the same test
|
||||||
|
executable is being used in multiple calls to ``catch_discover_tests()``.
|
||||||
|
Note that this variable is only available in CTest.
|
||||||
|
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
function(catch_discover_tests TARGET)
|
||||||
|
cmake_parse_arguments(
|
||||||
|
""
|
||||||
|
""
|
||||||
|
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
|
||||||
|
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT _WORKING_DIRECTORY)
|
||||||
|
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endif()
|
||||||
|
if(NOT _TEST_LIST)
|
||||||
|
set(_TEST_LIST ${TARGET}_TESTS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
## Generate a unique name based on the extra arguments
|
||||||
|
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
|
||||||
|
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||||
|
|
||||||
|
# Define rule to generate test list for aforementioned test executable
|
||||||
|
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
|
||||||
|
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
|
||||||
|
get_property(crosscompiling_emulator
|
||||||
|
TARGET ${TARGET}
|
||||||
|
PROPERTY CROSSCOMPILING_EMULATOR
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TARGET} POST_BUILD
|
||||||
|
BYPRODUCTS "${ctest_tests_file}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "TEST_TARGET=${TARGET}"
|
||||||
|
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
|
||||||
|
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
|
||||||
|
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
|
||||||
|
-D "TEST_SPEC=${_TEST_SPEC}"
|
||||||
|
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
||||||
|
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
||||||
|
-D "TEST_PREFIX='${_TEST_PREFIX}'"
|
||||||
|
-D "TEST_SUFFIX='${_TEST_SUFFIX}'"
|
||||||
|
-D "TEST_LIST=${_TEST_LIST}"
|
||||||
|
-D "CTEST_FILE=${ctest_tests_file}"
|
||||||
|
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
file(WRITE "${ctest_include_file}"
|
||||||
|
"if(EXISTS \"${ctest_tests_file}\")\n"
|
||||||
|
" include(\"${ctest_tests_file}\")\n"
|
||||||
|
"else()\n"
|
||||||
|
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
|
||||||
|
"endif()\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||||
|
# Add discovered tests to directory TEST_INCLUDE_FILES
|
||||||
|
set_property(DIRECTORY
|
||||||
|
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
||||||
|
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
||||||
|
if (NOT ${test_include_file_set})
|
||||||
|
set_property(DIRECTORY
|
||||||
|
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Cannot set more than one TEST_INCLUDE_FILE"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
set(_CATCH_DISCOVER_TESTS_SCRIPT
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
|
||||||
|
)
|
||||||
106
cmake/modules/Catch2/CatchAddTests.cmake
Normal file
106
cmake/modules/Catch2/CatchAddTests.cmake
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
set(prefix "${TEST_PREFIX}")
|
||||||
|
set(suffix "${TEST_SUFFIX}")
|
||||||
|
set(spec ${TEST_SPEC})
|
||||||
|
set(extra_args ${TEST_EXTRA_ARGS})
|
||||||
|
set(properties ${TEST_PROPERTIES})
|
||||||
|
set(script)
|
||||||
|
set(suite)
|
||||||
|
set(tests)
|
||||||
|
|
||||||
|
function(add_command NAME)
|
||||||
|
set(_args "")
|
||||||
|
foreach(_arg ${ARGN})
|
||||||
|
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
||||||
|
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
||||||
|
else()
|
||||||
|
set(_args "${_args} ${_arg}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
macro(_add_catch_test_labels LINE)
|
||||||
|
# convert to list of tags
|
||||||
|
string(REPLACE "][" "]\\;[" tags ${line})
|
||||||
|
|
||||||
|
add_command(
|
||||||
|
set_tests_properties "${prefix}${test}${suffix}"
|
||||||
|
PROPERTIES
|
||||||
|
LABELS "${tags}"
|
||||||
|
)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(_add_catch_test LINE)
|
||||||
|
set(test ${line})
|
||||||
|
# use escape commas to handle properly test cases with commans inside the name
|
||||||
|
string(REPLACE "," "\\," test_name ${test})
|
||||||
|
# ...and add to script
|
||||||
|
add_command(
|
||||||
|
add_test "${prefix}${test}${suffix}"
|
||||||
|
${TEST_EXECUTOR}
|
||||||
|
"${TEST_EXECUTABLE}"
|
||||||
|
"${test_name}"
|
||||||
|
${extra_args}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_command(
|
||||||
|
set_tests_properties "${prefix}${test}${suffix}"
|
||||||
|
PROPERTIES
|
||||||
|
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||||
|
${properties}
|
||||||
|
)
|
||||||
|
list(APPEND tests "${prefix}${test}${suffix}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Run test executable to get list of available tests
|
||||||
|
if(NOT EXISTS "${TEST_EXECUTABLE}")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-tests
|
||||||
|
OUTPUT_VARIABLE output
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
|
||||||
|
if(${result} EQUAL 0)
|
||||||
|
message(WARNING
|
||||||
|
"Test executable '${TEST_EXECUTABLE}' contains no tests!\n"
|
||||||
|
)
|
||||||
|
elseif(${result} LESS 0)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||||
|
" Result: ${result}\n"
|
||||||
|
" Output: ${output}\n"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE "\n" ";" output "${output}")
|
||||||
|
set(test)
|
||||||
|
set(tags_regex "(\\[([^\\[]*)\\])+$")
|
||||||
|
|
||||||
|
# Parse output
|
||||||
|
foreach(line ${output})
|
||||||
|
# lines without leading whitespaces are catch output not tests
|
||||||
|
if(${line} MATCHES "^[ \t]+")
|
||||||
|
# strip leading spaces and tabs
|
||||||
|
string(REGEX REPLACE "^[ \t]+" "" line ${line})
|
||||||
|
|
||||||
|
if(${line} MATCHES "${tags_regex}")
|
||||||
|
_add_catch_test_labels(${line})
|
||||||
|
else()
|
||||||
|
_add_catch_test(${line})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Create a list of all discovered tests, which users may use to e.g. set
|
||||||
|
# properties on the tests
|
||||||
|
add_command(set ${TEST_LIST} ${tests})
|
||||||
|
|
||||||
|
# Write CTest script
|
||||||
|
file(WRITE "${CTEST_FILE}" "${script}")
|
||||||
225
cmake/modules/Catch2/ParseAndAddCatchTests.cmake
Normal file
225
cmake/modules/Catch2/ParseAndAddCatchTests.cmake
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
#==================================================================================================#
|
||||||
|
# supported macros #
|
||||||
|
# - TEST_CASE, #
|
||||||
|
# - SCENARIO, #
|
||||||
|
# - TEST_CASE_METHOD, #
|
||||||
|
# - CATCH_TEST_CASE, #
|
||||||
|
# - CATCH_SCENARIO, #
|
||||||
|
# - CATCH_TEST_CASE_METHOD. #
|
||||||
|
# #
|
||||||
|
# Usage #
|
||||||
|
# 1. make sure this module is in the path or add this otherwise: #
|
||||||
|
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
||||||
|
# 2. make sure that you've enabled testing option for the project by the call: #
|
||||||
|
# enable_testing() #
|
||||||
|
# 3. add the lines to the script for testing target (sample CMakeLists.txt): #
|
||||||
|
# project(testing_target) #
|
||||||
|
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
||||||
|
# enable_testing() #
|
||||||
|
# #
|
||||||
|
# find_path(CATCH_INCLUDE_DIR "catch.hpp") #
|
||||||
|
# include_directories(${INCLUDE_DIRECTORIES} ${CATCH_INCLUDE_DIR}) #
|
||||||
|
# #
|
||||||
|
# file(GLOB SOURCE_FILES "*.cpp") #
|
||||||
|
# add_executable(${PROJECT_NAME} ${SOURCE_FILES}) #
|
||||||
|
# #
|
||||||
|
# include(ParseAndAddCatchTests) #
|
||||||
|
# ParseAndAddCatchTests(${PROJECT_NAME}) #
|
||||||
|
# #
|
||||||
|
# The following variables affect the behavior of the script: #
|
||||||
|
# #
|
||||||
|
# PARSE_CATCH_TESTS_VERBOSE (Default OFF) #
|
||||||
|
# -- enables debug messages #
|
||||||
|
# PARSE_CATCH_TESTS_NO_HIDDEN_TESTS (Default OFF) #
|
||||||
|
# -- excludes tests marked with [!hide], [.] or [.foo] tags #
|
||||||
|
# PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME (Default ON) #
|
||||||
|
# -- adds fixture class name to the test name #
|
||||||
|
# PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME (Default ON) #
|
||||||
|
# -- adds cmake target name to the test name #
|
||||||
|
# PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS (Default OFF) #
|
||||||
|
# -- causes CMake to rerun when file with tests changes so that new tests will be discovered #
|
||||||
|
# #
|
||||||
|
# One can also set (locally) the optional variable OptionalCatchTestLauncher to precise the way #
|
||||||
|
# a test should be run. For instance to use test MPI, one can write #
|
||||||
|
# set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC}) #
|
||||||
|
# just before calling this ParseAndAddCatchTests function #
|
||||||
|
# #
|
||||||
|
# The AdditionalCatchParameters optional variable can be used to pass extra argument to the test #
|
||||||
|
# command. For example, to include successful tests in the output, one can write #
|
||||||
|
# set(AdditionalCatchParameters --success) #
|
||||||
|
# #
|
||||||
|
# After the script, the ParseAndAddCatchTests_TESTS property for the target, and for each source #
|
||||||
|
# file in the target is set, and contains the list of the tests extracted from that target, or #
|
||||||
|
# from that file. This is useful, for example to add further labels or properties to the tests. #
|
||||||
|
# #
|
||||||
|
#==================================================================================================#
|
||||||
|
|
||||||
|
if (CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
|
||||||
|
message(FATAL_ERROR "ParseAndAddCatchTests requires CMake 2.8.8 or newer")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF)
|
||||||
|
option(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS "Exclude tests with [!hide], [.] or [.foo] tags" OFF)
|
||||||
|
option(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME "Add fixture class name to the test name" ON)
|
||||||
|
option(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME "Add target name to the test name" ON)
|
||||||
|
option(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS "Add test file to CMAKE_CONFIGURE_DEPENDS property" OFF)
|
||||||
|
|
||||||
|
function(ParseAndAddCatchTests_PrintDebugMessage)
|
||||||
|
if(PARSE_CATCH_TESTS_VERBOSE)
|
||||||
|
message(STATUS "ParseAndAddCatchTests: ${ARGV}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# This removes the contents between
|
||||||
|
# - block comments (i.e. /* ... */)
|
||||||
|
# - full line comments (i.e. // ... )
|
||||||
|
# contents have been read into '${CppCode}'.
|
||||||
|
# !keep partial line comments
|
||||||
|
function(ParseAndAddCatchTests_RemoveComments CppCode)
|
||||||
|
string(ASCII 2 CMakeBeginBlockComment)
|
||||||
|
string(ASCII 3 CMakeEndBlockComment)
|
||||||
|
string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
|
||||||
|
string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
|
||||||
|
string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
|
||||||
|
string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
|
||||||
|
|
||||||
|
set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Worker function
|
||||||
|
function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
||||||
|
# If SourceFile is an object library, do not scan it (as it is not a file). Exit without giving a warning about a missing file.
|
||||||
|
if(SourceFile MATCHES "\\\$<TARGET_OBJECTS:.+>")
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Detected OBJECT library: ${SourceFile} this will not be scanned for tests.")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
# According to CMake docs EXISTS behavior is well-defined only for full paths.
|
||||||
|
get_filename_component(SourceFile ${SourceFile} ABSOLUTE)
|
||||||
|
if(NOT EXISTS ${SourceFile})
|
||||||
|
message(WARNING "Cannot find source file: ${SourceFile}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("parsing ${SourceFile}")
|
||||||
|
file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME)
|
||||||
|
|
||||||
|
# Remove block and fullline comments
|
||||||
|
ParseAndAddCatchTests_RemoveComments(Contents)
|
||||||
|
|
||||||
|
# Find definition of test names
|
||||||
|
string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^\)]+\\)+[ \t\n]*{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
|
||||||
|
|
||||||
|
if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
|
||||||
|
set_property(
|
||||||
|
DIRECTORY
|
||||||
|
APPEND
|
||||||
|
PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(TestName ${Tests})
|
||||||
|
# Strip newlines
|
||||||
|
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
|
||||||
|
|
||||||
|
# Get test type and fixture if applicable
|
||||||
|
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
|
||||||
|
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
|
||||||
|
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
|
||||||
|
|
||||||
|
# Get string parts of test definition
|
||||||
|
string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
|
||||||
|
|
||||||
|
# Strip wrapping quotation marks
|
||||||
|
string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
|
||||||
|
string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")
|
||||||
|
|
||||||
|
# Validate that a test name and tags have been provided
|
||||||
|
list(LENGTH TestStrings TestStringsLength)
|
||||||
|
if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
|
||||||
|
message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Assign name and tags
|
||||||
|
list(GET TestStrings 0 Name)
|
||||||
|
if("${TestType}" STREQUAL "SCENARIO")
|
||||||
|
set(Name "Scenario: ${Name}")
|
||||||
|
endif()
|
||||||
|
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND TestFixture)
|
||||||
|
set(CTestName "${TestFixture}:${Name}")
|
||||||
|
else()
|
||||||
|
set(CTestName "${Name}")
|
||||||
|
endif()
|
||||||
|
if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
|
||||||
|
set(CTestName "${TestTarget}:${CTestName}")
|
||||||
|
endif()
|
||||||
|
# add target to labels to enable running all tests added from this target
|
||||||
|
set(Labels ${TestTarget})
|
||||||
|
if(TestStringsLength EQUAL 2)
|
||||||
|
list(GET TestStrings 1 Tags)
|
||||||
|
string(TOLOWER "${Tags}" Tags)
|
||||||
|
# remove target from labels if the test is hidden
|
||||||
|
if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
|
||||||
|
list(REMOVE_ITEM Labels ${TestTarget})
|
||||||
|
endif()
|
||||||
|
string(REPLACE "]" ";" Tags "${Tags}")
|
||||||
|
string(REPLACE "[" "" Tags "${Tags}")
|
||||||
|
else()
|
||||||
|
# unset tags variable from previous loop
|
||||||
|
unset(Tags)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND Labels ${Tags})
|
||||||
|
|
||||||
|
set(HiddenTagFound OFF)
|
||||||
|
foreach(label ${Labels})
|
||||||
|
string(REGEX MATCH "^!hide|^\\." result ${label})
|
||||||
|
if(result)
|
||||||
|
set(HiddenTagFound ON)
|
||||||
|
break()
|
||||||
|
endif(result)
|
||||||
|
endforeach(label)
|
||||||
|
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
|
||||||
|
else()
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"")
|
||||||
|
if(Labels)
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Escape commas in the test spec
|
||||||
|
string(REPLACE "," "\\," Name ${Name})
|
||||||
|
|
||||||
|
# Add the test and set its properties
|
||||||
|
add_test(NAME "\"${CTestName}\"" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
|
||||||
|
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
|
||||||
|
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
|
||||||
|
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
|
||||||
|
else()
|
||||||
|
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||||
|
LABELS "${Labels}")
|
||||||
|
endif()
|
||||||
|
set_property(
|
||||||
|
TARGET ${TestTarget}
|
||||||
|
APPEND
|
||||||
|
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
|
||||||
|
set_property(
|
||||||
|
SOURCE ${SourceFile}
|
||||||
|
APPEND
|
||||||
|
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# entry point
|
||||||
|
function(ParseAndAddCatchTests TestTarget)
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
|
||||||
|
get_target_property(SourceFiles ${TestTarget} SOURCES)
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
|
||||||
|
foreach(SourceFile ${SourceFiles})
|
||||||
|
ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget})
|
||||||
|
endforeach()
|
||||||
|
ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}")
|
||||||
|
endfunction()
|
||||||
106
cmake/modules/CheckAtomic.cmake
Normal file
106
cmake/modules/CheckAtomic.cmake
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# atomic builtins are required for threading support.
|
||||||
|
|
||||||
|
INCLUDE(CheckCXXSourceCompiles)
|
||||||
|
INCLUDE(CheckLibraryExists)
|
||||||
|
|
||||||
|
# Sometimes linking against libatomic is required for atomic ops, if
|
||||||
|
# the platform doesn't support lock-free atomics.
|
||||||
|
|
||||||
|
function(check_working_cxx_atomics varname)
|
||||||
|
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
|
#include <atomic>
|
||||||
|
std::atomic<int> x;
|
||||||
|
int main() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
" ${varname})
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||||
|
endfunction(check_working_cxx_atomics)
|
||||||
|
|
||||||
|
function(check_working_cxx_atomics64 varname)
|
||||||
|
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}")
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
|
#include <atomic>
|
||||||
|
#include <cstdint>
|
||||||
|
std::atomic<uint64_t> x (0);
|
||||||
|
int main() {
|
||||||
|
uint64_t i = x.load(std::memory_order_relaxed);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
" ${varname})
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||||
|
endfunction(check_working_cxx_atomics64)
|
||||||
|
|
||||||
|
|
||||||
|
# This isn't necessary on MSVC, so avoid command-line switch annoyance
|
||||||
|
# by only running on GCC-like hosts.
|
||||||
|
if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
|
||||||
|
# First check if atomics work without the library.
|
||||||
|
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
||||||
|
# If not, check if the library exists, and atomics work with it.
|
||||||
|
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
||||||
|
check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
|
||||||
|
if( HAVE_LIBATOMIC )
|
||||||
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
||||||
|
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
|
||||||
|
if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
|
||||||
|
message(FATAL_ERROR "Host compiler must support std::atomic!")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check for 64 bit atomic operations.
|
||||||
|
if(MSVC)
|
||||||
|
set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
|
||||||
|
else()
|
||||||
|
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# If not, check if the library exists, and atomics work with it.
|
||||||
|
if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
|
||||||
|
check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
|
||||||
|
if(HAVE_CXX_LIBATOMICS64)
|
||||||
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
||||||
|
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
|
||||||
|
if (NOT HAVE_CXX_ATOMICS64_WITH_LIB)
|
||||||
|
message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
## TODO: This define is only used for the legacy atomic operations in
|
||||||
|
## llvm's Atomic.h, which should be replaced. Other code simply
|
||||||
|
## assumes C++11 <atomic> works.
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
int main() {
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
volatile LONG val = 1;
|
||||||
|
MemoryBarrier();
|
||||||
|
InterlockedCompareExchange(&val, 0, 1);
|
||||||
|
InterlockedIncrement(&val);
|
||||||
|
InterlockedDecrement(&val);
|
||||||
|
#else
|
||||||
|
volatile unsigned long val = 1;
|
||||||
|
__sync_synchronize();
|
||||||
|
__sync_val_compare_and_swap(&val, 1, 0);
|
||||||
|
__sync_add_and_fetch(&val, 1);
|
||||||
|
__sync_sub_and_fetch(&val, 1);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
" LLVM_HAS_ATOMICS)
|
||||||
|
|
||||||
|
if( NOT LLVM_HAS_ATOMICS )
|
||||||
|
message(STATUS "Warning: LLVM will be built thread-unsafe because atomic builtins are missing")
|
||||||
|
endif()
|
||||||
109
cmake/modules/FindAlienWx.cmake
Normal file
109
cmake/modules/FindAlienWx.cmake
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
# Find the wxWidgets module based on the information provided by the Perl Alien::wxWidgets module.
|
||||||
|
|
||||||
|
# Check for the Perl & PerlLib modules
|
||||||
|
include(LibFindMacros)
|
||||||
|
libfind_package(AlienWx Perl)
|
||||||
|
libfind_package(AlienWx PerlLibs)
|
||||||
|
|
||||||
|
if (AlienWx_DEBUG)
|
||||||
|
message(STATUS " AlienWx_FIND_COMPONENTS=${AlienWx_FIND_COMPONENTS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Execute an Alien::Wx module to find the relevant information regarding
|
||||||
|
# the wxWidgets used by the Perl interpreter.
|
||||||
|
# Perl specific stuff
|
||||||
|
set(AlienWx_TEMP_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/AlienWx_TEMP_INCLUDE.txt)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${PERL_EXECUTABLE} -e "
|
||||||
|
# Import Perl modules.
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Text::ParseWords;
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
# CMake sets the environment variables CC and CXX to the detected C compiler.
|
||||||
|
# There is an issue with the Perl ExtUtils::CBuilder, which does not handle whitespaces
|
||||||
|
# in the paths correctly on Windows, so we rather drop the CMake auto-detected paths.
|
||||||
|
delete \$ENV{CC};
|
||||||
|
delete \$ENV{CXX};
|
||||||
|
}
|
||||||
|
|
||||||
|
use Alien::wxWidgets;
|
||||||
|
use ExtUtils::CppGuess;
|
||||||
|
|
||||||
|
# Test for a Visual Studio compiler
|
||||||
|
my \$cpp_guess = ExtUtils::CppGuess->new;
|
||||||
|
my \$mswin = \$^O eq 'MSWin32';
|
||||||
|
my \$msvc = \$cpp_guess->is_msvc;
|
||||||
|
|
||||||
|
# List of wxWidgets components to be used.
|
||||||
|
my @components = split /;/, '${AlienWx_FIND_COMPONENTS}';
|
||||||
|
|
||||||
|
# Query the available data from Alien::wxWidgets.
|
||||||
|
my \$version = Alien::wxWidgets->version;
|
||||||
|
my \$config = Alien::wxWidgets->config;
|
||||||
|
my \$compiler = Alien::wxWidgets->compiler;
|
||||||
|
my \$linker = Alien::wxWidgets->linker;
|
||||||
|
my \$include_path = ' ' . Alien::wxWidgets->include_path;
|
||||||
|
my \$defines = ' ' . Alien::wxWidgets->defines;
|
||||||
|
my \$cflags = Alien::wxWidgets->c_flags;
|
||||||
|
my \$linkflags = Alien::wxWidgets->link_flags;
|
||||||
|
my \$libraries = ' ' . Alien::wxWidgets->libraries(@components);
|
||||||
|
my \$gui_toolkit = Alien::wxWidgets->config->{toolkit};
|
||||||
|
#my @libraries = Alien::wxWidgets->link_libraries(@components);
|
||||||
|
#my @implib = Alien::wxWidgets->import_libraries(@components);
|
||||||
|
#my @shrlib = Alien::wxWidgets->shared_libraries(@components);
|
||||||
|
#my @keys = Alien::wxWidgets->library_keys; # 'gl', 'adv', ...
|
||||||
|
#my \$library_path = Alien::wxWidgets->shared_library_path;
|
||||||
|
#my \$key = Alien::wxWidgets->key;
|
||||||
|
#my \$prefix = Alien::wxWidgets->prefix;
|
||||||
|
|
||||||
|
my \$filename = '${AlienWx_TEMP_INCLUDE}';
|
||||||
|
open(my $fh, '>', \$filename) or die \"Could not open file '\$filename' \$!\";
|
||||||
|
|
||||||
|
# Convert a space separated lists to CMake semicolon separated lists,
|
||||||
|
# escape the backslashes,
|
||||||
|
# export the resulting list to a temp file.
|
||||||
|
sub cmake_set_var {
|
||||||
|
my (\$varname, \$content) = @_;
|
||||||
|
# Remove line separators.
|
||||||
|
\$content =~ s/\\r|\\n//g;
|
||||||
|
# Escape the path separators.
|
||||||
|
\$content =~ s/\\\\/\\\\\\\\\\\\\\\\/g;
|
||||||
|
my @words = shellwords(\$content);
|
||||||
|
print \$fh \"set(AlienWx_\$varname \\\"\" . join(';', @words) . \"\\\")\\n\";
|
||||||
|
}
|
||||||
|
cmake_set_var('VERSION', \$version);
|
||||||
|
\$include_path =~ s/ -I/ /g;
|
||||||
|
cmake_set_var('INCLUDE_DIRS', \$include_path);
|
||||||
|
\$libraries =~ s/ -L/ -LIBPATH:/g if \$msvc;
|
||||||
|
cmake_set_var('LIBRARIES', \$libraries);
|
||||||
|
#cmake_set_var('LIBRARY_DIRS', );
|
||||||
|
#\$defines =~ s/ -D/ /g;
|
||||||
|
cmake_set_var('DEFINITIONS', \$defines);
|
||||||
|
#cmake_set_var('DEFINITIONS_DEBUG', );
|
||||||
|
cmake_set_var('CXX_FLAGS', \$cflags);
|
||||||
|
cmake_set_var('GUI_TOOLKIT', \$gui_toolkit);
|
||||||
|
close \$fh;
|
||||||
|
")
|
||||||
|
include(${AlienWx_TEMP_INCLUDE})
|
||||||
|
file(REMOVE ${AlienWx_TEMP_INCLUDE})
|
||||||
|
unset(AlienWx_TEMP_INCLUDE)
|
||||||
|
|
||||||
|
if (AlienWx_DEBUG)
|
||||||
|
message(STATUS " AlienWx_VERSION = ${AlienWx_VERSION}")
|
||||||
|
message(STATUS " AlienWx_INCLUDE_DIRS = ${AlienWx_INCLUDE_DIRS}")
|
||||||
|
message(STATUS " AlienWx_LIBRARIES = ${AlienWx_LIBRARIES}")
|
||||||
|
message(STATUS " AlienWx_LIBRARY_DIRS = ${AlienWx_LIBRARY_DIRS}")
|
||||||
|
message(STATUS " AlienWx_DEFINITIONS = ${AlienWx_DEFINITIONS}")
|
||||||
|
message(STATUS " AlienWx_DEFINITIONS_DEBUG = ${AlienWx_DEFINITIONS_DEBUG}")
|
||||||
|
message(STATUS " AlienWx_CXX_FLAGS = ${AlienWx_CXX_FLAGS}")
|
||||||
|
message(STATUS " AlienWx_GUI_TOOLKIT = ${AlienWx_GUI_TOOLKIT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_package_handle_standard_args(AlienWx
|
||||||
|
REQUIRED_VARS AlienWx_INCLUDE_DIRS AlienWx_LIBRARIES
|
||||||
|
# HANDLE_COMPONENTS
|
||||||
|
VERSION_VAR AlienWx_VERSION)
|
||||||
111
cmake/modules/FindCURL.cmake
Normal file
111
cmake/modules/FindCURL.cmake
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# FindCURL
|
||||||
|
# --------
|
||||||
|
#
|
||||||
|
# Find the native CURL headers and libraries.
|
||||||
|
#
|
||||||
|
# IMPORTED Targets
|
||||||
|
# ^^^^^^^^^^^^^^^^
|
||||||
|
#
|
||||||
|
# This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if
|
||||||
|
# curl has been found.
|
||||||
|
#
|
||||||
|
# Result Variables
|
||||||
|
# ^^^^^^^^^^^^^^^^
|
||||||
|
#
|
||||||
|
# This module defines the following variables:
|
||||||
|
#
|
||||||
|
# ``CURL_FOUND``
|
||||||
|
# True if curl found.
|
||||||
|
#
|
||||||
|
# ``CURL_INCLUDE_DIRS``
|
||||||
|
# where to find curl/curl.h, etc.
|
||||||
|
#
|
||||||
|
# ``CURL_LIBRARIES``
|
||||||
|
# List of libraries when using curl.
|
||||||
|
#
|
||||||
|
# ``CURL_VERSION_STRING``
|
||||||
|
# The version of curl found.
|
||||||
|
|
||||||
|
# Look for the header file.
|
||||||
|
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
|
||||||
|
mark_as_advanced(CURL_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(NOT CURL_LIBRARY)
|
||||||
|
# Look for the library (sorted from most current/relevant entry to least).
|
||||||
|
find_library(CURL_LIBRARY_RELEASE NAMES
|
||||||
|
curl
|
||||||
|
# Windows MSVC prebuilts:
|
||||||
|
curllib
|
||||||
|
libcurl_imp
|
||||||
|
curllib_static
|
||||||
|
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
|
||||||
|
libcurl
|
||||||
|
# Static library on Windows
|
||||||
|
libcurl_a
|
||||||
|
)
|
||||||
|
mark_as_advanced(CURL_LIBRARY_RELEASE)
|
||||||
|
|
||||||
|
find_library(CURL_LIBRARY_DEBUG NAMES
|
||||||
|
# Windows MSVC CMake builds in debug configuration on vcpkg:
|
||||||
|
libcurl-d_imp
|
||||||
|
libcurl-d
|
||||||
|
# Static library on Windows, compiled in debug mode
|
||||||
|
libcurl_a_debug
|
||||||
|
)
|
||||||
|
mark_as_advanced(CURL_LIBRARY_DEBUG)
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations_SLIC3R.cmake)
|
||||||
|
select_library_configurations_SLIC3R(CURL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CURL_INCLUDE_DIR)
|
||||||
|
foreach(_curl_version_header curlver.h curl.h)
|
||||||
|
if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
|
||||||
|
file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
|
||||||
|
|
||||||
|
string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}")
|
||||||
|
unset(curl_version_str)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs_SLIC3R.cmake)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS_SLIC3R(CURL
|
||||||
|
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
|
||||||
|
VERSION_VAR CURL_VERSION_STRING)
|
||||||
|
|
||||||
|
if(CURL_FOUND)
|
||||||
|
set(CURL_LIBRARIES ${CURL_LIBRARY})
|
||||||
|
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET CURL::libcurl)
|
||||||
|
add_library(CURL::libcurl UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(CURL::libcurl PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
if(EXISTS "${CURL_LIBRARY}")
|
||||||
|
set_target_properties(CURL::libcurl PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${CURL_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
if(CURL_LIBRARY_RELEASE)
|
||||||
|
set_property(TARGET CURL::libcurl APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
set_target_properties(CURL::libcurl PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
if(CURL_LIBRARY_DEBUG)
|
||||||
|
set_property(TARGET CURL::libcurl APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
set_target_properties(CURL::libcurl PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
59
cmake/modules/FindDBus.cmake
Normal file
59
cmake/modules/FindDBus.cmake
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# - Try to find DBus
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# DBUS_FOUND - system has DBus
|
||||||
|
# DBUS_INCLUDE_DIRS - the DBus include directories
|
||||||
|
# DBUS_LIBRARIES - link these to use DBus
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
|
||||||
|
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
FIND_PACKAGE(PkgConfig)
|
||||||
|
PKG_CHECK_MODULES(PC_DBUS QUIET dbus-1)
|
||||||
|
|
||||||
|
FIND_LIBRARY(DBUS_LIBRARIES
|
||||||
|
NAMES dbus-1
|
||||||
|
HINTS ${PC_DBUS_LIBDIR}
|
||||||
|
${PC_DBUS_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_PATH(DBUS_INCLUDE_DIR
|
||||||
|
NAMES dbus/dbus.h
|
||||||
|
HINTS ${PC_DBUS_INCLUDEDIR}
|
||||||
|
${PC_DBUS_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
GET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH)
|
||||||
|
FIND_PATH(DBUS_ARCH_INCLUDE_DIR
|
||||||
|
NAMES dbus/dbus-arch-deps.h
|
||||||
|
HINTS ${PC_DBUS_INCLUDEDIR}
|
||||||
|
${PC_DBUS_INCLUDE_DIRS}
|
||||||
|
${_DBUS_LIBRARY_DIR}
|
||||||
|
${DBUS_INCLUDE_DIR}
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBus REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES)
|
||||||
86
cmake/modules/FindEigen3.cmake
Normal file
86
cmake/modules/FindEigen3.cmake
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# - Try to find Eigen3 lib
|
||||||
|
#
|
||||||
|
# This module supports requiring a minimum version, e.g. you can do
|
||||||
|
# find_package(Eigen3 3.1.2)
|
||||||
|
# to require version 3.1.2 or newer of Eigen3.
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# EIGEN3_FOUND - system has eigen lib with correct version
|
||||||
|
# EIGEN3_INCLUDE_DIR - the eigen include directory
|
||||||
|
# EIGEN3_VERSION - eigen version
|
||||||
|
|
||||||
|
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
|
||||||
|
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
|
||||||
|
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||||
|
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
|
||||||
|
|
||||||
|
if(NOT Eigen3_FIND_VERSION)
|
||||||
|
if(NOT Eigen3_FIND_VERSION_MAJOR)
|
||||||
|
set(Eigen3_FIND_VERSION_MAJOR 2)
|
||||||
|
endif(NOT Eigen3_FIND_VERSION_MAJOR)
|
||||||
|
if(NOT Eigen3_FIND_VERSION_MINOR)
|
||||||
|
set(Eigen3_FIND_VERSION_MINOR 91)
|
||||||
|
endif(NOT Eigen3_FIND_VERSION_MINOR)
|
||||||
|
if(NOT Eigen3_FIND_VERSION_PATCH)
|
||||||
|
set(Eigen3_FIND_VERSION_PATCH 0)
|
||||||
|
endif(NOT Eigen3_FIND_VERSION_PATCH)
|
||||||
|
|
||||||
|
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
|
||||||
|
endif(NOT Eigen3_FIND_VERSION)
|
||||||
|
|
||||||
|
macro(_eigen3_check_version)
|
||||||
|
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
|
||||||
|
|
||||||
|
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
|
||||||
|
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
|
||||||
|
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
|
||||||
|
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
|
||||||
|
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||||
|
set(EIGEN3_VERSION_OK FALSE)
|
||||||
|
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||||
|
set(EIGEN3_VERSION_OK TRUE)
|
||||||
|
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||||
|
|
||||||
|
if(NOT EIGEN3_VERSION_OK)
|
||||||
|
|
||||||
|
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
|
||||||
|
"but at least version ${Eigen3_FIND_VERSION} is required")
|
||||||
|
endif(NOT EIGEN3_VERSION_OK)
|
||||||
|
endmacro(_eigen3_check_version)
|
||||||
|
|
||||||
|
if (EIGEN3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# in cache already
|
||||||
|
_eigen3_check_version()
|
||||||
|
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
|
||||||
|
|
||||||
|
else (EIGEN3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# specific additional paths for some OS
|
||||||
|
if (WIN32)
|
||||||
|
set(EIGEN_ADDITIONAL_SEARCH_PATHS ${EIGEN_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/Eigen/include" "C:/Program Files (x86)/Eigen/include")
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
|
||||||
|
PATHS
|
||||||
|
${CMAKE_INSTALL_PREFIX}/include
|
||||||
|
${EIGEN_ADDITIONAL_SEARCH_PATHS}
|
||||||
|
${KDE4_INCLUDE_DIR}
|
||||||
|
PATH_SUFFIXES eigen3 eigen
|
||||||
|
)
|
||||||
|
|
||||||
|
if(EIGEN3_INCLUDE_DIR)
|
||||||
|
_eigen3_check_version()
|
||||||
|
endif(EIGEN3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
|
||||||
|
|
||||||
|
mark_as_advanced(EIGEN3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
endif(EIGEN3_INCLUDE_DIR)
|
||||||
352
cmake/modules/FindGLEW.cmake
Normal file
352
cmake/modules/FindGLEW.cmake
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# PrusaSlicer specifics:
|
||||||
|
# This file is backported from CMake 3.15 distribution to behave uniformly
|
||||||
|
# across all versions of CMake. It explicitly adds GLEW_STATIC complile
|
||||||
|
# definition to static targets which is needed to prevent link errors.
|
||||||
|
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
FindGLEW
|
||||||
|
--------
|
||||||
|
|
||||||
|
Find the OpenGL Extension Wrangler Library (GLEW)
|
||||||
|
|
||||||
|
Input Variables
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The following variables may be set to influence this module’s behavior:
|
||||||
|
|
||||||
|
``GLEW_USE_STATIC_LIBS``
|
||||||
|
to find and create :prop_tgt:`IMPORTED` target for static linkage.
|
||||||
|
|
||||||
|
``GLEW_VERBOSE``
|
||||||
|
to output a detailed log of this module.
|
||||||
|
|
||||||
|
Imported Targets
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This module defines the following :ref:`Imported Targets <Imported Targets>`:
|
||||||
|
|
||||||
|
|
||||||
|
``GLEW::glew``
|
||||||
|
The GLEW shared library.
|
||||||
|
``GLEW::glew_s``
|
||||||
|
The GLEW static library, if ``GLEW_USE_STATIC_LIBS`` is set to ``TRUE``.
|
||||||
|
``GLEW::GLEW``
|
||||||
|
Duplicates either ``GLEW::glew`` or ``GLEW::glew_s`` based on availability.
|
||||||
|
|
||||||
|
Result Variables
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This module defines the following variables:
|
||||||
|
|
||||||
|
``GLEW_INCLUDE_DIRS``
|
||||||
|
include directories for GLEW
|
||||||
|
``GLEW_LIBRARIES``
|
||||||
|
libraries to link against GLEW
|
||||||
|
``GLEW_SHARED_LIBRARIES``
|
||||||
|
libraries to link against shared GLEW
|
||||||
|
``GLEW_STATIC_LIBRARIES``
|
||||||
|
libraries to link against static GLEW
|
||||||
|
``GLEW_FOUND``
|
||||||
|
true if GLEW has been found and can be used
|
||||||
|
``GLEW_VERSION``
|
||||||
|
GLEW version
|
||||||
|
``GLEW_VERSION_MAJOR``
|
||||||
|
GLEW major version
|
||||||
|
``GLEW_VERSION_MINOR``
|
||||||
|
GLEW minor version
|
||||||
|
``GLEW_VERSION_MICRO``
|
||||||
|
GLEW micro version
|
||||||
|
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_package(GLEW CONFIG QUIET)
|
||||||
|
|
||||||
|
if(GLEW_FOUND)
|
||||||
|
find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_CONFIG)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: did not find GLEW CMake config file. Searching for libraries.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
find_package(OpenGL QUIET)
|
||||||
|
|
||||||
|
if(OpenGL_FOUND)
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: Found OpenGL Framework.")
|
||||||
|
message(STATUS "FindGLEW: OPENGL_LIBRARIES: ${OPENGL_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: could not find GLEW library.")
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
function(__glew_set_find_library_suffix shared_or_static)
|
||||||
|
if((UNIX AND NOT APPLE) AND "${shared_or_static}" MATCHES "SHARED")
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
|
||||||
|
elseif((UNIX AND NOT APPLE) AND "${shared_or_static}" MATCHES "STATIC")
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
elseif(APPLE AND "${shared_or_static}" MATCHES "SHARED")
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib;.so")
|
||||||
|
elseif(APPLE AND "${shared_or_static}" MATCHES "STATIC")
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
elseif(WIN32 AND "${shared_or_static}" MATCHES "SHARED")
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
|
||||||
|
elseif(WIN32 AND "${shared_or_static}" MATCHES "STATIC")
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.a;.dll.a")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}" PARENT_SCOPE)
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: CMAKE_FIND_LIBRARY_SUFFIXES for ${shared_or_static}: ${CMAKE_FIND_LIBRARY_SUFFIXES}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
if(DEFINED GLEW_USE_STATIC_LIBS)
|
||||||
|
message(STATUS "FindGLEW: GLEW_USE_STATIC_LIBS: ${GLEW_USE_STATIC_LIBS}.")
|
||||||
|
else()
|
||||||
|
message(STATUS "FindGLEW: GLEW_USE_STATIC_LIBS is undefined. Treated as FALSE.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(GLEW_INCLUDE_DIR GL/glew.h)
|
||||||
|
mark_as_advanced(GLEW_INCLUDE_DIR)
|
||||||
|
|
||||||
|
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: GLEW_INCLUDE_DIR: ${GLEW_INCLUDE_DIR}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_INCLUDE_DIRS: ${GLEW_INCLUDE_DIRS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if("${CMAKE_GENERATOR_PLATFORM}" MATCHES "x64" OR "${CMAKE_GENERATOR}" MATCHES "Win64")
|
||||||
|
set(_arch "x64")
|
||||||
|
else()
|
||||||
|
set(_arch "Win32")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
set(__GLEW_CURRENT_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
|
||||||
|
__glew_set_find_library_suffix(SHARED)
|
||||||
|
|
||||||
|
find_library(GLEW_SHARED_LIBRARY_RELEASE
|
||||||
|
NAMES GLEW glew glew32
|
||||||
|
PATH_SUFFIXES lib lib64 libx32 lib/Release/${_arch}
|
||||||
|
PATHS ENV GLEW_ROOT)
|
||||||
|
|
||||||
|
find_library(GLEW_SHARED_LIBRARY_DEBUG
|
||||||
|
NAMES GLEWd glewd glew32d
|
||||||
|
PATH_SUFFIXES lib lib64
|
||||||
|
PATHS ENV GLEW_ROOT)
|
||||||
|
|
||||||
|
|
||||||
|
__glew_set_find_library_suffix(STATIC)
|
||||||
|
|
||||||
|
find_library(GLEW_STATIC_LIBRARY_RELEASE
|
||||||
|
NAMES GLEW glew glew32s
|
||||||
|
PATH_SUFFIXES lib lib64 libx32 lib/Release/${_arch}
|
||||||
|
PATHS ENV GLEW_ROOT)
|
||||||
|
|
||||||
|
find_library(GLEW_STATIC_LIBRARY_DEBUG
|
||||||
|
NAMES GLEWds glewd glewds glew32ds
|
||||||
|
PATH_SUFFIXES lib lib64
|
||||||
|
PATHS ENV GLEW_ROOT)
|
||||||
|
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${__GLEW_CURRENT_FIND_LIBRARY_SUFFIXES})
|
||||||
|
unset(__GLEW_CURRENT_FIND_LIBRARY_SUFFIXES)
|
||||||
|
|
||||||
|
include(SelectLibraryConfigurations)
|
||||||
|
|
||||||
|
select_library_configurations(GLEW_SHARED)
|
||||||
|
select_library_configurations(GLEW_STATIC)
|
||||||
|
|
||||||
|
if(NOT GLEW_USE_STATIC_LIBS)
|
||||||
|
set(GLEW_LIBRARIES ${GLEW_SHARED_LIBRARY})
|
||||||
|
else()
|
||||||
|
set(GLEW_LIBRARIES ${GLEW_STATIC_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: GLEW_SHARED_LIBRARY_RELEASE: ${GLEW_SHARED_LIBRARY_RELEASE}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_STATIC_LIBRARY_RELEASE: ${GLEW_STATIC_LIBRARY_RELEASE}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_SHARED_LIBRARY_DEBUG: ${GLEW_SHARED_LIBRARY_DEBUG}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_STATIC_LIBRARY_DEBUG: ${GLEW_STATIC_LIBRARY_DEBUG}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_SHARED_LIBRARY: ${GLEW_SHARED_LIBRARY}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_STATIC_LIBRARY: ${GLEW_STATIC_LIBRARY}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_LIBRARIES: ${GLEW_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Read version from GL/glew.h file
|
||||||
|
if(EXISTS "${GLEW_INCLUDE_DIR}/GL/glew.h")
|
||||||
|
file(STRINGS "${GLEW_INCLUDE_DIR}/GL/glew.h" _contents REGEX "^VERSION_.+ [0-9]+")
|
||||||
|
if(_contents)
|
||||||
|
string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" GLEW_VERSION_MAJOR "${_contents}")
|
||||||
|
string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" GLEW_VERSION_MINOR "${_contents}")
|
||||||
|
string(REGEX REPLACE ".*VERSION_MICRO[ \t]+([0-9]+).*" "\\1" GLEW_VERSION_MICRO "${_contents}")
|
||||||
|
set(GLEW_VERSION "${GLEW_VERSION_MAJOR}.${GLEW_VERSION_MINOR}.${GLEW_VERSION_MICRO}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: GLEW_VERSION_MAJOR: ${GLEW_VERSION_MAJOR}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_VERSION_MINOR: ${GLEW_VERSION_MINOR}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_VERSION_MICRO: ${GLEW_VERSION_MICRO}")
|
||||||
|
message(STATUS "FindGLEW: GLEW_VERSION: ${GLEW_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package_handle_standard_args(GLEW
|
||||||
|
REQUIRED_VARS GLEW_INCLUDE_DIRS GLEW_LIBRARIES
|
||||||
|
VERSION_VAR GLEW_VERSION)
|
||||||
|
|
||||||
|
if(NOT GLEW_FOUND)
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: could not find GLEW library.")
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(NOT TARGET GLEW::glew AND NOT GLEW_USE_STATIC_LIBS)
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: Creating GLEW::glew imported target.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(GLEW::glew UNKNOWN IMPORTED)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::glew
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set_target_properties(GLEW::glew
|
||||||
|
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GLEW_SHARED_LIBRARY_RELEASE)
|
||||||
|
set_property(TARGET GLEW::glew
|
||||||
|
APPEND
|
||||||
|
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::glew
|
||||||
|
PROPERTIES IMPORTED_LOCATION_RELEASE "${GLEW_SHARED_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GLEW_SHARED_LIBRARY_DEBUG)
|
||||||
|
set_property(TARGET GLEW::glew
|
||||||
|
APPEND
|
||||||
|
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::glew
|
||||||
|
PROPERTIES IMPORTED_LOCATION_DEBUG "${GLEW_SHARED_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
elseif(NOT TARGET GLEW::glew_s AND GLEW_USE_STATIC_LIBS)
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: Creating GLEW::glew_s imported target.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(GLEW::glew_s UNKNOWN IMPORTED)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::glew_s
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
set_target_properties(GLEW::glew_s PROPERTIES INTERFACE_COMPILE_DEFINITIONS GLEW_STATIC)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set_target_properties(GLEW::glew_s
|
||||||
|
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GLEW_STATIC_LIBRARY_RELEASE)
|
||||||
|
set_property(TARGET GLEW::glew_s
|
||||||
|
APPEND
|
||||||
|
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::glew_s
|
||||||
|
PROPERTIES IMPORTED_LOCATION_RELEASE "${GLEW_STATIC_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GLEW_STATIC_LIBRARY_DEBUG)
|
||||||
|
set_property(TARGET GLEW::glew_s
|
||||||
|
APPEND
|
||||||
|
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::glew_s
|
||||||
|
PROPERTIES IMPORTED_LOCATION_DEBUG "${GLEW_STATIC_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET GLEW::GLEW)
|
||||||
|
if(GLEW_VERBOSE)
|
||||||
|
message(STATUS "FindGLEW: Creating GLEW::GLEW imported target.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(GLEW::GLEW UNKNOWN IMPORTED)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::GLEW
|
||||||
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set_target_properties(GLEW::GLEW
|
||||||
|
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET GLEW::glew)
|
||||||
|
if(GLEW_SHARED_LIBRARY_RELEASE)
|
||||||
|
set_property(TARGET GLEW::GLEW
|
||||||
|
APPEND
|
||||||
|
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::GLEW
|
||||||
|
PROPERTIES IMPORTED_LOCATION_RELEASE "${GLEW_SHARED_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GLEW_SHARED_LIBRARY_DEBUG)
|
||||||
|
set_property(TARGET GLEW::GLEW
|
||||||
|
APPEND
|
||||||
|
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::GLEW
|
||||||
|
PROPERTIES IMPORTED_LOCATION_DEBUG "${GLEW_SHARED_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
elseif(TARGET GLEW::glew_s)
|
||||||
|
if(GLEW_STATIC_LIBRARY_RELEASE)
|
||||||
|
set_property(TARGET GLEW::GLEW
|
||||||
|
APPEND
|
||||||
|
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::GLEW
|
||||||
|
PROPERTIES IMPORTED_LOCATION_RELEASE "${GLEW_STATIC_LIBRARY_RELEASE}"
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS GLEW_STATIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GLEW_STATIC_LIBRARY_DEBUG AND GLEW_USE_STATIC_LIBS)
|
||||||
|
set_property(TARGET GLEW::GLEW
|
||||||
|
APPEND
|
||||||
|
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
|
||||||
|
set_target_properties(GLEW::GLEW
|
||||||
|
PROPERTIES IMPORTED_LOCATION_DEBUG "${GLEW_STATIC_LIBRARY_DEBUG}"
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS GLEW_STATIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
elseif(GLEW_VERBOSE)
|
||||||
|
message(WARNING "FindGLEW: no `GLEW::glew` or `GLEW::glew_s` target was created. Something went wrong in FindGLEW target creation.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
51
cmake/modules/FindGTK3.cmake
Normal file
51
cmake/modules/FindGTK3.cmake
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# - Try to find GTK+ 3
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# GTK3_FOUND - system has GTK+ 3.
|
||||||
|
# GTK3_INCLUDE_DIRS - the GTK+ 3. include directories
|
||||||
|
# GTK3_LIBRARIES - link these to use GTK+ 3.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
|
||||||
|
# Copyright (C) 2013 Igalia S.L.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
|
||||||
|
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(GTK3 QUIET gtk+-3.0)
|
||||||
|
set(VERSION_OK TRUE)
|
||||||
|
if (GTK3_VERSION)
|
||||||
|
if (GTK3_FIND_VERSION_EXACT)
|
||||||
|
if (NOT("${GTK3_FIND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}"))
|
||||||
|
set(VERSION_OK FALSE)
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
if ("${GTK3_VERSION}" VERSION_LESS "${GTK3_FIND_VERSION}")
|
||||||
|
set(VERSION_OK FALSE)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
# Check for GDK Wayland support
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${GTK3_INCLUDE_DIRS})
|
||||||
|
check_symbol_exists(GDK_WINDOWING_WAYLAND "gdk/gdk.h" wxHAVE_GDK_WAYLAND)
|
||||||
|
check_symbol_exists(GDK_WINDOWING_X11 "gdk/gdk.h" wxHAVE_GDK_X11)
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)
|
||||||
130
cmake/modules/FindNLopt.cmake
Normal file
130
cmake/modules/FindNLopt.cmake
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
#///////////////////////////////////////////////////////////////////////////
|
||||||
|
#//-------------------------------------------------------------------------
|
||||||
|
#//
|
||||||
|
#// Description:
|
||||||
|
#// cmake module for finding NLopt installation
|
||||||
|
#// NLopt installation location is defined by environment variable $NLOPT
|
||||||
|
#//
|
||||||
|
#// following variables are defined:
|
||||||
|
#// NLopt_DIR - NLopt installation directory
|
||||||
|
#// NLopt_INCLUDE_DIR - NLopt header directory
|
||||||
|
#// NLopt_LIBRARY_DIR - NLopt library directory
|
||||||
|
#// NLopt_LIBS - NLopt library files
|
||||||
|
#//
|
||||||
|
#// Example usage:
|
||||||
|
#// find_package(NLopt 1.4 REQUIRED)
|
||||||
|
#//
|
||||||
|
#//
|
||||||
|
#//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
set(NLopt_FOUND FALSE)
|
||||||
|
set(NLopt_ERROR_REASON "")
|
||||||
|
set(NLopt_DEFINITIONS "")
|
||||||
|
unset(NLopt_LIBS CACHE)
|
||||||
|
|
||||||
|
set(NLopt_DIR $ENV{NLOPT})
|
||||||
|
if(NOT NLopt_DIR)
|
||||||
|
|
||||||
|
set(NLopt_FOUND TRUE)
|
||||||
|
|
||||||
|
set(_NLopt_LIB_NAMES "nlopt")
|
||||||
|
find_library(NLopt_LIBS
|
||||||
|
NAMES ${_NLopt_LIB_NAMES})
|
||||||
|
if(NOT NLopt_LIBS)
|
||||||
|
set(NLopt_FOUND FALSE)
|
||||||
|
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt library '${_NLopt_LIB_NAMES}'.")
|
||||||
|
else()
|
||||||
|
get_filename_component(NLopt_DIR ${NLopt_LIBS} PATH)
|
||||||
|
endif()
|
||||||
|
unset(_NLopt_LIB_NAMES)
|
||||||
|
|
||||||
|
set(_NLopt_HEADER_FILE_NAME "nlopt.hpp")
|
||||||
|
find_file(_NLopt_HEADER_FILE
|
||||||
|
NAMES ${_NLopt_HEADER_FILE_NAME})
|
||||||
|
if(NOT _NLopt_HEADER_FILE)
|
||||||
|
set(NLopt_FOUND FALSE)
|
||||||
|
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt header file '${_NLopt_HEADER_FILE_NAME}'.")
|
||||||
|
endif()
|
||||||
|
unset(_NLopt_HEADER_FILE_NAME)
|
||||||
|
|
||||||
|
if(NOT NLopt_FOUND)
|
||||||
|
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} NLopt not found in system directories (and environment variable NLOPT is not set).")
|
||||||
|
else()
|
||||||
|
get_filename_component(NLopt_INCLUDE_DIR ${_NLopt_HEADER_FILE} DIRECTORY )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
unset(_NLopt_HEADER_FILE CACHE)
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
set(NLopt_FOUND TRUE)
|
||||||
|
|
||||||
|
set(NLopt_INCLUDE_DIR "${NLopt_DIR}/include")
|
||||||
|
if(NOT EXISTS "${NLopt_INCLUDE_DIR}")
|
||||||
|
set(NLopt_FOUND FALSE)
|
||||||
|
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Directory '${NLopt_INCLUDE_DIR}' does not exist.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(NLopt_LIBRARY_DIR "${NLopt_DIR}/lib")
|
||||||
|
if(NOT EXISTS "${NLopt_LIBRARY_DIR}")
|
||||||
|
set(NLopt_FOUND FALSE)
|
||||||
|
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Directory '${NLopt_LIBRARY_DIR}' does not exist.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_NLopt_LIB_NAMES "nlopt_cxx")
|
||||||
|
find_library(NLopt_LIBS
|
||||||
|
NAMES ${_NLopt_LIB_NAMES}
|
||||||
|
PATHS ${NLopt_LIBRARY_DIR}
|
||||||
|
NO_DEFAULT_PATH)
|
||||||
|
if(NOT NLopt_LIBS)
|
||||||
|
set(NLopt_FOUND FALSE)
|
||||||
|
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt library '${_NLopt_LIB_NAMES}' in '${NLopt_LIBRARY_DIR}'.")
|
||||||
|
endif()
|
||||||
|
unset(_NLopt_LIB_NAMES)
|
||||||
|
|
||||||
|
set(_NLopt_HEADER_FILE_NAME "nlopt.hpp")
|
||||||
|
find_file(_NLopt_HEADER_FILE
|
||||||
|
NAMES ${_NLopt_HEADER_FILE_NAME}
|
||||||
|
PATHS ${NLopt_INCLUDE_DIR}
|
||||||
|
NO_DEFAULT_PATH)
|
||||||
|
if(NOT _NLopt_HEADER_FILE)
|
||||||
|
set(NLopt_FOUND FALSE)
|
||||||
|
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt header file '${_NLopt_HEADER_FILE_NAME}' in '${NLopt_INCLUDE_DIR}'.")
|
||||||
|
endif()
|
||||||
|
unset(_NLopt_HEADER_FILE_NAME)
|
||||||
|
unset(_NLopt_HEADER_FILE CACHE)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# make variables changeable
|
||||||
|
mark_as_advanced(
|
||||||
|
NLopt_INCLUDE_DIR
|
||||||
|
NLopt_LIBRARY_DIR
|
||||||
|
NLopt_LIBS
|
||||||
|
NLopt_DEFINITIONS
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# report result
|
||||||
|
if(NLopt_FOUND)
|
||||||
|
message(STATUS "Found NLopt in '${NLopt_DIR}'.")
|
||||||
|
message(STATUS "Using NLopt include directory '${NLopt_INCLUDE_DIR}'.")
|
||||||
|
message(STATUS "Using NLopt library '${NLopt_LIBS}'.")
|
||||||
|
add_library(NLopt::nlopt INTERFACE IMPORTED)
|
||||||
|
set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_LINK_LIBRARIES ${NLopt_LIBS})
|
||||||
|
set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${NLopt_INCLUDE_DIR})
|
||||||
|
set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${NLopt_DEFINITIONS}")
|
||||||
|
# target_link_libraries(Nlopt::Nlopt INTERFACE ${NLopt_LIBS})
|
||||||
|
# target_include_directories(Nlopt::Nlopt INTERFACE ${NLopt_INCLUDE_DIR})
|
||||||
|
# target_compile_definitions(Nlopt::Nlopt INTERFACE ${NLopt_DEFINITIONS})
|
||||||
|
else()
|
||||||
|
if(NLopt_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Unable to find requested NLopt installation:${NLopt_ERROR_REASON}")
|
||||||
|
else()
|
||||||
|
if(NOT NLopt_FIND_QUIETLY)
|
||||||
|
message(STATUS "NLopt was not found:${NLopt_ERROR_REASON}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
589
cmake/modules/FindOpenVDB.cmake
Normal file
589
cmake/modules/FindOpenVDB.cmake
Normal file
@@ -0,0 +1,589 @@
|
|||||||
|
# Copyright (c) DreamWorks Animation LLC
|
||||||
|
#
|
||||||
|
# All rights reserved. This software is distributed under the
|
||||||
|
# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
|
||||||
|
#
|
||||||
|
# Redistributions of source code must retain the above copyright
|
||||||
|
# and license notice and the following restrictions and disclaimer.
|
||||||
|
#
|
||||||
|
# * Neither the name of DreamWorks Animation nor the names of
|
||||||
|
# its contributors may be used to endorse or promote products derived
|
||||||
|
# from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
|
||||||
|
# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
|
||||||
|
#
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
|
||||||
|
FindOpenVDB
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Find OpenVDB include dirs, libraries and settings
|
||||||
|
|
||||||
|
Use this module by invoking find_package with the form::
|
||||||
|
|
||||||
|
find_package(OpenVDB
|
||||||
|
[version] [EXACT] # Minimum or EXACT version
|
||||||
|
[REQUIRED] # Fail with error if OpenVDB is not found
|
||||||
|
[COMPONENTS <libs>...] # OpenVDB libraries by their canonical name
|
||||||
|
# e.g. "openvdb" for "libopenvdb"
|
||||||
|
)
|
||||||
|
|
||||||
|
IMPORTED Targets
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
``OpenVDB::openvdb``
|
||||||
|
The core openvdb library target.
|
||||||
|
|
||||||
|
Result Variables
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This will define the following variables:
|
||||||
|
|
||||||
|
``OpenVDB_FOUND``
|
||||||
|
True if the system has the OpenVDB library.
|
||||||
|
``OpenVDB_VERSION``
|
||||||
|
The version of the OpenVDB library which was found.
|
||||||
|
``OpenVDB_INCLUDE_DIRS``
|
||||||
|
Include directories needed to use OpenVDB.
|
||||||
|
``OpenVDB_LIBRARIES``
|
||||||
|
Libraries needed to link to OpenVDB.
|
||||||
|
``OpenVDB_LIBRARY_DIRS``
|
||||||
|
OpenVDB library directories.
|
||||||
|
``OpenVDB_DEFINITIONS``
|
||||||
|
Definitions to use when compiling code that uses OpenVDB.
|
||||||
|
``OpenVDB_{COMPONENT}_FOUND``
|
||||||
|
True if the system has the named OpenVDB component.
|
||||||
|
``OpenVDB_USES_BLOSC``
|
||||||
|
True if the OpenVDB Library has been built with blosc support
|
||||||
|
``OpenVDB_USES_LOG4CPLUS``
|
||||||
|
True if the OpenVDB Library has been built with log4cplus support
|
||||||
|
``OpenVDB_USES_EXR``
|
||||||
|
True if the OpenVDB Library has been built with openexr support
|
||||||
|
``OpenVDB_ABI``
|
||||||
|
Set if this module was able to determine the ABI number the located
|
||||||
|
OpenVDB Library was built against. Unset otherwise.
|
||||||
|
|
||||||
|
Cache Variables
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The following cache variables may also be set:
|
||||||
|
|
||||||
|
``OpenVDB_INCLUDE_DIR``
|
||||||
|
The directory containing ``openvdb/version.h``.
|
||||||
|
``OpenVDB_{COMPONENT}_LIBRARY``
|
||||||
|
Individual component libraries for OpenVDB
|
||||||
|
|
||||||
|
Hints
|
||||||
|
^^^^^
|
||||||
|
|
||||||
|
Instead of explicitly setting the cache variables, the following variables
|
||||||
|
may be provided to tell this module where to look.
|
||||||
|
|
||||||
|
``OPENVDB_ROOT``
|
||||||
|
Preferred installation prefix.
|
||||||
|
``OPENVDB_INCLUDEDIR``
|
||||||
|
Preferred include directory e.g. <prefix>/include
|
||||||
|
``OPENVDB_LIBRARYDIR``
|
||||||
|
Preferred library directory e.g. <prefix>/lib
|
||||||
|
``SYSTEM_LIBRARY_PATHS``
|
||||||
|
Paths appended to all include and lib searches.
|
||||||
|
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
# If an explicit openvdb module path was specified, that will be used
|
||||||
|
if (OPENVDB_FIND_MODULE_PATH)
|
||||||
|
set(_module_path_bak ${CMAKE_MODULE_PATH})
|
||||||
|
set(CMAKE_MODULE_PATH ${OPENVDB_FIND_MODULE_PATH})
|
||||||
|
find_package(
|
||||||
|
OpenVDB ${OpenVDB_FIND_VERSION} QUIET
|
||||||
|
COMPONENTS
|
||||||
|
${OpenVDB_FIND_COMPONENTS}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${_module_path_bak})
|
||||||
|
if (OpenVDB_FOUND)
|
||||||
|
return()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT OpenVDB_FIND_QUIETLY)
|
||||||
|
message(STATUS "Using bundled find module for OpenVDB")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
# ###########################################################################
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.3)
|
||||||
|
# Monitoring <PackageName>_ROOT variables
|
||||||
|
if(POLICY CMP0074)
|
||||||
|
cmake_policy(SET CMP0074 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenVDB_FIND_QUIETLY)
|
||||||
|
set (_quiet "QUIET")
|
||||||
|
else()
|
||||||
|
set (_quiet "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenVDB_FIND_REQUIRED)
|
||||||
|
set (_required "REQUIRED")
|
||||||
|
else()
|
||||||
|
set (_required "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Include utility functions for version information
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/OpenVDBUtils.cmake)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
OpenVDB_INCLUDE_DIR
|
||||||
|
OpenVDB_LIBRARY
|
||||||
|
)
|
||||||
|
|
||||||
|
set(_OPENVDB_COMPONENT_LIST
|
||||||
|
openvdb
|
||||||
|
)
|
||||||
|
|
||||||
|
if(OpenVDB_FIND_COMPONENTS)
|
||||||
|
set(OPENVDB_COMPONENTS_PROVIDED TRUE)
|
||||||
|
set(_IGNORED_COMPONENTS "")
|
||||||
|
foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS})
|
||||||
|
if(NOT ${COMPONENT} IN_LIST _OPENVDB_COMPONENT_LIST)
|
||||||
|
list(APPEND _IGNORED_COMPONENTS ${COMPONENT})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(_IGNORED_COMPONENTS)
|
||||||
|
message(STATUS "Ignoring unknown components of OpenVDB:")
|
||||||
|
foreach(COMPONENT ${_IGNORED_COMPONENTS})
|
||||||
|
message(STATUS " ${COMPONENT}")
|
||||||
|
endforeach()
|
||||||
|
list(REMOVE_ITEM OpenVDB_FIND_COMPONENTS ${_IGNORED_COMPONENTS})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(OPENVDB_COMPONENTS_PROVIDED FALSE)
|
||||||
|
set(OpenVDB_FIND_COMPONENTS ${_OPENVDB_COMPONENT_LIST})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Append OPENVDB_ROOT or $ENV{OPENVDB_ROOT} if set (prioritize the direct cmake var)
|
||||||
|
set(_OPENVDB_ROOT_SEARCH_DIR "")
|
||||||
|
|
||||||
|
# Additionally try and use pkconfig to find OpenVDB
|
||||||
|
|
||||||
|
find_package(PkgConfig ${_quiet} )
|
||||||
|
pkg_check_modules(PC_OpenVDB QUIET OpenVDB)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
# Search for OpenVDB include DIR
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
set(_OPENVDB_INCLUDE_SEARCH_DIRS "")
|
||||||
|
list(APPEND _OPENVDB_INCLUDE_SEARCH_DIRS
|
||||||
|
${OPENVDB_INCLUDEDIR}
|
||||||
|
${_OPENVDB_ROOT_SEARCH_DIR}
|
||||||
|
${PC_OpenVDB_INCLUDE_DIRS}
|
||||||
|
${SYSTEM_LIBRARY_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Look for a standard OpenVDB header file.
|
||||||
|
find_path(OpenVDB_INCLUDE_DIR openvdb/version.h
|
||||||
|
PATHS ${_OPENVDB_INCLUDE_SEARCH_DIRS}
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
)
|
||||||
|
|
||||||
|
OPENVDB_VERSION_FROM_HEADER("${OpenVDB_INCLUDE_DIR}/openvdb/version.h"
|
||||||
|
VERSION OpenVDB_VERSION
|
||||||
|
MAJOR OpenVDB_MAJOR_VERSION
|
||||||
|
MINOR OpenVDB_MINOR_VERSION
|
||||||
|
PATCH OpenVDB_PATCH_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
# Search for OPENVDB lib DIR
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
set(_OPENVDB_LIBRARYDIR_SEARCH_DIRS "")
|
||||||
|
|
||||||
|
# Append to _OPENVDB_LIBRARYDIR_SEARCH_DIRS in priority order
|
||||||
|
|
||||||
|
list(APPEND _OPENVDB_LIBRARYDIR_SEARCH_DIRS
|
||||||
|
${OPENVDB_LIBRARYDIR}
|
||||||
|
${_OPENVDB_ROOT_SEARCH_DIR}
|
||||||
|
${PC_OpenVDB_LIBRARY_DIRS}
|
||||||
|
${SYSTEM_LIBRARY_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Build suffix directories
|
||||||
|
|
||||||
|
set(OPENVDB_PATH_SUFFIXES
|
||||||
|
lib64
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
# Static library setup
|
||||||
|
if(UNIX AND OPENVDB_USE_STATIC_LIBS)
|
||||||
|
set(_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(OpenVDB_LIB_COMPONENTS "")
|
||||||
|
set(OpenVDB_DEBUG_SUFFIX "d" CACHE STRING "Suffix for the debug libraries")
|
||||||
|
|
||||||
|
# get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
set(_is_multi FALSE)
|
||||||
|
|
||||||
|
foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS})
|
||||||
|
set(LIB_NAME ${COMPONENT})
|
||||||
|
|
||||||
|
find_library(OpenVDB_${COMPONENT}_LIBRARY_RELEASE ${LIB_NAME} lib${LIB_NAME}
|
||||||
|
PATHS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS}
|
||||||
|
PATH_SUFFIXES ${OPENVDB_PATH_SUFFIXES}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(OpenVDB_${COMPONENT}_LIBRARY_DEBUG ${LIB_NAME}${OpenVDB_DEBUG_SUFFIX} lib${LIB_NAME}${OpenVDB_DEBUG_SUFFIX}
|
||||||
|
PATHS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS}
|
||||||
|
PATH_SUFFIXES ${OPENVDB_PATH_SUFFIXES}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (_is_multi)
|
||||||
|
list(APPEND OpenVDB_LIB_COMPONENTS ${OpenVDB_${COMPONENT}_LIBRARY_RELEASE})
|
||||||
|
if (OpenVDB_${COMPONENT}_LIBRARY_DEBUG)
|
||||||
|
list(APPEND OpenVDB_LIB_COMPONENTS ${OpenVDB_${COMPONENT}_LIBRARY_DEBUG})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
list(FIND CMAKE_CONFIGURATION_TYPES "Debug" _has_debug)
|
||||||
|
|
||||||
|
if(OpenVDB_${COMPONENT}_LIBRARY_RELEASE AND (NOT MSVC OR _has_debug LESS 0 OR OpenVDB_${COMPONENT}_LIBRARY_DEBUG))
|
||||||
|
set(OpenVDB_${COMPONENT}_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
set(OpenVDB_${COMPONENT}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_${COMPONENT}_LIBRARY_RELEASE})
|
||||||
|
else ()
|
||||||
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" _BUILD_TYPE)
|
||||||
|
|
||||||
|
set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_${COMPONENT}_LIBRARY_${_BUILD_TYPE}})
|
||||||
|
|
||||||
|
if (NOT OpenVDB_${COMPONENT}_LIBRARY)
|
||||||
|
set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_${COMPONENT}_LIBRARY_RELEASE})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
list(APPEND OpenVDB_LIB_COMPONENTS ${OpenVDB_${COMPONENT}_LIBRARY})
|
||||||
|
|
||||||
|
if(OpenVDB_${COMPONENT}_LIBRARY)
|
||||||
|
set(OpenVDB_${COMPONENT}_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
set(OpenVDB_${COMPONENT}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(UNIX AND OPENVDB_USE_STATIC_LIBS)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
unset(_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
# Cache and set OPENVDB_FOUND
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(OpenVDB
|
||||||
|
FOUND_VAR OpenVDB_FOUND
|
||||||
|
REQUIRED_VARS
|
||||||
|
OpenVDB_INCLUDE_DIR
|
||||||
|
OpenVDB_LIB_COMPONENTS
|
||||||
|
VERSION_VAR OpenVDB_VERSION
|
||||||
|
HANDLE_COMPONENTS
|
||||||
|
)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
# Determine ABI number
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Set the ABI number the library was built against. Uses vdb_print
|
||||||
|
find_program(OPENVDB_PRINT vdb_print PATHS ${OpenVDB_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
OPENVDB_ABI_VERSION_FROM_PRINT(
|
||||||
|
"${OPENVDB_PRINT}"
|
||||||
|
ABI OpenVDB_ABI
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT OpenVDB_FIND_QUIETLY)
|
||||||
|
if(NOT OpenVDB_ABI)
|
||||||
|
message(WARNING "Unable to determine OpenVDB ABI version from OpenVDB "
|
||||||
|
"installation. The library major version \"${OpenVDB_MAJOR_VERSION}\" "
|
||||||
|
"will be inferred. If this is not correct, use "
|
||||||
|
"add_definitions(-DOPENVDB_ABI_VERSION_NUMBER=N)"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(STATUS "OpenVDB ABI Version: ${OpenVDB_ABI}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
# Handle OpenVDB dependencies
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Add standard dependencies
|
||||||
|
|
||||||
|
macro(just_fail msg)
|
||||||
|
set(OpenVDB_FOUND FALSE)
|
||||||
|
if(OpenVDB_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR ${msg})
|
||||||
|
elseif(NOT OpenVDB_FIND_QUIETLY)
|
||||||
|
message(WARNING ${msg})
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
find_package(IlmBase QUIET)
|
||||||
|
if(NOT IlmBase_FOUND)
|
||||||
|
pkg_check_modules(IlmBase QUIET IlmBase)
|
||||||
|
endif()
|
||||||
|
if (IlmBase_FOUND AND NOT TARGET IlmBase::Half)
|
||||||
|
message(STATUS "Falling back to IlmBase found by pkg-config...")
|
||||||
|
|
||||||
|
find_library(IlmHalf_LIBRARY NAMES Half)
|
||||||
|
if(IlmHalf_LIBRARY-NOTFOUND OR NOT IlmBase_INCLUDE_DIRS)
|
||||||
|
just_fail("IlmBase::Half can not be found!")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(IlmBase::Half UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(IlmBase::Half PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${IlmHalf_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${IlmBase_INCLUDE_DIRS}")
|
||||||
|
elseif(NOT IlmBase_FOUND)
|
||||||
|
just_fail("IlmBase::Half can not be found!")
|
||||||
|
endif()
|
||||||
|
find_package(TBB ${_quiet} ${_required} COMPONENTS tbb)
|
||||||
|
find_package(ZLIB ${_quiet} ${_required})
|
||||||
|
find_package(Boost ${_quiet} ${_required} COMPONENTS iostreams system )
|
||||||
|
|
||||||
|
# Use GetPrerequisites to see which libraries this OpenVDB lib has linked to
|
||||||
|
# which we can query for optional deps. This basically runs ldd/otoll/objdump
|
||||||
|
# etc to track deps. We could use a vdb_config binary tools here to improve
|
||||||
|
# this process
|
||||||
|
|
||||||
|
include(GetPrerequisites)
|
||||||
|
|
||||||
|
set(_EXCLUDE_SYSTEM_PREREQUISITES 1)
|
||||||
|
set(_RECURSE_PREREQUISITES 0)
|
||||||
|
set(_OPENVDB_PREREQUISITE_LIST)
|
||||||
|
|
||||||
|
if(NOT OPENVDB_USE_STATIC_LIBS)
|
||||||
|
get_prerequisites(${OpenVDB_openvdb_LIBRARY}
|
||||||
|
_OPENVDB_PREREQUISITE_LIST
|
||||||
|
${_EXCLUDE_SYSTEM_PREREQUISITES}
|
||||||
|
${_RECURSE_PREREQUISITES}
|
||||||
|
""
|
||||||
|
"${SYSTEM_LIBRARY_PATHS}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
unset(_EXCLUDE_SYSTEM_PREREQUISITES)
|
||||||
|
unset(_RECURSE_PREREQUISITES)
|
||||||
|
|
||||||
|
# As the way we resolve optional libraries relies on library file names, use
|
||||||
|
# the configuration options from the main CMakeLists.txt to allow users
|
||||||
|
# to manually identify the requirements of OpenVDB builds if they know them.
|
||||||
|
|
||||||
|
set(OpenVDB_USES_BLOSC ${USE_BLOSC})
|
||||||
|
set(OpenVDB_USES_LOG4CPLUS ${USE_LOG4CPLUS})
|
||||||
|
set(OpenVDB_USES_ILM ${USE_EXR})
|
||||||
|
set(OpenVDB_USES_EXR ${USE_EXR})
|
||||||
|
|
||||||
|
# Search for optional dependencies
|
||||||
|
|
||||||
|
foreach(PREREQUISITE ${_OPENVDB_PREREQUISITE_LIST})
|
||||||
|
set(_HAS_DEP)
|
||||||
|
get_filename_component(PREREQUISITE ${PREREQUISITE} NAME)
|
||||||
|
|
||||||
|
string(FIND ${PREREQUISITE} "blosc" _HAS_DEP)
|
||||||
|
if(NOT ${_HAS_DEP} EQUAL -1)
|
||||||
|
set(OpenVDB_USES_BLOSC ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(FIND ${PREREQUISITE} "log4cplus" _HAS_DEP)
|
||||||
|
if(NOT ${_HAS_DEP} EQUAL -1)
|
||||||
|
set(OpenVDB_USES_LOG4CPLUS ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(FIND ${PREREQUISITE} "IlmImf" _HAS_DEP)
|
||||||
|
if(NOT ${_HAS_DEP} EQUAL -1)
|
||||||
|
set(OpenVDB_USES_ILM ON)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
unset(_OPENVDB_PREREQUISITE_LIST)
|
||||||
|
unset(_HAS_DEP)
|
||||||
|
|
||||||
|
if(OpenVDB_USES_BLOSC)
|
||||||
|
find_package(Blosc QUIET)
|
||||||
|
if(NOT Blosc_FOUND OR NOT TARGET Blosc::blosc)
|
||||||
|
message(STATUS "find_package could not find Blosc. Using fallback blosc search...")
|
||||||
|
find_path(Blosc_INCLUDE_DIR blosc.h)
|
||||||
|
find_library(Blosc_LIBRARY NAMES blosc)
|
||||||
|
if (Blosc_INCLUDE_DIR AND Blosc_LIBRARY)
|
||||||
|
set(Blosc_FOUND TRUE)
|
||||||
|
add_library(Blosc::blosc UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(Blosc::blosc PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${Blosc_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${Blosc_INCLUDE_DIR})
|
||||||
|
elseif()
|
||||||
|
just_fail("Blosc library can not be found!")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenVDB_USES_LOG4CPLUS)
|
||||||
|
find_package(Log4cplus ${_quiet} ${_required})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenVDB_USES_ILM)
|
||||||
|
find_package(IlmBase ${_quiet} ${_required})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenVDB_USES_EXR)
|
||||||
|
find_package(OpenEXR ${_quiet} ${_required})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
find_package(Threads ${_quiet} ${_required})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set deps. Note that the order here is important. If we're building against
|
||||||
|
# Houdini 17.5 we must include OpenEXR and IlmBase deps first to ensure the
|
||||||
|
# users chosen namespaced headers are correctly prioritized. Otherwise other
|
||||||
|
# include paths from shared installs (including houdini) may pull in the wrong
|
||||||
|
# headers
|
||||||
|
|
||||||
|
set(_OPENVDB_VISIBLE_DEPENDENCIES
|
||||||
|
Boost::iostreams
|
||||||
|
Boost::system
|
||||||
|
IlmBase::Half
|
||||||
|
)
|
||||||
|
|
||||||
|
set(_OPENVDB_DEFINITIONS)
|
||||||
|
if(OpenVDB_ABI)
|
||||||
|
list(APPEND _OPENVDB_DEFINITIONS "-DOPENVDB_ABI_VERSION_NUMBER=${OpenVDB_ABI}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenVDB_USES_EXR)
|
||||||
|
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES
|
||||||
|
IlmBase::IlmThread
|
||||||
|
IlmBase::Iex
|
||||||
|
IlmBase::Imath
|
||||||
|
OpenEXR::IlmImf
|
||||||
|
)
|
||||||
|
list(APPEND _OPENVDB_DEFINITIONS "-DOPENVDB_TOOLS_RAYTRACER_USE_EXR")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenVDB_USES_LOG4CPLUS)
|
||||||
|
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES Log4cplus::log4cplus)
|
||||||
|
list(APPEND _OPENVDB_DEFINITIONS "-DOPENVDB_USE_LOG4CPLUS")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES
|
||||||
|
TBB::tbb
|
||||||
|
)
|
||||||
|
if(UNIX)
|
||||||
|
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES
|
||||||
|
Threads::Threads
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_OPENVDB_HIDDEN_DEPENDENCIES)
|
||||||
|
|
||||||
|
if(OpenVDB_USES_BLOSC)
|
||||||
|
if(OPENVDB_USE_STATIC_LIBS)
|
||||||
|
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES $<LINK_ONLY:Blosc::blosc>)
|
||||||
|
else()
|
||||||
|
list(APPEND _OPENVDB_HIDDEN_DEPENDENCIES Blosc::blosc)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OPENVDB_USE_STATIC_LIBS)
|
||||||
|
list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES $<LINK_ONLY:ZLIB::ZLIB>)
|
||||||
|
else()
|
||||||
|
list(APPEND _OPENVDB_HIDDEN_DEPENDENCIES ZLIB::ZLIB)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
# Configure imported target
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
set(OpenVDB_LIBRARIES
|
||||||
|
${OpenVDB_LIB_COMPONENTS}
|
||||||
|
)
|
||||||
|
set(OpenVDB_INCLUDE_DIRS ${OpenVDB_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set(OpenVDB_DEFINITIONS)
|
||||||
|
list(APPEND OpenVDB_DEFINITIONS "${PC_OpenVDB_CFLAGS_OTHER}")
|
||||||
|
list(APPEND OpenVDB_DEFINITIONS "${_OPENVDB_DEFINITIONS}")
|
||||||
|
list(REMOVE_DUPLICATES OpenVDB_DEFINITIONS)
|
||||||
|
|
||||||
|
set(OpenVDB_LIBRARY_DIRS "")
|
||||||
|
foreach(LIB ${OpenVDB_LIB_COMPONENTS})
|
||||||
|
get_filename_component(_OPENVDB_LIBDIR ${LIB} DIRECTORY)
|
||||||
|
list(APPEND OpenVDB_LIBRARY_DIRS ${_OPENVDB_LIBDIR})
|
||||||
|
endforeach()
|
||||||
|
list(REMOVE_DUPLICATES OpenVDB_LIBRARY_DIRS)
|
||||||
|
|
||||||
|
foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS})
|
||||||
|
if(NOT TARGET OpenVDB::${COMPONENT})
|
||||||
|
if (${COMPONENT} STREQUAL openvdb)
|
||||||
|
include (${CMAKE_CURRENT_LIST_DIR}/CheckAtomic.cmake)
|
||||||
|
set(_LINK_LIBS ${_OPENVDB_VISIBLE_DEPENDENCIES} ${CMAKE_REQUIRED_LIBRARIES})
|
||||||
|
else ()
|
||||||
|
set(_LINK_LIBS _OPENVDB_VISIBLE_DEPENDENCIES)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
add_library(OpenVDB::${COMPONENT} UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(OpenVDB::${COMPONENT} PROPERTIES
|
||||||
|
INTERFACE_COMPILE_OPTIONS "${OpenVDB_DEFINITIONS}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LINK_DEPENDENT_LIBRARIES "${_OPENVDB_HIDDEN_DEPENDENCIES}" # non visible deps
|
||||||
|
INTERFACE_LINK_LIBRARIES "${_LINK_LIBS}" # visible deps (headers)
|
||||||
|
INTERFACE_COMPILE_FEATURES cxx_std_11
|
||||||
|
IMPORTED_LOCATION "${OpenVDB_${COMPONENT}_LIBRARY}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (_is_multi)
|
||||||
|
set_target_properties(OpenVDB::${COMPONENT} PROPERTIES
|
||||||
|
IMPORTED_LOCATION_RELEASE "${OpenVDB_${COMPONENT}_LIBRARY_RELEASE}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (MSVC OR OpenVDB_${COMPONENT}_LIBRARY_DEBUG)
|
||||||
|
set_target_properties(OpenVDB::${COMPONENT} PROPERTIES
|
||||||
|
IMPORTED_LOCATION_DEBUG "${OpenVDB_${COMPONENT}_LIBRARY_DEBUG}"
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (OPENVDB_USE_STATIC_LIBS)
|
||||||
|
set_target_properties(OpenVDB::${COMPONENT} PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "OPENVDB_STATICLIB;OPENVDB_OPENEXR_STATICLIB"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(OpenVDB_FOUND AND NOT OpenVDB_FIND_QUIETLY)
|
||||||
|
message(STATUS "OpenVDB libraries: ${OpenVDB_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
unset(_OPENVDB_DEFINITIONS)
|
||||||
|
unset(_OPENVDB_VISIBLE_DEPENDENCIES)
|
||||||
|
unset(_OPENVDB_HIDDEN_DEPENDENCIES)
|
||||||
392
cmake/modules/FindPackageHandleStandardArgs_SLIC3R.cmake
Normal file
392
cmake/modules/FindPackageHandleStandardArgs_SLIC3R.cmake
Normal file
@@ -0,0 +1,392 @@
|
|||||||
|
# Modified from the CMake github master,
|
||||||
|
# required by the bundled FindCURL.cmake
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
FindPackageHandleStandardArgs
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
This module provides a function intended to be used in :ref:`Find Modules`
|
||||||
|
implementing :command:`find_package(<PackageName>)` calls. It handles the
|
||||||
|
``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``.
|
||||||
|
It also sets the ``<PackageName>_FOUND`` variable. The package is
|
||||||
|
considered found if all variables listed contain valid results, e.g.
|
||||||
|
valid filepaths.
|
||||||
|
|
||||||
|
.. command:: find_package_handle_standard_args
|
||||||
|
|
||||||
|
There are two signatures::
|
||||||
|
|
||||||
|
find_package_handle_standard_args(<PackageName>
|
||||||
|
(DEFAULT_MSG|<custom-failure-message>)
|
||||||
|
<required-var>...
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package_handle_standard_args(<PackageName>
|
||||||
|
[FOUND_VAR <result-var>]
|
||||||
|
[REQUIRED_VARS <required-var>...]
|
||||||
|
[VERSION_VAR <version-var>]
|
||||||
|
[HANDLE_COMPONENTS]
|
||||||
|
[CONFIG_MODE]
|
||||||
|
[FAIL_MESSAGE <custom-failure-message>]
|
||||||
|
)
|
||||||
|
|
||||||
|
The ``<PackageName>_FOUND`` variable will be set to ``TRUE`` if all
|
||||||
|
the variables ``<required-var>...`` are valid and any optional
|
||||||
|
constraints are satisfied, and ``FALSE`` otherwise. A success or
|
||||||
|
failure message may be displayed based on the results and on
|
||||||
|
whether the ``REQUIRED`` and/or ``QUIET`` option was given to
|
||||||
|
the :command:`find_package` call.
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
|
||||||
|
``(DEFAULT_MSG|<custom-failure-message>)``
|
||||||
|
In the simple signature this specifies the failure message.
|
||||||
|
Use ``DEFAULT_MSG`` to ask for a default message to be computed
|
||||||
|
(recommended). Not valid in the full signature.
|
||||||
|
|
||||||
|
``FOUND_VAR <result-var>``
|
||||||
|
Obsolete. Specifies either ``<PackageName>_FOUND`` or
|
||||||
|
``<PACKAGENAME>_FOUND`` as the result variable. This exists only
|
||||||
|
for compatibility with older versions of CMake and is now ignored.
|
||||||
|
Result variables of both names are always set for compatibility.
|
||||||
|
|
||||||
|
``REQUIRED_VARS <required-var>...``
|
||||||
|
Specify the variables which are required for this package.
|
||||||
|
These may be named in the generated failure message asking the
|
||||||
|
user to set the missing variable values. Therefore these should
|
||||||
|
typically be cache entries such as ``FOO_LIBRARY`` and not output
|
||||||
|
variables like ``FOO_LIBRARIES``.
|
||||||
|
|
||||||
|
``VERSION_VAR <version-var>``
|
||||||
|
Specify the name of a variable that holds the version of the package
|
||||||
|
that has been found. This version will be checked against the
|
||||||
|
(potentially) specified required version given to the
|
||||||
|
:command:`find_package` call, including its ``EXACT`` option.
|
||||||
|
The default messages include information about the required
|
||||||
|
version and the version which has been actually found, both
|
||||||
|
if the version is ok or not.
|
||||||
|
|
||||||
|
``HANDLE_COMPONENTS``
|
||||||
|
Enable handling of package components. In this case, the command
|
||||||
|
will report which components have been found and which are missing,
|
||||||
|
and the ``<PackageName>_FOUND`` variable will be set to ``FALSE``
|
||||||
|
if any of the required components (i.e. not the ones listed after
|
||||||
|
the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are
|
||||||
|
missing.
|
||||||
|
|
||||||
|
``CONFIG_MODE``
|
||||||
|
Specify that the calling find module is a wrapper around a
|
||||||
|
call to ``find_package(<PackageName> NO_MODULE)``. This implies
|
||||||
|
a ``VERSION_VAR`` value of ``<PackageName>_VERSION``. The command
|
||||||
|
will automatically check whether the package configuration file
|
||||||
|
was found.
|
||||||
|
|
||||||
|
``FAIL_MESSAGE <custom-failure-message>``
|
||||||
|
Specify a custom failure message instead of using the default
|
||||||
|
generated message. Not recommended.
|
||||||
|
|
||||||
|
Example for the simple signature:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
find_package_handle_standard_args(LibXml2 DEFAULT_MSG
|
||||||
|
LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
|
||||||
|
|
||||||
|
The ``LibXml2`` package is considered to be found if both
|
||||||
|
``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid.
|
||||||
|
Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found
|
||||||
|
and ``REQUIRED`` was used, it fails with a
|
||||||
|
:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was
|
||||||
|
used or not. If it is found, success will be reported, including
|
||||||
|
the content of the first ``<required-var>``. On repeated CMake runs,
|
||||||
|
the same message will not be printed again.
|
||||||
|
|
||||||
|
Example for the full signature:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
find_package_handle_standard_args(LibArchive
|
||||||
|
REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
|
||||||
|
VERSION_VAR LibArchive_VERSION)
|
||||||
|
|
||||||
|
In this case, the ``LibArchive`` package is considered to be found if
|
||||||
|
both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid.
|
||||||
|
Also the version of ``LibArchive`` will be checked by using the version
|
||||||
|
contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given,
|
||||||
|
the default messages will be printed.
|
||||||
|
|
||||||
|
Another example for the full signature:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
|
||||||
|
find_package_handle_standard_args(Automoc4 CONFIG_MODE)
|
||||||
|
|
||||||
|
In this case, a ``FindAutmoc4.cmake`` module wraps a call to
|
||||||
|
``find_package(Automoc4 NO_MODULE)`` and adds an additional search
|
||||||
|
directory for ``automoc4``. Then the call to
|
||||||
|
``find_package_handle_standard_args`` produces a proper success/failure
|
||||||
|
message.
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage_SLIC3R.cmake)
|
||||||
|
|
||||||
|
# internal helper macro
|
||||||
|
macro(_FPHSA_FAILURE_MESSAGE _msg)
|
||||||
|
if (${_NAME}_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "${_msg}")
|
||||||
|
else ()
|
||||||
|
if (NOT ${_NAME}_FIND_QUIETLY)
|
||||||
|
message(STATUS "${_msg}")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
# internal helper macro to generate the failure message when used in CONFIG_MODE:
|
||||||
|
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
|
||||||
|
# <PackageName>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
|
||||||
|
if(${_NAME}_CONFIG)
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
|
||||||
|
else()
|
||||||
|
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
|
||||||
|
# List them all in the error message:
|
||||||
|
if(${_NAME}_CONSIDERED_CONFIGS)
|
||||||
|
set(configsText "")
|
||||||
|
list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
|
||||||
|
math(EXPR configsCount "${configsCount} - 1")
|
||||||
|
foreach(currentConfigIndex RANGE ${configsCount})
|
||||||
|
list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
|
||||||
|
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
|
||||||
|
string(APPEND configsText " ${filename} (version ${version})\n")
|
||||||
|
endforeach()
|
||||||
|
if (${_NAME}_NOT_FOUND_MESSAGE)
|
||||||
|
string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
|
||||||
|
endif()
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
|
||||||
|
|
||||||
|
else()
|
||||||
|
# Simple case: No Config-file was found at all:
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
function(FIND_PACKAGE_HANDLE_STANDARD_ARGS_SLIC3R _NAME _FIRST_ARG)
|
||||||
|
|
||||||
|
# Set up the arguments for `cmake_parse_arguments`.
|
||||||
|
set(options CONFIG_MODE HANDLE_COMPONENTS)
|
||||||
|
set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR)
|
||||||
|
set(multiValueArgs REQUIRED_VARS)
|
||||||
|
|
||||||
|
# Check whether we are in 'simple' or 'extended' mode:
|
||||||
|
set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
|
||||||
|
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
|
||||||
|
|
||||||
|
if(${INDEX} EQUAL -1)
|
||||||
|
set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
|
||||||
|
set(FPHSA_REQUIRED_VARS ${ARGN})
|
||||||
|
set(FPHSA_VERSION_VAR)
|
||||||
|
else()
|
||||||
|
cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
|
||||||
|
|
||||||
|
if(FPHSA_UNPARSED_ARGUMENTS)
|
||||||
|
message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FPHSA_FAIL_MESSAGE)
|
||||||
|
set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# In config-mode, we rely on the variable <PackageName>_CONFIG, which is set by find_package()
|
||||||
|
# when it successfully found the config-file, including version checking:
|
||||||
|
if(FPHSA_CONFIG_MODE)
|
||||||
|
list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
|
||||||
|
list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
|
||||||
|
set(FPHSA_VERSION_VAR ${_NAME}_VERSION)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FPHSA_REQUIRED_VARS)
|
||||||
|
message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# now that we collected all arguments, process them
|
||||||
|
|
||||||
|
if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
|
||||||
|
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
|
||||||
|
|
||||||
|
string(TOUPPER ${_NAME} _NAME_UPPER)
|
||||||
|
string(TOLOWER ${_NAME} _NAME_LOWER)
|
||||||
|
|
||||||
|
if(FPHSA_FOUND_VAR)
|
||||||
|
if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
|
||||||
|
set(_FOUND_VAR ${FPHSA_FOUND_VAR})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# collect all variables which were not found, so they can be printed, so the
|
||||||
|
# user knows better what went wrong (#6375)
|
||||||
|
set(MISSING_VARS "")
|
||||||
|
set(DETAILS "")
|
||||||
|
# check if all passed variables are valid
|
||||||
|
set(FPHSA_FOUND_${_NAME} TRUE)
|
||||||
|
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
|
||||||
|
if(NOT ${_CURRENT_VAR})
|
||||||
|
set(FPHSA_FOUND_${_NAME} FALSE)
|
||||||
|
string(APPEND MISSING_VARS " ${_CURRENT_VAR}")
|
||||||
|
else()
|
||||||
|
string(APPEND DETAILS "[${${_CURRENT_VAR}}]")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(FPHSA_FOUND_${_NAME})
|
||||||
|
set(${_NAME}_FOUND TRUE)
|
||||||
|
set(${_NAME_UPPER}_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
set(${_NAME}_FOUND FALSE)
|
||||||
|
set(${_NAME_UPPER}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# component handling
|
||||||
|
unset(FOUND_COMPONENTS_MSG)
|
||||||
|
unset(MISSING_COMPONENTS_MSG)
|
||||||
|
|
||||||
|
if(FPHSA_HANDLE_COMPONENTS)
|
||||||
|
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||||
|
if(${_NAME}_${comp}_FOUND)
|
||||||
|
|
||||||
|
if(NOT DEFINED FOUND_COMPONENTS_MSG)
|
||||||
|
set(FOUND_COMPONENTS_MSG "found components: ")
|
||||||
|
endif()
|
||||||
|
string(APPEND FOUND_COMPONENTS_MSG " ${comp}")
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
if(NOT DEFINED MISSING_COMPONENTS_MSG)
|
||||||
|
set(MISSING_COMPONENTS_MSG "missing components: ")
|
||||||
|
endif()
|
||||||
|
string(APPEND MISSING_COMPONENTS_MSG " ${comp}")
|
||||||
|
|
||||||
|
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||||
|
set(${_NAME}_FOUND FALSE)
|
||||||
|
string(APPEND MISSING_VARS " ${comp}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
|
||||||
|
string(APPEND DETAILS "[c${COMPONENT_MSG}]")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# version handling:
|
||||||
|
set(VERSION_MSG "")
|
||||||
|
set(VERSION_OK TRUE)
|
||||||
|
|
||||||
|
# check with DEFINED here as the requested or found version may be "0"
|
||||||
|
if (DEFINED ${_NAME}_FIND_VERSION)
|
||||||
|
if(DEFINED ${FPHSA_VERSION_VAR})
|
||||||
|
set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}})
|
||||||
|
|
||||||
|
if(${_NAME}_FIND_VERSION_EXACT) # exact version required
|
||||||
|
# count the dots in the version string
|
||||||
|
string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}")
|
||||||
|
# add one dot because there is one dot more than there are components
|
||||||
|
string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS)
|
||||||
|
if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT)
|
||||||
|
# Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT
|
||||||
|
# is at most 4 here. Therefore a simple lookup table is used.
|
||||||
|
if (${_NAME}_FIND_VERSION_COUNT EQUAL 1)
|
||||||
|
set(_VERSION_REGEX "[^.]*")
|
||||||
|
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2)
|
||||||
|
set(_VERSION_REGEX "[^.]*\\.[^.]*")
|
||||||
|
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3)
|
||||||
|
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*")
|
||||||
|
else ()
|
||||||
|
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
|
||||||
|
endif ()
|
||||||
|
string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}")
|
||||||
|
unset(_VERSION_REGEX)
|
||||||
|
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD)
|
||||||
|
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
|
||||||
|
set(VERSION_OK FALSE)
|
||||||
|
else ()
|
||||||
|
set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")")
|
||||||
|
endif ()
|
||||||
|
unset(_VERSION_HEAD)
|
||||||
|
else ()
|
||||||
|
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION)
|
||||||
|
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
|
||||||
|
set(VERSION_OK FALSE)
|
||||||
|
else ()
|
||||||
|
set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
unset(_VERSION_DOTS)
|
||||||
|
|
||||||
|
else() # minimum version specified:
|
||||||
|
if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION)
|
||||||
|
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
|
||||||
|
set(VERSION_OK FALSE)
|
||||||
|
else ()
|
||||||
|
set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
# if the package was not found, but a version was given, add that to the output:
|
||||||
|
if(${_NAME}_FIND_VERSION_EXACT)
|
||||||
|
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
else()
|
||||||
|
set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
else ()
|
||||||
|
# Check with DEFINED as the found version may be 0.
|
||||||
|
if(DEFINED ${FPHSA_VERSION_VAR})
|
||||||
|
set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")")
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(VERSION_OK)
|
||||||
|
string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]")
|
||||||
|
else()
|
||||||
|
set(${_NAME}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# print the result:
|
||||||
|
if (${_NAME}_FOUND)
|
||||||
|
FIND_PACKAGE_MESSAGE_SLIC3R(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
|
||||||
|
else ()
|
||||||
|
|
||||||
|
if(FPHSA_CONFIG_MODE)
|
||||||
|
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
|
||||||
|
else()
|
||||||
|
if(NOT VERSION_OK)
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
|
||||||
|
else()
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
|
||||||
|
set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
54
cmake/modules/FindPackageMessage_SLIC3R.cmake
Normal file
54
cmake/modules/FindPackageMessage_SLIC3R.cmake
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# Modified from the CMake github master.
|
||||||
|
# required by the bundled FindCURL.cmake
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# FindPackageMessage
|
||||||
|
# ------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
|
||||||
|
#
|
||||||
|
# This macro is intended to be used in FindXXX.cmake modules files. It
|
||||||
|
# will print a message once for each unique find result. This is useful
|
||||||
|
# for telling the user where a package was found. The first argument
|
||||||
|
# specifies the name (XXX) of the package. The second argument
|
||||||
|
# specifies the message to display. The third argument lists details
|
||||||
|
# about the find result so that if they change the message will be
|
||||||
|
# displayed again. The macro also obeys the QUIET argument to the
|
||||||
|
# find_package command.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# if(X11_FOUND)
|
||||||
|
# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
|
||||||
|
# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
|
||||||
|
# else()
|
||||||
|
# ...
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
function(FIND_PACKAGE_MESSAGE_SLIC3R pkg msg details)
|
||||||
|
# Avoid printing a message repeatedly for the same find result.
|
||||||
|
if(NOT ${pkg}_FIND_QUIETLY)
|
||||||
|
string(REPLACE "\n" "" details "${details}")
|
||||||
|
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
|
||||||
|
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
|
||||||
|
# The message has not yet been printed.
|
||||||
|
message(STATUS "${msg}")
|
||||||
|
|
||||||
|
# Save the find details in the cache to avoid printing the same
|
||||||
|
# message again.
|
||||||
|
set("${DETAILS_VAR}" "${details}"
|
||||||
|
CACHE INTERNAL "Details about finding ${pkg}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
88
cmake/modules/FindPerlEmbed.cmake
Normal file
88
cmake/modules/FindPerlEmbed.cmake
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
# Find the dependencies for linking with the Perl runtime library.
|
||||||
|
|
||||||
|
# Check for the Perl & PerlLib modules
|
||||||
|
include(LibFindMacros)
|
||||||
|
libfind_package(PerlEmbed Perl)
|
||||||
|
libfind_package(PerlEmbed PerlLibs)
|
||||||
|
|
||||||
|
# Execute an Alien::Wx module to find the relevant information regarding
|
||||||
|
# the wxWidgets used by the Perl interpreter.
|
||||||
|
# Perl specific stuff
|
||||||
|
set(PerlEmbed_TEMP_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/PerlEmbed_TEMP_INCLUDE.txt)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e "
|
||||||
|
# Import Perl modules.
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Config;
|
||||||
|
use Text::ParseWords;
|
||||||
|
use ExtUtils::CppGuess;
|
||||||
|
|
||||||
|
# Test for a Visual Studio compiler
|
||||||
|
my \$cpp_guess = ExtUtils::CppGuess->new;
|
||||||
|
my \$mswin = \$^O eq 'MSWin32';
|
||||||
|
my \$msvc = \$cpp_guess->is_msvc;
|
||||||
|
|
||||||
|
# Query the available data from Alien::wxWidgets.
|
||||||
|
my \$ccflags;
|
||||||
|
my \$ldflags;
|
||||||
|
{ local *STDOUT; open STDOUT, '>', \\\$ccflags; ccflags; }
|
||||||
|
{ local *STDOUT; open STDOUT, '>', \\\$ldflags; ldopts; }
|
||||||
|
\$ccflags = ' ' . \$ccflags;
|
||||||
|
\$ldflags = ' ' . \$ldflags;
|
||||||
|
|
||||||
|
my \$filename = '${PerlEmbed_TEMP_INCLUDE}';
|
||||||
|
open(my $fh, '>', \$filename) or die \"Could not open file '\$filename' \$!\";
|
||||||
|
|
||||||
|
# Convert a space separated lists to CMake semicolon separated lists,
|
||||||
|
# escape the backslashes,
|
||||||
|
# export the resulting list to a temp file.
|
||||||
|
sub cmake_set_var {
|
||||||
|
my (\$varname, \$content) = @_;
|
||||||
|
# Remove line separators.
|
||||||
|
\$content =~ s/\\r|\\n//g;
|
||||||
|
# Escape the path separators.
|
||||||
|
\$content =~ s/\\\\/\\\\\\\\\\\\\\\\/g;
|
||||||
|
my @words = shellwords(\$content);
|
||||||
|
print \$fh \"set(PerlEmbed_\$varname \\\"\" . join(';', @words) . \"\\\")\\n\";
|
||||||
|
}
|
||||||
|
cmake_set_var('ARCHNAME', \$Config{archname});
|
||||||
|
cmake_set_var('CCFLAGS', \$ccflags);
|
||||||
|
\$ldflags =~ s/ -L/ -LIBPATH:/g if \$msvc;
|
||||||
|
cmake_set_var('LD', \$Config{ld});
|
||||||
|
cmake_set_var('LDFLAGS', \$ldflags);
|
||||||
|
cmake_set_var('CCCDLFLAGS', \$Config{cccdlflags});
|
||||||
|
cmake_set_var('LDDLFLAGS', \$Config{lddlflags});
|
||||||
|
cmake_set_var('DLEXT', \$Config{dlext});
|
||||||
|
close \$fh;
|
||||||
|
")
|
||||||
|
include(${PerlEmbed_TEMP_INCLUDE})
|
||||||
|
file(REMOVE ${PerlEmbed_TEMP_INCLUDE})
|
||||||
|
unset(PerlEmbed_TEMP_INCLUDE)
|
||||||
|
|
||||||
|
if (PerlEmbed_DEBUG)
|
||||||
|
# First show the configuration extracted by FindPerl & FindPerlLibs:
|
||||||
|
message(STATUS " PERL_INCLUDE_PATH = ${PERL_INCLUDE_PATH}")
|
||||||
|
message(STATUS " PERL_LIBRARY = ${PERL_LIBRARY}")
|
||||||
|
message(STATUS " PERL_EXECUTABLE = ${PERL_EXECUTABLE}")
|
||||||
|
message(STATUS " PERL_SITESEARCH = ${PERL_SITESEARCH}")
|
||||||
|
message(STATUS " PERL_SITELIB = ${PERL_SITELIB}")
|
||||||
|
message(STATUS " PERL_VENDORARCH = ${PERL_VENDORARCH}")
|
||||||
|
message(STATUS " PERL_VENDORLIB = ${PERL_VENDORLIB}")
|
||||||
|
message(STATUS " PERL_ARCHLIB = ${PERL_ARCHLIB}")
|
||||||
|
message(STATUS " PERL_PRIVLIB = ${PERL_PRIVLIB}")
|
||||||
|
message(STATUS " PERL_EXTRA_C_FLAGS = ${PERL_EXTRA_C_FLAGS}")
|
||||||
|
# Second show the configuration extracted by this module (FindPerlEmbed):
|
||||||
|
message(STATUS " PerlEmbed_ARCHNAME = ${PerlEmbed_ARCHNAME}")
|
||||||
|
message(STATUS " PerlEmbed_CCFLAGS = ${PerlEmbed_CCFLAGS}")
|
||||||
|
message(STATUS " PerlEmbed_CCCDLFLAGS = ${PerlEmbed_CCCDLFLAGS}")
|
||||||
|
message(STATUS " LD = ${PerlEmbed_LD}")
|
||||||
|
message(STATUS " PerlEmbed_LDFLAGS = ${PerlEmbed_LDFLAGS}")
|
||||||
|
message(STATUS " PerlEmbed_LDDLFLAGS = ${PerlEmbed_LDDLFLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_package_handle_standard_args(PerlEmbed
|
||||||
|
REQUIRED_VARS PerlEmbed_CCFLAGS PerlEmbed_LDFLAGS
|
||||||
|
VERSION_VAR PERL_VERSION)
|
||||||
24
cmake/modules/FindTBB.cmake
Normal file
24
cmake/modules/FindTBB.cmake
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# This is a wrapper of FindTBB which prefers the config scripts if available in the system
|
||||||
|
# but only if building with dynamic dependencies. The config scripts potentially belong
|
||||||
|
# to TBB >= 2020 which is incompatible with OpenVDB in our static dependency bundle.
|
||||||
|
# This workaround is useful for package maintainers on Linux systems to use newer versions
|
||||||
|
# of intel TBB (renamed to oneTBB from version 2021 up).
|
||||||
|
set(_q "")
|
||||||
|
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||||
|
set(_q QUIET)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
find_package(${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG ${_q})
|
||||||
|
|
||||||
|
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||||
|
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||||
|
message(STATUS "Falling back to MODULE search for ${CMAKE_FIND_PACKAGE_NAME}...")
|
||||||
|
else()
|
||||||
|
message(STATUS "${CMAKE_FIND_PACKAGE_NAME} found in ${${CMAKE_FIND_PACKAGE_NAME}_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/FindTBB.cmake.in)
|
||||||
|
endif ()
|
||||||
332
cmake/modules/FindTBB.cmake.in
Normal file
332
cmake/modules/FindTBB.cmake.in
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
# The MIT License (MIT)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015 Justus Calvin
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
#
|
||||||
|
# FindTBB
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# Find TBB include directories and libraries.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# find_package(TBB [major[.minor]] [EXACT]
|
||||||
|
# [QUIET] [REQUIRED]
|
||||||
|
# [[COMPONENTS] [components...]]
|
||||||
|
# [OPTIONAL_COMPONENTS components...])
|
||||||
|
#
|
||||||
|
# where the allowed components are tbbmalloc and tbb_preview. Users may modify
|
||||||
|
# the behavior of this module with the following variables:
|
||||||
|
#
|
||||||
|
# * TBB_ROOT_DIR - The base directory the of TBB installation.
|
||||||
|
# * TBB_INCLUDE_DIR - The directory that contains the TBB headers files.
|
||||||
|
# * TBB_LIBRARY - The directory that contains the TBB library files.
|
||||||
|
# * TBB_<library>_LIBRARY - The path of the TBB the corresponding TBB library.
|
||||||
|
# These libraries, if specified, override the
|
||||||
|
# corresponding library search results, where <library>
|
||||||
|
# may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug,
|
||||||
|
# tbb_preview, or tbb_preview_debug.
|
||||||
|
# * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will
|
||||||
|
# be used instead of the release version.
|
||||||
|
# * TBB_STATIC - Static linking of libraries with a _static suffix.
|
||||||
|
# For example, on Windows a tbb_static.lib will be searched for
|
||||||
|
# instead of tbb.lib.
|
||||||
|
#
|
||||||
|
# Users may modify the behavior of this module with the following environment
|
||||||
|
# variables:
|
||||||
|
#
|
||||||
|
# * TBB_INSTALL_DIR
|
||||||
|
# * TBBROOT
|
||||||
|
# * LIBRARY_PATH
|
||||||
|
#
|
||||||
|
# This module will set the following variables:
|
||||||
|
#
|
||||||
|
# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or
|
||||||
|
# don’t want to use TBB.
|
||||||
|
# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
|
||||||
|
# not available.
|
||||||
|
# * TBB_VERSION - The full version string
|
||||||
|
# * TBB_VERSION_MAJOR - The major version
|
||||||
|
# * TBB_VERSION_MINOR - The minor version
|
||||||
|
# * TBB_INTERFACE_VERSION - The interface version number defined in
|
||||||
|
# tbb/tbb_stddef.h.
|
||||||
|
# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of
|
||||||
|
# <library>, where <library> may be tbb, tbb_debug,
|
||||||
|
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
|
||||||
|
# tbb_preview_debug.
|
||||||
|
# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of
|
||||||
|
# <library>, where <library> may be tbb, tbb_debug,
|
||||||
|
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
|
||||||
|
# tbb_preview_debug.
|
||||||
|
#
|
||||||
|
# The following varibles should be used to build and link with TBB:
|
||||||
|
#
|
||||||
|
# * TBB_INCLUDE_DIRS - The include directory for TBB.
|
||||||
|
# * TBB_LIBRARIES - The libraries to link against to use TBB.
|
||||||
|
# * TBB_LIBRARIES_RELEASE - The release libraries to link against to use TBB.
|
||||||
|
# * TBB_LIBRARIES_DEBUG - The debug libraries to link against to use TBB.
|
||||||
|
# * TBB_DEFINITIONS - Definitions to use when compiling code that uses
|
||||||
|
# TBB.
|
||||||
|
# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that
|
||||||
|
# uses TBB.
|
||||||
|
# * TBB_DEFINITIONS_DEBUG - Definitions to use when compiling debug code that
|
||||||
|
# uses TBB.
|
||||||
|
#
|
||||||
|
# This module will also create the "tbb" target that may be used when building
|
||||||
|
# executables and libraries.
|
||||||
|
|
||||||
|
unset(TBB_FOUND CACHE)
|
||||||
|
unset(TBB_INCLUDE_DIRS CACHE)
|
||||||
|
unset(TBB_LIBRARIES)
|
||||||
|
unset(TBB_LIBRARIES_DEBUG)
|
||||||
|
unset(TBB_LIBRARIES_RELEASE)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_package(Threads QUIET REQUIRED)
|
||||||
|
|
||||||
|
if(NOT TBB_FOUND)
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Check the build type
|
||||||
|
##################################
|
||||||
|
|
||||||
|
if(NOT DEFINED TBB_USE_DEBUG_BUILD)
|
||||||
|
if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)")
|
||||||
|
set(TBB_BUILD_TYPE DEBUG)
|
||||||
|
else()
|
||||||
|
set(TBB_BUILD_TYPE RELEASE)
|
||||||
|
endif()
|
||||||
|
elseif(TBB_USE_DEBUG_BUILD)
|
||||||
|
set(TBB_BUILD_TYPE DEBUG)
|
||||||
|
else()
|
||||||
|
set(TBB_BUILD_TYPE RELEASE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Set the TBB search directories
|
||||||
|
##################################
|
||||||
|
|
||||||
|
# Define search paths based on user input and environment variables
|
||||||
|
set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
|
||||||
|
|
||||||
|
# Define the search directories based on the current platform
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
|
||||||
|
"C:/Program Files (x86)/Intel/TBB")
|
||||||
|
|
||||||
|
# Set the target architecture
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(TBB_ARCHITECTURE "intel64")
|
||||||
|
else()
|
||||||
|
set(TBB_ARCHITECTURE "ia32")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set the TBB search library path search suffix based on the version of VC
|
||||||
|
if(WINDOWS_STORE)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui")
|
||||||
|
elseif(MSVC14)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14")
|
||||||
|
elseif(MSVC12)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12")
|
||||||
|
elseif(MSVC11)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
|
||||||
|
elseif(MSVC10)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add the library path search suffix for the VC independent version of TBB
|
||||||
|
list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
|
||||||
|
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
# OS X
|
||||||
|
set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
|
||||||
|
|
||||||
|
# TODO: Check to see which C++ library is being used by the compiler.
|
||||||
|
if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
|
||||||
|
# The default C++ library on OS X 10.9 and later is libc++
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
|
||||||
|
else()
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib")
|
||||||
|
endif()
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
# Linux
|
||||||
|
set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
|
||||||
|
|
||||||
|
# TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
|
||||||
|
# <arch>/gcc4.1. For now, assume that the compiler is more recent than
|
||||||
|
# gcc 4.4.x or later.
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Find the TBB include dir
|
||||||
|
##################################
|
||||||
|
|
||||||
|
find_path(TBB_INCLUDE_DIRS tbb/tbb.h
|
||||||
|
HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
|
||||||
|
PATHS ${TBB_DEFAULT_SEARCH_DIR}
|
||||||
|
PATH_SUFFIXES include)
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Set version strings
|
||||||
|
##################################
|
||||||
|
|
||||||
|
if(TBB_INCLUDE_DIRS)
|
||||||
|
file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file)
|
||||||
|
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
|
||||||
|
TBB_VERSION_MAJOR "${_tbb_version_file}")
|
||||||
|
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
|
||||||
|
TBB_VERSION_MINOR "${_tbb_version_file}")
|
||||||
|
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
|
||||||
|
TBB_INTERFACE_VERSION "${_tbb_version_file}")
|
||||||
|
set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Find TBB components
|
||||||
|
##################################
|
||||||
|
|
||||||
|
if(TBB_VERSION VERSION_LESS 4.3)
|
||||||
|
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
|
||||||
|
else()
|
||||||
|
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TBB_STATIC)
|
||||||
|
set(TBB_STATIC_SUFFIX "_static")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find each component
|
||||||
|
foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
|
||||||
|
if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
|
||||||
|
|
||||||
|
unset(TBB_${_comp}_LIBRARY_DEBUG CACHE)
|
||||||
|
unset(TBB_${_comp}_LIBRARY_RELEASE CACHE)
|
||||||
|
|
||||||
|
# Search for the libraries
|
||||||
|
find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}${TBB_STATIC_SUFFIX}
|
||||||
|
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
|
||||||
|
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
|
||||||
|
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
|
||||||
|
|
||||||
|
find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}${TBB_STATIC_SUFFIX}_debug
|
||||||
|
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
|
||||||
|
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
|
||||||
|
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
|
||||||
|
|
||||||
|
if(TBB_${_comp}_LIBRARY_DEBUG)
|
||||||
|
list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
if(TBB_${_comp}_LIBRARY_RELEASE)
|
||||||
|
list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
|
||||||
|
set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
|
||||||
|
set(TBB_${_comp}_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
set(TBB_${_comp}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Mark internal variables as advanced
|
||||||
|
mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
|
||||||
|
mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
|
||||||
|
mark_as_advanced(TBB_${_comp}_LIBRARY)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Set compile flags and libraries
|
||||||
|
##################################
|
||||||
|
|
||||||
|
set(TBB_DEFINITIONS_RELEASE "")
|
||||||
|
set(TBB_DEFINITIONS_DEBUG "TBB_USE_DEBUG=1")
|
||||||
|
|
||||||
|
if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
|
||||||
|
set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT MSVC AND NOT TBB_LIBRARIES)
|
||||||
|
set(TBB_LIBRARIES ${TBB_LIBRARIES_RELEASE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(TBB_DEFINITIONS "")
|
||||||
|
if (MSVC AND TBB_STATIC)
|
||||||
|
set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
unset (TBB_STATIC_SUFFIX)
|
||||||
|
|
||||||
|
find_package_handle_standard_args(TBB
|
||||||
|
REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
|
||||||
|
FAIL_MESSAGE "TBB library cannot be found. Consider set TBBROOT environment variable."
|
||||||
|
HANDLE_COMPONENTS
|
||||||
|
VERSION_VAR TBB_VERSION)
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Create targets
|
||||||
|
##################################
|
||||||
|
|
||||||
|
if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND AND NOT TARGET TBB::tbb)
|
||||||
|
add_library(TBB::tbb UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(TBB::tbb PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "Threads::Threads;${CMAKE_DL_LIBS}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS}
|
||||||
|
IMPORTED_LOCATION ${TBB_LIBRARIES})
|
||||||
|
if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
|
||||||
|
set_target_properties(TBB::tbb PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS};$<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>:${TBB_DEFINITIONS_RELEASE}>;$<$<CONFIG:Debug>:${TBB_DEFINITIONS_DEBUG}>"
|
||||||
|
IMPORTED_LOCATION_DEBUG ${TBB_LIBRARIES_DEBUG}
|
||||||
|
IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_RELEASE}
|
||||||
|
IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE}
|
||||||
|
IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
|
||||||
|
|
||||||
|
unset(TBB_ARCHITECTURE)
|
||||||
|
unset(TBB_BUILD_TYPE)
|
||||||
|
unset(TBB_LIB_PATH_SUFFIX)
|
||||||
|
unset(TBB_DEFAULT_SEARCH_DIR)
|
||||||
|
|
||||||
|
if(TBB_DEBUG)
|
||||||
|
message(STATUS " TBB_FOUND = ${TBB_FOUND}")
|
||||||
|
message(STATUS " TBB_INCLUDE_DIRS = ${TBB_INCLUDE_DIRS}")
|
||||||
|
message(STATUS " TBB_DEFINITIONS = ${TBB_DEFINITIONS}")
|
||||||
|
message(STATUS " TBB_LIBRARIES = ${TBB_LIBRARIES}")
|
||||||
|
message(STATUS " TBB_DEFINITIONS_DEBUG = ${TBB_DEFINITIONS_DEBUG}")
|
||||||
|
message(STATUS " TBB_LIBRARIES_DEBUG = ${TBB_LIBRARIES_DEBUG}")
|
||||||
|
message(STATUS " TBB_DEFINITIONS_RELEASE = ${TBB_DEFINITIONS_RELEASE}")
|
||||||
|
message(STATUS " TBB_LIBRARIES_RELEASE = ${TBB_LIBRARIES_RELEASE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
26
cmake/modules/Findcereal.cmake
Normal file
26
cmake/modules/Findcereal.cmake
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
set(_q "")
|
||||||
|
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||||
|
set(_q QUIET)
|
||||||
|
set(_quietly TRUE)
|
||||||
|
endif()
|
||||||
|
find_package(${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG ${_q})
|
||||||
|
|
||||||
|
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||||
|
# Fall-back solution to find the Cereal serialization library header file
|
||||||
|
include(CheckIncludeFileCXX)
|
||||||
|
add_library(cereal INTERFACE)
|
||||||
|
target_include_directories(cereal INTERFACE include)
|
||||||
|
|
||||||
|
if (_quietly)
|
||||||
|
set(CMAKE_REQUIRED_QUIET ON)
|
||||||
|
endif()
|
||||||
|
CHECK_INCLUDE_FILE_CXX("cereal/cereal.hpp" HAVE_CEREAL_H)
|
||||||
|
|
||||||
|
if (NOT HAVE_CEREAL_H)
|
||||||
|
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Cereal library not found. Please install the dependency.")
|
||||||
|
elseif(NOT _quietly)
|
||||||
|
message(WARNING "Cereal library not found.")
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
265
cmake/modules/LibFindMacros.cmake
Normal file
265
cmake/modules/LibFindMacros.cmake
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
# Version 2.2
|
||||||
|
# Public Domain, originally written by Lasse Kärkkäinen <tronic>
|
||||||
|
# Maintained at https://github.com/Tronic/cmake-modules
|
||||||
|
# Please send your improvements as pull requests on Github.
|
||||||
|
|
||||||
|
# Find another package and make it a dependency of the current package.
|
||||||
|
# This also automatically forwards the "REQUIRED" argument.
|
||||||
|
# Usage: libfind_package(<prefix> <another package> [extra args to find_package])
|
||||||
|
macro (libfind_package PREFIX PKG)
|
||||||
|
set(${PREFIX}_args ${PKG} ${ARGN})
|
||||||
|
if (${PREFIX}_FIND_REQUIRED)
|
||||||
|
set(${PREFIX}_args ${${PREFIX}_args} REQUIRED)
|
||||||
|
endif()
|
||||||
|
find_package(${${PREFIX}_args})
|
||||||
|
set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG})
|
||||||
|
unset(${PREFIX}_args)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# A simple wrapper to make pkg-config searches a bit easier.
|
||||||
|
# Works the same as CMake's internal pkg_check_modules but is always quiet.
|
||||||
|
macro (libfind_pkg_check_modules)
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if (PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(${ARGN} QUIET)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Avoid useless copy&pasta by doing what most simple libraries do anyway:
|
||||||
|
# pkg-config, find headers, find library.
|
||||||
|
# Usage: libfind_pkg_detect(<prefix> <pkg-config args> FIND_PATH <name> [other args] FIND_LIBRARY <name> [other args])
|
||||||
|
# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2)
|
||||||
|
function (libfind_pkg_detect PREFIX)
|
||||||
|
# Parse arguments
|
||||||
|
set(argname pkgargs)
|
||||||
|
foreach (i ${ARGN})
|
||||||
|
if ("${i}" STREQUAL "FIND_PATH")
|
||||||
|
set(argname pathargs)
|
||||||
|
elseif ("${i}" STREQUAL "FIND_LIBRARY")
|
||||||
|
set(argname libraryargs)
|
||||||
|
else()
|
||||||
|
set(${argname} ${${argname}} ${i})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if (NOT pkgargs)
|
||||||
|
message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.")
|
||||||
|
endif()
|
||||||
|
# Find library
|
||||||
|
libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs})
|
||||||
|
if (pathargs)
|
||||||
|
find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
if (libraryargs)
|
||||||
|
find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
|
||||||
|
# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR)
|
||||||
|
# Fourth argument "QUIET" may be used for silently testing different define names.
|
||||||
|
# This function does nothing if the version variable is already defined.
|
||||||
|
function (libfind_version_header PREFIX VERSION_H DEFINE_NAME)
|
||||||
|
# Skip processing if we already have a version or if the include dir was not found
|
||||||
|
if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(quiet ${${PREFIX}_FIND_QUIETLY})
|
||||||
|
# Process optional arguments
|
||||||
|
foreach(arg ${ARGN})
|
||||||
|
if (arg STREQUAL "QUIET")
|
||||||
|
set(quiet TRUE)
|
||||||
|
else()
|
||||||
|
message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
# Read the header and parse for version number
|
||||||
|
set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
|
||||||
|
if (NOT EXISTS ${filename})
|
||||||
|
if (NOT quiet)
|
||||||
|
message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
file(READ "${filename}" header)
|
||||||
|
string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}")
|
||||||
|
# No regex match?
|
||||||
|
if (match STREQUAL header)
|
||||||
|
if (NOT quiet)
|
||||||
|
message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"<version>\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
# Export the version string
|
||||||
|
set(${PREFIX}_VERSION "${match}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Do the final processing once the paths have been detected.
|
||||||
|
# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
|
||||||
|
# all the variables, each of which contain one include directory.
|
||||||
|
# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
|
||||||
|
# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
|
||||||
|
# Also handles errors in case library detection was required, etc.
|
||||||
|
function (libfind_process PREFIX)
|
||||||
|
# Skip processing if already processed during this configuration run
|
||||||
|
if (${PREFIX}_FOUND)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(found TRUE) # Start with the assumption that the package was found
|
||||||
|
|
||||||
|
# Did we find any files? Did we miss includes? These are for formatting better error messages.
|
||||||
|
set(some_files FALSE)
|
||||||
|
set(missing_headers FALSE)
|
||||||
|
|
||||||
|
# Shorthands for some variables that we need often
|
||||||
|
set(quiet ${${PREFIX}_FIND_QUIETLY})
|
||||||
|
set(required ${${PREFIX}_FIND_REQUIRED})
|
||||||
|
set(exactver ${${PREFIX}_FIND_VERSION_EXACT})
|
||||||
|
set(findver "${${PREFIX}_FIND_VERSION}")
|
||||||
|
set(version "${${PREFIX}_VERSION}")
|
||||||
|
|
||||||
|
# Lists of config option names (all, includes, libs)
|
||||||
|
unset(configopts)
|
||||||
|
set(includeopts ${${PREFIX}_PROCESS_INCLUDES})
|
||||||
|
set(libraryopts ${${PREFIX}_PROCESS_LIBS})
|
||||||
|
|
||||||
|
# Process deps to add to
|
||||||
|
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
|
||||||
|
if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
|
||||||
|
# The package seems to export option lists that we can use, woohoo!
|
||||||
|
list(APPEND includeopts ${${i}_INCLUDE_OPTS})
|
||||||
|
list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
|
||||||
|
else()
|
||||||
|
# If plural forms don't exist or they equal singular forms
|
||||||
|
if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
|
||||||
|
({i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
|
||||||
|
# Singular forms can be used
|
||||||
|
if (DEFINED ${i}_INCLUDE_DIR)
|
||||||
|
list(APPEND includeopts ${i}_INCLUDE_DIR)
|
||||||
|
endif()
|
||||||
|
if (DEFINED ${i}_LIBRARY)
|
||||||
|
list(APPEND libraryopts ${i}_LIBRARY)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# Oh no, we don't know the option names
|
||||||
|
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if (includeopts)
|
||||||
|
list(REMOVE_DUPLICATES includeopts)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (libraryopts)
|
||||||
|
list(REMOVE_DUPLICATES libraryopts)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}")
|
||||||
|
if (NOT tmp STREQUAL "${includeopts} ${libraryopts}")
|
||||||
|
message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Include/library names separated by spaces (notice: not CMake lists)
|
||||||
|
unset(includes)
|
||||||
|
unset(libs)
|
||||||
|
|
||||||
|
# Process all includes and set found false if any are missing
|
||||||
|
foreach (i ${includeopts})
|
||||||
|
list(APPEND configopts ${i})
|
||||||
|
if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
|
||||||
|
list(APPEND includes "${${i}}")
|
||||||
|
else()
|
||||||
|
set(found FALSE)
|
||||||
|
set(missing_headers TRUE)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Process all libraries and set found false if any are missing
|
||||||
|
foreach (i ${libraryopts})
|
||||||
|
list(APPEND configopts ${i})
|
||||||
|
if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
|
||||||
|
list(APPEND libs "${${i}}")
|
||||||
|
else()
|
||||||
|
set (found FALSE)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Version checks
|
||||||
|
if (found AND findver)
|
||||||
|
if (NOT version)
|
||||||
|
message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.")
|
||||||
|
elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver))
|
||||||
|
set(found FALSE)
|
||||||
|
set(version_unsuitable TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# If all-OK, hide all config options, export variables, print status and exit
|
||||||
|
if (found)
|
||||||
|
foreach (i ${configopts})
|
||||||
|
mark_as_advanced(${i})
|
||||||
|
endforeach()
|
||||||
|
if (NOT quiet)
|
||||||
|
message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
|
||||||
|
if (LIBFIND_DEBUG)
|
||||||
|
message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}")
|
||||||
|
message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}")
|
||||||
|
message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}")
|
||||||
|
message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
|
||||||
|
message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
|
||||||
|
endif()
|
||||||
|
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
|
||||||
|
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
|
||||||
|
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
|
||||||
|
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
|
||||||
|
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Format messages for debug info and the type of error
|
||||||
|
set(vars "Relevant CMake configuration variables:\n")
|
||||||
|
foreach (i ${configopts})
|
||||||
|
mark_as_advanced(CLEAR ${i})
|
||||||
|
set(val ${${i}})
|
||||||
|
if ("${val}" STREQUAL "${i}-NOTFOUND")
|
||||||
|
set (val "<not found>")
|
||||||
|
elseif (val AND NOT EXISTS ${val})
|
||||||
|
set (val "${val} (does not exist)")
|
||||||
|
else()
|
||||||
|
set(some_files TRUE)
|
||||||
|
endif()
|
||||||
|
set(vars "${vars} ${i}=${val}\n")
|
||||||
|
endforeach()
|
||||||
|
set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n")
|
||||||
|
if (version_unsuitable)
|
||||||
|
set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but")
|
||||||
|
if (exactver)
|
||||||
|
set(msg "${msg} only version ${findver} is acceptable.")
|
||||||
|
else()
|
||||||
|
set(msg "${msg} version ${findver} is the minimum requirement.")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if (missing_headers)
|
||||||
|
set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?")
|
||||||
|
elseif (some_files)
|
||||||
|
set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?")
|
||||||
|
if(findver)
|
||||||
|
set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(msg "We were unable to find package ${PREFIX}.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Fatal error out if REQUIRED
|
||||||
|
if (required)
|
||||||
|
set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.")
|
||||||
|
message(FATAL_ERROR "${msg}\n${vars}")
|
||||||
|
endif()
|
||||||
|
# Otherwise just print a nasty warning
|
||||||
|
if (NOT quiet)
|
||||||
|
message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
133
cmake/modules/MacOSXBundleInfo.plist.in
Normal file
133
cmake/modules/MacOSXBundleInfo.plist.in
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.qidilab.qidi-studio</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>qidistudioopen url</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>qidistudioopen</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>stl</string>
|
||||||
|
<string>STL</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>images/stl.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>STL</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LISsAppleDefaultForType</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Alternate</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>obj</string>
|
||||||
|
<string>OBJ</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>images/QIDIStudio.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>STL</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LISsAppleDefaultForType</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Alternate</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>amf</string>
|
||||||
|
<string>AMF</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>images/QIDIStudio.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>AMF</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LISsAppleDefaultForType</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Alternate</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>3mf</string>
|
||||||
|
<string>3MF</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>images/QIDIStudio.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>3MF</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LISsAppleDefaultForType</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Alternate</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>gcode</string>
|
||||||
|
<string>GCODE</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>images/gcode.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>GCODE</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LISsAppleDefaultForType</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Alternate</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
172
cmake/modules/OpenVDBUtils.cmake
Normal file
172
cmake/modules/OpenVDBUtils.cmake
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
# Copyright (c) DreamWorks Animation LLC
|
||||||
|
#
|
||||||
|
# All rights reserved. This software is distributed under the
|
||||||
|
# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
|
||||||
|
#
|
||||||
|
# Redistributions of source code must retain the above copyright
|
||||||
|
# and license notice and the following restrictions and disclaimer.
|
||||||
|
#
|
||||||
|
# * Neither the name of DreamWorks Animation nor the names of
|
||||||
|
# its contributors may be used to endorse or promote products derived
|
||||||
|
# from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
|
||||||
|
# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
|
||||||
|
#
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
|
||||||
|
OpenVDBUtils.cmake
|
||||||
|
------------------
|
||||||
|
|
||||||
|
A utility CMake file which provides helper functions for configuring an
|
||||||
|
OpenVDB installation.
|
||||||
|
|
||||||
|
Use this module by invoking include with the form::
|
||||||
|
|
||||||
|
include ( OpenVDBUtils )
|
||||||
|
|
||||||
|
|
||||||
|
The following functions are provided:
|
||||||
|
|
||||||
|
``OPENVDB_VERSION_FROM_HEADER``
|
||||||
|
|
||||||
|
OPENVDB_VERSION_FROM_HEADER ( <header_path>
|
||||||
|
VERSION [<version>]
|
||||||
|
MAJOR [<version>]
|
||||||
|
MINOR [<version>]
|
||||||
|
PATCH [<version>] )
|
||||||
|
|
||||||
|
Parse the provided version file to retrieve the current OpenVDB
|
||||||
|
version information. The file is expected to be a version.h file
|
||||||
|
as found in the following path of an OpenVDB repository:
|
||||||
|
openvdb/version.h
|
||||||
|
|
||||||
|
If the file does not exist, variables are unmodified.
|
||||||
|
|
||||||
|
``OPENVDB_ABI_VERSION_FROM_PRINT``
|
||||||
|
|
||||||
|
OPENVDB_ABI_VERSION_FROM_PRINT ( <vdb_print>
|
||||||
|
[QUIET]
|
||||||
|
ABI [<version>] )
|
||||||
|
|
||||||
|
Retrieve the ABI version that an installation of OpenVDB was compiled
|
||||||
|
for using the provided vdb_print binary. Parses the result of:
|
||||||
|
vdb_print --version
|
||||||
|
|
||||||
|
If the binary does not exist or fails to launch, variables are
|
||||||
|
unmodified.
|
||||||
|
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
|
||||||
|
function(OPENVDB_VERSION_FROM_HEADER OPENVDB_VERSION_FILE)
|
||||||
|
cmake_parse_arguments(_VDB "" "VERSION;MAJOR;MINOR;PATCH" "" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT EXISTS ${OPENVDB_VERSION_FILE})
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(STRINGS "${OPENVDB_VERSION_FILE}" openvdb_version_str
|
||||||
|
REGEX "^#define[\t ]+OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER[\t ]+.*"
|
||||||
|
)
|
||||||
|
string(REGEX REPLACE "^.*OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1"
|
||||||
|
_OpenVDB_MAJOR_VERSION "${openvdb_version_str}"
|
||||||
|
)
|
||||||
|
|
||||||
|
file(STRINGS "${OPENVDB_VERSION_FILE}" openvdb_version_str
|
||||||
|
REGEX "^#define[\t ]+OPENVDB_LIBRARY_MINOR_VERSION_NUMBER[\t ]+.*"
|
||||||
|
)
|
||||||
|
string(REGEX REPLACE "^.*OPENVDB_LIBRARY_MINOR_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1"
|
||||||
|
_OpenVDB_MINOR_VERSION "${openvdb_version_str}"
|
||||||
|
)
|
||||||
|
|
||||||
|
file(STRINGS "${OPENVDB_VERSION_FILE}" openvdb_version_str
|
||||||
|
REGEX "^#define[\t ]+OPENVDB_LIBRARY_PATCH_VERSION_NUMBER[\t ]+.*"
|
||||||
|
)
|
||||||
|
string(REGEX REPLACE "^.*OPENVDB_LIBRARY_PATCH_VERSION_NUMBER[\t ]+([0-9]*).*$" "\\1"
|
||||||
|
_OpenVDB_PATCH_VERSION "${openvdb_version_str}"
|
||||||
|
)
|
||||||
|
unset(openvdb_version_str)
|
||||||
|
|
||||||
|
if(_VDB_VERSION)
|
||||||
|
set(${_VDB_VERSION}
|
||||||
|
${_OpenVDB_MAJOR_VERSION}.${_OpenVDB_MINOR_VERSION}.${_OpenVDB_PATCH_VERSION}
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if(_VDB_MAJOR)
|
||||||
|
set(${_VDB_MAJOR} ${_OpenVDB_MAJOR_VERSION} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
if(_VDB_MINOR)
|
||||||
|
set(${_VDB_MINOR} ${_OpenVDB_MINOR_VERSION} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
if(_VDB_PATCH)
|
||||||
|
set(${_VDB_PATCH} ${_OpenVDB_PATCH_VERSION} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
function(OPENVDB_ABI_VERSION_FROM_PRINT OPENVDB_PRINT)
|
||||||
|
cmake_parse_arguments(_VDB "QUIET" "ABI" "" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT EXISTS ${OPENVDB_PRINT})
|
||||||
|
if(NOT OpenVDB_FIND_QUIETLY)
|
||||||
|
message(WARNING "vdb_print not found! ${OPENVDB_PRINT}")
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_VDB_PRINT_VERSION_STRING "")
|
||||||
|
set(_VDB_PRINT_RETURN_STATUS "")
|
||||||
|
|
||||||
|
if(${_VDB_QUIET})
|
||||||
|
execute_process(COMMAND ${OPENVDB_PRINT} "--version"
|
||||||
|
RESULT_VARIABLE _VDB_PRINT_RETURN_STATUS
|
||||||
|
OUTPUT_VARIABLE _VDB_PRINT_VERSION_STRING
|
||||||
|
ERROR_QUIET
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
execute_process(COMMAND ${OPENVDB_PRINT} "--version"
|
||||||
|
RESULT_VARIABLE _VDB_PRINT_RETURN_STATUS
|
||||||
|
OUTPUT_VARIABLE _VDB_PRINT_VERSION_STRING
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${_VDB_PRINT_RETURN_STATUS})
|
||||||
|
if(NOT OpenVDB_FIND_QUIETLY)
|
||||||
|
message(WARNING "vdb_print returned with status ${_VDB_PRINT_RETURN_STATUS}")
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_OpenVDB_ABI)
|
||||||
|
if (_VDB_PRINT_VERSION_STRING)
|
||||||
|
string(REGEX REPLACE ".*abi([0-9]*).*" "\\1" _OpenVDB_ABI ${_VDB_PRINT_VERSION_STRING})
|
||||||
|
endif ()
|
||||||
|
if(${_OpenVDB_ABI} STREQUAL ${_VDB_PRINT_VERSION_STRING})
|
||||||
|
set(_OpenVDB_ABI "")
|
||||||
|
endif()
|
||||||
|
unset(_VDB_PRINT_RETURN_STATUS)
|
||||||
|
unset(_VDB_PRINT_VERSION_STRING)
|
||||||
|
|
||||||
|
if(_VDB_ABI)
|
||||||
|
set(${_VDB_ABI} ${_OpenVDB_ABI} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
269
cmake/modules/PrecompiledHeader.cmake
Normal file
269
cmake/modules/PrecompiledHeader.cmake
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
# Function for setting up precompiled headers. Usage:
|
||||||
|
#
|
||||||
|
# add_library/executable(target
|
||||||
|
# pchheader.c pchheader.cpp pchheader.h)
|
||||||
|
#
|
||||||
|
# add_precompiled_header(target pchheader.h
|
||||||
|
# [FORCEINCLUDE]
|
||||||
|
# [SOURCE_C pchheader.c]
|
||||||
|
# [SOURCE_CXX pchheader.cpp])
|
||||||
|
#
|
||||||
|
# Options:
|
||||||
|
#
|
||||||
|
# FORCEINCLUDE: Add compiler flags to automatically include the
|
||||||
|
# pchheader.h from every source file. Works with both GCC and
|
||||||
|
# MSVC. This is recommended.
|
||||||
|
#
|
||||||
|
# SOURCE_C/CXX: Specifies the .c/.cpp source file that includes
|
||||||
|
# pchheader.h for generating the pre-compiled header
|
||||||
|
# output. Defaults to pchheader.c. Only required for MSVC.
|
||||||
|
#
|
||||||
|
# Caveats:
|
||||||
|
#
|
||||||
|
# * Its not currently possible to use the same precompiled-header in
|
||||||
|
# more than a single target in the same directory (No way to set
|
||||||
|
# the source file properties differently for each target).
|
||||||
|
#
|
||||||
|
# * MSVC: A source file with the same name as the header must exist
|
||||||
|
# and be included in the target (E.g. header.cpp). Name of file
|
||||||
|
# can be changed using the SOURCE_CXX/SOURCE_C options.
|
||||||
|
#
|
||||||
|
# License:
|
||||||
|
#
|
||||||
|
# Copyright (C) 2009-2017 Lars Christensen <larsch@belunktum.dk>
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person
|
||||||
|
# obtaining a copy of this software and associated documentation files
|
||||||
|
# (the 'Software') deal in the Software without restriction,
|
||||||
|
# including without limitation the rights to use, copy, modify, merge,
|
||||||
|
# publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
# and to permit persons to whom the Software is furnished to do so,
|
||||||
|
# subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be
|
||||||
|
# included in all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
# Use the new builtin CMake function if possible or fall back to the old one.
|
||||||
|
if (CMAKE_VERSION VERSION_LESS 3.16)
|
||||||
|
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
macro(combine_arguments _variable)
|
||||||
|
set(_result "")
|
||||||
|
foreach(_element ${${_variable}})
|
||||||
|
set(_result "${_result} \"${_element}\"")
|
||||||
|
endforeach()
|
||||||
|
string(STRIP "${_result}" _result)
|
||||||
|
set(${_variable} "${_result}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
function(export_all_flags _filename)
|
||||||
|
set(_include_directories "$<TARGET_PROPERTY:${_target},INCLUDE_DIRECTORIES>")
|
||||||
|
set(_compile_definitions "$<TARGET_PROPERTY:${_target},COMPILE_DEFINITIONS>")
|
||||||
|
set(_compile_flags "$<TARGET_PROPERTY:${_target},COMPILE_FLAGS>")
|
||||||
|
set(_compile_options "$<TARGET_PROPERTY:${_target},COMPILE_OPTIONS>")
|
||||||
|
|
||||||
|
#handle config-specific cxx flags
|
||||||
|
string(TOUPPER ${CMAKE_BUILD_TYPE} _config)
|
||||||
|
set(_build_cxx_flags ${CMAKE_CXX_FLAGS_${_config}})
|
||||||
|
|
||||||
|
#handle fpie option
|
||||||
|
get_target_property(_fpie ${_target} POSITION_INDEPENDENT_CODE)
|
||||||
|
if (_fpie AND CMAKE_POSITION_INDEPENDENT_CODE)
|
||||||
|
list(APPEND _compile_options ${CMAKE_CXX_COMPILE_OPTIONS_PIC})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#handle compiler standard (GCC only)
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
get_target_property(_cxx_standard ${_target} CXX_STANDARD)
|
||||||
|
if ((NOT "${_cxx_standard}" STREQUAL NOTFOUND) AND (NOT "${_cxx_standard}" STREQUAL ""))
|
||||||
|
get_target_property(_cxx_extensions ${_target} CXX_EXTENSIONS)
|
||||||
|
get_property(_exists TARGET ${_target} PROPERTY CXX_EXTENSIONS SET)
|
||||||
|
if (NOT _exists OR ${_cxx_extensions})
|
||||||
|
list(APPEND _compile_options "-std=gnu++${_cxx_standard}")
|
||||||
|
else()
|
||||||
|
list(APPEND _compile_options "-std=c++${_cxx_standard}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_include_directories "$<$<BOOL:${_include_directories}>:-I$<JOIN:${_include_directories},\n-I>\n>")
|
||||||
|
set(_compile_definitions "$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions},\n-D>\n>")
|
||||||
|
set(_compile_flags "$<$<BOOL:${_compile_flags}>:$<JOIN:${_compile_flags},\n>\n>")
|
||||||
|
set(_compile_options "$<$<BOOL:${_compile_options}>:$<JOIN:${_compile_options},\n>\n>")
|
||||||
|
set(_cxx_flags "$<$<BOOL:${CMAKE_CXX_FLAGS}>:${CMAKE_CXX_FLAGS}\n>$<$<BOOL:${_build_cxx_flags}>:${_build_cxx_flags}\n>")
|
||||||
|
file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}${_cxx_flags}\n")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(add_precompiled_header _target _input)
|
||||||
|
|
||||||
|
message(STATUS "Adding precompiled header ${_input} to target ${_target} with legacy method. "
|
||||||
|
"Update your cmake instance to use the native PCH functions.")
|
||||||
|
|
||||||
|
cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C" "" ${ARGN})
|
||||||
|
|
||||||
|
get_filename_component(_input_we ${_input} NAME_WE)
|
||||||
|
get_filename_component(_input_full ${_input} ABSOLUTE)
|
||||||
|
file(TO_NATIVE_PATH "${_input_full}" _input_fullpath)
|
||||||
|
|
||||||
|
if(NOT _PCH_SOURCE_CXX)
|
||||||
|
set(_PCH_SOURCE_CXX "${_input_we}.cpp")
|
||||||
|
endif()
|
||||||
|
if(NOT _PCH_SOURCE_C)
|
||||||
|
set(_PCH_SOURCE_C "${_input_we}.c")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(_pch_cxx_pch "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/cxx_${_input_we}.pch")
|
||||||
|
set(_pch_c_pch "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/c_${_input_we}.pch")
|
||||||
|
|
||||||
|
get_target_property(sources ${_target} SOURCES)
|
||||||
|
foreach(_source ${sources})
|
||||||
|
set(_pch_compile_flags "")
|
||||||
|
if(_source MATCHES \\.\(cc|cxx|cpp|c\)$)
|
||||||
|
if(_source MATCHES \\.\(cpp|cxx|cc\)$)
|
||||||
|
set(_pch_header "${_input}")
|
||||||
|
set(_pch "${_pch_cxx_pch}")
|
||||||
|
else()
|
||||||
|
set(_pch_header "${_input}")
|
||||||
|
set(_pch "${_pch_c_pch}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_source STREQUAL "${_PCH_SOURCE_CXX}")
|
||||||
|
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_cxx_pch}\" \"/Yc${_input}\"")
|
||||||
|
set(_pch_source_cxx_found TRUE)
|
||||||
|
set_source_files_properties("${_source}" PROPERTIES OBJECT_OUTPUTS "${_pch_cxx_pch}")
|
||||||
|
elseif(_source STREQUAL "${_PCH_SOURCE_C}")
|
||||||
|
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_c_pch}\" \"/Yc${_input}\"")
|
||||||
|
set(_pch_source_c_found TRUE)
|
||||||
|
set_source_files_properties("${_source}" PROPERTIES OBJECT_OUTPUTS "${_pch_c_pch}")
|
||||||
|
else()
|
||||||
|
if(_source MATCHES \\.\(cpp|cxx|cc\)$)
|
||||||
|
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_cxx_pch}\" \"/Yu${_input_fullpath}\"")
|
||||||
|
set(_pch_source_cxx_needed TRUE)
|
||||||
|
set_source_files_properties("${_source}" PROPERTIES OBJECT_DEPENDS "${_pch_cxx_pch}")
|
||||||
|
else()
|
||||||
|
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_c_pch}\" \"/Yu${_input_fullpath}\"")
|
||||||
|
set(_pch_source_c_needed TRUE)
|
||||||
|
set_source_files_properties("${_source}" PROPERTIES OBJECT_DEPENDS "${_pch_c_pch}")
|
||||||
|
endif()
|
||||||
|
if(_PCH_FORCEINCLUDE)
|
||||||
|
set(_pch_compile_flags "${_pch_compile_flags} /FI${_input_fullpath}")
|
||||||
|
endif(_PCH_FORCEINCLUDE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_source_file_property(_object_depends "${_source}" OBJECT_DEPENDS)
|
||||||
|
if(NOT _object_depends)
|
||||||
|
set(_object_depends)
|
||||||
|
endif()
|
||||||
|
if(_PCH_FORCEINCLUDE)
|
||||||
|
list(APPEND _object_depends "${CMAKE_CURRENT_SOURCE_DIR}/${_pch_header}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_source_files_properties(${_source} PROPERTIES
|
||||||
|
COMPILE_FLAGS "${_pch_compile_flags}"
|
||||||
|
OBJECT_DEPENDS "${_object_depends}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(_pch_source_cxx_needed AND NOT _pch_source_cxx_found)
|
||||||
|
message(FATAL_ERROR "A source file ${_PCH_SOURCE_CXX} for ${_input} is required for MSVC builds. Can be set with the SOURCE_CXX option.")
|
||||||
|
endif()
|
||||||
|
if(_pch_source_c_needed AND NOT _pch_source_c_found)
|
||||||
|
message(FATAL_ERROR "A source file ${_PCH_SOURCE_C} for ${_input} is required for MSVC builds. Can be set with the SOURCE_C option.")
|
||||||
|
endif()
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
get_filename_component(_name ${_input} NAME)
|
||||||
|
set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
|
||||||
|
set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch")
|
||||||
|
set(_pchfile "${_pch_binary_dir}/${_input}")
|
||||||
|
set(_outdir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch/${_name}.gch")
|
||||||
|
file(MAKE_DIRECTORY "${_outdir}")
|
||||||
|
set(_output_cxx "${_outdir}/.c++")
|
||||||
|
set(_output_c "${_outdir}/.c")
|
||||||
|
|
||||||
|
set(_pch_flags_file "${_pch_binary_dir}/compile_flags.rsp")
|
||||||
|
export_all_flags("${_pch_flags_file}")
|
||||||
|
set(_compiler_FLAGS "@${_pch_flags_file}")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${_pchfile}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${_pch_header}" "${_pchfile}"
|
||||||
|
DEPENDS "${_pch_header}"
|
||||||
|
COMMENT "Updating ${_name}")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${_output_cxx}"
|
||||||
|
COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" "${_pchfile}"
|
||||||
|
DEPENDS "${_pchfile}" "${_pch_flags_file}"
|
||||||
|
COMMENT "Precompiling ${_name} for ${_target} (C++)")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${_output_c}"
|
||||||
|
COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" "${_pchfile}"
|
||||||
|
DEPENDS "${_pchfile}" "${_pch_flags_file}"
|
||||||
|
COMMENT "Precompiling ${_name} for ${_target} (C)")
|
||||||
|
|
||||||
|
get_property(_sources TARGET ${_target} PROPERTY SOURCES)
|
||||||
|
foreach(_source ${_sources})
|
||||||
|
set(_pch_compile_flags "")
|
||||||
|
|
||||||
|
if(_source MATCHES \\.\(cc|cxx|cpp|c\)$)
|
||||||
|
get_source_file_property(_pch_compile_flags "${_source}" COMPILE_FLAGS)
|
||||||
|
if(NOT _pch_compile_flags)
|
||||||
|
set(_pch_compile_flags)
|
||||||
|
endif()
|
||||||
|
separate_arguments(_pch_compile_flags)
|
||||||
|
list(APPEND _pch_compile_flags -Winvalid-pch)
|
||||||
|
if(_PCH_FORCEINCLUDE)
|
||||||
|
list(APPEND _pch_compile_flags -include "${_pchfile}")
|
||||||
|
else(_PCH_FORCEINCLUDE)
|
||||||
|
list(APPEND _pch_compile_flags "-I${_pch_binary_dir}")
|
||||||
|
endif(_PCH_FORCEINCLUDE)
|
||||||
|
|
||||||
|
get_source_file_property(_object_depends "${_source}" OBJECT_DEPENDS)
|
||||||
|
if(NOT _object_depends)
|
||||||
|
set(_object_depends)
|
||||||
|
endif()
|
||||||
|
list(APPEND _object_depends "${_pchfile}")
|
||||||
|
if(_source MATCHES \\.\(cc|cxx|cpp\)$)
|
||||||
|
list(APPEND _object_depends "${_output_cxx}")
|
||||||
|
else()
|
||||||
|
list(APPEND _object_depends "${_output_c}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
combine_arguments(_pch_compile_flags)
|
||||||
|
set_source_files_properties(${_source} PROPERTIES
|
||||||
|
COMPILE_FLAGS "${_pch_compile_flags}"
|
||||||
|
OBJECT_DEPENDS "${_object_depends}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
function(add_precompiled_header _target _input)
|
||||||
|
message(STATUS "Adding precompiled header ${_input} to target ${_target}.")
|
||||||
|
target_precompile_headers(${_target} PRIVATE ${_input})
|
||||||
|
|
||||||
|
get_target_property(_sources ${_target} SOURCES)
|
||||||
|
list(FILTER _sources INCLUDE REGEX ".*\\.mm?")
|
||||||
|
|
||||||
|
if (_sources)
|
||||||
|
message(STATUS "PCH skipping sources: ${_sources}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set_source_files_properties(${_sources} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
endif (CMAKE_VERSION VERSION_LESS 3.16)
|
||||||
77
cmake/modules/SelectLibraryConfigurations_SLIC3R.cmake
Normal file
77
cmake/modules/SelectLibraryConfigurations_SLIC3R.cmake
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# Modified from the CMake github master.
|
||||||
|
# required by the bundled FindCURL.cmake
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# SelectLibraryConfigurations
|
||||||
|
# ---------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# select_library_configurations( basename )
|
||||||
|
#
|
||||||
|
# This macro takes a library base name as an argument, and will choose
|
||||||
|
# good values for basename_LIBRARY, basename_LIBRARIES,
|
||||||
|
# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what
|
||||||
|
# has been found and set. If only basename_LIBRARY_RELEASE is defined,
|
||||||
|
# basename_LIBRARY will be set to the release value, and
|
||||||
|
# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND.
|
||||||
|
# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will
|
||||||
|
# take the debug value, and basename_LIBRARY_RELEASE will be set to
|
||||||
|
# basename_LIBRARY_RELEASE-NOTFOUND.
|
||||||
|
#
|
||||||
|
# If the generator supports configuration types, then basename_LIBRARY
|
||||||
|
# and basename_LIBRARIES will be set with debug and optimized flags
|
||||||
|
# specifying the library to be used for the given configuration. If no
|
||||||
|
# build type has been set or the generator in use does not support
|
||||||
|
# configuration types, then basename_LIBRARY and basename_LIBRARIES will
|
||||||
|
# take only the release value, or the debug value if the release one is
|
||||||
|
# not set.
|
||||||
|
|
||||||
|
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
|
||||||
|
# Dicharry <wdicharry@stellarscience.com>.
|
||||||
|
|
||||||
|
macro( select_library_configurations_SLIC3R basename )
|
||||||
|
if(NOT ${basename}_LIBRARY_RELEASE)
|
||||||
|
set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
|
||||||
|
endif()
|
||||||
|
if(NOT ${basename}_LIBRARY_DEBUG)
|
||||||
|
set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
|
||||||
|
NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
|
||||||
|
( _isMultiConfig OR CMAKE_BUILD_TYPE ) )
|
||||||
|
# if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
|
||||||
|
# single-config generators, set optimized and debug libraries
|
||||||
|
set( ${basename}_LIBRARY "" )
|
||||||
|
foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
|
||||||
|
list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
|
||||||
|
endforeach()
|
||||||
|
foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
|
||||||
|
list( APPEND ${basename}_LIBRARY debug "${_libname}" )
|
||||||
|
endforeach()
|
||||||
|
elseif( ${basename}_LIBRARY_RELEASE )
|
||||||
|
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
|
||||||
|
elseif( ${basename}_LIBRARY_DEBUG )
|
||||||
|
set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} )
|
||||||
|
else()
|
||||||
|
set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
|
||||||
|
|
||||||
|
if( ${basename}_LIBRARY )
|
||||||
|
set( ${basename}_FOUND TRUE )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced( ${basename}_LIBRARY_RELEASE
|
||||||
|
${basename}_LIBRARY_DEBUG
|
||||||
|
)
|
||||||
|
endmacro()
|
||||||
89
cmake/modules/bin2h.cmake
Normal file
89
cmake/modules/bin2h.cmake
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# Source: https://gist.github.com/sivachandran/3a0de157dccef822a230#file-bin2h-cmake
|
||||||
|
# Added modifications to suit prusaslicer
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
# Function to wrap a given string into multiple lines at the given column position.
|
||||||
|
# Parameters:
|
||||||
|
# VARIABLE - The name of the CMake variable holding the string.
|
||||||
|
# AT_COLUMN - The column position at which string will be wrapped.
|
||||||
|
function(WRAP_STRING)
|
||||||
|
set(oneValueArgs VARIABLE AT_COLUMN)
|
||||||
|
cmake_parse_arguments(WRAP_STRING "${options}" "${oneValueArgs}" "" ${ARGN})
|
||||||
|
|
||||||
|
string(LENGTH ${${WRAP_STRING_VARIABLE}} stringLength)
|
||||||
|
math(EXPR offset "0")
|
||||||
|
|
||||||
|
while(stringLength GREATER 0)
|
||||||
|
|
||||||
|
if(stringLength GREATER ${WRAP_STRING_AT_COLUMN})
|
||||||
|
math(EXPR length "${WRAP_STRING_AT_COLUMN}")
|
||||||
|
else()
|
||||||
|
math(EXPR length "${stringLength}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(SUBSTRING ${${WRAP_STRING_VARIABLE}} ${offset} ${length} line)
|
||||||
|
set(lines "${lines}\n${line}")
|
||||||
|
|
||||||
|
math(EXPR stringLength "${stringLength} - ${length}")
|
||||||
|
math(EXPR offset "${offset} + ${length}")
|
||||||
|
endwhile()
|
||||||
|
|
||||||
|
set(${WRAP_STRING_VARIABLE} "${lines}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Function to embed contents of a file as byte array in C/C++ header file(.h). The header file
|
||||||
|
# will contain a byte array and integer variable holding the size of the array.
|
||||||
|
# Parameters
|
||||||
|
# SOURCE_FILE - The path of source file whose contents will be embedded in the header file.
|
||||||
|
# VARIABLE_NAME - The name of the variable for the byte array. The string "_SIZE" will be append
|
||||||
|
# to this name and will be used a variable name for size variable.
|
||||||
|
# HEADER_FILE - The path of header file.
|
||||||
|
# APPEND - If specified appends to the header file instead of overwriting it
|
||||||
|
# NULL_TERMINATE - If specified a null byte(zero) will be append to the byte array. This will be
|
||||||
|
# useful if the source file is a text file and we want to use the file contents
|
||||||
|
# as string. But the size variable holds size of the byte array without this
|
||||||
|
# null byte.
|
||||||
|
# Usage:
|
||||||
|
# bin2h(SOURCE_FILE "Logo.png" HEADER_FILE "Logo.h" VARIABLE_NAME "LOGO_PNG")
|
||||||
|
function(BIN2H)
|
||||||
|
set(options APPEND NULL_TERMINATE ADD_WARNING_TEXT)
|
||||||
|
set(oneValueArgs SOURCE_FILE VARIABLE_NAME HEADER_FILE)
|
||||||
|
cmake_parse_arguments(BIN2H "${options}" "${oneValueArgs}" "" ${ARGN})
|
||||||
|
|
||||||
|
# reads source file contents as hex string
|
||||||
|
file(READ ${BIN2H_SOURCE_FILE} hexString HEX)
|
||||||
|
string(LENGTH ${hexString} hexStringLength)
|
||||||
|
|
||||||
|
# appends null byte if asked
|
||||||
|
if(BIN2H_NULL_TERMINATE)
|
||||||
|
set(hexString "${hexString}00")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# wraps the hex string into multiple lines at column 32(i.e. 16 bytes per line)
|
||||||
|
wrap_string(VARIABLE hexString AT_COLUMN 32)
|
||||||
|
math(EXPR arraySize "${hexStringLength} / 2")
|
||||||
|
|
||||||
|
# adds '0x' prefix and comma suffix before and after every byte respectively
|
||||||
|
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1, " arrayValues ${hexString})
|
||||||
|
# removes trailing comma
|
||||||
|
string(REGEX REPLACE ", $" "" arrayValues ${arrayValues})
|
||||||
|
|
||||||
|
# converts the variable name into proper C identifier
|
||||||
|
string(MAKE_C_IDENTIFIER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME)
|
||||||
|
# string(TOUPPER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME)
|
||||||
|
|
||||||
|
# declares byte array and the length variables
|
||||||
|
set(arrayDefinition "const unsigned char ${BIN2H_VARIABLE_NAME}[] = { ${arrayValues} };")
|
||||||
|
set(arraySizeDefinition "const size_t ${BIN2H_VARIABLE_NAME}_SIZE = ${arraySize};")
|
||||||
|
set(warnTxt "")
|
||||||
|
if (BIN2H_ADD_WARNING_TEXT)
|
||||||
|
set(warnTxt "/* WARN: This file is auto-generated from ${BIN2H_SOURCE_FILE} */\n")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(declarations "${warnTxt}${arrayDefinition}\n\n${arraySizeDefinition}\n\n")
|
||||||
|
if(BIN2H_APPEND)
|
||||||
|
file(APPEND ${BIN2H_HEADER_FILE} "${declarations}")
|
||||||
|
else()
|
||||||
|
file(WRITE ${BIN2H_HEADER_FILE} "${declarations}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
22
cmake/msvc/xs.wperl.props.in
Normal file
22
cmake/msvc/xs.wperl.props.in
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file is autogenerated by CMake
|
||||||
|
Note: In the .in template file, the $ {}-style variables are interpreted by CMake while the $()-style variables belong to MSVC
|
||||||
|
-->
|
||||||
|
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Label="PropertySheets">
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<ExecutablePath>$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);${PROPS_PERL_BIN_PATH}\;</ExecutablePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup />
|
||||||
|
<ItemGroup />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<LocalDebuggerCommand>${PROPS_PERL_EXECUTABLE}</LocalDebuggerCommand>
|
||||||
|
<LocalDebuggerCommandArguments>slic3r.pl</LocalDebuggerCommandArguments>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
<LocalDebuggerWorkingDirectory>${PROPS_CMAKE_SOURCE_DIR}</LocalDebuggerWorkingDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
28
deps/Blosc/Blosc.cmake
vendored
Normal file
28
deps/Blosc/Blosc.cmake
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
set(_build_shared ON)
|
||||||
|
set(_build_static OFF)
|
||||||
|
else()
|
||||||
|
set(_build_shared OFF)
|
||||||
|
set(_build_static ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
qidistudio_add_cmake_project(Blosc
|
||||||
|
#URL https://github.com/Blosc/c-blosc/archive/refs/tags/v1.17.0.zip
|
||||||
|
#URL_HASH SHA256=7463a1df566704f212263312717ab2c36b45d45cba6cd0dccebf91b2cc4b4da9
|
||||||
|
URL https://github.com/tamasmeszaros/c-blosc/archive/refs/heads/v1.17.0_tm.zip
|
||||||
|
URL_HASH SHA256=dcb48bf43a672fa3de6a4b1de2c4c238709dad5893d1e097b8374ad84b1fc3b3
|
||||||
|
DEPENDS ${ZLIB_PKG}
|
||||||
|
# Patching upstream does not work this way with git version 2.28 installed on mac worker
|
||||||
|
# PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/blosc-mods.patch
|
||||||
|
CMAKE_ARGS
|
||||||
|
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||||
|
-DBUILD_SHARED=${_build_shared}
|
||||||
|
-DBUILD_STATIC=${_build_static}
|
||||||
|
-DBUILD_TESTS=OFF
|
||||||
|
-DBUILD_BENCHMARKS=OFF
|
||||||
|
-DPREFER_EXTERNAL_ZLIB=ON
|
||||||
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
add_debug_dep(dep_Blosc)
|
||||||
|
endif ()
|
||||||
469
deps/Blosc/blosc-mods.patch
vendored
Normal file
469
deps/Blosc/blosc-mods.patch
vendored
Normal file
@@ -0,0 +1,469 @@
|
|||||||
|
From 7cf6c014a36f1712efbdbe9bc52d2d4922b54673 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tamasmeszaros <meszaros.q@gmail.com>
|
||||||
|
Date: Wed, 30 Oct 2019 12:54:52 +0100
|
||||||
|
Subject: [PATCH] Blosc 1.17 fixes and cmake config script
|
||||||
|
|
||||||
|
Signed-off-by: tamasmeszaros <meszaros.q@gmail.com>
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 105 +++++++++++++++++-----------------
|
||||||
|
blosc/CMakeLists.txt | 118 +++++++++------------------------------
|
||||||
|
cmake/FindLZ4.cmake | 6 +-
|
||||||
|
cmake/FindSnappy.cmake | 8 ++-
|
||||||
|
cmake/FindZstd.cmake | 8 ++-
|
||||||
|
cmake_config.cmake.in | 24 ++++++++
|
||||||
|
internal-complibs/CMakeLists.txt | 35 ++++++++++++
|
||||||
|
7 files changed, 157 insertions(+), 147 deletions(-)
|
||||||
|
create mode 100644 cmake_config.cmake.in
|
||||||
|
create mode 100644 internal-complibs/CMakeLists.txt
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 59d9fab..e9134c2 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -71,7 +71,7 @@
|
||||||
|
# DEV: static includes blosc.a and blosc.h
|
||||||
|
|
||||||
|
|
||||||
|
-cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
+cmake_minimum_required(VERSION 3.1) # Threads::Threads target available from 3.1
|
||||||
|
if (NOT CMAKE_VERSION VERSION_LESS 3.3)
|
||||||
|
cmake_policy(SET CMP0063 NEW)
|
||||||
|
endif()
|
||||||
|
@@ -124,55 +124,30 @@ option(PREFER_EXTERNAL_ZSTD
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
-
|
||||||
|
-if(NOT DEACTIVATE_LZ4)
|
||||||
|
- if(PREFER_EXTERNAL_LZ4)
|
||||||
|
- find_package(LZ4)
|
||||||
|
- else()
|
||||||
|
- message(STATUS "Using LZ4 internal sources.")
|
||||||
|
- endif(PREFER_EXTERNAL_LZ4)
|
||||||
|
- # HAVE_LZ4 will be set to true because even if the library is
|
||||||
|
- # not found, we will use the included sources for it
|
||||||
|
- set(HAVE_LZ4 TRUE)
|
||||||
|
-endif(NOT DEACTIVATE_LZ4)
|
||||||
|
-
|
||||||
|
-if(NOT DEACTIVATE_SNAPPY)
|
||||||
|
- if(PREFER_EXTERNAL_SNAPPY)
|
||||||
|
- find_package(Snappy)
|
||||||
|
- else()
|
||||||
|
- message(STATUS "Using Snappy internal sources.")
|
||||||
|
- endif(PREFER_EXTERNAL_SNAPPY)
|
||||||
|
- # HAVE_SNAPPY will be set to true because even if the library is not found,
|
||||||
|
- # we will use the included sources for it
|
||||||
|
- set(HAVE_SNAPPY TRUE)
|
||||||
|
-endif(NOT DEACTIVATE_SNAPPY)
|
||||||
|
-
|
||||||
|
-if(NOT DEACTIVATE_ZLIB)
|
||||||
|
- # import the ZLIB_ROOT environment variable to help finding the zlib library
|
||||||
|
- if(PREFER_EXTERNAL_ZLIB)
|
||||||
|
- set(ZLIB_ROOT $ENV{ZLIB_ROOT})
|
||||||
|
- find_package(ZLIB)
|
||||||
|
- if (NOT ZLIB_FOUND )
|
||||||
|
- message(STATUS "No zlib found. Using internal sources.")
|
||||||
|
- endif (NOT ZLIB_FOUND )
|
||||||
|
- else()
|
||||||
|
- message(STATUS "Using zlib internal sources.")
|
||||||
|
- endif(PREFER_EXTERNAL_ZLIB)
|
||||||
|
- # HAVE_ZLIB will be set to true because even if the library is not found,
|
||||||
|
- # we will use the included sources for it
|
||||||
|
- set(HAVE_ZLIB TRUE)
|
||||||
|
-endif(NOT DEACTIVATE_ZLIB)
|
||||||
|
-
|
||||||
|
-if (NOT DEACTIVATE_ZSTD)
|
||||||
|
- if (PREFER_EXTERNAL_ZSTD)
|
||||||
|
- find_package(Zstd)
|
||||||
|
- else ()
|
||||||
|
- message(STATUS "Using ZSTD internal sources.")
|
||||||
|
- endif (PREFER_EXTERNAL_ZSTD)
|
||||||
|
- # HAVE_ZSTD will be set to true because even if the library is
|
||||||
|
- # not found, we will use the included sources for it
|
||||||
|
- set(HAVE_ZSTD TRUE)
|
||||||
|
-endif (NOT DEACTIVATE_ZSTD)
|
||||||
|
+set(LIBS "")
|
||||||
|
+macro(use_package _pkg _tgt)
|
||||||
|
+ string(TOUPPER ${_pkg} _PKG)
|
||||||
|
+ if(NOT DEACTIVATE_${_PKG})
|
||||||
|
+ if(PREFER_EXTERNAL_${_PKG})
|
||||||
|
+ find_package(${_pkg})
|
||||||
|
+ if (NOT ${_pkg}_FOUND )
|
||||||
|
+ message(STATUS "No ${_pkg} found. Using internal sources.")
|
||||||
|
+ endif()
|
||||||
|
+ else()
|
||||||
|
+ message(STATUS "Using ${_pkg} internal sources.")
|
||||||
|
+ endif(PREFER_EXTERNAL_${_PKG})
|
||||||
|
+ # HAVE_${_pkg} will be set to true because even if the library is
|
||||||
|
+ # not found, we will use the included sources for it
|
||||||
|
+ set(HAVE_${_PKG} TRUE)
|
||||||
|
+ list(APPEND LIBS ${_pkg}::${_tgt})
|
||||||
|
+ endif(NOT DEACTIVATE_${_PKG})
|
||||||
|
+endmacro()
|
||||||
|
+
|
||||||
|
+set(ZLIB_ROOT $ENV{ZLIB_ROOT})
|
||||||
|
+use_package(ZLIB ZLIB)
|
||||||
|
+use_package(LZ4 LZ4)
|
||||||
|
+use_package(Snappy snappy)
|
||||||
|
+use_package(Zstd Zstd)
|
||||||
|
|
||||||
|
# create the config.h file
|
||||||
|
configure_file ("blosc/config.h.in" "blosc/config.h" )
|
||||||
|
@@ -316,6 +291,7 @@ endif()
|
||||||
|
|
||||||
|
|
||||||
|
# subdirectories
|
||||||
|
+add_subdirectory(internal-complibs)
|
||||||
|
add_subdirectory(blosc)
|
||||||
|
|
||||||
|
if(BUILD_TESTS)
|
||||||
|
@@ -328,7 +304,6 @@ if(BUILD_BENCHMARKS)
|
||||||
|
add_subdirectory(bench)
|
||||||
|
endif(BUILD_BENCHMARKS)
|
||||||
|
|
||||||
|
-
|
||||||
|
# uninstall target
|
||||||
|
if (BLOSC_INSTALL)
|
||||||
|
configure_file(
|
||||||
|
@@ -338,10 +313,38 @@ if (BLOSC_INSTALL)
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/blosc.pc"
|
||||||
|
DESTINATION lib/pkgconfig COMPONENT DEV)
|
||||||
|
|
||||||
|
+ configure_file(
|
||||||
|
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake_config.cmake.in"
|
||||||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscConfig.cmake"
|
||||||
|
+ @ONLY)
|
||||||
|
+
|
||||||
|
configure_file(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
|
IMMEDIATE @ONLY)
|
||||||
|
+
|
||||||
|
+ include(CMakePackageConfigHelpers)
|
||||||
|
+ write_basic_package_version_file(
|
||||||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscConfigVersion.cmake"
|
||||||
|
+ VERSION ${BLOSC_VERSION_MAJOR}.${BLOSC_VERSION_MINOR}.${BLOSC_VERSION_PATCH}
|
||||||
|
+ COMPATIBILITY AnyNewerVersion
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
+ export(EXPORT BloscTargets
|
||||||
|
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscTargets.cmake"
|
||||||
|
+ NAMESPACE Blosc::)
|
||||||
|
+
|
||||||
|
+ install(EXPORT BloscTargets
|
||||||
|
+ FILE BloscTargets.cmake
|
||||||
|
+ NAMESPACE Blosc::
|
||||||
|
+ DESTINATION lib/cmake/Blosc
|
||||||
|
+ EXPORT_LINK_INTERFACE_LIBRARIES)
|
||||||
|
+
|
||||||
|
+ install(FILES
|
||||||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscConfig.cmake"
|
||||||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/cmakeexports/BloscConfigVersion.cmake"
|
||||||
|
+ DESTINATION lib/cmake/Blosc COMPONENT DEV)
|
||||||
|
+
|
||||||
|
add_custom_target(uninstall
|
||||||
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||||
|
endif()
|
||||||
|
diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt
|
||||||
|
index 1d1bebe..f554abe 100644
|
||||||
|
--- a/blosc/CMakeLists.txt
|
||||||
|
+++ b/blosc/CMakeLists.txt
|
||||||
|
@@ -1,52 +1,11 @@
|
||||||
|
# a simple way to detect that we are using CMAKE
|
||||||
|
add_definitions(-DUSING_CMAKE)
|
||||||
|
|
||||||
|
-set(INTERNAL_LIBS ${PROJECT_SOURCE_DIR}/internal-complibs)
|
||||||
|
-
|
||||||
|
# Hide symbols by default unless they're specifically exported.
|
||||||
|
# This makes it easier to keep the set of exported symbols the
|
||||||
|
# same across all compilers/platforms.
|
||||||
|
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||||
|
|
||||||
|
-# includes
|
||||||
|
-set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
-if(NOT DEACTIVATE_LZ4)
|
||||||
|
- if (LZ4_FOUND)
|
||||||
|
- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_INCLUDE_DIR})
|
||||||
|
- else(LZ4_FOUND)
|
||||||
|
- set(LZ4_LOCAL_DIR ${INTERNAL_LIBS}/lz4-1.9.1)
|
||||||
|
- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_LOCAL_DIR})
|
||||||
|
- endif(LZ4_FOUND)
|
||||||
|
-endif(NOT DEACTIVATE_LZ4)
|
||||||
|
-
|
||||||
|
-if(NOT DEACTIVATE_SNAPPY)
|
||||||
|
- if (SNAPPY_FOUND)
|
||||||
|
- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${SNAPPY_INCLUDE_DIR})
|
||||||
|
- else(SNAPPY_FOUND)
|
||||||
|
- set(SNAPPY_LOCAL_DIR ${INTERNAL_LIBS}/snappy-1.1.1)
|
||||||
|
- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${SNAPPY_LOCAL_DIR})
|
||||||
|
- endif(SNAPPY_FOUND)
|
||||||
|
-endif(NOT DEACTIVATE_SNAPPY)
|
||||||
|
-
|
||||||
|
-if(NOT DEACTIVATE_ZLIB)
|
||||||
|
- if (ZLIB_FOUND)
|
||||||
|
- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
||||||
|
- else(ZLIB_FOUND)
|
||||||
|
- set(ZLIB_LOCAL_DIR ${INTERNAL_LIBS}/zlib-1.2.8)
|
||||||
|
- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_LOCAL_DIR})
|
||||||
|
- endif(ZLIB_FOUND)
|
||||||
|
-endif(NOT DEACTIVATE_ZLIB)
|
||||||
|
-
|
||||||
|
-if (NOT DEACTIVATE_ZSTD)
|
||||||
|
- if (ZSTD_FOUND)
|
||||||
|
- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIR})
|
||||||
|
- else (ZSTD_FOUND)
|
||||||
|
- set(ZSTD_LOCAL_DIR ${INTERNAL_LIBS}/zstd-1.4.1)
|
||||||
|
- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_LOCAL_DIR} ${ZSTD_LOCAL_DIR}/common)
|
||||||
|
- endif (ZSTD_FOUND)
|
||||||
|
-endif (NOT DEACTIVATE_ZSTD)
|
||||||
|
-
|
||||||
|
-include_directories(${BLOSC_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
# library sources
|
||||||
|
set(SOURCES blosc.c blosclz.c fastcopy.c shuffle-generic.c bitshuffle-generic.c
|
||||||
|
@@ -73,53 +32,13 @@ if(WIN32)
|
||||||
|
message(STATUS "using the internal pthread library for win32 systems.")
|
||||||
|
set(SOURCES ${SOURCES} win32/pthread.c)
|
||||||
|
else(NOT Threads_FOUND)
|
||||||
|
- set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
+ list(APPEND LIBS Threads::Threads)
|
||||||
|
endif(NOT Threads_FOUND)
|
||||||
|
else(WIN32)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
- set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
+ list(APPEND LIBS Threads::Threads)
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
-if(NOT DEACTIVATE_LZ4)
|
||||||
|
- if(LZ4_FOUND)
|
||||||
|
- set(LIBS ${LIBS} ${LZ4_LIBRARY})
|
||||||
|
- else(LZ4_FOUND)
|
||||||
|
- file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c)
|
||||||
|
- set(SOURCES ${SOURCES} ${LZ4_FILES})
|
||||||
|
- endif(LZ4_FOUND)
|
||||||
|
-endif(NOT DEACTIVATE_LZ4)
|
||||||
|
-
|
||||||
|
-if(NOT DEACTIVATE_SNAPPY)
|
||||||
|
- if(SNAPPY_FOUND)
|
||||||
|
- set(LIBS ${LIBS} ${SNAPPY_LIBRARY})
|
||||||
|
- else(SNAPPY_FOUND)
|
||||||
|
- file(GLOB SNAPPY_FILES ${SNAPPY_LOCAL_DIR}/*.cc)
|
||||||
|
- set(SOURCES ${SOURCES} ${SNAPPY_FILES})
|
||||||
|
- endif(SNAPPY_FOUND)
|
||||||
|
-endif(NOT DEACTIVATE_SNAPPY)
|
||||||
|
-
|
||||||
|
-if(NOT DEACTIVATE_ZLIB)
|
||||||
|
- if(ZLIB_FOUND)
|
||||||
|
- set(LIBS ${LIBS} ${ZLIB_LIBRARY})
|
||||||
|
- else(ZLIB_FOUND)
|
||||||
|
- file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c)
|
||||||
|
- set(SOURCES ${SOURCES} ${ZLIB_FILES})
|
||||||
|
- endif(ZLIB_FOUND)
|
||||||
|
-endif(NOT DEACTIVATE_ZLIB)
|
||||||
|
-
|
||||||
|
-if (NOT DEACTIVATE_ZSTD)
|
||||||
|
- if (ZSTD_FOUND)
|
||||||
|
- set(LIBS ${LIBS} ${ZSTD_LIBRARY})
|
||||||
|
- else (ZSTD_FOUND)
|
||||||
|
- file(GLOB ZSTD_FILES
|
||||||
|
- ${ZSTD_LOCAL_DIR}/common/*.c
|
||||||
|
- ${ZSTD_LOCAL_DIR}/compress/*.c
|
||||||
|
- ${ZSTD_LOCAL_DIR}/decompress/*.c)
|
||||||
|
- set(SOURCES ${SOURCES} ${ZSTD_FILES})
|
||||||
|
- endif (ZSTD_FOUND)
|
||||||
|
-endif (NOT DEACTIVATE_ZSTD)
|
||||||
|
-
|
||||||
|
-
|
||||||
|
# targets
|
||||||
|
if (BUILD_SHARED)
|
||||||
|
add_library(blosc_shared SHARED ${SOURCES})
|
||||||
|
@@ -191,14 +110,17 @@ if (BUILD_TESTS)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
+add_library(blosc INTERFACE)
|
||||||
|
+
|
||||||
|
if (BUILD_SHARED)
|
||||||
|
- target_link_libraries(blosc_shared ${LIBS})
|
||||||
|
- target_include_directories(blosc_shared PUBLIC ${BLOSC_INCLUDE_DIRS})
|
||||||
|
+ target_link_libraries(blosc_shared PRIVATE ${LIBS})
|
||||||
|
+ target_include_directories(blosc_shared PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||||
|
+ target_link_libraries(blosc INTERFACE blosc_shared)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_TESTS)
|
||||||
|
- target_link_libraries(blosc_shared_testing ${LIBS})
|
||||||
|
- target_include_directories(blosc_shared_testing PUBLIC ${BLOSC_INCLUDE_DIRS})
|
||||||
|
+ target_link_libraries(blosc_shared_testing PRIVATE ${LIBS})
|
||||||
|
+ target_include_directories(blosc_shared_testing PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_STATIC)
|
||||||
|
@@ -207,17 +129,31 @@ if(BUILD_STATIC)
|
||||||
|
if (MSVC)
|
||||||
|
set_target_properties(blosc_static PROPERTIES PREFIX lib)
|
||||||
|
endif()
|
||||||
|
- target_link_libraries(blosc_static ${LIBS})
|
||||||
|
- target_include_directories(blosc_static PUBLIC ${BLOSC_INCLUDE_DIRS})
|
||||||
|
+ # With the static library, cmake has to deal with transitive dependencies
|
||||||
|
+ target_link_libraries(blosc_static PRIVATE ${LIBS})
|
||||||
|
+ target_include_directories(blosc_static PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||||
|
+ if (NOT BUILD_SHARED)
|
||||||
|
+ target_link_libraries(blosc INTERFACE blosc_static)
|
||||||
|
+ endif()
|
||||||
|
endif(BUILD_STATIC)
|
||||||
|
|
||||||
|
+
|
||||||
|
# install
|
||||||
|
if(BLOSC_INSTALL)
|
||||||
|
install(FILES blosc.h blosc-export.h DESTINATION include COMPONENT DEV)
|
||||||
|
+ set(_inst_libs "blosc")
|
||||||
|
if(BUILD_SHARED)
|
||||||
|
- install(TARGETS blosc_shared DESTINATION ${lib_dir} COMPONENT LIB)
|
||||||
|
+ list(APPEND _inst_libs blosc_shared)
|
||||||
|
endif(BUILD_SHARED)
|
||||||
|
if(BUILD_STATIC)
|
||||||
|
- install(TARGETS blosc_static DESTINATION ${lib_dir} COMPONENT DEV)
|
||||||
|
+ list(APPEND _inst_libs blosc_static)
|
||||||
|
endif(BUILD_STATIC)
|
||||||
|
+
|
||||||
|
+ install(TARGETS ${_inst_libs}
|
||||||
|
+ EXPORT BloscTargets
|
||||||
|
+ LIBRARY DESTINATION ${lib_dir}
|
||||||
|
+ ARCHIVE DESTINATION ${lib_dir}
|
||||||
|
+ RUNTIME DESTINATION bin
|
||||||
|
+ COMPONENT DEV
|
||||||
|
+ INCLUDES DESTINATION include)
|
||||||
|
endif(BLOSC_INSTALL)
|
||||||
|
diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake
|
||||||
|
index e581a80..05de6ef 100644
|
||||||
|
--- a/cmake/FindLZ4.cmake
|
||||||
|
+++ b/cmake/FindLZ4.cmake
|
||||||
|
@@ -5,6 +5,10 @@ find_library(LZ4_LIBRARY NAMES lz4)
|
||||||
|
if (LZ4_INCLUDE_DIR AND LZ4_LIBRARY)
|
||||||
|
set(LZ4_FOUND TRUE)
|
||||||
|
message(STATUS "Found LZ4 library: ${LZ4_LIBRARY}")
|
||||||
|
+ add_library(LZ4::LZ4 UNKNOWN IMPORTED)
|
||||||
|
+ set_target_properties(LZ4::LZ4 PROPERTIES
|
||||||
|
+ IMPORTED_LOCATION ${LZ4_LIBRARY}
|
||||||
|
+ INTERFACE_INCLUDE_DIRECTORIES ${LZ4_INCLUDE_DIR})
|
||||||
|
else ()
|
||||||
|
message(STATUS "No LZ4 library found. Using internal sources.")
|
||||||
|
-endif ()
|
||||||
|
+endif ()
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/cmake/FindSnappy.cmake b/cmake/FindSnappy.cmake
|
||||||
|
index 688d4d5..21dbee1 100644
|
||||||
|
--- a/cmake/FindSnappy.cmake
|
||||||
|
+++ b/cmake/FindSnappy.cmake
|
||||||
|
@@ -3,8 +3,12 @@ find_path(SNAPPY_INCLUDE_DIR snappy-c.h)
|
||||||
|
find_library(SNAPPY_LIBRARY NAMES snappy)
|
||||||
|
|
||||||
|
if (SNAPPY_INCLUDE_DIR AND SNAPPY_LIBRARY)
|
||||||
|
- set(SNAPPY_FOUND TRUE)
|
||||||
|
+ set(Snappy_FOUND TRUE)
|
||||||
|
+ add_library(Snappy::snappy UNKNOWN IMPORTED)
|
||||||
|
+ set_target_properties(Snappy::snappy PROPERTIES
|
||||||
|
+ IMPORTED_LOCATION ${SNAPPY_LIBRARY}
|
||||||
|
+ INTERFACE_INCLUDE_DIRECTORIES ${SNAPPY_INCLUDE_DIR})
|
||||||
|
message(STATUS "Found SNAPPY library: ${SNAPPY_LIBRARY}")
|
||||||
|
else ()
|
||||||
|
message(STATUS "No snappy found. Using internal sources.")
|
||||||
|
-endif ()
|
||||||
|
+endif ()
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/cmake/FindZstd.cmake b/cmake/FindZstd.cmake
|
||||||
|
index 7db4bb9..cabc2f8 100644
|
||||||
|
--- a/cmake/FindZstd.cmake
|
||||||
|
+++ b/cmake/FindZstd.cmake
|
||||||
|
@@ -3,8 +3,12 @@ find_path(ZSTD_INCLUDE_DIR zstd.h)
|
||||||
|
find_library(ZSTD_LIBRARY NAMES zstd)
|
||||||
|
|
||||||
|
if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY)
|
||||||
|
- set(ZSTD_FOUND TRUE)
|
||||||
|
+ set(Zstd_FOUND TRUE)
|
||||||
|
+ add_library(Zstd::Zstd UNKNOWN IMPORTED)
|
||||||
|
+ set_target_properties(Zstd::Zstd PROPERTIES
|
||||||
|
+ IMPORTED_LOCATION ${ZSTD_LIBRARY}
|
||||||
|
+ INTERFACE_INCLUDE_DIRECTORIES ${ZSTD_INCLUDE_DIR})
|
||||||
|
message(STATUS "Found Zstd library: ${ZSTD_LIBRARY}")
|
||||||
|
else ()
|
||||||
|
message(STATUS "No Zstd library found. Using internal sources.")
|
||||||
|
-endif ()
|
||||||
|
+endif ()
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/cmake_config.cmake.in b/cmake_config.cmake.in
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..0f6af24
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/cmake_config.cmake.in
|
||||||
|
@@ -0,0 +1,24 @@
|
||||||
|
+include(CMakeFindDependencyMacro)
|
||||||
|
+
|
||||||
|
+include("${CMAKE_CURRENT_LIST_DIR}/BloscTargets.cmake")
|
||||||
|
+
|
||||||
|
+function(_blosc_remap_configs from_Cfg to_Cfg)
|
||||||
|
+ string(TOUPPER ${from_Cfg} from_CFG)
|
||||||
|
+ string(TOLOWER ${from_Cfg} from_cfg)
|
||||||
|
+
|
||||||
|
+ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/BloscTargets-${from_cfg}.cmake)
|
||||||
|
+ foreach(tgt IN ITEMS blosc_static blosc_shared blosc)
|
||||||
|
+ if(TARGET Blosc::${tgt})
|
||||||
|
+ set_target_properties(Blosc::${tgt} PROPERTIES
|
||||||
|
+ MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg})
|
||||||
|
+ endif()
|
||||||
|
+ endforeach()
|
||||||
|
+ endif()
|
||||||
|
+endfunction()
|
||||||
|
+
|
||||||
|
+# MSVC will try to link RelWithDebInfo or MinSizeRel target with debug config
|
||||||
|
+# if no matching installation is present which would result in link errors.
|
||||||
|
+if(MSVC)
|
||||||
|
+ _blosc_remap_configs(RelWithDebInfo Release)
|
||||||
|
+ _blosc_remap_configs(MinSizeRel Release)
|
||||||
|
+endif()
|
||||||
|
diff --git a/internal-complibs/CMakeLists.txt b/internal-complibs/CMakeLists.txt
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..4586efa
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/internal-complibs/CMakeLists.txt
|
||||||
|
@@ -0,0 +1,35 @@
|
||||||
|
+macro(add_lib_target pkg tgt incdir files)
|
||||||
|
+ string(TOUPPER ${pkg} TGT)
|
||||||
|
+ if(NOT DEACTIVATE_${TGT} AND NOT ${pkg}_FOUND)
|
||||||
|
+ add_library(${tgt}_objs OBJECT ${files})
|
||||||
|
+ add_library(${tgt} INTERFACE)
|
||||||
|
+ target_include_directories(${tgt}_objs PRIVATE $<BUILD_INTERFACE:${incdir}>)
|
||||||
|
+ target_include_directories(${tgt} INTERFACE $<BUILD_INTERFACE:${incdir}>)
|
||||||
|
+ #set_target_properties(${tgt} PROPERTIES INTERFACE_SOURCES "$<TARGET_OBJECTS:${tgt}_objs>")
|
||||||
|
+ set_target_properties(${tgt}_objs PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
+ target_sources(${tgt} INTERFACE "$<BUILD_INTERFACE:$<TARGET_OBJECTS:${tgt}_objs>>")
|
||||||
|
+ add_library(${pkg}::${tgt} ALIAS ${tgt})
|
||||||
|
+
|
||||||
|
+ # This creates dummy (empty) interface targets in the exported config.
|
||||||
|
+ install(TARGETS ${tgt} EXPORT BloscTargets INCLUDES DESTINATION include)
|
||||||
|
+ endif()
|
||||||
|
+ unset(TGT)
|
||||||
|
+endmacro()
|
||||||
|
+
|
||||||
|
+set(ZLIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zlib-1.2.8)
|
||||||
|
+file(GLOB ZLIB_FILES ${ZLIB_DIR}/*.c)
|
||||||
|
+add_lib_target(ZLIB ZLIB ${ZLIB_DIR} "${ZLIB_FILES}")
|
||||||
|
+
|
||||||
|
+set(SNAPPY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/snappy-1.1.1)
|
||||||
|
+file(GLOB SNAPPY_FILES ${SNAPPY_DIR}/*.cc)
|
||||||
|
+add_lib_target(Snappy snappy ${SNAPPY_DIR} "${SNAPPY_FILES}")
|
||||||
|
+
|
||||||
|
+set(LZ4_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lz4-1.9.1)
|
||||||
|
+file(GLOB LZ4_FILES ${LZ4_DIR}/*.c)
|
||||||
|
+add_lib_target(LZ4 LZ4 ${LZ4_DIR} "${LZ4_FILES}")
|
||||||
|
+
|
||||||
|
+set(ZSTD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zstd-1.4.1)
|
||||||
|
+file(GLOB ZSTD_FILES ${ZSTD_DIR}/common/*.c ${ZSTD_DIR}/compress/*.c ${ZSTD_DIR}/decompress/*.c)
|
||||||
|
+add_lib_target(Zstd Zstd ${ZSTD_DIR} "${ZSTD_FILES}")
|
||||||
|
+target_include_directories(Zstd INTERFACE $<BUILD_INTERFACE:${ZSTD_DIR}/common>)
|
||||||
|
+target_include_directories(Zstd_objs PRIVATE $<BUILD_INTERFACE:${ZSTD_DIR}/common>)
|
||||||
|
\ No newline at end of file
|
||||||
|
--
|
||||||
|
2.16.2.windows.1
|
||||||
|
|
||||||
125
deps/Boost/0001-Boost-fix.patch
vendored
Normal file
125
deps/Boost/0001-Boost-fix.patch
vendored
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
From 1d6cd7c2f8640db3cda194c1b9b82f1e4b321395 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "chunmao.guo" <chunmao.guo@qidilab.com>
|
||||||
|
Date: Thu, 5 Jan 2023 15:55:57 +0800
|
||||||
|
Subject: [PATCH] FIX: limit_handles
|
||||||
|
|
||||||
|
---
|
||||||
|
boost/process/detail/posix/executor.hpp | 4 +++-
|
||||||
|
boost/process/detail/posix/pipe_out.hpp | 13 +++++++++++--
|
||||||
|
boost/process/detail/used_handles.hpp | 3 +++
|
||||||
|
boost/process/detail/windows/handles.hpp | 10 +++++++---
|
||||||
|
4 files changed, 24 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/boost/process/detail/posix/executor.hpp b/boost/process/detail/posix/executor.hpp
|
||||||
|
index ca7713c..5521720 100644
|
||||||
|
--- a/boost/process/detail/posix/executor.hpp
|
||||||
|
+++ b/boost/process/detail/posix/executor.hpp
|
||||||
|
@@ -325,6 +325,7 @@ public:
|
||||||
|
}
|
||||||
|
void set_error(const std::error_code &ec, const std::string &msg) {set_error(ec, msg.c_str());};
|
||||||
|
|
||||||
|
+ int error_sink() const { return _pipe_sink; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Sequence>
|
||||||
|
@@ -388,6 +389,8 @@ child executor<Sequence>::invoke(boost::mpl::false_, boost::mpl::false_)
|
||||||
|
set_error(err, "fcntl(2) failed");//this might throw, so we need to be sure our pipe is safe.
|
||||||
|
return child();
|
||||||
|
}
|
||||||
|
+ _pipe_sink = p.p[1];
|
||||||
|
+
|
||||||
|
_ec.clear();
|
||||||
|
boost::fusion::for_each(seq, call_on_setup(*this));
|
||||||
|
|
||||||
|
@@ -411,7 +414,6 @@ child executor<Sequence>::invoke(boost::mpl::false_, boost::mpl::false_)
|
||||||
|
}
|
||||||
|
else if (pid == 0)
|
||||||
|
{
|
||||||
|
- _pipe_sink = p.p[1];
|
||||||
|
::close(p.p[0]);
|
||||||
|
|
||||||
|
boost::fusion::for_each(seq, call_on_exec_setup(*this));
|
||||||
|
diff --git a/boost/process/detail/posix/pipe_out.hpp b/boost/process/detail/posix/pipe_out.hpp
|
||||||
|
index d54cca4..a081d78 100644
|
||||||
|
--- a/boost/process/detail/posix/pipe_out.hpp
|
||||||
|
+++ b/boost/process/detail/posix/pipe_out.hpp
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
namespace boost { namespace process { namespace detail { namespace posix {
|
||||||
|
|
||||||
|
template<int p1, int p2>
|
||||||
|
-struct pipe_out : handler_base_ext
|
||||||
|
+struct pipe_out : handler_base_ext, ::boost::process::detail::uses_handles
|
||||||
|
{
|
||||||
|
int sink;
|
||||||
|
int source; //opposite end
|
||||||
|
@@ -30,6 +30,14 @@ struct pipe_out : handler_base_ext
|
||||||
|
{
|
||||||
|
p.assign_sink(-1);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ std::array<int, 4> get_used_handles()
|
||||||
|
+ {
|
||||||
|
+ const auto pp1 = p1 != -1 ? p1 : p2;
|
||||||
|
+ const auto pp2 = p2 != -1 ? p2 : p1;
|
||||||
|
+
|
||||||
|
+ return {sink, source, pp1, pp2};
|
||||||
|
+ }
|
||||||
|
|
||||||
|
template<typename Executor>
|
||||||
|
void on_error(Executor &, const std::error_code &) const
|
||||||
|
@@ -66,7 +74,7 @@ void pipe_out<2,-1>::on_exec_setup(Executor &e) const
|
||||||
|
if (::dup2(sink, STDERR_FILENO) == -1)
|
||||||
|
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
|
||||||
|
|
||||||
|
- if (sink != STDOUT_FILENO)
|
||||||
|
+ if (sink != STDERR_FILENO)
|
||||||
|
::close(sink);
|
||||||
|
::close(source);
|
||||||
|
}
|
||||||
|
@@ -81,6 +89,7 @@ void pipe_out<1,2>::on_exec_setup(Executor &e) const
|
||||||
|
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
|
||||||
|
if ((sink != STDOUT_FILENO) && (sink != STDERR_FILENO))
|
||||||
|
::close(sink);
|
||||||
|
+ ::close(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
class async_pipe;
|
||||||
|
diff --git a/boost/process/detail/used_handles.hpp b/boost/process/detail/used_handles.hpp
|
||||||
|
index 4d56af3..5d71dc3 100644
|
||||||
|
--- a/boost/process/detail/used_handles.hpp
|
||||||
|
+++ b/boost/process/detail/used_handles.hpp
|
||||||
|
@@ -61,6 +61,9 @@ struct foreach_handle_invocator
|
||||||
|
template<typename Executor, typename Function>
|
||||||
|
void foreach_used_handle(Executor &exec, Function &&func)
|
||||||
|
{
|
||||||
|
+#if defined(BOOST_POSIX_API)
|
||||||
|
+ func(exec.error_sink());
|
||||||
|
+#endif
|
||||||
|
boost::fusion::for_each(boost::fusion::filter_if<does_use_handle<boost::mpl::_>>(exec.seq),
|
||||||
|
foreach_handle_invocator<Function>(func));
|
||||||
|
}
|
||||||
|
diff --git a/boost/process/detail/windows/handles.hpp b/boost/process/detail/windows/handles.hpp
|
||||||
|
index 7a93ac2..f120ef7 100644
|
||||||
|
--- a/boost/process/detail/windows/handles.hpp
|
||||||
|
+++ b/boost/process/detail/windows/handles.hpp
|
||||||
|
@@ -139,10 +139,14 @@ struct limit_handles_ : handler_base_ext
|
||||||
|
::boost::winapi::DWORD_ flags = 0u;
|
||||||
|
if (itr != all_handles.end())
|
||||||
|
*itr = ::boost::winapi::INVALID_HANDLE_VALUE_;
|
||||||
|
- else if ((::boost::winapi::GetHandleInformation(*itr, &flags) != 0)
|
||||||
|
- &&((flags & ::boost::winapi::HANDLE_FLAG_INHERIT_) == 0)) //it is NOT inherited anyhow, so ignore too
|
||||||
|
- *itr = ::boost::winapi::INVALID_HANDLE_VALUE_;
|
||||||
|
});
|
||||||
|
+ for (auto& h : all_handles) {
|
||||||
|
+ ::boost::winapi::DWORD_ flags = 0u;
|
||||||
|
+ if ((h != ::boost::winapi::INVALID_HANDLE_VALUE_)
|
||||||
|
+ && (::boost::winapi::GetHandleInformation(h, &flags) != 0)
|
||||||
|
+ && ((flags & ::boost::winapi::HANDLE_FLAG_INHERIT_) == 0)) //it is NOT inherited anyhow, so ignore too
|
||||||
|
+ h = ::boost::winapi::INVALID_HANDLE_VALUE_;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
auto part_itr = std::partition(all_handles.begin(), all_handles.end(),
|
||||||
|
[](::boost::winapi::HANDLE_ handle) {return handle != ::boost::winapi::INVALID_HANDLE_VALUE_;});
|
||||||
|
--
|
||||||
|
2.36.1.windows.1
|
||||||
|
|
||||||
160
deps/Boost/Boost.cmake
vendored
Normal file
160
deps/Boost/Boost.cmake
vendored
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
set(_bootstrap_cmd bootstrap.bat)
|
||||||
|
set(_build_cmd b2.exe)
|
||||||
|
else()
|
||||||
|
set(_bootstrap_cmd ./bootstrap.sh)
|
||||||
|
set(_build_cmd ./b2)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set(_boost_toolset gcc)
|
||||||
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/user-config.jam boost-user-config.jam)
|
||||||
|
set(_patch_command ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/boost-user-config.jam ./tools/build/src/tools/user-config.jam)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
|
||||||
|
if (MSVC_VERSION EQUAL 1800)
|
||||||
|
# 1800 = VS 12.0 (v120 toolset)
|
||||||
|
set(_boost_toolset "msvc-12.0")
|
||||||
|
elseif (MSVC_VERSION EQUAL 1900)
|
||||||
|
# 1900 = VS 14.0 (v140 toolset)
|
||||||
|
set(_boost_toolset "msvc-14.0")
|
||||||
|
elseif (MSVC_VERSION LESS 1920)
|
||||||
|
# 1910-1919 = VS 15.0 (v141 toolset)
|
||||||
|
set(_boost_toolset "msvc-14.1")
|
||||||
|
elseif (MSVC_VERSION LESS 1930)
|
||||||
|
# 1920-1929 = VS 16.0 (v142 toolset)
|
||||||
|
set(_boost_toolset "msvc-14.2")
|
||||||
|
elseif (MSVC_VERSION LESS 1950)
|
||||||
|
# 1930-1949 = VS 17.0 (v143 toolset)
|
||||||
|
set(_boost_toolset "msvc-14.3")
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "Unsupported MSVC version")
|
||||||
|
endif ()
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
if (WIN32)
|
||||||
|
set(_boost_toolset "clang-win")
|
||||||
|
elseif (APPLE)
|
||||||
|
set(_boost_toolset "clang")
|
||||||
|
else()
|
||||||
|
set(_boost_toolset clang)
|
||||||
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/user-config.jam boost-user-config.jam)
|
||||||
|
set(_patch_command ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/boost-user-config.jam ./tools/build/src/tools/user-config.jam)
|
||||||
|
endif()
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
|
set(_boost_toolset "intel")
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
|
set(_boost_toolset "clang")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Deduced boost toolset: ${_boost_toolset} based on ${CMAKE_CXX_COMPILER_ID} compiler")
|
||||||
|
|
||||||
|
set(_libs "")
|
||||||
|
foreach(_comp ${DEP_Boost_COMPONENTS})
|
||||||
|
list(APPEND _libs "--with-${_comp}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
set(_link shared)
|
||||||
|
else()
|
||||||
|
set(_link static)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_bits "")
|
||||||
|
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||||
|
set(_bits 64)
|
||||||
|
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||||||
|
set(_bits 32)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include(ProcessorCount)
|
||||||
|
ProcessorCount(NPROC)
|
||||||
|
file(TO_NATIVE_PATH ${DESTDIR}/usr/local/ _prefix)
|
||||||
|
|
||||||
|
set(_boost_flags "")
|
||||||
|
if (UNIX)
|
||||||
|
set(_boost_flags "cflags=-fPIC;cxxflags=-fPIC")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set(_boost_flags
|
||||||
|
"cflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
|
||||||
|
"cxxflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
|
||||||
|
"mflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
|
||||||
|
"mmflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_boost_variants "")
|
||||||
|
if(CMAKE_BUILD_TYPE)
|
||||||
|
list(APPEND CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
|
||||||
|
list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
|
||||||
|
endif()
|
||||||
|
list(FIND CMAKE_CONFIGURATION_TYPES "Release" _cfg_rel)
|
||||||
|
list(FIND CMAKE_CONFIGURATION_TYPES "RelWithDebInfo" _cfg_relwdeb)
|
||||||
|
list(FIND CMAKE_CONFIGURATION_TYPES "MinSizeRel" _cfg_minsizerel)
|
||||||
|
list(FIND CMAKE_CONFIGURATION_TYPES "Debug" _cfg_deb)
|
||||||
|
|
||||||
|
if (_cfg_rel GREATER -1 OR _cfg_relwdeb GREATER -1 OR _cfg_minsizerel GREATER -1)
|
||||||
|
list(APPEND _boost_variants release)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ( (NOT MSVC AND _cfg_deb GREATER -1) OR (MSVC AND ${DEP_DEBUG}) )
|
||||||
|
list(APPEND _boost_variants debug)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT _boost_variants)
|
||||||
|
set(_boost_variants release)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_build_cmd ${_build_cmd}
|
||||||
|
${_boost_flags}
|
||||||
|
-j${NPROC}
|
||||||
|
${_libs}
|
||||||
|
--layout=versioned
|
||||||
|
--debug-configuration
|
||||||
|
toolset=${_boost_toolset}
|
||||||
|
address-model=${_bits}
|
||||||
|
link=${_link}
|
||||||
|
threading=multi
|
||||||
|
boost.locale.icu=off
|
||||||
|
--disable-icu
|
||||||
|
${_boost_variants}
|
||||||
|
stage)
|
||||||
|
|
||||||
|
set(_install_cmd ${_build_cmd} --prefix=${_prefix} install)
|
||||||
|
|
||||||
|
list(APPEND _patch_command COMMAND git init && ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-Boost-fix.patch)
|
||||||
|
|
||||||
|
ExternalProject_Add(
|
||||||
|
dep_Boost
|
||||||
|
#URL "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip"
|
||||||
|
URL "https://github.com/qidilab/boost/releases/download/1.78.0/boost_1_78_0.zip"
|
||||||
|
URL_HASH SHA256=f22143b5528e081123c3c5ed437e92f648fe69748e95fa6e2bd41484e2986cc3
|
||||||
|
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/Boost
|
||||||
|
CONFIGURE_COMMAND "${_bootstrap_cmd}"
|
||||||
|
PATCH_COMMAND ${_patch_command}
|
||||||
|
BUILD_COMMAND "${_build_cmd}"
|
||||||
|
BUILD_IN_SOURCE ON
|
||||||
|
INSTALL_COMMAND "${_install_cmd}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||||
|
# Patch the boost::polygon library with a custom one.
|
||||||
|
ExternalProject_Add(dep_boost_polygon
|
||||||
|
EXCLUDE_FROM_ALL ON
|
||||||
|
# GIT_REPOSITORY "https://github.com/prusa3d/polygon"
|
||||||
|
# GIT_TAG prusaslicer_gmp
|
||||||
|
URL https://github.com/prusa3d/polygon/archive/refs/heads/prusaslicer_gmp.zip
|
||||||
|
URL_HASH SHA256=abeb9710f0a7069fb9b22181ae5c56f6066002f125db210e7ffb27032aed6824
|
||||||
|
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/boost_polygon
|
||||||
|
DEPENDS dep_Boost
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/dep_boost_polygon-prefix/src/dep_boost_polygon/include/boost/polygon"
|
||||||
|
"${DESTDIR}/usr/local/include/boost/polygon"
|
||||||
|
)
|
||||||
|
# Only override boost::Polygon Voronoi implementation with Vojtech's GMP hacks on 64bit platforms.
|
||||||
|
list(APPEND _dep_list "dep_boost_polygon")
|
||||||
|
endif ()
|
||||||
1
deps/Boost/user-config.jam
vendored
Normal file
1
deps/Boost/user-config.jam
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
using @_boost_toolset@ : : @CMAKE_CXX_COMPILER@ ;
|
||||||
11
deps/CGAL/CGAL.cmake
vendored
Normal file
11
deps/CGAL/CGAL.cmake
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
qidistudio_add_cmake_project(
|
||||||
|
CGAL
|
||||||
|
# GIT_REPOSITORY https://github.com/CGAL/cgal.git
|
||||||
|
# GIT_TAG caacd806dc55c61cc68adaad99f2240f00493b29 # releases/CGAL-5.3
|
||||||
|
# For whatever reason, this keeps downloading forever (repeats downloads if finished)
|
||||||
|
URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip
|
||||||
|
URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0
|
||||||
|
DEPENDS ${BOOST_PKG} dep_GMP dep_MPFR
|
||||||
|
)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
25
deps/CGAL/cgal/CGALConfigVersion.cmake
vendored
Normal file
25
deps/CGAL/cgal/CGALConfigVersion.cmake
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# This is a basic version file for the Config-mode of find_package().
|
||||||
|
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||||
|
# to create a version-file which can be installed along a config.cmake file.
|
||||||
|
#
|
||||||
|
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||||
|
# the requested version string are exactly the same and it sets
|
||||||
|
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
|
||||||
|
# The variable CVF_VERSION must be set before calling configure_file().
|
||||||
|
|
||||||
|
set(PACKAGE_VERSION "5.0.0")
|
||||||
|
|
||||||
|
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
else()
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||||
|
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||||
|
set(PACKAGE_VERSION_EXACT TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# if the installed project requested no architecture check, don't perform the check
|
||||||
|
if("FALSE")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
269
deps/CMakeLists.txt
vendored
Normal file
269
deps/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
#
|
||||||
|
# This CMake project downloads, configures and builds QIDIStudio dependencies on Unix and Windows.
|
||||||
|
#
|
||||||
|
# When using this script, it's recommended to perform an out-of-source build using CMake.
|
||||||
|
#
|
||||||
|
# All the dependencies are installed in a `destdir` directory in the root of the build directory,
|
||||||
|
# in a traditional Unix-style prefix structure. The destdir can be used directly by CMake
|
||||||
|
# when building QIDIStudio - to do this, set the CMAKE_PREFIX_PATH to ${destdir}/usr/local.
|
||||||
|
# Warning: On UNIX/Linux, you also need to set -DSLIC3R_STATIC=1 when building QIDIStudio.
|
||||||
|
#
|
||||||
|
# For better clarity of console output, it's recommended to _not_ use a parallelized build
|
||||||
|
# for the top-level command, ie. use `make -j 1` or `ninja -j 1` to force single-threaded top-level
|
||||||
|
# build. This doesn't degrade performance as individual dependencies are built in parallel fashion
|
||||||
|
# if supported by the dependency.
|
||||||
|
#
|
||||||
|
# On Windows, architecture (64 vs 32 bits) is judged based on the compiler variant.
|
||||||
|
# To build dependencies for either 64 or 32 bit OS, use the respective compiler command line.
|
||||||
|
#
|
||||||
|
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-conffig` utility,
|
||||||
|
# therefore, unfortunatelly, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
||||||
|
#
|
||||||
|
|
||||||
|
project(QIDIStudio-deps)
|
||||||
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
include(ProcessorCount)
|
||||||
|
|
||||||
|
ProcessorCount(NPROC)
|
||||||
|
if (NPROC EQUAL 0)
|
||||||
|
set(NPROC 1)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
option(DEP_BUILD_PNG "Compile libpng" ON)
|
||||||
|
option(DEP_BUILD_JPEG "Compile libjpeg" ON)
|
||||||
|
option(DEP_BUILD_TIFF "Compile libtiff" ON)
|
||||||
|
option(DEP_BUILD_BOOST "Compile boost" ON)
|
||||||
|
option(DEP_BUILD_OPENSSL "Compile openssl" ON)
|
||||||
|
option(DEP_BUILD_GLFW "Compile GLFW" ON)
|
||||||
|
option(DEP_BUILD_FREETYPE "Compile freetype" ON)
|
||||||
|
option(DEP_BUILD_WXWIDGETS "Compile wxWidgets" ON)
|
||||||
|
|
||||||
|
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
|
||||||
|
set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Path for downloaded source packages.")
|
||||||
|
|
||||||
|
option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
option(DEP_WX_GTK3 "Build wxWidgets against GTK3" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# On developer machines, it can be enabled to speed up compilation and suppress warnings coming from IGL.
|
||||||
|
# FIXME:
|
||||||
|
# Enabling this option is not safe. IGL will compile itself with its own version of Eigen while
|
||||||
|
# Slic3r compiles with a different version which will cause runtime errors.
|
||||||
|
# option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors and increase binary size." OFF)
|
||||||
|
|
||||||
|
message(STATUS "QIDIStudio deps DESTDIR: ${DESTDIR}")
|
||||||
|
message(STATUS "QIDIStudio dowload dir for source packages: ${DEP_DOWNLOAD_DIR}")
|
||||||
|
message(STATUS "QIDIStudio deps debug build: ${DEP_DEBUG}")
|
||||||
|
|
||||||
|
find_package(Git REQUIRED)
|
||||||
|
|
||||||
|
# The default command line for patching. Only works for newer
|
||||||
|
set(PATCH_CMD ${GIT_EXECUTABLE} apply --verbose --ignore-space-change --whitespace=fix)
|
||||||
|
|
||||||
|
get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
|
||||||
|
if (NOT _is_multi AND NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
message(STATUS "Forcing CMAKE_BUILD_TYPE to Release as it was not specified.")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
function(qidistudio_add_cmake_project projectname)
|
||||||
|
cmake_parse_arguments(P_ARGS "" "INSTALL_DIR;BUILD_COMMAND;INSTALL_COMMAND" "CMAKE_ARGS" ${ARGN})
|
||||||
|
|
||||||
|
set(_configs_line -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE})
|
||||||
|
if (_is_multi OR MSVC)
|
||||||
|
set(_configs_line "")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(_gen "")
|
||||||
|
set(_build_j "-j${NPROC}")
|
||||||
|
if (MSVC)
|
||||||
|
set(_gen CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}")
|
||||||
|
set(_build_j "/m")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
ExternalProject_Add(
|
||||||
|
dep_${projectname}
|
||||||
|
EXCLUDE_FROM_ALL ON
|
||||||
|
INSTALL_DIR ${DESTDIR}/usr/local
|
||||||
|
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
|
||||||
|
${_gen}
|
||||||
|
CMAKE_ARGS
|
||||||
|
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}/usr/local
|
||||||
|
-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules
|
||||||
|
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}/usr/local
|
||||||
|
-DCMAKE_DEBUG_POSTFIX:STRING=d
|
||||||
|
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
|
||||||
|
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
|
||||||
|
-DBUILD_SHARED_LIBS:BOOL=OFF
|
||||||
|
"${_configs_line}"
|
||||||
|
${DEP_CMAKE_OPTS}
|
||||||
|
${P_ARGS_CMAKE_ARGS}
|
||||||
|
${P_ARGS_UNPARSED_ARGUMENTS}
|
||||||
|
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j}
|
||||||
|
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release
|
||||||
|
)
|
||||||
|
|
||||||
|
endfunction(qidistudio_add_cmake_project)
|
||||||
|
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||||
|
message(STATUS "\nDetected 64-bit compiler => building 64-bit deps bundle\n")
|
||||||
|
set(DEPS_BITS 64)
|
||||||
|
include("deps-windows.cmake")
|
||||||
|
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||||||
|
message(STATUS "\nDetected 32-bit compiler => building 32-bit deps bundle\n")
|
||||||
|
set(DEPS_BITS 32)
|
||||||
|
include("deps-windows.cmake")
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "Unable to detect architecture")
|
||||||
|
endif ()
|
||||||
|
elseif (APPLE)
|
||||||
|
message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}")
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
|
||||||
|
if (CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||||
|
set(DEP_OSX_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||||
|
message("OS X Deployment Target: ${DEP_OSX_TARGET}")
|
||||||
|
else ()
|
||||||
|
# Attempt to infer the SDK version from the CMAKE_OSX_SYSROOT,
|
||||||
|
# this is done because wxWidgets need the min version explicitly set
|
||||||
|
string(REGEX MATCH "[0-9]+[.][0-9]+[.]sdk$" DEP_OSX_TARGET "${CMAKE_OSX_SYSROOT}")
|
||||||
|
string(REGEX MATCH "^[0-9]+[.][0-9]+" DEP_OSX_TARGET "${DEP_OSX_TARGET}")
|
||||||
|
|
||||||
|
if (NOT DEP_OSX_TARGET)
|
||||||
|
message(FATAL_ERROR "Could not determine OS X SDK version. Please use -DCMAKE_OSX_DEPLOYMENT_TARGET=<version>")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
message("OS X Deployment Target (inferred from SDK): ${DEP_OSX_TARGET}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include("deps-macos.cmake")
|
||||||
|
elseif (MINGW)
|
||||||
|
message(STATUS "Building for MinGW...")
|
||||||
|
include("deps-mingw.cmake")
|
||||||
|
else()
|
||||||
|
include("deps-linux.cmake")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(ZLIB_PKG "")
|
||||||
|
if (NOT ZLIB_FOUND)
|
||||||
|
include(ZLIB/ZLIB.cmake)
|
||||||
|
set(ZLIB_PKG dep_ZLIB)
|
||||||
|
endif ()
|
||||||
|
set(PNG_PKG "")
|
||||||
|
if (DEP_BUILD_PNG AND NOT PNG_FOUND)
|
||||||
|
include(PNG/PNG.cmake)
|
||||||
|
set(PNG_PKG dep_PNG)
|
||||||
|
endif ()
|
||||||
|
set(JPEG_PKG "")
|
||||||
|
if (DEP_BUILD_JPEG AND NOT JPEG_FOUND)
|
||||||
|
include(JPEG/JPEG.cmake)
|
||||||
|
set(JPEG_PKG dep_JPEG)
|
||||||
|
endif()
|
||||||
|
set(TIFF_PKG "")
|
||||||
|
if (DEP_BUILD_TIFF AND NOT TIFF_FOUND)
|
||||||
|
include(TIFF/TIFF.cmake)
|
||||||
|
set(TIFF_PKG dep_TIFF)
|
||||||
|
endif()
|
||||||
|
set(EXPAT_PKG "")
|
||||||
|
if (NOT EXPAT_FOUND)
|
||||||
|
include(EXPAT/EXPAT.cmake)
|
||||||
|
set(EXPAT_PKG dep_EXPAT)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(DEP_Boost_COMPONENTS system iostreams filesystem thread log locale regex date_time)
|
||||||
|
set(BOOST_PKG "")
|
||||||
|
if (DEP_BUILD_BOOST)
|
||||||
|
include(Boost/Boost.cmake)
|
||||||
|
set(BOOST_PKG dep_Boost)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# The order of includes respects the dependencies between libraries
|
||||||
|
include(Cereal/Cereal.cmake)
|
||||||
|
include(Qhull/Qhull.cmake)
|
||||||
|
include(GLEW/GLEW.cmake)
|
||||||
|
set(GLFW_PKG "")
|
||||||
|
if (DEP_BUILD_GLFW)
|
||||||
|
include(GLFW/GLFW.cmake)
|
||||||
|
set(GLFW_PKG dep_GLFW)
|
||||||
|
endif ()
|
||||||
|
include(OpenCSG/OpenCSG.cmake)
|
||||||
|
|
||||||
|
include(TBB/TBB.cmake)
|
||||||
|
|
||||||
|
include(Blosc/Blosc.cmake)
|
||||||
|
include(OpenEXR/OpenEXR.cmake)
|
||||||
|
include(OpenVDB/OpenVDB.cmake)
|
||||||
|
|
||||||
|
include(GMP/GMP.cmake)
|
||||||
|
include(MPFR/MPFR.cmake)
|
||||||
|
include(CGAL/CGAL.cmake)
|
||||||
|
|
||||||
|
include(NLopt/NLopt.cmake)
|
||||||
|
|
||||||
|
set(OPENSSL_PKG "")
|
||||||
|
if (DEP_BUILD_OPENSSL)
|
||||||
|
include(OpenSSL/OpenSSL.cmake)
|
||||||
|
set(OPENSSL_PKG dep_OpenSSL)
|
||||||
|
endif ()
|
||||||
|
set(CURL_PKG "")
|
||||||
|
if (NOT CURL_FOUND)
|
||||||
|
include(CURL/CURL.cmake)
|
||||||
|
set(CURL_PKG dep_CURL)
|
||||||
|
endif ()
|
||||||
|
set(WXWIDGETS_PKG "")
|
||||||
|
if (DEP_BUILD_WXWIDGETS)
|
||||||
|
include(wxWidgets/wxWidgets.cmake)
|
||||||
|
set(WXWIDGETS_PKG dep_wxWidgets)
|
||||||
|
endif ()
|
||||||
|
set(FREETYPE_PKG "")
|
||||||
|
if (DEP_BUILD_FREETYPE)
|
||||||
|
include(FREETYPE/FREETYPE.cmake)
|
||||||
|
set(FREETYPE_PKG dep_FREETYPE)
|
||||||
|
endif ()
|
||||||
|
include(OCCT/OCCT.cmake)
|
||||||
|
include(OpenCV/OpenCV.cmake)
|
||||||
|
|
||||||
|
set(_dep_list
|
||||||
|
${BOOST_PKG}
|
||||||
|
dep_TBB
|
||||||
|
${CURL_PKG}
|
||||||
|
${WXWIDGETS_PKG}
|
||||||
|
dep_Cereal
|
||||||
|
dep_NLopt
|
||||||
|
dep_OpenVDB
|
||||||
|
dep_OpenCSG
|
||||||
|
dep_OpenCV
|
||||||
|
dep_CGAL
|
||||||
|
${OPENSSL_PKG}
|
||||||
|
${GLFW_PKG}
|
||||||
|
${PNG_PKG}
|
||||||
|
${ZLIB_PKG}
|
||||||
|
${EXPAT_PKG}
|
||||||
|
${FREETYPE_PKG}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Experimental
|
||||||
|
#list(APPEND _dep_list "dep_qhull")
|
||||||
|
else()
|
||||||
|
list(APPEND _dep_list "dep_Qhull")
|
||||||
|
# Not working, static build has different Eigen
|
||||||
|
#list(APPEND _dep_list "dep_libigl")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND _dep_list "dep_OCCT")
|
||||||
|
# if (DEP_BUILD_FREETYPE)
|
||||||
|
# list(APPEND _dep_list "dep_FREETYPE")
|
||||||
|
# endif ()
|
||||||
|
|
||||||
|
add_custom_target(deps ALL DEPENDS ${_dep_list})
|
||||||
|
|
||||||
|
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands
|
||||||
|
# because they seem to generate bogus build files (possibly a bug in ExternalProject).
|
||||||
81
deps/CURL/CURL.cmake
vendored
Normal file
81
deps/CURL/CURL.cmake
vendored
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
set(_curl_platform_flags
|
||||||
|
-DENABLE_IPV6:BOOL=ON
|
||||||
|
-DENABLE_VERSIONED_SYMBOLS:BOOL=ON
|
||||||
|
-DENABLE_THREADED_RESOLVER:BOOL=ON
|
||||||
|
-DENABLE_MANUAL:BOOL=OFF
|
||||||
|
-DCURL_DISABLE_LDAP:BOOL=ON
|
||||||
|
-DCURL_DISABLE_LDAPS:BOOL=ON
|
||||||
|
-DCURL_DISABLE_RTSP:BOOL=ON
|
||||||
|
-DCURL_DISABLE_DICT:BOOL=ON
|
||||||
|
-DCURL_DISABLE_TELNET:BOOL=ON
|
||||||
|
-DCURL_DISABLE_POP3:BOOL=ON
|
||||||
|
-DCURL_DISABLE_IMAP:BOOL=ON
|
||||||
|
-DCURL_DISABLE_SMB:BOOL=ON
|
||||||
|
-DCURL_DISABLE_SMTP:BOOL=ON
|
||||||
|
-DCURL_DISABLE_GOPHER:BOOL=ON
|
||||||
|
-DCURL_DISABLE_TFTP:BOOL=ON
|
||||||
|
-DCURL_DISABLE_MQTT:BOOL=ON
|
||||||
|
#-DHTTP_ONLY=ON
|
||||||
|
|
||||||
|
-DCMAKE_USE_GSSAPI:BOOL=OFF
|
||||||
|
-DCMAKE_USE_LIBSSH2:BOOL=OFF
|
||||||
|
-DUSE_RTMP:BOOL=OFF
|
||||||
|
-DUSE_NGHTTP2:BOOL=OFF
|
||||||
|
-DUSE_MBEDTLS:BOOL=OFF
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
#set(_curl_platform_flags ${_curl_platform_flags} -DCMAKE_USE_SCHANNEL=ON)
|
||||||
|
set(_curl_platform_flags ${_curl_platform_flags} -DCMAKE_USE_OPENSSL=ON -DCURL_CA_PATH:STRING=none)
|
||||||
|
elseif (APPLE)
|
||||||
|
set(_curl_platform_flags
|
||||||
|
|
||||||
|
${_curl_platform_flags}
|
||||||
|
|
||||||
|
#-DCMAKE_USE_SECTRANSP:BOOL=ON
|
||||||
|
-DCMAKE_USE_OPENSSL:BOOL=ON
|
||||||
|
|
||||||
|
-DCURL_CA_PATH:STRING=none
|
||||||
|
)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
set(_curl_platform_flags
|
||||||
|
|
||||||
|
${_curl_platform_flags}
|
||||||
|
|
||||||
|
-DCMAKE_USE_OPENSSL:BOOL=ON
|
||||||
|
|
||||||
|
-DCURL_CA_PATH:STRING=none
|
||||||
|
-DCURL_CA_BUNDLE:STRING=none
|
||||||
|
-DCURL_CA_FALLBACK:BOOL=ON
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
set(_curl_static OFF)
|
||||||
|
else()
|
||||||
|
set(_curl_static ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
qidistudio_add_cmake_project(CURL
|
||||||
|
# GIT_REPOSITORY https://github.com/curl/curl.git
|
||||||
|
# GIT_TAG curl-7_75_0
|
||||||
|
URL https://github.com/curl/curl/archive/refs/tags/curl-7_75_0.zip
|
||||||
|
URL_HASH SHA256=a63ae025bb0a14f119e73250f2c923f4bf89aa93b8d4fafa4a9f5353a96a765a
|
||||||
|
DEPENDS ${ZLIB_PKG}
|
||||||
|
# PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
|
||||||
|
# ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/curl-mods.patch
|
||||||
|
CMAKE_ARGS
|
||||||
|
-DBUILD_TESTING:BOOL=OFF
|
||||||
|
-DBUILD_CURL_EXE:BOOL=OFF
|
||||||
|
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||||
|
-DCURL_STATICLIB=${_curl_static}
|
||||||
|
${_curl_platform_flags}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (DEP_BUILD_OPENSSL)
|
||||||
|
add_dependencies(dep_CURL ${OPENSSL_PKG})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
add_debug_dep(dep_CURL)
|
||||||
|
endif ()
|
||||||
8
deps/Cereal/Cereal.cmake
vendored
Normal file
8
deps/Cereal/Cereal.cmake
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
qidistudio_add_cmake_project(Cereal
|
||||||
|
URL "https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.0.zip"
|
||||||
|
URL_HASH SHA256=71642cb54658e98c8f07a0f0d08bf9766f1c3771496936f6014169d3726d9657
|
||||||
|
CMAKE_ARGS
|
||||||
|
-DJUST_INSTALL_CEREAL=ON
|
||||||
|
-DSKIP_PERFORMANCE_COMPARISON=ON
|
||||||
|
-DBUILD_TESTS=OFF
|
||||||
|
)
|
||||||
9
deps/EXPAT/EXPAT.cmake
vendored
Normal file
9
deps/EXPAT/EXPAT.cmake
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
qidistudio_add_cmake_project(EXPAT
|
||||||
|
# GIT_REPOSITORY https://github.com/nigels-com/glew.git
|
||||||
|
# GIT_TAG 3a8eff7 # 2.1.0
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/expat
|
||||||
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
add_debug_dep(dep_EXPAT)
|
||||||
|
endif ()
|
||||||
130
deps/EXPAT/expat/CMakeLists.txt
vendored
Normal file
130
deps/EXPAT/expat/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
|
project(EXPAT)
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/ConfigureChecks.cmake)
|
||||||
|
|
||||||
|
macro(expat_shy_set var default cache type desc)
|
||||||
|
# Macro expat_shy_set came into life because:
|
||||||
|
# - Expat was previously using an inconsistent mix of CMake's native set()
|
||||||
|
# and option() to define public build time options.
|
||||||
|
# - option() is more friendly than set() with regard to configuring an
|
||||||
|
# external project that is pulled in by means of add_subdirectory() --
|
||||||
|
# see comments in issue #597 -- so we wanted to get away from set().
|
||||||
|
# - option() auto-converts non-bool values to bool when writing to the CMake
|
||||||
|
# cache, so we needed something that supports non-bool better and hence
|
||||||
|
# wanted to get away from plain option(), too.
|
||||||
|
#
|
||||||
|
# As a result, this function serves as a hybrid between CMake's regular set()
|
||||||
|
# and option(): from set() it takes support for non-bool types and the function
|
||||||
|
# name and signature whereas from option() (with policy CMP0077 mode NEW) it
|
||||||
|
# takes being shy when a value has previously been defined for that variable.
|
||||||
|
#
|
||||||
|
# So that resolves all need for set(.. FORCE) when pulling in Expat by means of
|
||||||
|
# add_subdirectory().
|
||||||
|
#
|
||||||
|
if(NOT ${cache} STREQUAL "CACHE")
|
||||||
|
message(SEND_ERROR "Macro usage is: expat_shy_set(var default CACHE type desc)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED ${var})
|
||||||
|
# NOTE: The idea is to (ideally) only add to the cache if
|
||||||
|
# there is no cache entry, yet. "if(DEFINED CACHE{var})"
|
||||||
|
# requires CMake >=3.14.
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.14" AND NOT DEFINED "CACHE{${var}}")
|
||||||
|
set("${var}" "${${var}}" CACHE "${type}" "${desc}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set("${var}" "${default}" CACHE "${type}" "${desc}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
expat_shy_set(EXPAT_WITH_GETRANDOM "AUTO" CACHE STRING "Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]")
|
||||||
|
expat_shy_set(EXPAT_WITH_SYS_GETRANDOM "AUTO" CACHE STRING "Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
macro(evaluate_detection_results use_ref have_ref thing_lower thing_title)
|
||||||
|
if(${use_ref} AND NOT (${use_ref} STREQUAL "AUTO") AND NOT ${have_ref})
|
||||||
|
message(SEND_ERROR
|
||||||
|
"Use of ${thing_lower} was enforced by ${use_ref}=ON but it could not be found.")
|
||||||
|
elseif(NOT ${use_ref} AND ${have_ref})
|
||||||
|
message("${thing_title} was found but it will not be used due to ${use_ref}=OFF.")
|
||||||
|
set(${have_ref} 0)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
evaluate_detection_results(EXPAT_WITH_GETRANDOM HAVE_GETRANDOM "function getrandom" "Function getrandom")
|
||||||
|
evaluate_detection_results(EXPAT_WITH_SYS_GETRANDOM HAVE_SYSCALL_GETRANDOM "syscall SYS_getrandom" "Syscall SYS_getrandom")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
configure_file(expat_configure.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/expat_configure.h")
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS AND MSVC)
|
||||||
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(expat
|
||||||
|
xmlparse.c
|
||||||
|
xmlrole.c
|
||||||
|
xmltok.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(expat PRIVATE ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
${PROJECT_SOURCE_DIR}/expat.h
|
||||||
|
${PROJECT_SOURCE_DIR}/expat_config.h
|
||||||
|
${PROJECT_SOURCE_DIR}/expat_external.h
|
||||||
|
DESTINATION
|
||||||
|
${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(EXPAT INTERFACE)
|
||||||
|
target_link_libraries(EXPAT INTERFACE expat)
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
write_basic_package_version_file(
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||||
|
VERSION 1.95
|
||||||
|
COMPATIBILITY AnyNewerVersion
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS expat EXPAT
|
||||||
|
EXPORT ${PROJECT_NAME}Targets
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
export(EXPORT ${PROJECT_NAME}Targets
|
||||||
|
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake"
|
||||||
|
NAMESPACE ${PROJECT_NAME}:: )
|
||||||
|
|
||||||
|
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
||||||
|
|
||||||
|
install(EXPORT ${PROJECT_NAME}Targets
|
||||||
|
FILE
|
||||||
|
"${PROJECT_NAME}Targets.cmake"
|
||||||
|
NAMESPACE
|
||||||
|
${PROJECT_NAME}::
|
||||||
|
DESTINATION
|
||||||
|
${ConfigPackageLocation}
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_file(config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||||
|
DESTINATION
|
||||||
|
${ConfigPackageLocation}
|
||||||
|
)
|
||||||
|
|
||||||
21
deps/EXPAT/expat/COPYING
vendored
Normal file
21
deps/EXPAT/expat/COPYING
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
|
||||||
|
Copyright (c) 2001-2022 Expat maintainers
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
69
deps/EXPAT/expat/ConfigureChecks.cmake
vendored
Normal file
69
deps/EXPAT/expat/ConfigureChecks.cmake
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
include(CheckCCompilerFlag)
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
include(CheckIncludeFile)
|
||||||
|
include(CheckIncludeFiles)
|
||||||
|
include(CheckLibraryExists)
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
include(TestBigEndian)
|
||||||
|
|
||||||
|
check_include_file("dlfcn.h" HAVE_DLFCN_H)
|
||||||
|
check_include_file("fcntl.h" HAVE_FCNTL_H)
|
||||||
|
check_include_file("inttypes.h" HAVE_INTTYPES_H)
|
||||||
|
check_include_file("memory.h" HAVE_MEMORY_H)
|
||||||
|
check_include_file("stdint.h" HAVE_STDINT_H)
|
||||||
|
check_include_file("stdlib.h" HAVE_STDLIB_H)
|
||||||
|
check_include_file("strings.h" HAVE_STRINGS_H)
|
||||||
|
check_include_file("string.h" HAVE_STRING_H)
|
||||||
|
check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
|
||||||
|
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
|
||||||
|
check_include_file("unistd.h" HAVE_UNISTD_H)
|
||||||
|
|
||||||
|
check_symbol_exists("getpagesize" "unistd.h" HAVE_GETPAGESIZE)
|
||||||
|
check_symbol_exists("mmap" "sys/mman.h" HAVE_MMAP)
|
||||||
|
check_symbol_exists("getrandom" "sys/random.h" HAVE_GETRANDOM)
|
||||||
|
|
||||||
|
if(EXPAT_WITH_LIQDSD)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")
|
||||||
|
set(_bsd "bsd/")
|
||||||
|
else()
|
||||||
|
set(_bsd "")
|
||||||
|
endif()
|
||||||
|
check_symbol_exists("arc4random_buf" "${_bsd}stdlib.h" HAVE_ARC4RANDOM_BUF)
|
||||||
|
if(NOT HAVE_ARC4RANDOM_BUF)
|
||||||
|
check_symbol_exists("arc4random" "${_bsd}stdlib.h" HAVE_ARC4RANDOM)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
|
||||||
|
#/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
|
||||||
|
|
||||||
|
test_big_endian(WORDS_BIGENDIAN)
|
||||||
|
#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
|
||||||
|
if(WORDS_BIGENDIAN)
|
||||||
|
set(BYTEORDER 4321)
|
||||||
|
else(WORDS_BIGENDIAN)
|
||||||
|
set(BYTEORDER 1234)
|
||||||
|
endif(WORDS_BIGENDIAN)
|
||||||
|
|
||||||
|
if(HAVE_SYS_TYPES_H)
|
||||||
|
check_symbol_exists("off_t" "sys/types.h" OFF_T)
|
||||||
|
check_symbol_exists("size_t" "sys/types.h" SIZE_T)
|
||||||
|
else(HAVE_SYS_TYPES_H)
|
||||||
|
set(OFF_T "long")
|
||||||
|
set(SIZE_T "unsigned")
|
||||||
|
endif(HAVE_SYS_TYPES_H)
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <stdlib.h> /* for NULL */
|
||||||
|
#include <unistd.h> /* for syscall */
|
||||||
|
#include <sys/syscall.h> /* for SYS_getrandom */
|
||||||
|
int main() {
|
||||||
|
syscall(SYS_getrandom, NULL, 0, 0);
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
HAVE_SYSCALL_GETRANDOM)
|
||||||
|
|
||||||
|
check_c_compiler_flag("-fno-strict-aliasing" FLAG_NO_STRICT_ALIASING)
|
||||||
|
check_c_compiler_flag("-fvisibility=hidden" FLAG_VISIBILITY)
|
||||||
|
|
||||||
|
check_library_exists(m cos "" _EXPAT_LIBM_FOUND)
|
||||||
274
deps/EXPAT/expat/README.md
vendored
Normal file
274
deps/EXPAT/expat/README.md
vendored
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
Expat, Release 2.5.0, only picked the lib related files into QIDI Studio, built as static library
|
||||||
|
|
||||||
|
The original README:
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
[](https://github.com/libexpat/libexpat/actions/workflows/linux.yml)
|
||||||
|
[](https://ci.appveyor.com/project/libexpat/libexpat)
|
||||||
|
[](https://repology.org/metapackage/expat/versions)
|
||||||
|
[](https://sourceforge.net/projects/expat/files/)
|
||||||
|
[](https://github.com/libexpat/libexpat/releases)
|
||||||
|
|
||||||
|
|
||||||
|
# Expat, Release 2.5.0
|
||||||
|
|
||||||
|
This is Expat, a C library for parsing XML, started by
|
||||||
|
[James Clark](https://en.wikipedia.org/wiki/James_Clark_%28programmer%29) in 1997.
|
||||||
|
Expat is a stream-oriented XML parser. This means that you register
|
||||||
|
handlers with the parser before starting the parse. These handlers
|
||||||
|
are called when the parser discovers the associated structures in the
|
||||||
|
document being parsed. A start tag is an example of the kind of
|
||||||
|
structures for which you may register handlers.
|
||||||
|
|
||||||
|
Expat supports the following compilers:
|
||||||
|
|
||||||
|
- GNU GCC >=4.5
|
||||||
|
- LLVM Clang >=3.5
|
||||||
|
- Microsoft Visual Studio >=15.0/2017 (rolling `${today} minus 5 years`)
|
||||||
|
|
||||||
|
Windows users can use the
|
||||||
|
[`expat-win32bin-*.*.*.{exe,zip}` download](https://github.com/libexpat/libexpat/releases),
|
||||||
|
which includes both pre-compiled libraries and executables, and source code for
|
||||||
|
developers.
|
||||||
|
|
||||||
|
Expat is [free software](https://www.gnu.org/philosophy/free-sw.en.html).
|
||||||
|
You may copy, distribute, and modify it under the terms of the License
|
||||||
|
contained in the file
|
||||||
|
[`COPYING`](https://github.com/libexpat/libexpat/blob/master/expat/COPYING)
|
||||||
|
distributed with this package.
|
||||||
|
This license is the same as the MIT/X Consortium license.
|
||||||
|
|
||||||
|
|
||||||
|
## Using libexpat in your CMake-Based Project
|
||||||
|
|
||||||
|
There are two ways of using libexpat with CMake:
|
||||||
|
|
||||||
|
### a) Module Mode
|
||||||
|
|
||||||
|
This approach leverages CMake's own [module `FindEXPAT`](https://cmake.org/cmake/help/latest/module/FindEXPAT.html).
|
||||||
|
|
||||||
|
Notice the *uppercase* `EXPAT` in the following example:
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
cmake_minimum_required(VERSION 3.0) # or 3.10, see below
|
||||||
|
|
||||||
|
project(hello VERSION 1.0.0)
|
||||||
|
|
||||||
|
find_package(EXPAT 2.2.8 MODULE REQUIRED)
|
||||||
|
|
||||||
|
add_executable(hello
|
||||||
|
hello.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# a) for CMake >=3.10 (see CMake's FindEXPAT docs)
|
||||||
|
target_link_libraries(hello PUBLIC EXPAT::EXPAT)
|
||||||
|
|
||||||
|
# b) for CMake >=3.0
|
||||||
|
target_include_directories(hello PRIVATE ${EXPAT_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(hello PUBLIC ${EXPAT_LIBRARIES})
|
||||||
|
```
|
||||||
|
|
||||||
|
### b) Config Mode
|
||||||
|
|
||||||
|
This approach requires files from…
|
||||||
|
|
||||||
|
- libexpat >=2.2.8 where packaging uses the CMake build system
|
||||||
|
or
|
||||||
|
- libexpat >=2.3.0 where packaging uses the GNU Autotools build system
|
||||||
|
on Linux
|
||||||
|
or
|
||||||
|
- libexpat >=2.4.0 where packaging uses the GNU Autotools build system
|
||||||
|
on macOS or MinGW.
|
||||||
|
|
||||||
|
Notice the *lowercase* `expat` in the following example:
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
|
project(hello VERSION 1.0.0)
|
||||||
|
|
||||||
|
find_package(expat 2.2.8 CONFIG REQUIRED char dtd ns)
|
||||||
|
|
||||||
|
add_executable(hello
|
||||||
|
hello.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(hello PUBLIC expat::expat)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Building from a Git Clone
|
||||||
|
|
||||||
|
If you are building Expat from a check-out from the
|
||||||
|
[Git repository](https://github.com/libexpat/libexpat/),
|
||||||
|
you need to run a script that generates the configure script using the
|
||||||
|
GNU autoconf and libtool tools. To do this, you need to have
|
||||||
|
autoconf 2.58 or newer. Run the script like this:
|
||||||
|
|
||||||
|
```console
|
||||||
|
./buildconf.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Once this has been done, follow the same instructions as for building
|
||||||
|
from a source distribution.
|
||||||
|
|
||||||
|
|
||||||
|
## Building from a Source Distribution
|
||||||
|
|
||||||
|
### a) Building with the configure script (i.e. GNU Autotools)
|
||||||
|
|
||||||
|
To build Expat from a source distribution, you first run the
|
||||||
|
configuration shell script in the top level distribution directory:
|
||||||
|
|
||||||
|
```console
|
||||||
|
./configure
|
||||||
|
```
|
||||||
|
|
||||||
|
There are many options which you may provide to configure (which you
|
||||||
|
can discover by running configure with the `--help` option). But the
|
||||||
|
one of most interest is the one that sets the installation directory.
|
||||||
|
By default, the configure script will set things up to install
|
||||||
|
libexpat into `/usr/local/lib`, `expat.h` into `/usr/local/include`, and
|
||||||
|
`xmlwf` into `/usr/local/bin`. If, for example, you'd prefer to install
|
||||||
|
into `/home/me/mystuff/lib`, `/home/me/mystuff/include`, and
|
||||||
|
`/home/me/mystuff/bin`, you can tell `configure` about that with:
|
||||||
|
|
||||||
|
```console
|
||||||
|
./configure --prefix=/home/me/mystuff
|
||||||
|
```
|
||||||
|
|
||||||
|
Another interesting option is to enable 64-bit integer support for
|
||||||
|
line and column numbers and the over-all byte index:
|
||||||
|
|
||||||
|
```console
|
||||||
|
./configure CPPFLAGS=-DXML_LARGE_SIZE
|
||||||
|
```
|
||||||
|
|
||||||
|
However, such a modification would be a breaking change to the ABI
|
||||||
|
and is therefore not recommended for general use — e.g. as part of
|
||||||
|
a Linux distribution — but rather for builds with special requirements.
|
||||||
|
|
||||||
|
After running the configure script, the `make` command will build
|
||||||
|
things and `make install` will install things into their proper
|
||||||
|
location. Have a look at the `Makefile` to learn about additional
|
||||||
|
`make` options. Note that you need to have write permission into
|
||||||
|
the directories into which things will be installed.
|
||||||
|
|
||||||
|
If you are interested in building Expat to provide document
|
||||||
|
information in UTF-16 encoding rather than the default UTF-8, follow
|
||||||
|
these instructions (after having run `make distclean`).
|
||||||
|
Please note that we configure with `--without-xmlwf` as xmlwf does not
|
||||||
|
support this mode of compilation (yet):
|
||||||
|
|
||||||
|
1. Mass-patch `Makefile.am` files to use `libexpatw.la` for a library name:
|
||||||
|
<br/>
|
||||||
|
`find -name Makefile.am -exec sed
|
||||||
|
-e 's,libexpat\.la,libexpatw.la,'
|
||||||
|
-e 's,libexpat_la,libexpatw_la,'
|
||||||
|
-i {} +`
|
||||||
|
|
||||||
|
1. Run `automake` to re-write `Makefile.in` files:<br/>
|
||||||
|
`automake`
|
||||||
|
|
||||||
|
1. For UTF-16 output as unsigned short (and version/error strings as char),
|
||||||
|
run:<br/>
|
||||||
|
`./configure CPPFLAGS=-DXML_UNICODE --without-xmlwf`<br/>
|
||||||
|
For UTF-16 output as `wchar_t` (incl. version/error strings), run:<br/>
|
||||||
|
`./configure CFLAGS="-g -O2 -fshort-wchar" CPPFLAGS=-DXML_UNICODE_WCHAR_T
|
||||||
|
--without-xmlwf`
|
||||||
|
<br/>Note: The latter requires libc compiled with `-fshort-wchar`, as well.
|
||||||
|
|
||||||
|
1. Run `make` (which excludes xmlwf).
|
||||||
|
|
||||||
|
1. Run `make install` (again, excludes xmlwf).
|
||||||
|
|
||||||
|
Using `DESTDIR` is supported. It works as follows:
|
||||||
|
|
||||||
|
```console
|
||||||
|
make install DESTDIR=/path/to/image
|
||||||
|
```
|
||||||
|
|
||||||
|
overrides the in-makefile set `DESTDIR`, because variable-setting priority is
|
||||||
|
|
||||||
|
1. commandline
|
||||||
|
1. in-makefile
|
||||||
|
1. environment
|
||||||
|
|
||||||
|
Note: This only applies to the Expat library itself, building UTF-16 versions
|
||||||
|
of xmlwf and the tests is currently not supported.
|
||||||
|
|
||||||
|
When using Expat with a project using autoconf for configuration, you
|
||||||
|
can use the probing macro in `conftools/expat.m4` to determine how to
|
||||||
|
include Expat. See the comments at the top of that file for more
|
||||||
|
information.
|
||||||
|
|
||||||
|
A reference manual is available in the file `doc/reference.html` in this
|
||||||
|
distribution.
|
||||||
|
|
||||||
|
|
||||||
|
### b) Building with CMake
|
||||||
|
|
||||||
|
The CMake build system is still *experimental* and may replace the primary
|
||||||
|
build system based on GNU Autotools at some point when it is ready.
|
||||||
|
|
||||||
|
|
||||||
|
#### Available Options
|
||||||
|
|
||||||
|
For an idea of the available (non-advanced) options for building with CMake:
|
||||||
|
|
||||||
|
```console
|
||||||
|
# rm -f CMakeCache.txt ; cmake -D_EXPAT_HELP=ON -LH . | grep -B1 ':.*=' | sed 's,^--$,,'
|
||||||
|
// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
|
||||||
|
CMAKE_BUILD_TYPE:STRING=
|
||||||
|
|
||||||
|
// Install path prefix, prepended onto install directories.
|
||||||
|
CMAKE_INSTALL_PREFIX:PATH=/usr/local
|
||||||
|
|
||||||
|
// Path to a program.
|
||||||
|
DOCBOOK_TO_MAN:FILEPATH=/usr/bin/docbook2x-man
|
||||||
|
|
||||||
|
// Build man page for xmlwf
|
||||||
|
EXPAT_BUILD_DOCS:BOOL=ON
|
||||||
|
|
||||||
|
// Build the examples for expat library
|
||||||
|
EXPAT_BUILD_EXAMPLES:BOOL=ON
|
||||||
|
|
||||||
|
// Build fuzzers for the expat library
|
||||||
|
EXPAT_BUILD_FUZZERS:BOOL=OFF
|
||||||
|
|
||||||
|
// Build pkg-config file
|
||||||
|
EXPAT_BUILD_PKGCONFIG:BOOL=ON
|
||||||
|
|
||||||
|
// Build the tests for expat library
|
||||||
|
EXPAT_BUILD_TESTS:BOOL=ON
|
||||||
|
|
||||||
|
// Build the xmlwf tool for expat library
|
||||||
|
EXPAT_BUILD_TOOLS:BOOL=ON
|
||||||
|
|
||||||
|
// Character type to use (char|ushort|wchar_t) [default=char]
|
||||||
|
EXPAT_CHAR_TYPE:STRING=char
|
||||||
|
|
||||||
|
// Install expat files in cmake install target
|
||||||
|
EXPAT_ENABLE_INSTALL:BOOL=ON
|
||||||
|
|
||||||
|
// Use /MT flag (static CRT) when compiling in MSVC
|
||||||
|
EXPAT_MSVC_STATIC_CRT:BOOL=OFF
|
||||||
|
|
||||||
|
// Build fuzzers via ossfuzz for the expat library
|
||||||
|
EXPAT_OSSFUZZ_BUILD:BOOL=OFF
|
||||||
|
|
||||||
|
// Build a shared expat library
|
||||||
|
EXPAT_SHARED_LIBS:BOOL=ON
|
||||||
|
|
||||||
|
// Treat all compiler warnings as errors
|
||||||
|
EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF
|
||||||
|
|
||||||
|
// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]
|
||||||
|
EXPAT_WITH_GETRANDOM:STRING=AUTO
|
||||||
|
|
||||||
|
// Utilize liqdsd (for arc4random_buf)
|
||||||
|
EXPAT_WITH_LIQDSD:BOOL=OFF
|
||||||
|
|
||||||
|
// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]
|
||||||
|
EXPAT_WITH_SYS_GETRANDOM:STRING=AUTO
|
||||||
|
```
|
||||||
123
deps/EXPAT/expat/ascii.h
vendored
Normal file
123
deps/EXPAT/expat/ascii.h
vendored
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
|
||||||
|
Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ASCII_A 0x41
|
||||||
|
#define ASCII_B 0x42
|
||||||
|
#define ASCII_C 0x43
|
||||||
|
#define ASCII_D 0x44
|
||||||
|
#define ASCII_E 0x45
|
||||||
|
#define ASCII_F 0x46
|
||||||
|
#define ASCII_G 0x47
|
||||||
|
#define ASCII_H 0x48
|
||||||
|
#define ASCII_I 0x49
|
||||||
|
#define ASCII_J 0x4A
|
||||||
|
#define ASCII_K 0x4B
|
||||||
|
#define ASCII_L 0x4C
|
||||||
|
#define ASCII_M 0x4D
|
||||||
|
#define ASCII_N 0x4E
|
||||||
|
#define ASCII_O 0x4F
|
||||||
|
#define ASCII_P 0x50
|
||||||
|
#define ASCII_Q 0x51
|
||||||
|
#define ASCII_R 0x52
|
||||||
|
#define ASCII_S 0x53
|
||||||
|
#define ASCII_T 0x54
|
||||||
|
#define ASCII_U 0x55
|
||||||
|
#define ASCII_V 0x56
|
||||||
|
#define ASCII_W 0x57
|
||||||
|
#define ASCII_X 0x58
|
||||||
|
#define ASCII_Y 0x59
|
||||||
|
#define ASCII_Z 0x5A
|
||||||
|
|
||||||
|
#define ASCII_a 0x61
|
||||||
|
#define ASCII_b 0x62
|
||||||
|
#define ASCII_c 0x63
|
||||||
|
#define ASCII_d 0x64
|
||||||
|
#define ASCII_e 0x65
|
||||||
|
#define ASCII_f 0x66
|
||||||
|
#define ASCII_g 0x67
|
||||||
|
#define ASCII_h 0x68
|
||||||
|
#define ASCII_i 0x69
|
||||||
|
#define ASCII_j 0x6A
|
||||||
|
#define ASCII_k 0x6B
|
||||||
|
#define ASCII_l 0x6C
|
||||||
|
#define ASCII_m 0x6D
|
||||||
|
#define ASCII_n 0x6E
|
||||||
|
#define ASCII_o 0x6F
|
||||||
|
#define ASCII_p 0x70
|
||||||
|
#define ASCII_q 0x71
|
||||||
|
#define ASCII_r 0x72
|
||||||
|
#define ASCII_s 0x73
|
||||||
|
#define ASCII_t 0x74
|
||||||
|
#define ASCII_u 0x75
|
||||||
|
#define ASCII_v 0x76
|
||||||
|
#define ASCII_w 0x77
|
||||||
|
#define ASCII_x 0x78
|
||||||
|
#define ASCII_y 0x79
|
||||||
|
#define ASCII_z 0x7A
|
||||||
|
|
||||||
|
#define ASCII_0 0x30
|
||||||
|
#define ASCII_1 0x31
|
||||||
|
#define ASCII_2 0x32
|
||||||
|
#define ASCII_3 0x33
|
||||||
|
#define ASCII_4 0x34
|
||||||
|
#define ASCII_5 0x35
|
||||||
|
#define ASCII_6 0x36
|
||||||
|
#define ASCII_7 0x37
|
||||||
|
#define ASCII_8 0x38
|
||||||
|
#define ASCII_9 0x39
|
||||||
|
|
||||||
|
#define ASCII_TAB 0x09
|
||||||
|
#define ASCII_SPACE 0x20
|
||||||
|
#define ASCII_EXCL 0x21
|
||||||
|
#define ASCII_QUOT 0x22
|
||||||
|
#define ASCII_AMP 0x26
|
||||||
|
#define ASCII_APOS 0x27
|
||||||
|
#define ASCII_MINUS 0x2D
|
||||||
|
#define ASCII_PERIOD 0x2E
|
||||||
|
#define ASCII_COLON 0x3A
|
||||||
|
#define ASCII_SEMI 0x3B
|
||||||
|
#define ASCII_LT 0x3C
|
||||||
|
#define ASCII_EQUALS 0x3D
|
||||||
|
#define ASCII_GT 0x3E
|
||||||
|
#define ASCII_LSQB 0x5B
|
||||||
|
#define ASCII_RSQB 0x5D
|
||||||
|
#define ASCII_UNDERSCORE 0x5F
|
||||||
|
#define ASCII_LPAREN 0x28
|
||||||
|
#define ASCII_RPAREN 0x29
|
||||||
|
#define ASCII_FF 0x0C
|
||||||
|
#define ASCII_SLASH 0x2F
|
||||||
|
#define ASCII_HASH 0x23
|
||||||
|
#define ASCII_PIPE 0x7C
|
||||||
|
#define ASCII_COMMA 0x2C
|
||||||
66
deps/EXPAT/expat/asciitab.h
vendored
Normal file
66
deps/EXPAT/expat/asciitab.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
|
||||||
|
/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
|
||||||
|
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
|
||||||
|
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
|
||||||
|
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
|
||||||
|
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
||||||
|
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
||||||
|
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
|
||||||
|
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
|
||||||
|
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
||||||
|
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
||||||
|
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
|
||||||
|
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
|
||||||
|
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
||||||
|
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
||||||
|
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
||||||
|
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
4
deps/EXPAT/expat/config.cmake.in
vendored
Normal file
4
deps/EXPAT/expat/config.cmake.in
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/EXPATTargets.cmake)
|
||||||
|
set(EXPAT_LIBRARIES EXPAT::expat)
|
||||||
|
set(EXPAT_INCLUDE_DIRS ${_IMPORT_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
1064
deps/EXPAT/expat/expat.h
vendored
Normal file
1064
deps/EXPAT/expat/expat.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
49
deps/EXPAT/expat/expat_config.h
vendored
Normal file
49
deps/EXPAT/expat/expat_config.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
|
||||||
|
Copyright (c) 2005 Karl Waclawek <karl@waclawek.net>
|
||||||
|
Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EXPATCONFIG_H
|
||||||
|
#define EXPATCONFIG_H
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "expat_configure.h"
|
||||||
|
#include <memory.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#endif /* ndef EXPATCONFIG_H */
|
||||||
120
deps/EXPAT/expat/expat_configure.h.cmake
vendored
Normal file
120
deps/EXPAT/expat/expat_configure.h.cmake
vendored
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/* expat_config.h.cmake. Based upon generated expat_config.h.in. */
|
||||||
|
|
||||||
|
#ifndef EXPAT_CONFIG_H
|
||||||
|
#define EXPAT_CONFIG_H 1
|
||||||
|
|
||||||
|
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
|
||||||
|
#cmakedefine BYTEORDER @BYTEORDER@
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `arc4random' function. */
|
||||||
|
#cmakedefine HAVE_ARC4RANDOM
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `arc4random_buf' function. */
|
||||||
|
#cmakedefine HAVE_ARC4RANDOM_BUF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
#cmakedefine HAVE_DLFCN_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||||
|
#cmakedefine HAVE_FCNTL_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpagesize' function. */
|
||||||
|
#cmakedefine HAVE_GETPAGESIZE
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getrandom' function. */
|
||||||
|
#cmakedefine HAVE_GETRANDOM
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#cmakedefine HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `bsd' library (-lbsd). */
|
||||||
|
#cmakedefine HAVE_LIQDSD
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#cmakedefine HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have a working `mmap' system call. */
|
||||||
|
#cmakedefine HAVE_MMAP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#cmakedefine HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#cmakedefine HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#cmakedefine HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#cmakedefine HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have `syscall' and `SYS_getrandom'. */
|
||||||
|
#cmakedefine HAVE_SYSCALL_GETRANDOM
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#cmakedefine HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#define PACKAGE "@PACKAGE_NAME@"
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@"
|
||||||
|
|
||||||
|
/* Define to the home page for this package. */
|
||||||
|
#define PACKAGE_URL ""
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#cmakedefine STDC_HEADERS
|
||||||
|
|
||||||
|
/* whether byteorder is bigendian */
|
||||||
|
#cmakedefine WORDS_BIGENDIAN
|
||||||
|
|
||||||
|
/* Define to allow retrieving the byte offsets for attribute names and values.
|
||||||
|
*/
|
||||||
|
#cmakedefine XML_ATTR_INFO
|
||||||
|
|
||||||
|
/* Define to specify how much context to retain around the current parse
|
||||||
|
point. */
|
||||||
|
#cmakedefine XML_CONTEXT_BYTES @XML_CONTEXT_BYTES@
|
||||||
|
|
||||||
|
#if ! defined(_WIN32)
|
||||||
|
/* Define to include code reading entropy from `/dev/urandom'. */
|
||||||
|
#cmakedefine XML_DEV_URANDOM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define to make parameter entity parsing functionality available. */
|
||||||
|
#cmakedefine XML_DTD
|
||||||
|
|
||||||
|
/* Define to make XML Namespaces functionality available. */
|
||||||
|
#cmakedefine XML_NS
|
||||||
|
|
||||||
|
/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define __func__ __FUNCTION__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> does not define. */
|
||||||
|
#cmakedefine off_t @OFF_T@
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||||
|
#cmakedefine size_t @SIZE_T@
|
||||||
|
|
||||||
|
#endif // ndef EXPAT_CONFIG_H
|
||||||
165
deps/EXPAT/expat/expat_external.h
vendored
Normal file
165
deps/EXPAT/expat/expat_external.h
vendored
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2000-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
||||||
|
Copyright (c) 2016 Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||||
|
Copyright (c) 2016-2019 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
||||||
|
Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Expat_External_INCLUDED
|
||||||
|
#define Expat_External_INCLUDED 1
|
||||||
|
|
||||||
|
/* External API definitions */
|
||||||
|
|
||||||
|
/* Expat tries very hard to make the API boundary very specifically
|
||||||
|
defined. There are two macros defined to control this boundary;
|
||||||
|
each of these can be defined before including this header to
|
||||||
|
achieve some different behavior, but doing so it not recommended or
|
||||||
|
tested frequently.
|
||||||
|
|
||||||
|
XMLCALL - The calling convention to use for all calls across the
|
||||||
|
"library boundary." This will default to cdecl, and
|
||||||
|
try really hard to tell the compiler that's what we
|
||||||
|
want.
|
||||||
|
|
||||||
|
XMLIMPORT - Whatever magic is needed to note that a function is
|
||||||
|
to be imported from a dynamically loaded library
|
||||||
|
(.dll, .so, or .sl, depending on your platform).
|
||||||
|
|
||||||
|
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
||||||
|
expected to be directly useful in client code is XMLCALL.
|
||||||
|
|
||||||
|
Note that on at least some Unix versions, the Expat library must be
|
||||||
|
compiled with the cdecl calling convention as the default since
|
||||||
|
system headers may assume the cdecl convention.
|
||||||
|
*/
|
||||||
|
#ifndef XMLCALL
|
||||||
|
# if defined(_MSC_VER)
|
||||||
|
# define XMLCALL __cdecl
|
||||||
|
# elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
|
||||||
|
# define XMLCALL __attribute__((cdecl))
|
||||||
|
# else
|
||||||
|
/* For any platform which uses this definition and supports more than
|
||||||
|
one calling convention, we need to extend this definition to
|
||||||
|
declare the convention used on that platform, if it's possible to
|
||||||
|
do so.
|
||||||
|
|
||||||
|
If this is the case for your platform, please file a bug report
|
||||||
|
with information on how to identify your platform via the C
|
||||||
|
pre-processor and how to specify the same calling convention as the
|
||||||
|
platform's malloc() implementation.
|
||||||
|
*/
|
||||||
|
# define XMLCALL
|
||||||
|
# endif
|
||||||
|
#endif /* not defined XMLCALL */
|
||||||
|
|
||||||
|
#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
|
||||||
|
# ifndef XML_BUILDING_EXPAT
|
||||||
|
/* using Expat from an application */
|
||||||
|
|
||||||
|
# if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
|
||||||
|
//# define XMLIMPORT __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif /* not defined XML_STATIC */
|
||||||
|
|
||||||
|
#ifndef XML_ENABLE_VISIBILITY
|
||||||
|
# define XML_ENABLE_VISIBILITY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
|
||||||
|
# define XMLIMPORT __attribute__((visibility("default")))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If we didn't define it above, define it away: */
|
||||||
|
#ifndef XMLIMPORT
|
||||||
|
# define XMLIMPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__) \
|
||||||
|
&& (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
|
||||||
|
# define XML_ATTR_MALLOC __attribute__((__malloc__))
|
||||||
|
#else
|
||||||
|
# define XML_ATTR_MALLOC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__) \
|
||||||
|
&& ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||||
|
# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
|
||||||
|
#else
|
||||||
|
# define XML_ATTR_ALLOC_SIZE(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XML_UNICODE_WCHAR_T
|
||||||
|
# ifndef XML_UNICODE
|
||||||
|
# define XML_UNICODE
|
||||||
|
# endif
|
||||||
|
# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
|
||||||
|
# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||||
|
# ifdef XML_UNICODE_WCHAR_T
|
||||||
|
typedef wchar_t XML_Char;
|
||||||
|
typedef wchar_t XML_LChar;
|
||||||
|
# else
|
||||||
|
typedef unsigned short XML_Char;
|
||||||
|
typedef char XML_LChar;
|
||||||
|
# endif /* XML_UNICODE_WCHAR_T */
|
||||||
|
#else /* Information is UTF-8 encoded. */
|
||||||
|
typedef char XML_Char;
|
||||||
|
typedef char XML_LChar;
|
||||||
|
#endif /* XML_UNICODE */
|
||||||
|
|
||||||
|
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
|
||||||
|
typedef long long XML_Index;
|
||||||
|
typedef unsigned long long XML_Size;
|
||||||
|
#else
|
||||||
|
typedef long XML_Index;
|
||||||
|
typedef unsigned long XML_Size;
|
||||||
|
#endif /* XML_LARGE_SIZE */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* not Expat_External_INCLUDED */
|
||||||
67
deps/EXPAT/expat/iasciitab.h
vendored
Normal file
67
deps/EXPAT/expat/iasciitab.h
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
|
||||||
|
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
|
||||||
|
/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
|
||||||
|
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
|
||||||
|
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
|
||||||
|
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
|
||||||
|
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
||||||
|
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
||||||
|
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
|
||||||
|
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
|
||||||
|
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
||||||
|
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
||||||
|
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
|
||||||
|
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
|
||||||
|
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
||||||
|
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
||||||
|
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
||||||
|
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
165
deps/EXPAT/expat/internal.h
vendored
Normal file
165
deps/EXPAT/expat/internal.h
vendored
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
/* internal.h
|
||||||
|
|
||||||
|
Internal definitions used by Expat. This is not needed to compile
|
||||||
|
client code.
|
||||||
|
|
||||||
|
The following calling convention macros are defined for frequently
|
||||||
|
called functions:
|
||||||
|
|
||||||
|
FASTCALL - Used for those internal functions that have a simple
|
||||||
|
body and a low number of arguments and local variables.
|
||||||
|
|
||||||
|
PTRCALL - Used for functions called though function pointers.
|
||||||
|
|
||||||
|
PTRFASTCALL - Like PTRCALL, but for low number of arguments.
|
||||||
|
|
||||||
|
inline - Used for selected internal functions for which inlining
|
||||||
|
may improve performance on some platforms.
|
||||||
|
|
||||||
|
Note: Use of these macros is based on judgement, not hard rules,
|
||||||
|
and therefore subject to change.
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 2002-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
||||||
|
Copyright (c) 2003 Greg Stein <gstein@users.sourceforge.net>
|
||||||
|
Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
|
||||||
|
Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined(__i386__) && ! defined(__MINGW32__)
|
||||||
|
/* We'll use this version by default only where we know it helps.
|
||||||
|
|
||||||
|
regparm() generates warnings on Solaris boxes. See SF bug #692878.
|
||||||
|
|
||||||
|
Instability reported with egcs on a RedHat Linux 7.3.
|
||||||
|
Let's comment out:
|
||||||
|
#define FASTCALL __attribute__((stdcall, regparm(3)))
|
||||||
|
and let's try this:
|
||||||
|
*/
|
||||||
|
# define FASTCALL __attribute__((regparm(3)))
|
||||||
|
# define PTRFASTCALL __attribute__((regparm(3)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Using __fastcall seems to have an unexpected negative effect under
|
||||||
|
MS VC++, especially for function pointers, so we won't use it for
|
||||||
|
now on that platform. It may be reconsidered for a future release
|
||||||
|
if it can be made more effective.
|
||||||
|
Likely reason: __fastcall on Windows is like stdcall, therefore
|
||||||
|
the compiler cannot perform stack optimizations for call clusters.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Make sure all of these are defined if they aren't already. */
|
||||||
|
|
||||||
|
#ifndef FASTCALL
|
||||||
|
# define FASTCALL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PTRCALL
|
||||||
|
# define PTRCALL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PTRFASTCALL
|
||||||
|
# define PTRFASTCALL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef XML_MIN_SIZE
|
||||||
|
# if ! defined(__cplusplus) && ! defined(inline)
|
||||||
|
# ifdef __GNUC__
|
||||||
|
# define inline __inline
|
||||||
|
# endif /* __GNUC__ */
|
||||||
|
# endif
|
||||||
|
#endif /* XML_MIN_SIZE */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# define inline inline
|
||||||
|
#else
|
||||||
|
# ifndef inline
|
||||||
|
# define inline
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <limits.h> // ULONG_MAX
|
||||||
|
|
||||||
|
#if defined(_WIN32) \
|
||||||
|
&& (! defined(__USE_MINGW_ANSI_STDIO) \
|
||||||
|
|| (1 - __USE_MINGW_ANSI_STDIO - 1 == 0))
|
||||||
|
# define EXPAT_FMT_ULL(midpart) "%" midpart "I64u"
|
||||||
|
# if defined(_WIN64) // Note: modifiers "td" and "zu" do not work for MinGW
|
||||||
|
# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "I64d"
|
||||||
|
# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "I64u"
|
||||||
|
# else
|
||||||
|
# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d"
|
||||||
|
# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define EXPAT_FMT_ULL(midpart) "%" midpart "llu"
|
||||||
|
# if ! defined(ULONG_MAX)
|
||||||
|
# error Compiler did not define ULONG_MAX for us
|
||||||
|
# elif ULONG_MAX == 18446744073709551615u // 2^64-1
|
||||||
|
# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "ld"
|
||||||
|
# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "lu"
|
||||||
|
# else
|
||||||
|
# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d"
|
||||||
|
# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNUSED_P
|
||||||
|
# define UNUSED_P(p) (void)p
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* NOTE BEGIN If you ever patch these defaults to greater values
|
||||||
|
for non-attack XML payload in your environment,
|
||||||
|
please file a bug report with libexpat. Thank you!
|
||||||
|
*/
|
||||||
|
#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT \
|
||||||
|
100.0f
|
||||||
|
#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT \
|
||||||
|
8388608 // 8 MiB, 2^23
|
||||||
|
/* NOTE END */
|
||||||
|
|
||||||
|
#include "expat.h" // so we can use type XML_Parser below
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void _INTERNAL_trim_to_complete_utf8_characters(const char *from,
|
||||||
|
const char **fromLimRef);
|
||||||
|
|
||||||
|
#if defined(XML_DTD)
|
||||||
|
unsigned long long testingAccountingGetCountBytesDirect(XML_Parser parser);
|
||||||
|
unsigned long long testingAccountingGetCountBytesIndirect(XML_Parser parser);
|
||||||
|
const char *unsignedCharToPrintable(unsigned char c);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
66
deps/EXPAT/expat/latin1tab.h
vendored
Normal file
66
deps/EXPAT/expat/latin1tab.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
|
||||||
|
/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
|
||||||
|
/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
|
||||||
|
/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||||
|
/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
||||||
|
/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
||||||
|
/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
|
/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||||
136
deps/EXPAT/expat/nametab.h
vendored
Normal file
136
deps/EXPAT/expat/nametab.h
vendored
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const unsigned namingBitmap[] = {
|
||||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||||
|
0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||||
|
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x04000000,
|
||||||
|
0x87FFFFFE, 0x07FFFFFE, 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
|
||||||
|
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||||
|
0xFFFFE00F, 0xFC31FFFF, 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
||||||
|
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
|
||||||
|
0x00000000, 0x00000000, 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
||||||
|
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFF0003, 0xFFFFFFFF,
|
||||||
|
0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
||||||
|
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, 0x00000000, 0x07FFFFFE,
|
||||||
|
0x000007FE, 0xFFFE0000, 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
|
||||||
|
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, 0xFFF99FE0, 0x03C5FDFF,
|
||||||
|
0xB0000000, 0x00030003, 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
|
||||||
|
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, 0xFFF99FE0, 0x23CDFDFF,
|
||||||
|
0xB0000000, 0x00000003, 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
|
||||||
|
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, 0xFFFDDFE0, 0x03EFFDFF,
|
||||||
|
0x40000000, 0x00000003, 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
|
||||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFE, 0x000D7FFF,
|
||||||
|
0x0000003F, 0x00000000, 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
|
||||||
|
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, 0x00000000, 0x00000000,
|
||||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||||
|
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, 0x0007DAED, 0x50000000,
|
||||||
|
0x82315001, 0x002C62AB, 0x40000000, 0xF580C900, 0x00000007, 0x02010800,
|
||||||
|
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0FFFFFFF, 0xFFFFFFFF,
|
||||||
|
0xFFFFFFFF, 0x03FFFFFF, 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
|
||||||
|
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, 0x00000000, 0x00004C40,
|
||||||
|
0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000,
|
||||||
|
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, 0x001FFFFF, 0xFFFFFFFE,
|
||||||
|
0xFFFFFFFF, 0x07FFFFFF, 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
|
||||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||||
|
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
|
||||||
|
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F,
|
||||||
|
0x00000000, 0x00000000, 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
|
||||||
|
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, 0x00FFFFFF, 0x00000000,
|
||||||
|
0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
|
||||||
|
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, 0xFFFFD7C0, 0xFFFFFFFB,
|
||||||
|
0x547F7FFF, 0x000FFFFD, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
||||||
|
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000,
|
||||||
|
0x027FFFFF, 0xFFFFFFFE, 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
|
||||||
|
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, 0xFFFFFFFF, 0x7CFFFFFF,
|
||||||
|
0xFFEF7FFF, 0x03FF3DFF, 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
|
||||||
|
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, 0xFFF987E4, 0xD36DFDFF,
|
||||||
|
0x5E003987, 0x001FFFC0, 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
|
||||||
|
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, 0xD63DC7EC, 0xC3BFC718,
|
||||||
|
0x00803DC7, 0x0000FF80, 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
|
||||||
|
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, 0xFFFDDFEC, 0xC3FFFDFF,
|
||||||
|
0x00803DCF, 0x0000FFC3, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||||
|
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, 0xFEF02596, 0x3BFF6CAE,
|
||||||
|
0x03FF3F5F, 0x00000000, 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
|
||||||
|
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
|
||||||
|
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, 0x661FFFFF, 0xFFFFFFFE,
|
||||||
|
0xFFFFFFFF, 0x77FFFFFF,
|
||||||
|
};
|
||||||
|
static const unsigned char nmstrtPages[] = {
|
||||||
|
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x09, 0x0A, 0x0B,
|
||||||
|
0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x00, 0x14, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
|
static const unsigned char namePages[] = {
|
||||||
|
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, 0x00, 0x1F, 0x20, 0x21,
|
||||||
|
0x22, 0x23, 0x24, 0x25, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x26, 0x14, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
393
deps/EXPAT/expat/siphash.h
vendored
Normal file
393
deps/EXPAT/expat/siphash.h
vendored
Normal file
@@ -0,0 +1,393 @@
|
|||||||
|
/* ==========================================================================
|
||||||
|
* siphash.h - SipHash-2-4 in a single header file
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Derived by William Ahern from the reference implementation[1] published[2]
|
||||||
|
* by Jean-Philippe Aumasson and Daniel J. Berstein.
|
||||||
|
* Minimal changes by Sebastian Pipping and Victor Stinner on top, see below.
|
||||||
|
* Licensed under the CC0 Public Domain Dedication license.
|
||||||
|
*
|
||||||
|
* 1. https://www.131002.net/siphash/siphash24.c
|
||||||
|
* 2. https://www.131002.net/siphash/
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* HISTORY:
|
||||||
|
*
|
||||||
|
* 2020-10-03 (Sebastian Pipping)
|
||||||
|
* - Drop support for Visual Studio 9.0/2008 and earlier
|
||||||
|
*
|
||||||
|
* 2019-08-03 (Sebastian Pipping)
|
||||||
|
* - Mark part of sip24_valid as to be excluded from clang-format
|
||||||
|
* - Re-format code using clang-format 9
|
||||||
|
*
|
||||||
|
* 2018-07-08 (Anton Maklakov)
|
||||||
|
* - Add "fall through" markers for GCC's -Wimplicit-fallthrough
|
||||||
|
*
|
||||||
|
* 2017-11-03 (Sebastian Pipping)
|
||||||
|
* - Hide sip_tobin and sip_binof unless SIPHASH_TOBIN macro is defined
|
||||||
|
*
|
||||||
|
* 2017-07-25 (Vadim Zeitlin)
|
||||||
|
* - Fix use of SIPHASH_MAIN macro
|
||||||
|
*
|
||||||
|
* 2017-07-05 (Sebastian Pipping)
|
||||||
|
* - Use _SIP_ULL macro to not require a C++11 compiler if compiled as C++
|
||||||
|
* - Add const qualifiers at two places
|
||||||
|
* - Ensure <=80 characters line length (assuming tab width 4)
|
||||||
|
*
|
||||||
|
* 2017-06-23 (Victor Stinner)
|
||||||
|
* - Address Win64 compile warnings
|
||||||
|
*
|
||||||
|
* 2017-06-18 (Sebastian Pipping)
|
||||||
|
* - Clarify license note in the header
|
||||||
|
* - Address C89 issues:
|
||||||
|
* - Stop using inline keyword (and let compiler decide)
|
||||||
|
* - Replace _Bool by int
|
||||||
|
* - Turn macro siphash24 into a function
|
||||||
|
* - Address invalid conversion (void pointer) by explicit cast
|
||||||
|
* - Address lack of stdint.h for Visual Studio 2003 to 2008
|
||||||
|
* - Always expose sip24_valid (for self-tests)
|
||||||
|
*
|
||||||
|
* 2012-11-04 - Born. (William Ahern)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* USAGE:
|
||||||
|
*
|
||||||
|
* SipHash-2-4 takes as input two 64-bit words as the key, some number of
|
||||||
|
* message bytes, and outputs a 64-bit word as the message digest. This
|
||||||
|
* implementation employs two data structures: a struct sipkey for
|
||||||
|
* representing the key, and a struct siphash for representing the hash
|
||||||
|
* state.
|
||||||
|
*
|
||||||
|
* For converting a 16-byte unsigned char array to a key, use either the
|
||||||
|
* macro sip_keyof or the routine sip_tokey. The former instantiates a
|
||||||
|
* compound literal key, while the latter requires a key object as a
|
||||||
|
* parameter.
|
||||||
|
*
|
||||||
|
* unsigned char secret[16];
|
||||||
|
* arc4random_buf(secret, sizeof secret);
|
||||||
|
* struct sipkey *key = sip_keyof(secret);
|
||||||
|
*
|
||||||
|
* For hashing a message, use either the convenience macro siphash24 or the
|
||||||
|
* routines sip24_init, sip24_update, and sip24_final.
|
||||||
|
*
|
||||||
|
* struct siphash state;
|
||||||
|
* void *msg;
|
||||||
|
* size_t len;
|
||||||
|
* uint64_t hash;
|
||||||
|
*
|
||||||
|
* sip24_init(&state, key);
|
||||||
|
* sip24_update(&state, msg, len);
|
||||||
|
* hash = sip24_final(&state);
|
||||||
|
*
|
||||||
|
* or
|
||||||
|
*
|
||||||
|
* hash = siphash24(msg, len, key);
|
||||||
|
*
|
||||||
|
* To convert the 64-bit hash value to a canonical 8-byte little-endian
|
||||||
|
* binary representation, use either the macro sip_binof or the routine
|
||||||
|
* sip_tobin. The former instantiates and returns a compound literal array,
|
||||||
|
* while the latter requires an array object as a parameter.
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* NOTES:
|
||||||
|
*
|
||||||
|
* o Neither sip_keyof, sip_binof, nor siphash24 will work with compilers
|
||||||
|
* lacking compound literal support. Instead, you must use the lower-level
|
||||||
|
* interfaces which take as parameters the temporary state objects.
|
||||||
|
*
|
||||||
|
* o Uppercase macros may evaluate parameters more than once. Lowercase
|
||||||
|
* macros should not exhibit any such side effects.
|
||||||
|
* ==========================================================================
|
||||||
|
*/
|
||||||
|
#ifndef SIPHASH_H
|
||||||
|
#define SIPHASH_H
|
||||||
|
|
||||||
|
#include <stddef.h> /* size_t */
|
||||||
|
#include <stdint.h> /* uint64_t uint32_t uint8_t */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Workaround to not require a C++11 compiler for using ULL suffix
|
||||||
|
* if this code is included and compiled as C++; related GCC warning is:
|
||||||
|
* warning: use of C++11 long long integer constant [-Wlong-long]
|
||||||
|
*/
|
||||||
|
#define _SIP_ULL(high, low) ((((uint64_t)high) << 32) | (low))
|
||||||
|
|
||||||
|
#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
|
||||||
|
|
||||||
|
#define SIP_U32TO8_LE(p, v) \
|
||||||
|
(p)[0] = (uint8_t)((v) >> 0); \
|
||||||
|
(p)[1] = (uint8_t)((v) >> 8); \
|
||||||
|
(p)[2] = (uint8_t)((v) >> 16); \
|
||||||
|
(p)[3] = (uint8_t)((v) >> 24);
|
||||||
|
|
||||||
|
#define SIP_U64TO8_LE(p, v) \
|
||||||
|
SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0)); \
|
||||||
|
SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32));
|
||||||
|
|
||||||
|
#define SIP_U8TO64_LE(p) \
|
||||||
|
(((uint64_t)((p)[0]) << 0) | ((uint64_t)((p)[1]) << 8) \
|
||||||
|
| ((uint64_t)((p)[2]) << 16) | ((uint64_t)((p)[3]) << 24) \
|
||||||
|
| ((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40) \
|
||||||
|
| ((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56))
|
||||||
|
|
||||||
|
#define SIPHASH_INITIALIZER \
|
||||||
|
{ 0, 0, 0, 0, {0}, 0, 0 }
|
||||||
|
|
||||||
|
struct siphash {
|
||||||
|
uint64_t v0, v1, v2, v3;
|
||||||
|
|
||||||
|
unsigned char buf[8], *p;
|
||||||
|
uint64_t c;
|
||||||
|
}; /* struct siphash */
|
||||||
|
|
||||||
|
#define SIP_KEYLEN 16
|
||||||
|
|
||||||
|
struct sipkey {
|
||||||
|
uint64_t k[2];
|
||||||
|
}; /* struct sipkey */
|
||||||
|
|
||||||
|
#define sip_keyof(k) sip_tokey(&(struct sipkey){{0}}, (k))
|
||||||
|
|
||||||
|
static struct sipkey *
|
||||||
|
sip_tokey(struct sipkey *key, const void *src) {
|
||||||
|
key->k[0] = SIP_U8TO64_LE((const unsigned char *)src);
|
||||||
|
key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8);
|
||||||
|
return key;
|
||||||
|
} /* sip_tokey() */
|
||||||
|
|
||||||
|
#ifdef SIPHASH_TOBIN
|
||||||
|
|
||||||
|
# define sip_binof(v) sip_tobin((unsigned char[8]){0}, (v))
|
||||||
|
|
||||||
|
static void *
|
||||||
|
sip_tobin(void *dst, uint64_t u64) {
|
||||||
|
SIP_U64TO8_LE((unsigned char *)dst, u64);
|
||||||
|
return dst;
|
||||||
|
} /* sip_tobin() */
|
||||||
|
|
||||||
|
#endif /* SIPHASH_TOBIN */
|
||||||
|
|
||||||
|
static void
|
||||||
|
sip_round(struct siphash *H, const int rounds) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < rounds; i++) {
|
||||||
|
H->v0 += H->v1;
|
||||||
|
H->v1 = SIP_ROTL(H->v1, 13);
|
||||||
|
H->v1 ^= H->v0;
|
||||||
|
H->v0 = SIP_ROTL(H->v0, 32);
|
||||||
|
|
||||||
|
H->v2 += H->v3;
|
||||||
|
H->v3 = SIP_ROTL(H->v3, 16);
|
||||||
|
H->v3 ^= H->v2;
|
||||||
|
|
||||||
|
H->v0 += H->v3;
|
||||||
|
H->v3 = SIP_ROTL(H->v3, 21);
|
||||||
|
H->v3 ^= H->v0;
|
||||||
|
|
||||||
|
H->v2 += H->v1;
|
||||||
|
H->v1 = SIP_ROTL(H->v1, 17);
|
||||||
|
H->v1 ^= H->v2;
|
||||||
|
H->v2 = SIP_ROTL(H->v2, 32);
|
||||||
|
}
|
||||||
|
} /* sip_round() */
|
||||||
|
|
||||||
|
static struct siphash *
|
||||||
|
sip24_init(struct siphash *H, const struct sipkey *key) {
|
||||||
|
H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0];
|
||||||
|
H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1];
|
||||||
|
H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0];
|
||||||
|
H->v3 = _SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1];
|
||||||
|
|
||||||
|
H->p = H->buf;
|
||||||
|
H->c = 0;
|
||||||
|
|
||||||
|
return H;
|
||||||
|
} /* sip24_init() */
|
||||||
|
|
||||||
|
#define sip_endof(a) (&(a)[sizeof(a) / sizeof *(a)])
|
||||||
|
|
||||||
|
static struct siphash *
|
||||||
|
sip24_update(struct siphash *H, const void *src, size_t len) {
|
||||||
|
const unsigned char *p = (const unsigned char *)src, *pe = p + len;
|
||||||
|
uint64_t m;
|
||||||
|
|
||||||
|
do {
|
||||||
|
while (p < pe && H->p < sip_endof(H->buf))
|
||||||
|
*H->p++ = *p++;
|
||||||
|
|
||||||
|
if (H->p < sip_endof(H->buf))
|
||||||
|
break;
|
||||||
|
|
||||||
|
m = SIP_U8TO64_LE(H->buf);
|
||||||
|
H->v3 ^= m;
|
||||||
|
sip_round(H, 2);
|
||||||
|
H->v0 ^= m;
|
||||||
|
|
||||||
|
H->p = H->buf;
|
||||||
|
H->c += 8;
|
||||||
|
} while (p < pe);
|
||||||
|
|
||||||
|
return H;
|
||||||
|
} /* sip24_update() */
|
||||||
|
|
||||||
|
static uint64_t
|
||||||
|
sip24_final(struct siphash *H) {
|
||||||
|
const char left = (char)(H->p - H->buf);
|
||||||
|
uint64_t b = (H->c + left) << 56;
|
||||||
|
|
||||||
|
switch (left) {
|
||||||
|
case 7:
|
||||||
|
b |= (uint64_t)H->buf[6] << 48;
|
||||||
|
/* fall through */
|
||||||
|
case 6:
|
||||||
|
b |= (uint64_t)H->buf[5] << 40;
|
||||||
|
/* fall through */
|
||||||
|
case 5:
|
||||||
|
b |= (uint64_t)H->buf[4] << 32;
|
||||||
|
/* fall through */
|
||||||
|
case 4:
|
||||||
|
b |= (uint64_t)H->buf[3] << 24;
|
||||||
|
/* fall through */
|
||||||
|
case 3:
|
||||||
|
b |= (uint64_t)H->buf[2] << 16;
|
||||||
|
/* fall through */
|
||||||
|
case 2:
|
||||||
|
b |= (uint64_t)H->buf[1] << 8;
|
||||||
|
/* fall through */
|
||||||
|
case 1:
|
||||||
|
b |= (uint64_t)H->buf[0] << 0;
|
||||||
|
/* fall through */
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
H->v3 ^= b;
|
||||||
|
sip_round(H, 2);
|
||||||
|
H->v0 ^= b;
|
||||||
|
H->v2 ^= 0xff;
|
||||||
|
sip_round(H, 4);
|
||||||
|
|
||||||
|
return H->v0 ^ H->v1 ^ H->v2 ^ H->v3;
|
||||||
|
} /* sip24_final() */
|
||||||
|
|
||||||
|
static uint64_t
|
||||||
|
siphash24(const void *src, size_t len, const struct sipkey *key) {
|
||||||
|
struct siphash state = SIPHASH_INITIALIZER;
|
||||||
|
return sip24_final(sip24_update(sip24_init(&state, key), src, len));
|
||||||
|
} /* siphash24() */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SipHash-2-4 output with
|
||||||
|
* k = 00 01 02 ...
|
||||||
|
* and
|
||||||
|
* in = (empty string)
|
||||||
|
* in = 00 (1 byte)
|
||||||
|
* in = 00 01 (2 bytes)
|
||||||
|
* in = 00 01 02 (3 bytes)
|
||||||
|
* ...
|
||||||
|
* in = 00 01 02 ... 3e (63 bytes)
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
sip24_valid(void) {
|
||||||
|
/* clang-format off */
|
||||||
|
static const unsigned char vectors[64][8] = {
|
||||||
|
{ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, },
|
||||||
|
{ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, },
|
||||||
|
{ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, },
|
||||||
|
{ 0x2d, 0x7e, 0xfb, 0xd7, 0x96, 0x66, 0x67, 0x85, },
|
||||||
|
{ 0xb7, 0x87, 0x71, 0x27, 0xe0, 0x94, 0x27, 0xcf, },
|
||||||
|
{ 0x8d, 0xa6, 0x99, 0xcd, 0x64, 0x55, 0x76, 0x18, },
|
||||||
|
{ 0xce, 0xe3, 0xfe, 0x58, 0x6e, 0x46, 0xc9, 0xcb, },
|
||||||
|
{ 0x37, 0xd1, 0x01, 0x8b, 0xf5, 0x00, 0x02, 0xab, },
|
||||||
|
{ 0x62, 0x24, 0x93, 0x9a, 0x79, 0xf5, 0xf5, 0x93, },
|
||||||
|
{ 0xb0, 0xe4, 0xa9, 0x0b, 0xdf, 0x82, 0x00, 0x9e, },
|
||||||
|
{ 0xf3, 0xb9, 0xdd, 0x94, 0xc5, 0xbb, 0x5d, 0x7a, },
|
||||||
|
{ 0xa7, 0xad, 0x6b, 0x22, 0x46, 0x2f, 0xb3, 0xf4, },
|
||||||
|
{ 0xfb, 0xe5, 0x0e, 0x86, 0xbc, 0x8f, 0x1e, 0x75, },
|
||||||
|
{ 0x90, 0x3d, 0x84, 0xc0, 0x27, 0x56, 0xea, 0x14, },
|
||||||
|
{ 0xee, 0xf2, 0x7a, 0x8e, 0x90, 0xca, 0x23, 0xf7, },
|
||||||
|
{ 0xe5, 0x45, 0xbe, 0x49, 0x61, 0xca, 0x29, 0xa1, },
|
||||||
|
{ 0xdb, 0x9b, 0xc2, 0x57, 0x7f, 0xcc, 0x2a, 0x3f, },
|
||||||
|
{ 0x94, 0x47, 0xbe, 0x2c, 0xf5, 0xe9, 0x9a, 0x69, },
|
||||||
|
{ 0x9c, 0xd3, 0x8d, 0x96, 0xf0, 0xb3, 0xc1, 0x4b, },
|
||||||
|
{ 0xbd, 0x61, 0x79, 0xa7, 0x1d, 0xc9, 0x6d, 0xbb, },
|
||||||
|
{ 0x98, 0xee, 0xa2, 0x1a, 0xf2, 0x5c, 0xd6, 0xbe, },
|
||||||
|
{ 0xc7, 0x67, 0x3b, 0x2e, 0xb0, 0xcb, 0xf2, 0xd0, },
|
||||||
|
{ 0x88, 0x3e, 0xa3, 0xe3, 0x95, 0x67, 0x53, 0x93, },
|
||||||
|
{ 0xc8, 0xce, 0x5c, 0xcd, 0x8c, 0x03, 0x0c, 0xa8, },
|
||||||
|
{ 0x94, 0xaf, 0x49, 0xf6, 0xc6, 0x50, 0xad, 0xb8, },
|
||||||
|
{ 0xea, 0xb8, 0x85, 0x8a, 0xde, 0x92, 0xe1, 0xbc, },
|
||||||
|
{ 0xf3, 0x15, 0xbb, 0x5b, 0xb8, 0x35, 0xd8, 0x17, },
|
||||||
|
{ 0xad, 0xcf, 0x6b, 0x07, 0x63, 0x61, 0x2e, 0x2f, },
|
||||||
|
{ 0xa5, 0xc9, 0x1d, 0xa7, 0xac, 0xaa, 0x4d, 0xde, },
|
||||||
|
{ 0x71, 0x65, 0x95, 0x87, 0x66, 0x50, 0xa2, 0xa6, },
|
||||||
|
{ 0x28, 0xef, 0x49, 0x5c, 0x53, 0xa3, 0x87, 0xad, },
|
||||||
|
{ 0x42, 0xc3, 0x41, 0xd8, 0xfa, 0x92, 0xd8, 0x32, },
|
||||||
|
{ 0xce, 0x7c, 0xf2, 0x72, 0x2f, 0x51, 0x27, 0x71, },
|
||||||
|
{ 0xe3, 0x78, 0x59, 0xf9, 0x46, 0x23, 0xf3, 0xa7, },
|
||||||
|
{ 0x38, 0x12, 0x05, 0xbb, 0x1a, 0xb0, 0xe0, 0x12, },
|
||||||
|
{ 0xae, 0x97, 0xa1, 0x0f, 0xd4, 0x34, 0xe0, 0x15, },
|
||||||
|
{ 0xb4, 0xa3, 0x15, 0x08, 0xbe, 0xff, 0x4d, 0x31, },
|
||||||
|
{ 0x81, 0x39, 0x62, 0x29, 0xf0, 0x90, 0x79, 0x02, },
|
||||||
|
{ 0x4d, 0x0c, 0xf4, 0x9e, 0xe5, 0xd4, 0xdc, 0xca, },
|
||||||
|
{ 0x5c, 0x73, 0x33, 0x6a, 0x76, 0xd8, 0xbf, 0x9a, },
|
||||||
|
{ 0xd0, 0xa7, 0x04, 0x53, 0x6b, 0xa9, 0x3e, 0x0e, },
|
||||||
|
{ 0x92, 0x59, 0x58, 0xfc, 0xd6, 0x42, 0x0c, 0xad, },
|
||||||
|
{ 0xa9, 0x15, 0xc2, 0x9b, 0xc8, 0x06, 0x73, 0x18, },
|
||||||
|
{ 0x95, 0x2b, 0x79, 0xf3, 0xbc, 0x0a, 0xa6, 0xd4, },
|
||||||
|
{ 0xf2, 0x1d, 0xf2, 0xe4, 0x1d, 0x45, 0x35, 0xf9, },
|
||||||
|
{ 0x87, 0x57, 0x75, 0x19, 0x04, 0x8f, 0x53, 0xa9, },
|
||||||
|
{ 0x10, 0xa5, 0x6c, 0xf5, 0xdf, 0xcd, 0x9a, 0xdb, },
|
||||||
|
{ 0xeb, 0x75, 0x09, 0x5c, 0xcd, 0x98, 0x6c, 0xd0, },
|
||||||
|
{ 0x51, 0xa9, 0xcb, 0x9e, 0xcb, 0xa3, 0x12, 0xe6, },
|
||||||
|
{ 0x96, 0xaf, 0xad, 0xfc, 0x2c, 0xe6, 0x66, 0xc7, },
|
||||||
|
{ 0x72, 0xfe, 0x52, 0x97, 0x5a, 0x43, 0x64, 0xee, },
|
||||||
|
{ 0x5a, 0x16, 0x45, 0xb2, 0x76, 0xd5, 0x92, 0xa1, },
|
||||||
|
{ 0xb2, 0x74, 0xcb, 0x8e, 0xbf, 0x87, 0x87, 0x0a, },
|
||||||
|
{ 0x6f, 0x9b, 0xb4, 0x20, 0x3d, 0xe7, 0xb3, 0x81, },
|
||||||
|
{ 0xea, 0xec, 0xb2, 0xa3, 0x0b, 0x22, 0xa8, 0x7f, },
|
||||||
|
{ 0x99, 0x24, 0xa4, 0x3c, 0xc1, 0x31, 0x57, 0x24, },
|
||||||
|
{ 0xbd, 0x83, 0x8d, 0x3a, 0xaf, 0xbf, 0x8d, 0xb7, },
|
||||||
|
{ 0x0b, 0x1a, 0x2a, 0x32, 0x65, 0xd5, 0x1a, 0xea, },
|
||||||
|
{ 0x13, 0x50, 0x79, 0xa3, 0x23, 0x1c, 0xe6, 0x60, },
|
||||||
|
{ 0x93, 0x2b, 0x28, 0x46, 0xe4, 0xd7, 0x06, 0x66, },
|
||||||
|
{ 0xe1, 0x91, 0x5f, 0x5c, 0xb1, 0xec, 0xa4, 0x6c, },
|
||||||
|
{ 0xf3, 0x25, 0x96, 0x5c, 0xa1, 0x6d, 0x62, 0x9f, },
|
||||||
|
{ 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, },
|
||||||
|
{ 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, }
|
||||||
|
};
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
|
unsigned char in[64];
|
||||||
|
struct sipkey k;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
sip_tokey(&k, "\000\001\002\003\004\005\006\007\010\011"
|
||||||
|
"\012\013\014\015\016\017");
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof in; ++i) {
|
||||||
|
in[i] = (unsigned char)i;
|
||||||
|
|
||||||
|
if (siphash24(in, i, &k) != SIP_U8TO64_LE(vectors[i]))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
} /* sip24_valid() */
|
||||||
|
|
||||||
|
#ifdef SIPHASH_MAIN
|
||||||
|
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void) {
|
||||||
|
const int ok = sip24_valid();
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
puts("OK");
|
||||||
|
else
|
||||||
|
puts("FAIL");
|
||||||
|
|
||||||
|
return ! ok;
|
||||||
|
} /* main() */
|
||||||
|
|
||||||
|
#endif /* SIPHASH_MAIN */
|
||||||
|
|
||||||
|
#endif /* SIPHASH_H */
|
||||||
66
deps/EXPAT/expat/utf8tab.h
vendored
Normal file
66
deps/EXPAT/expat/utf8tab.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||||
|
/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||||
|
/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||||
|
/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||||
|
/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||||
|
/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||||
|
/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||||
|
/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||||
|
/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||||
|
/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
||||||
|
/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
||||||
|
/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
||||||
|
/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
||||||
|
/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
|
||||||
|
/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||||
|
/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,
|
||||||
8400
deps/EXPAT/expat/xmlparse.c
vendored
Normal file
8400
deps/EXPAT/expat/xmlparse.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1251
deps/EXPAT/expat/xmlrole.c
vendored
Normal file
1251
deps/EXPAT/expat/xmlrole.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
142
deps/EXPAT/expat/xmlrole.h
vendored
Normal file
142
deps/EXPAT/expat/xmlrole.h
vendored
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Karl Waclawek <karl@waclawek.net>
|
||||||
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XmlRole_INCLUDED
|
||||||
|
#define XmlRole_INCLUDED 1
|
||||||
|
|
||||||
|
#ifdef __VMS
|
||||||
|
/* 0 1 2 3 0 1 2 3
|
||||||
|
1234567890123456789012345678901 1234567890123456789012345678901 */
|
||||||
|
# define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "xmltok.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum {
|
||||||
|
XML_ROLE_ERROR = -1,
|
||||||
|
XML_ROLE_NONE = 0,
|
||||||
|
XML_ROLE_XML_DECL,
|
||||||
|
XML_ROLE_INSTANCE_START,
|
||||||
|
XML_ROLE_DOCTYPE_NONE,
|
||||||
|
XML_ROLE_DOCTYPE_NAME,
|
||||||
|
XML_ROLE_DOCTYPE_SYSTEM_ID,
|
||||||
|
XML_ROLE_DOCTYPE_PUBLIC_ID,
|
||||||
|
XML_ROLE_DOCTYPE_INTERNAL_SUBSET,
|
||||||
|
XML_ROLE_DOCTYPE_CLOSE,
|
||||||
|
XML_ROLE_GENERAL_ENTITY_NAME,
|
||||||
|
XML_ROLE_PARAM_ENTITY_NAME,
|
||||||
|
XML_ROLE_ENTITY_NONE,
|
||||||
|
XML_ROLE_ENTITY_VALUE,
|
||||||
|
XML_ROLE_ENTITY_SYSTEM_ID,
|
||||||
|
XML_ROLE_ENTITY_PUBLIC_ID,
|
||||||
|
XML_ROLE_ENTITY_COMPLETE,
|
||||||
|
XML_ROLE_ENTITY_NOTATION_NAME,
|
||||||
|
XML_ROLE_NOTATION_NONE,
|
||||||
|
XML_ROLE_NOTATION_NAME,
|
||||||
|
XML_ROLE_NOTATION_SYSTEM_ID,
|
||||||
|
XML_ROLE_NOTATION_NO_SYSTEM_ID,
|
||||||
|
XML_ROLE_NOTATION_PUBLIC_ID,
|
||||||
|
XML_ROLE_ATTRIBUTE_NAME,
|
||||||
|
XML_ROLE_ATTRIBUTE_TYPE_CDATA,
|
||||||
|
XML_ROLE_ATTRIBUTE_TYPE_ID,
|
||||||
|
XML_ROLE_ATTRIBUTE_TYPE_IDREF,
|
||||||
|
XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
|
||||||
|
XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
|
||||||
|
XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
|
||||||
|
XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
|
||||||
|
XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
|
||||||
|
XML_ROLE_ATTRIBUTE_ENUM_VALUE,
|
||||||
|
XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
|
||||||
|
XML_ROLE_ATTLIST_NONE,
|
||||||
|
XML_ROLE_ATTLIST_ELEMENT_NAME,
|
||||||
|
XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
|
||||||
|
XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
|
||||||
|
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
|
||||||
|
XML_ROLE_FIXED_ATTRIBUTE_VALUE,
|
||||||
|
XML_ROLE_ELEMENT_NONE,
|
||||||
|
XML_ROLE_ELEMENT_NAME,
|
||||||
|
XML_ROLE_CONTENT_ANY,
|
||||||
|
XML_ROLE_CONTENT_EMPTY,
|
||||||
|
XML_ROLE_CONTENT_PCDATA,
|
||||||
|
XML_ROLE_GROUP_OPEN,
|
||||||
|
XML_ROLE_GROUP_CLOSE,
|
||||||
|
XML_ROLE_GROUP_CLOSE_REP,
|
||||||
|
XML_ROLE_GROUP_CLOSE_OPT,
|
||||||
|
XML_ROLE_GROUP_CLOSE_PLUS,
|
||||||
|
XML_ROLE_GROUP_CHOICE,
|
||||||
|
XML_ROLE_GROUP_SEQUENCE,
|
||||||
|
XML_ROLE_CONTENT_ELEMENT,
|
||||||
|
XML_ROLE_CONTENT_ELEMENT_REP,
|
||||||
|
XML_ROLE_CONTENT_ELEMENT_OPT,
|
||||||
|
XML_ROLE_CONTENT_ELEMENT_PLUS,
|
||||||
|
XML_ROLE_PI,
|
||||||
|
XML_ROLE_COMMENT,
|
||||||
|
#ifdef XML_DTD
|
||||||
|
XML_ROLE_TEXT_DECL,
|
||||||
|
XML_ROLE_IGNORE_SECT,
|
||||||
|
XML_ROLE_INNER_PARAM_ENTITY_REF,
|
||||||
|
#endif /* XML_DTD */
|
||||||
|
XML_ROLE_PARAM_ENTITY_REF
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct prolog_state {
|
||||||
|
int(PTRCALL *handler)(struct prolog_state *state, int tok, const char *ptr,
|
||||||
|
const char *end, const ENCODING *enc);
|
||||||
|
unsigned level;
|
||||||
|
int role_none;
|
||||||
|
#ifdef XML_DTD
|
||||||
|
unsigned includeLevel;
|
||||||
|
int documentEntity;
|
||||||
|
int inEntityValue;
|
||||||
|
#endif /* XML_DTD */
|
||||||
|
} PROLOG_STATE;
|
||||||
|
|
||||||
|
void XmlPrologStateInit(PROLOG_STATE *);
|
||||||
|
#ifdef XML_DTD
|
||||||
|
void XmlPrologStateInitExternalEntity(PROLOG_STATE *);
|
||||||
|
#endif /* XML_DTD */
|
||||||
|
|
||||||
|
#define XmlTokenRole(state, tok, ptr, end, enc) \
|
||||||
|
(((state)->handler)(state, tok, ptr, end, enc))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* not XmlRole_INCLUDED */
|
||||||
1673
deps/EXPAT/expat/xmltok.c
vendored
Normal file
1673
deps/EXPAT/expat/xmltok.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
319
deps/EXPAT/expat/xmltok.h
vendored
Normal file
319
deps/EXPAT/expat/xmltok.h
vendored
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002-2005 Karl Waclawek <karl@waclawek.net>
|
||||||
|
Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XmlTok_INCLUDED
|
||||||
|
#define XmlTok_INCLUDED 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The following token may be returned by XmlContentTok */
|
||||||
|
#define XML_TOK_TRAILING_RSQB \
|
||||||
|
-5 /* ] or ]] at the end of the scan; might be \
|
||||||
|
start of illegal ]]> sequence */
|
||||||
|
/* The following tokens may be returned by both XmlPrologTok and
|
||||||
|
XmlContentTok.
|
||||||
|
*/
|
||||||
|
#define XML_TOK_NONE -4 /* The string to be scanned is empty */
|
||||||
|
#define XML_TOK_TRAILING_CR \
|
||||||
|
-3 /* A CR at the end of the scan; \
|
||||||
|
might be part of CRLF sequence */
|
||||||
|
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
|
||||||
|
#define XML_TOK_PARTIAL -1 /* only part of a token */
|
||||||
|
#define XML_TOK_INVALID 0
|
||||||
|
|
||||||
|
/* The following tokens are returned by XmlContentTok; some are also
|
||||||
|
returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok.
|
||||||
|
*/
|
||||||
|
#define XML_TOK_START_TAG_WITH_ATTS 1
|
||||||
|
#define XML_TOK_START_TAG_NO_ATTS 2
|
||||||
|
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
|
||||||
|
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
|
||||||
|
#define XML_TOK_END_TAG 5
|
||||||
|
#define XML_TOK_DATA_CHARS 6
|
||||||
|
#define XML_TOK_DATA_NEWLINE 7
|
||||||
|
#define XML_TOK_CDATA_SECT_OPEN 8
|
||||||
|
#define XML_TOK_ENTITY_REF 9
|
||||||
|
#define XML_TOK_CHAR_REF 10 /* numeric character reference */
|
||||||
|
|
||||||
|
/* The following tokens may be returned by both XmlPrologTok and
|
||||||
|
XmlContentTok.
|
||||||
|
*/
|
||||||
|
#define XML_TOK_PI 11 /* processing instruction */
|
||||||
|
#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
|
||||||
|
#define XML_TOK_COMMENT 13
|
||||||
|
#define XML_TOK_BOM 14 /* Byte order mark */
|
||||||
|
|
||||||
|
/* The following tokens are returned only by XmlPrologTok */
|
||||||
|
#define XML_TOK_PROLOG_S 15
|
||||||
|
#define XML_TOK_DECL_OPEN 16 /* <!foo */
|
||||||
|
#define XML_TOK_DECL_CLOSE 17 /* > */
|
||||||
|
#define XML_TOK_NAME 18
|
||||||
|
#define XML_TOK_NMTOKEN 19
|
||||||
|
#define XML_TOK_POUND_NAME 20 /* #name */
|
||||||
|
#define XML_TOK_OR 21 /* | */
|
||||||
|
#define XML_TOK_PERCENT 22
|
||||||
|
#define XML_TOK_OPEN_PAREN 23
|
||||||
|
#define XML_TOK_CLOSE_PAREN 24
|
||||||
|
#define XML_TOK_OPEN_BRACKET 25
|
||||||
|
#define XML_TOK_CLOSE_BRACKET 26
|
||||||
|
#define XML_TOK_LITERAL 27
|
||||||
|
#define XML_TOK_PARAM_ENTITY_REF 28
|
||||||
|
#define XML_TOK_INSTANCE_START 29
|
||||||
|
|
||||||
|
/* The following occur only in element type declarations */
|
||||||
|
#define XML_TOK_NAME_QUESTION 30 /* name? */
|
||||||
|
#define XML_TOK_NAME_ASTERISK 31 /* name* */
|
||||||
|
#define XML_TOK_NAME_PLUS 32 /* name+ */
|
||||||
|
#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
|
||||||
|
#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
|
||||||
|
#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
|
||||||
|
#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
|
||||||
|
#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
|
||||||
|
#define XML_TOK_COMMA 38
|
||||||
|
|
||||||
|
/* The following token is returned only by XmlAttributeValueTok */
|
||||||
|
#define XML_TOK_ATTRIBUTE_VALUE_S 39
|
||||||
|
|
||||||
|
/* The following token is returned only by XmlCdataSectionTok */
|
||||||
|
#define XML_TOK_CDATA_SECT_CLOSE 40
|
||||||
|
|
||||||
|
/* With namespace processing this is returned by XmlPrologTok for a
|
||||||
|
name with a colon.
|
||||||
|
*/
|
||||||
|
#define XML_TOK_PREFIXED_NAME 41
|
||||||
|
|
||||||
|
#ifdef XML_DTD
|
||||||
|
# define XML_TOK_IGNORE_SECT 42
|
||||||
|
#endif /* XML_DTD */
|
||||||
|
|
||||||
|
#ifdef XML_DTD
|
||||||
|
# define XML_N_STATES 4
|
||||||
|
#else /* not XML_DTD */
|
||||||
|
# define XML_N_STATES 3
|
||||||
|
#endif /* not XML_DTD */
|
||||||
|
|
||||||
|
#define XML_PROLOG_STATE 0
|
||||||
|
#define XML_CONTENT_STATE 1
|
||||||
|
#define XML_CDATA_SECTION_STATE 2
|
||||||
|
#ifdef XML_DTD
|
||||||
|
# define XML_IGNORE_SECTION_STATE 3
|
||||||
|
#endif /* XML_DTD */
|
||||||
|
|
||||||
|
#define XML_N_LITERAL_TYPES 2
|
||||||
|
#define XML_ATTRIBUTE_VALUE_LITERAL 0
|
||||||
|
#define XML_ENTITY_VALUE_LITERAL 1
|
||||||
|
|
||||||
|
/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
|
||||||
|
#define XML_UTF8_ENCODE_MAX 4
|
||||||
|
/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
|
||||||
|
#define XML_UTF16_ENCODE_MAX 2
|
||||||
|
|
||||||
|
typedef struct position {
|
||||||
|
/* first line and first column are 0 not 1 */
|
||||||
|
XML_Size lineNumber;
|
||||||
|
XML_Size columnNumber;
|
||||||
|
} POSITION;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const char *name;
|
||||||
|
const char *valuePtr;
|
||||||
|
const char *valueEnd;
|
||||||
|
char normalized;
|
||||||
|
} ATTRIBUTE;
|
||||||
|
|
||||||
|
struct encoding;
|
||||||
|
typedef struct encoding ENCODING;
|
||||||
|
|
||||||
|
typedef int(PTRCALL *SCANNER)(const ENCODING *, const char *, const char *,
|
||||||
|
const char **);
|
||||||
|
|
||||||
|
enum XML_Convert_Result {
|
||||||
|
XML_CONVERT_COMPLETED = 0,
|
||||||
|
XML_CONVERT_INPUT_INCOMPLETE = 1,
|
||||||
|
XML_CONVERT_OUTPUT_EXHAUSTED
|
||||||
|
= 2 /* and therefore potentially input remaining as well */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct encoding {
|
||||||
|
SCANNER scanners[XML_N_STATES];
|
||||||
|
SCANNER literalScanners[XML_N_LITERAL_TYPES];
|
||||||
|
int(PTRCALL *nameMatchesAscii)(const ENCODING *, const char *, const char *,
|
||||||
|
const char *);
|
||||||
|
int(PTRFASTCALL *nameLength)(const ENCODING *, const char *);
|
||||||
|
const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *);
|
||||||
|
int(PTRCALL *getAtts)(const ENCODING *enc, const char *ptr, int attsMax,
|
||||||
|
ATTRIBUTE *atts);
|
||||||
|
int(PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
|
||||||
|
int(PTRCALL *predefinedEntityName)(const ENCODING *, const char *,
|
||||||
|
const char *);
|
||||||
|
void(PTRCALL *updatePosition)(const ENCODING *, const char *ptr,
|
||||||
|
const char *end, POSITION *);
|
||||||
|
int(PTRCALL *isPublicId)(const ENCODING *enc, const char *ptr,
|
||||||
|
const char *end, const char **badPtr);
|
||||||
|
enum XML_Convert_Result(PTRCALL *utf8Convert)(const ENCODING *enc,
|
||||||
|
const char **fromP,
|
||||||
|
const char *fromLim, char **toP,
|
||||||
|
const char *toLim);
|
||||||
|
enum XML_Convert_Result(PTRCALL *utf16Convert)(const ENCODING *enc,
|
||||||
|
const char **fromP,
|
||||||
|
const char *fromLim,
|
||||||
|
unsigned short **toP,
|
||||||
|
const unsigned short *toLim);
|
||||||
|
int minBytesPerChar;
|
||||||
|
char isUtf8;
|
||||||
|
char isUtf16;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Scan the string starting at ptr until the end of the next complete
|
||||||
|
token, but do not scan past eptr. Return an integer giving the
|
||||||
|
type of token.
|
||||||
|
|
||||||
|
Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
|
||||||
|
|
||||||
|
Return XML_TOK_PARTIAL when the string does not contain a complete
|
||||||
|
token; nextTokPtr will not be set.
|
||||||
|
|
||||||
|
Return XML_TOK_INVALID when the string does not start a valid
|
||||||
|
token; nextTokPtr will be set to point to the character which made
|
||||||
|
the token invalid.
|
||||||
|
|
||||||
|
Otherwise the string starts with a valid token; nextTokPtr will be
|
||||||
|
set to point to the character following the end of that token.
|
||||||
|
|
||||||
|
Each data character counts as a single token, but adjacent data
|
||||||
|
characters may be returned together. Similarly for characters in
|
||||||
|
the prolog outside literals, comments and processing instructions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XmlTok(enc, state, ptr, end, nextTokPtr) \
|
||||||
|
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
|
||||||
|
|
||||||
|
#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
|
||||||
|
XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
|
||||||
|
|
||||||
|
#define XmlContentTok(enc, ptr, end, nextTokPtr) \
|
||||||
|
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
|
||||||
|
|
||||||
|
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
|
||||||
|
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
|
||||||
|
|
||||||
|
#ifdef XML_DTD
|
||||||
|
|
||||||
|
# define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
|
||||||
|
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
|
||||||
|
|
||||||
|
#endif /* XML_DTD */
|
||||||
|
|
||||||
|
/* This is used for performing a 2nd-level tokenization on the content
|
||||||
|
of a literal that has already been returned by XmlTok.
|
||||||
|
*/
|
||||||
|
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
|
||||||
|
(((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
|
||||||
|
|
||||||
|
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
|
||||||
|
XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
|
||||||
|
|
||||||
|
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
|
||||||
|
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
|
||||||
|
|
||||||
|
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
|
||||||
|
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
|
||||||
|
|
||||||
|
#define XmlNameLength(enc, ptr) (((enc)->nameLength)(enc, ptr))
|
||||||
|
|
||||||
|
#define XmlSkipS(enc, ptr) (((enc)->skipS)(enc, ptr))
|
||||||
|
|
||||||
|
#define XmlGetAttributes(enc, ptr, attsMax, atts) \
|
||||||
|
(((enc)->getAtts)(enc, ptr, attsMax, atts))
|
||||||
|
|
||||||
|
#define XmlCharRefNumber(enc, ptr) (((enc)->charRefNumber)(enc, ptr))
|
||||||
|
|
||||||
|
#define XmlPredefinedEntityName(enc, ptr, end) \
|
||||||
|
(((enc)->predefinedEntityName)(enc, ptr, end))
|
||||||
|
|
||||||
|
#define XmlUpdatePosition(enc, ptr, end, pos) \
|
||||||
|
(((enc)->updatePosition)(enc, ptr, end, pos))
|
||||||
|
|
||||||
|
#define XmlIsPublicId(enc, ptr, end, badPtr) \
|
||||||
|
(((enc)->isPublicId)(enc, ptr, end, badPtr))
|
||||||
|
|
||||||
|
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
|
||||||
|
(((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
|
||||||
|
|
||||||
|
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
|
||||||
|
(((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ENCODING initEnc;
|
||||||
|
const ENCODING **encPtr;
|
||||||
|
} INIT_ENCODING;
|
||||||
|
|
||||||
|
int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc,
|
||||||
|
const char *ptr, const char *end, const char **badPtr,
|
||||||
|
const char **versionPtr, const char **versionEndPtr,
|
||||||
|
const char **encodingNamePtr,
|
||||||
|
const ENCODING **namedEncodingPtr, int *standalonePtr);
|
||||||
|
|
||||||
|
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||||
|
const ENCODING *XmlGetUtf8InternalEncoding(void);
|
||||||
|
const ENCODING *XmlGetUtf16InternalEncoding(void);
|
||||||
|
int FASTCALL XmlUtf8Encode(int charNumber, char *buf);
|
||||||
|
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);
|
||||||
|
int XmlSizeOfUnknownEncoding(void);
|
||||||
|
|
||||||
|
typedef int(XMLCALL *CONVERTER)(void *userData, const char *p);
|
||||||
|
|
||||||
|
ENCODING *XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert,
|
||||||
|
void *userData);
|
||||||
|
|
||||||
|
int XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc,
|
||||||
|
const char *ptr, const char *end, const char **badPtr,
|
||||||
|
const char **versionPtr, const char **versionEndPtr,
|
||||||
|
const char **encodingNamePtr,
|
||||||
|
const ENCODING **namedEncodingPtr, int *standalonePtr);
|
||||||
|
|
||||||
|
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||||
|
const ENCODING *XmlGetUtf8InternalEncodingNS(void);
|
||||||
|
const ENCODING *XmlGetUtf16InternalEncodingNS(void);
|
||||||
|
ENCODING *XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert,
|
||||||
|
void *userData);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* not XmlTok_INCLUDED */
|
||||||
74
deps/EXPAT/expat/xmltok_impl.h
vendored
Normal file
74
deps/EXPAT/expat/xmltok_impl.h
vendored
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2017-2019 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
BT_NONXML, /* e.g. noncharacter-FFFF */
|
||||||
|
BT_MALFORM, /* illegal, with regard to encoding */
|
||||||
|
BT_LT, /* less than = "<" */
|
||||||
|
BT_AMP, /* ampersand = "&" */
|
||||||
|
BT_RSQB, /* right square bracket = "[" */
|
||||||
|
BT_LEAD2, /* lead byte of a 2-byte UTF-8 character */
|
||||||
|
BT_LEAD3, /* lead byte of a 3-byte UTF-8 character */
|
||||||
|
BT_LEAD4, /* lead byte of a 4-byte UTF-8 character */
|
||||||
|
BT_TRAIL, /* trailing unit, e.g. second 16-bit unit of a 4-byte char. */
|
||||||
|
BT_CR, /* carriage return = "\r" */
|
||||||
|
BT_LF, /* line feed = "\n" */
|
||||||
|
BT_GT, /* greater than = ">" */
|
||||||
|
BT_QUOT, /* quotation character = "\"" */
|
||||||
|
BT_APOS, /* apostrophe = "'" */
|
||||||
|
BT_EQUALS, /* equal sign = "=" */
|
||||||
|
BT_QUEST, /* question mark = "?" */
|
||||||
|
BT_EXCL, /* exclamation mark = "!" */
|
||||||
|
BT_SOL, /* solidus, slash = "/" */
|
||||||
|
BT_SEMI, /* semicolon = ";" */
|
||||||
|
BT_NUM, /* number sign = "#" */
|
||||||
|
BT_LSQB, /* left square bracket = "[" */
|
||||||
|
BT_S, /* white space, e.g. "\t", " "[, "\r"] */
|
||||||
|
BT_NMSTRT, /* non-hex name start letter = "G".."Z" + "g".."z" + "_" */
|
||||||
|
BT_COLON, /* colon = ":" */
|
||||||
|
BT_HEX, /* hex letter = "A".."F" + "a".."f" */
|
||||||
|
BT_DIGIT, /* digit = "0".."9" */
|
||||||
|
BT_NAME, /* dot and middle dot = "." + chr(0xb7) */
|
||||||
|
BT_MINUS, /* minus = "-" */
|
||||||
|
BT_OTHER, /* known not to be a name or name start character */
|
||||||
|
BT_NONASCII, /* might be a name or name start character */
|
||||||
|
BT_PERCNT, /* percent sign = "%" */
|
||||||
|
BT_LPAR, /* left parenthesis = "(" */
|
||||||
|
BT_RPAR, /* right parenthesis = "(" */
|
||||||
|
BT_AST, /* asterisk = "*" */
|
||||||
|
BT_PLUS, /* plus sign = "+" */
|
||||||
|
BT_COMMA, /* comma = "," */
|
||||||
|
BT_VERBAR /* vertical bar = "|" */
|
||||||
|
};
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
1819
deps/EXPAT/expat/xmltok_impl.inc
vendored
Normal file
1819
deps/EXPAT/expat/xmltok_impl.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
122
deps/EXPAT/expat/xmltok_ns.inc
vendored
Normal file
122
deps/EXPAT/expat/xmltok_ns.inc
vendored
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
/* This file is included!
|
||||||
|
__ __ _
|
||||||
|
___\ \/ /_ __ __ _| |_
|
||||||
|
/ _ \\ /| '_ \ / _` | __|
|
||||||
|
| __// \| |_) | (_| | |_
|
||||||
|
\___/_/\_\ .__/ \__,_|\__|
|
||||||
|
|_| XML parser
|
||||||
|
|
||||||
|
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||||
|
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||||
|
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
||||||
|
Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
|
||||||
|
Licensed under the MIT license:
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef XML_TOK_NS_C
|
||||||
|
|
||||||
|
const ENCODING *
|
||||||
|
NS(XmlGetUtf8InternalEncoding)(void) {
|
||||||
|
return &ns(internal_utf8_encoding).enc;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ENCODING *
|
||||||
|
NS(XmlGetUtf16InternalEncoding)(void) {
|
||||||
|
# if BYTEORDER == 1234
|
||||||
|
return &ns(internal_little2_encoding).enc;
|
||||||
|
# elif BYTEORDER == 4321
|
||||||
|
return &ns(internal_big2_encoding).enc;
|
||||||
|
# else
|
||||||
|
const short n = 1;
|
||||||
|
return (*(const char *)&n ? &ns(internal_little2_encoding).enc
|
||||||
|
: &ns(internal_big2_encoding).enc);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static const ENCODING *const NS(encodings)[] = {
|
||||||
|
&ns(latin1_encoding).enc, &ns(ascii_encoding).enc,
|
||||||
|
&ns(utf8_encoding).enc, &ns(big2_encoding).enc,
|
||||||
|
&ns(big2_encoding).enc, &ns(little2_encoding).enc,
|
||||||
|
&ns(utf8_encoding).enc /* NO_ENC */
|
||||||
|
};
|
||||||
|
|
||||||
|
static int PTRCALL
|
||||||
|
NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
|
||||||
|
const char **nextTokPtr) {
|
||||||
|
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE,
|
||||||
|
ptr, end, nextTokPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int PTRCALL
|
||||||
|
NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
|
||||||
|
const char **nextTokPtr) {
|
||||||
|
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE,
|
||||||
|
ptr, end, nextTokPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,
|
||||||
|
const char *name) {
|
||||||
|
int i = getEncodingIndex(name);
|
||||||
|
if (i == UNKNOWN_ENC)
|
||||||
|
return 0;
|
||||||
|
SET_INIT_ENC_INDEX(p, i);
|
||||||
|
p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
|
||||||
|
p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
|
||||||
|
p->initEnc.updatePosition = initUpdatePosition;
|
||||||
|
p->encPtr = encPtr;
|
||||||
|
*encPtr = &(p->initEnc);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const ENCODING *
|
||||||
|
NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) {
|
||||||
|
# define ENCODING_MAX 128
|
||||||
|
char buf[ENCODING_MAX] = "";
|
||||||
|
char *p = buf;
|
||||||
|
int i;
|
||||||
|
XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
|
||||||
|
if (ptr != end)
|
||||||
|
return 0;
|
||||||
|
*p = 0;
|
||||||
|
if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
|
||||||
|
return enc;
|
||||||
|
i = getEncodingIndex(buf);
|
||||||
|
if (i == UNKNOWN_ENC)
|
||||||
|
return 0;
|
||||||
|
return NS(encodings)[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
NS(XmlParseXmlDecl)(int isGeneralTextEntity, const ENCODING *enc,
|
||||||
|
const char *ptr, const char *end, const char **badPtr,
|
||||||
|
const char **versionPtr, const char **versionEndPtr,
|
||||||
|
const char **encodingName, const ENCODING **encoding,
|
||||||
|
int *standalone) {
|
||||||
|
return doParseXmlDecl(NS(findEncoding), isGeneralTextEntity, enc, ptr, end,
|
||||||
|
badPtr, versionPtr, versionEndPtr, encodingName,
|
||||||
|
encoding, standalone);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* XML_TOK_NS_C */
|
||||||
29
deps/FREETYPE/FREETYPE.cmake
vendored
Normal file
29
deps/FREETYPE/FREETYPE.cmake
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
if(WIN32)
|
||||||
|
set(library_build_shared "1")
|
||||||
|
else()
|
||||||
|
set(library_build_shared "0")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
set(_ft_disable_zlib "-D FT_DISABLE_ZLIB=FALSE")
|
||||||
|
else()
|
||||||
|
set(_ft_disable_zlib "-D FT_DISABLE_ZLIB=TRUE")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
qidistudio_add_cmake_project(FREETYPE
|
||||||
|
URL https://github.com/freetype/freetype/archive/refs/tags/VER-2-12-1.tar.gz
|
||||||
|
URL_HASH SHA256=0E72CAE32751598D126CFD4BCEDA909F646B7231AB8C52E28ABB686C20A2BEA1
|
||||||
|
#DEPENDS ${ZLIB_PKG}
|
||||||
|
#"${_patch_step}"
|
||||||
|
CMAKE_ARGS
|
||||||
|
-D BUILD_SHARED_LIBS=${library_build_shared}
|
||||||
|
${_ft_disable_zlib}
|
||||||
|
-D FT_DISABLE_BZIP2=TRUE
|
||||||
|
-D FT_DISABLE_PNG=TRUE
|
||||||
|
-D FT_DISABLE_HARFBUZZ=TRUE
|
||||||
|
-D FT_DISABLE_BROTLI=TRUE
|
||||||
|
)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
add_debug_dep(dep_FREETYPE)
|
||||||
|
endif()
|
||||||
12
deps/GLEW/GLEW.cmake
vendored
Normal file
12
deps/GLEW/GLEW.cmake
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# We have to check for OpenGL to compile GLEW
|
||||||
|
set(OpenGL_GL_PREFERENCE "LEGACY") # to prevent a nasty warning by cmake
|
||||||
|
find_package(OpenGL QUIET REQUIRED)
|
||||||
|
|
||||||
|
qidistudio_add_cmake_project(
|
||||||
|
GLEW
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/glew
|
||||||
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
add_debug_dep(dep_GLEW)
|
||||||
|
endif ()
|
||||||
36
deps/GLEW/glew/CMakeLists.txt
vendored
Normal file
36
deps/GLEW/glew/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(GLEW)
|
||||||
|
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
if(OpenGL_EGL_FOUND)
|
||||||
|
message(STATUS "building GLEW for EGL (hope that wxWidgets agrees, otherwise you won't have any output!)")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGLEW_EGL")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(GLEW src/glew.c)
|
||||||
|
target_include_directories(GLEW PRIVATE include/)
|
||||||
|
target_link_libraries(GLEW PUBLIC OpenGL::GL)
|
||||||
|
|
||||||
|
if (NOT BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(GLEW PUBLIC GLEW_STATIC)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
${PROJECT_SOURCE_DIR}/include/GL/glew.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/GL/wglew.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/GL/glxew.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/GL/eglew.h
|
||||||
|
DESTINATION
|
||||||
|
${CMAKE_INSTALL_INCLUDEDIR}/GL
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS GLEW GLEW
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
73
deps/GLEW/glew/LICENSE.txt
vendored
Normal file
73
deps/GLEW/glew/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
The OpenGL Extension Wrangler Library
|
||||||
|
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
|
||||||
|
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
|
||||||
|
Copyright (C) 2002, Lev Povalahev
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* The name of the author may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
Mesa 3-D graphics library
|
||||||
|
Version: 7.0
|
||||||
|
|
||||||
|
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||||
|
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (c) 2007 The Khronos Group Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and/or associated documentation files (the
|
||||||
|
"Materials"), to deal in the Materials without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||||
|
permit persons to whom the Materials are furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Materials.
|
||||||
|
|
||||||
|
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||||
258
deps/GLEW/glew/README.md
vendored
Normal file
258
deps/GLEW/glew/README.md
vendored
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
# GLEW - The OpenGL Extension Wrangler Library
|
||||||
|
|
||||||
|
The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform. OpenGL core and extension functionality is exposed in a single header file. GLEW has been tested on a variety of operating systems, including Windows, Linux, Mac OS X, FreeBSD, Irix, and Solaris.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
http://glew.sourceforge.net/
|
||||||
|
|
||||||
|
https://github.com/nigels-com/glew
|
||||||
|
|
||||||
|
[](https://travis-ci.org/nigels-com/glew)
|
||||||
|
[](https://gitter.im/nigels-com/glew?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||||
|
[](https://sourceforge.net/projects/glew/files/latest/download)
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
* [Downloads](#downloads)
|
||||||
|
* [Recent snapshots](#recent-snapshots)
|
||||||
|
* [Build](#build)
|
||||||
|
* [Linux and Mac](#linux-and-mac)
|
||||||
|
* [Using GNU Make](#using-gnu-make)
|
||||||
|
* [Install build tools](#install-build-tools)
|
||||||
|
* [Build](#build-1)
|
||||||
|
* [Linux EGL](#linux-egl)
|
||||||
|
* [Linux OSMesa](#linux-osmesa)
|
||||||
|
* [Linux mingw-w64](#linux-mingw-w64)
|
||||||
|
* [Using cmake](#using-cmake)
|
||||||
|
* [Install build tools](#install-build-tools-1)
|
||||||
|
* [Build](#build-2)
|
||||||
|
* [Windows](#windows)
|
||||||
|
* [Visual Studio](#visual-studio)
|
||||||
|
* [MSYS/Mingw](#msysmingw)
|
||||||
|
* [MSYS2/Mingw-w64](#msys2mingw-w64)
|
||||||
|
* [glewinfo](#glewinfo)
|
||||||
|
* [Code Generation](#code-generation)
|
||||||
|
* [Authors](#authors)
|
||||||
|
* [Contributions](#contributions)
|
||||||
|
* [Copyright and Licensing](#copyright-and-licensing)
|
||||||
|
|
||||||
|
## Downloads
|
||||||
|
|
||||||
|
Current release is [2.1.0](https://sourceforge.net/projects/glew/files/glew/2.1.0/).
|
||||||
|
[(Change Log)](http://glew.sourceforge.net/log.html)
|
||||||
|
|
||||||
|
Sources available as
|
||||||
|
[ZIP](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.zip/download) or
|
||||||
|
[TGZ](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.tgz/download).
|
||||||
|
|
||||||
|
Windows binaries for [32-bit and 64-bit](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0-win32.zip/download).
|
||||||
|
|
||||||
|
### Recent snapshots
|
||||||
|
|
||||||
|
Snapshots may contain new features, bug-fixes or new OpenGL extensions ahead of tested, official releases.
|
||||||
|
|
||||||
|
[glew-20200115.tgz](https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20200115.tgz/download) *GLEW 2.2.0 RC3: fixes*
|
||||||
|
|
||||||
|
[glew-20190928.tgz](https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20190928.tgz/download) *GLEW 2.2.0 RC2: New extensions, bug fixes*
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
It is highly recommended to build from a tgz or zip release snapshot.
|
||||||
|
The code generation workflow is a complex brew of gnu make, perl and python, that works best on Linux or Mac.
|
||||||
|
The code generation is known to work on Windows using [MSYS2](https://www.msys2.org/).
|
||||||
|
For most end-users of GLEW the official releases are the best choice, with first class support.
|
||||||
|
|
||||||
|
### Linux and Mac
|
||||||
|
|
||||||
|
#### Using GNU Make
|
||||||
|
|
||||||
|
GNU make is the primary build system for GLEW, historically.
|
||||||
|
It includes targets for building the sources and headers, for maintenance purposes.
|
||||||
|
|
||||||
|
##### Install build tools
|
||||||
|
|
||||||
|
Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev`
|
||||||
|
|
||||||
|
RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel`
|
||||||
|
|
||||||
|
FreeBSD: `# pkg install xorg lang/gcc git cmake gmake bash python perl5`
|
||||||
|
|
||||||
|
##### Build
|
||||||
|
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
$ make clean
|
||||||
|
|
||||||
|
Targets: `all, glew.lib (sub-targets: glew.lib.shared, glew.lib.static), glew.bin, clean, install, uninstall`
|
||||||
|
|
||||||
|
Variables: `SYSTEM=linux-clang, GLEW_DEST=/usr/local, STRIP=`
|
||||||
|
|
||||||
|
_Note: you may need to call `make` in the **auto** folder first_
|
||||||
|
|
||||||
|
##### Linux EGL
|
||||||
|
|
||||||
|
$ sudo apt install libegl1-mesa-dev
|
||||||
|
$ make SYSTEM=linux-egl
|
||||||
|
|
||||||
|
##### Linux OSMesa
|
||||||
|
|
||||||
|
$ sudo apt install libosmesa-dev
|
||||||
|
$ make SYSTEM=linux-osmesa
|
||||||
|
|
||||||
|
##### Linux mingw-w64
|
||||||
|
|
||||||
|
$ sudo apt install mingw-w64
|
||||||
|
$ make SYSTEM=linux-mingw32
|
||||||
|
$ make SYSTEM=linux-mingw64
|
||||||
|
|
||||||
|
#### Using cmake
|
||||||
|
|
||||||
|
The cmake build is mostly contributer maintained.
|
||||||
|
Due to the multitude of use cases this is maintained on a _best effort_ basis.
|
||||||
|
Pull requests are welcome.
|
||||||
|
|
||||||
|
*CMake 2.8.12 or higher is required.*
|
||||||
|
|
||||||
|
##### Install build tools
|
||||||
|
|
||||||
|
Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev cmake git`
|
||||||
|
|
||||||
|
RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel cmake git`
|
||||||
|
|
||||||
|
##### Build
|
||||||
|
|
||||||
|
$ cd build
|
||||||
|
$ cmake ./cmake
|
||||||
|
$ make -j4
|
||||||
|
|
||||||
|
| Target | Description |
|
||||||
|
| ---------- | ----------- |
|
||||||
|
| glew | Build the glew shared library. |
|
||||||
|
| glew_s | Build the glew static library. |
|
||||||
|
| glewinfo | Build the `glewinfo` executable (requires `BUILD_UTILS` to be `ON`). |
|
||||||
|
| visualinfo | Build the `visualinfo` executable (requires `BUILD_UTILS` to be `ON`). |
|
||||||
|
| install | Install all enabled targets into `CMAKE_INSTALL_PREFIX`. |
|
||||||
|
| clean | Clean up build artifacts. |
|
||||||
|
| all | Build all enabled targets (default target). |
|
||||||
|
|
||||||
|
| Variables | Description |
|
||||||
|
| --------------- | ----------- |
|
||||||
|
| BUILD_UTILS | Build the `glewinfo` and `visualinfo` executables. |
|
||||||
|
| GLEW_REGAL | Build in Regal mode. |
|
||||||
|
| GLEW_OSMESA | Build in off-screen Mesa mode. |
|
||||||
|
| BUILD_FRAMEWORK | Build as MacOSX Framework. Setting `CMAKE_INSTALL_PREFIX` to `/Library/Frameworks` is recommended. |
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
#### Visual Studio
|
||||||
|
|
||||||
|
Use the provided Visual Studio project file in build/vc15/
|
||||||
|
|
||||||
|
Projects for vc6, vc10, vc12 and vc14 are also provided
|
||||||
|
|
||||||
|
#### MSYS/Mingw
|
||||||
|
|
||||||
|
Available from [Mingw](http://www.mingw.org/)
|
||||||
|
|
||||||
|
Requirements: bash, make, gcc
|
||||||
|
|
||||||
|
$ mingw32-make
|
||||||
|
$ mingw32-make install
|
||||||
|
$ mingw32-make install.all
|
||||||
|
|
||||||
|
Alternative toolchain: `SYSTEM=mingw-win32`
|
||||||
|
|
||||||
|
#### MSYS2/Mingw-w64
|
||||||
|
|
||||||
|
Available from [Msys2](http://msys2.github.io/) and/or [Mingw-w64](http://mingw-w64.org/)
|
||||||
|
|
||||||
|
Requirements: bash, make, gcc
|
||||||
|
|
||||||
|
$ pacman -S gcc make mingw-w64-i686-gcc mingw-w64-x86_64-gcc
|
||||||
|
$ make
|
||||||
|
$ make install
|
||||||
|
$ make install.all
|
||||||
|
|
||||||
|
Alternative toolchain: `SYSTEM=msys, SYSTEM=msys-win32, SYSTEM=msys-win64`
|
||||||
|
|
||||||
|
## glewinfo
|
||||||
|
|
||||||
|
`glewinfo` is a command-line tool useful for inspecting the capabilities of an
|
||||||
|
OpenGL implementation and GLEW support for that. Please include `glewinfo.txt`
|
||||||
|
with bug reports, as appropriate.
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
GLEW Extension Info
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
GLEW version 2.0.0
|
||||||
|
Reporting capabilities of pixelformat 3
|
||||||
|
Running on a Intel(R) HD Graphics 3000 from Intel
|
||||||
|
OpenGL version 3.1.0 - Build 9.17.10.4229 is supported
|
||||||
|
|
||||||
|
GL_VERSION_1_1: OK
|
||||||
|
---------------
|
||||||
|
|
||||||
|
GL_VERSION_1_2: OK
|
||||||
|
---------------
|
||||||
|
glCopyTexSubImage3D: OK
|
||||||
|
glDrawRangeElements: OK
|
||||||
|
glTexImage3D: OK
|
||||||
|
glTexSubImage3D: OK
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
## Code Generation
|
||||||
|
|
||||||
|
A Unix or Mac environment is needed for building GLEW from scratch to
|
||||||
|
include new extensions, or customize the code generation. The extension
|
||||||
|
data is regenerated from the top level source directory with:
|
||||||
|
|
||||||
|
make extensions
|
||||||
|
|
||||||
|
An alternative to generating the GLEW sources from scratch is to
|
||||||
|
download a pre-generated (unsupported) snapshot:
|
||||||
|
|
||||||
|
https://sourceforge.net/projects/glew/files/glew/snapshots/
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
GLEW is currently maintained by [Nigel Stewart](https://github.com/nigels-com)
|
||||||
|
with bug fixes, new OpenGL extension support and new releases.
|
||||||
|
|
||||||
|
GLEW was developed by [Milan Ikits](http://www.cs.utah.edu/~ikits/)
|
||||||
|
and [Marcelo Magallon](http://wwwvis.informatik.uni-stuttgart.de/~magallon/).
|
||||||
|
Aaron Lefohn, Joe Kniss, and Chris Wyman were the first users and also
|
||||||
|
assisted with the design and debugging process.
|
||||||
|
|
||||||
|
The acronym GLEW originates from Aaron Lefohn.
|
||||||
|
Pasi Kärkkäinen identified and fixed several problems with
|
||||||
|
GLX and SDL. Nate Robins created the `wglinfo` utility, to
|
||||||
|
which modifications were made by Michael Wimmer.
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
|
GLEW welcomes community contributions. Typically these are co-ordinated
|
||||||
|
via [Issues](https://github.com/nigels-com/glew/issues) or
|
||||||
|
[Pull Requests](https://github.com/nigels-com/glew/pulls) in the
|
||||||
|
GitHub web interface.
|
||||||
|
|
||||||
|
Be sure to mention platform and compiler toolchain details when filing
|
||||||
|
a bug report. The output of `glewinfo` can be quite useful for discussion
|
||||||
|
also.
|
||||||
|
|
||||||
|
Generally GLEW is usually released once a year, around the time of the Siggraph
|
||||||
|
computer graphics conference. If you're not using the current release
|
||||||
|
version of GLEW, be sure to check if the issue or bug is fixed there.
|
||||||
|
|
||||||
|
## Copyright and Licensing
|
||||||
|
|
||||||
|
GLEW is originally derived from the EXTGL project by Lev Povalahev.
|
||||||
|
The source code is licensed under the
|
||||||
|
[Modified BSD License](http://glew.sourceforge.net/glew.txt), the
|
||||||
|
[Mesa 3-D License](http://glew.sourceforge.net/mesa.txt) (MIT) and the
|
||||||
|
[Khronos License](http://glew.sourceforge.net/khronos.txt) (MIT).
|
||||||
|
|
||||||
|
The automatic code generation scripts are released under the
|
||||||
|
[GNU GPL](http://glew.sourceforge.net/gpl.txt).
|
||||||
1
deps/GLEW/glew/VERSION
vendored
Normal file
1
deps/GLEW/glew/VERSION
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
2.2.0
|
||||||
3051
deps/GLEW/glew/include/GL/eglew.h
vendored
Normal file
3051
deps/GLEW/glew/include/GL/eglew.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
26427
deps/GLEW/glew/include/GL/glew.h
vendored
Normal file
26427
deps/GLEW/glew/include/GL/glew.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1831
deps/GLEW/glew/include/GL/glxew.h
vendored
Normal file
1831
deps/GLEW/glew/include/GL/glxew.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1468
deps/GLEW/glew/include/GL/wglew.h
vendored
Normal file
1468
deps/GLEW/glew/include/GL/wglew.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31949
deps/GLEW/glew/src/glew.c
vendored
Normal file
31949
deps/GLEW/glew/src/glew.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
29
deps/GLFW/GLFW.cmake
vendored
Normal file
29
deps/GLFW/GLFW.cmake
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
set(_build_shared ON)
|
||||||
|
set(_build_static OFF)
|
||||||
|
else()
|
||||||
|
set(_build_shared OFF)
|
||||||
|
set(_build_static ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
set(_glfw_use_wayland "-DGLFW_USE_WAYLAND=ON")
|
||||||
|
else()
|
||||||
|
set(_glfw_use_wayland "-DGLFW_USE_WAYLAND=OFF")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
qidistudio_add_cmake_project(GLFW
|
||||||
|
URL https://github.com/glfw/glfw/archive/refs/tags/3.3.7.zip
|
||||||
|
URL_HASH SHA256=e02d956935e5b9fb4abf90e2c2e07c9a0526d7eacae8ee5353484c69a2a76cd0
|
||||||
|
#DEPENDS dep_Boost
|
||||||
|
CMAKE_ARGS
|
||||||
|
-DBUILD_SHARED_LIBS=${_build_shared}
|
||||||
|
-DGLFW_BUILD_DOCS=OFF
|
||||||
|
-DGLFW_BUILD_EXAMPLES=OFF
|
||||||
|
-DGLFW_BUILD_TESTS=OFF
|
||||||
|
${_glfw_use_wayland}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
add_debug_dep(dep_GLFW)
|
||||||
|
endif ()
|
||||||
54
deps/GMP/GMP.cmake
vendored
Normal file
54
deps/GMP/GMP.cmake
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/gmp)
|
||||||
|
set(_dstdir ${DESTDIR}/usr/local)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
set(_output ${_dstdir}/include/gmp.h
|
||||||
|
${_dstdir}/lib/libgmp-10.lib
|
||||||
|
${_dstdir}/bin/libgmp-10.dll)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${_output}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/gmp.h ${_dstdir}/include/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libgmp-10.lib ${_dstdir}/lib/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libgmp-10.dll ${_dstdir}/bin/
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(dep_GMP SOURCES ${_output})
|
||||||
|
|
||||||
|
else ()
|
||||||
|
set(_gmp_ccflags "-O2 -DNDEBUG -fPIC -DPIC -Wall -Wmissing-prototypes -Wpointer-arith -pedantic -fomit-frame-pointer -fno-common")
|
||||||
|
set(_gmp_build_tgt "${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
|
||||||
|
set(_gmp_build_tgt aarch64)
|
||||||
|
endif()
|
||||||
|
set(_gmp_ccflags "${_gmp_ccflags} -mmacosx-version-min=${DEP_OSX_TARGET}")
|
||||||
|
set(_gmp_build_tgt "--build=${_gmp_build_tgt}-apple-darwin")
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
|
||||||
|
set(_gmp_ccflags "${_gmp_ccflags} -march=armv7-a") # Works on RPi-4
|
||||||
|
set(_gmp_build_tgt armv7)
|
||||||
|
endif()
|
||||||
|
set(_gmp_build_tgt "--build=${_gmp_build_tgt}-pc-linux-gnu")
|
||||||
|
else ()
|
||||||
|
set(_gmp_build_tgt "") # let it guess
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_cross_compile_arg "")
|
||||||
|
if (CMAKE_CROSSCOMPILING)
|
||||||
|
# TOOLCHAIN_PREFIX should be defined in the toolchain file
|
||||||
|
set(_cross_compile_arg --host=${TOOLCHAIN_PREFIX})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
ExternalProject_Add(dep_GMP
|
||||||
|
URL https://github.com/qidilab/gmp/archive/refs/tags/6.2.1.tar.gz
|
||||||
|
URL_HASH SHA256=705ae57ee2014b2c6fc0f572c85ee43276b99b6b256ee16c1a9d3a8c4e3609d5
|
||||||
|
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/GMP
|
||||||
|
BUILD_IN_SOURCE ON
|
||||||
|
CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --enable-shared=no --enable-cxx=yes --enable-static=yes "--prefix=${DESTDIR}/usr/local" ${_gmp_build_tgt}
|
||||||
|
BUILD_COMMAND make -j
|
||||||
|
INSTALL_COMMAND make install
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
674
deps/GMP/gmp/gmp.COPYING
vendored
Normal file
674
deps/GMP/gmp/gmp.COPYING
vendored
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
105
deps/GMP/gmp/gmp.README
vendored
Normal file
105
deps/GMP/gmp/gmp.README
vendored
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
Copyright 1991, 1996, 1999, 2000, 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of the GNU MP Library.
|
||||||
|
|
||||||
|
The GNU MP Library is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The GNU MP Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
THE GNU MP LIBRARY
|
||||||
|
|
||||||
|
|
||||||
|
GNU MP is a library for arbitrary precision arithmetic, operating on signed
|
||||||
|
integers, rational numbers, and floating point numbers. It has a rich set of
|
||||||
|
functions, and the functions have a regular interface.
|
||||||
|
|
||||||
|
GNU MP is designed to be as fast as possible, both for small operands and huge
|
||||||
|
operands. The speed is achieved by using fullwords as the basic arithmetic
|
||||||
|
type, by using fast algorithms, with carefully optimized assembly code for the
|
||||||
|
most common inner loops for lots of CPUs, and by a general emphasis on speed
|
||||||
|
(instead of simplicity or elegance).
|
||||||
|
|
||||||
|
GNU MP is believed to be faster than any other similar library. Its advantage
|
||||||
|
increases with operand sizes for certain operations, since GNU MP in many
|
||||||
|
cases has asymptotically faster algorithms.
|
||||||
|
|
||||||
|
GNU MP is free software and may be freely copied on the terms contained in the
|
||||||
|
files COPYING.LIB and COPYING (most of GNU MP is under the former, some under
|
||||||
|
the latter).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OVERVIEW OF GNU MP
|
||||||
|
|
||||||
|
There are five classes of functions in GNU MP.
|
||||||
|
|
||||||
|
1. Signed integer arithmetic functions (mpz). These functions are intended
|
||||||
|
to be easy to use, with their regular interface. The associated type is
|
||||||
|
`mpz_t'.
|
||||||
|
|
||||||
|
2. Rational arithmetic functions (mpq). For now, just a small set of
|
||||||
|
functions necessary for basic rational arithmetics. The associated type
|
||||||
|
is `mpq_t'.
|
||||||
|
|
||||||
|
3. Floating-point arithmetic functions (mpf). If the C type `double'
|
||||||
|
doesn't give enough precision for your application, declare your
|
||||||
|
variables as `mpf_t' instead, set the precision to any number desired,
|
||||||
|
and call the functions in the mpf class for the arithmetic operations.
|
||||||
|
|
||||||
|
4. Positive-integer, hard-to-use, very low overhead functions are in the
|
||||||
|
mpn class. No memory management is performed. The caller must ensure
|
||||||
|
enough space is available for the results. The set of functions is not
|
||||||
|
regular, nor is the calling interface. These functions accept input
|
||||||
|
arguments in the form of pairs consisting of a pointer to the least
|
||||||
|
significant word, and an integral size telling how many limbs (= words)
|
||||||
|
the pointer points to.
|
||||||
|
|
||||||
|
Almost all calculations, in the entire package, are made by calling these
|
||||||
|
low-level functions.
|
||||||
|
|
||||||
|
5. Berkeley MP compatible functions.
|
||||||
|
|
||||||
|
To use these functions, include the file "mp.h". You can test if you are
|
||||||
|
using the GNU version by testing if the symbol __GNU_MP__ is defined.
|
||||||
|
|
||||||
|
For more information on how to use GNU MP, please refer to the documentation.
|
||||||
|
It is composed from the file doc/gmp.texi, and can be displayed on the screen
|
||||||
|
or printed. How to do that, as well how to build the library, is described in
|
||||||
|
the INSTALL file in this directory.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
REPORTING BUGS
|
||||||
|
|
||||||
|
If you find a bug in the library, please make sure to tell us about it!
|
||||||
|
|
||||||
|
You should first check the GNU MP web pages at http://gmplib.org/, under
|
||||||
|
"Status of the current release". There will be patches for all known serious
|
||||||
|
bugs there.
|
||||||
|
|
||||||
|
Report bugs to gmp-bugs@gmplib.org. What information is needed in a useful bug
|
||||||
|
report is described in the manual. The same address can be used for suggesting
|
||||||
|
modifications and enhancements.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
----------------
|
||||||
|
Local variables:
|
||||||
|
mode: text
|
||||||
|
fill-column: 78
|
||||||
|
End:
|
||||||
2280
deps/GMP/gmp/include/gmp.h
vendored
Normal file
2280
deps/GMP/gmp/include/gmp.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
deps/GMP/gmp/lib/win32/libgmp-10.dll
vendored
Normal file
BIN
deps/GMP/gmp/lib/win32/libgmp-10.dll
vendored
Normal file
Binary file not shown.
BIN
deps/GMP/gmp/lib/win32/libgmp-10.lib
vendored
Normal file
BIN
deps/GMP/gmp/lib/win32/libgmp-10.lib
vendored
Normal file
Binary file not shown.
BIN
deps/GMP/gmp/lib/win64/libgmp-10.dll
vendored
Normal file
BIN
deps/GMP/gmp/lib/win64/libgmp-10.dll
vendored
Normal file
Binary file not shown.
BIN
deps/GMP/gmp/lib/win64/libgmp-10.lib
vendored
Normal file
BIN
deps/GMP/gmp/lib/win64/libgmp-10.lib
vendored
Normal file
Binary file not shown.
22
deps/JPEG/JPEG.cmake
vendored
Normal file
22
deps/JPEG/JPEG.cmake
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
if (JPEG_VERSION STREQUAL "6")
|
||||||
|
message("Using Jpeg Lib 62")
|
||||||
|
set(jpeg_flag "")
|
||||||
|
elseif (JPEG_VERSION STREQUAL "7")
|
||||||
|
message("Using Jpeg Lib 70")
|
||||||
|
set(jpeg_flag "-DWITH_JPEG7=ON")
|
||||||
|
else ()
|
||||||
|
message("Using Jpeg Lib 80")
|
||||||
|
set(jpeg_flag "-DWITH_JPEG8=ON")
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
qidistudio_add_cmake_project(JPEG
|
||||||
|
URL https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/2.0.6.zip
|
||||||
|
URL_HASH SHA256=017bdc33ff3a72e11301c0feb4657cb27719d7f97fa67a78ed506c594218bbf1
|
||||||
|
DEPENDS ${ZLIB_PKG}
|
||||||
|
CMAKE_ARGS
|
||||||
|
-DENABLE_SHARED=OFF
|
||||||
|
-DENABLE_STATIC=ON
|
||||||
|
${jpeg_flag}
|
||||||
|
)
|
||||||
38
deps/MPFR/MPFR.cmake
vendored
Normal file
38
deps/MPFR/MPFR.cmake
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/mpfr)
|
||||||
|
set(_dstdir ${DESTDIR}/usr/local)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
set(_output ${_dstdir}/include/mpfr.h
|
||||||
|
${_dstdir}/include/mpf2mpfr.h
|
||||||
|
${_dstdir}/lib/libmpfr-4.lib
|
||||||
|
${_dstdir}/bin/libmpfr-4.dll)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${_output}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/mpfr.h ${_dstdir}/include/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/mpf2mpfr.h ${_dstdir}/include/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libmpfr-4.lib ${_dstdir}/lib/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libmpfr-4.dll ${_dstdir}/bin/
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(dep_MPFR SOURCES ${_output})
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
set(_cross_compile_arg "")
|
||||||
|
if (CMAKE_CROSSCOMPILING)
|
||||||
|
# TOOLCHAIN_PREFIX should be defined in the toolchain file
|
||||||
|
set(_cross_compile_arg --host=${TOOLCHAIN_PREFIX})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
ExternalProject_Add(dep_MPFR
|
||||||
|
URL http://ftp.vim.org/ftp/gnu/mpfr/mpfr-3.1.6.tar.bz2 https://www.mpfr.org/mpfr-3.1.6/mpfr-3.1.6.tar.bz2 # mirrors are allowed
|
||||||
|
URL_HASH SHA256=cf4f4b2d80abb79e820e78c8077b6725bbbb4e8f41896783c899087be0e94068
|
||||||
|
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/MPFR
|
||||||
|
BUILD_IN_SOURCE ON
|
||||||
|
CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local ${_gmp_build_tgt}
|
||||||
|
BUILD_COMMAND make -j
|
||||||
|
INSTALL_COMMAND make install
|
||||||
|
DEPENDS dep_GMP
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
175
deps/MPFR/mpfr/include/mpf2mpfr.h
vendored
Normal file
175
deps/MPFR/mpfr/include/mpf2mpfr.h
vendored
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
/* mpf2mpfr.h -- Compatibility include file with mpf.
|
||||||
|
|
||||||
|
Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||||
|
Contributed by the Arenaire and Cacao projects, INRIA.
|
||||||
|
|
||||||
|
This file is part of the GNU MPFR Library.
|
||||||
|
|
||||||
|
The GNU MPFR Library is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The GNU MPFR Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
|
||||||
|
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#ifndef __MPFR_FROM_MPF__
|
||||||
|
#define __MPFR_FROM_MPF__
|
||||||
|
|
||||||
|
/* types */
|
||||||
|
#define mpf_t mpfr_t
|
||||||
|
#define mpf_srcptr mpfr_srcptr
|
||||||
|
#define mpf_ptr mpfr_ptr
|
||||||
|
|
||||||
|
/* Get current Rounding Mode */
|
||||||
|
#ifndef MPFR_DEFAULT_RND
|
||||||
|
# define MPFR_DEFAULT_RND mpfr_get_default_rounding_mode ()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* mpf_init initalizes at 0 */
|
||||||
|
#undef mpf_init
|
||||||
|
#define mpf_init(x) mpfr_init_set_ui ((x), 0, MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_init2
|
||||||
|
#define mpf_init2(x,p) (mpfr_init2((x),(p)), mpfr_set_ui ((x), 0, MPFR_DEFAULT_RND))
|
||||||
|
|
||||||
|
/* functions which don't take as argument the rounding mode */
|
||||||
|
#undef mpf_ceil
|
||||||
|
#define mpf_ceil mpfr_ceil
|
||||||
|
#undef mpf_clear
|
||||||
|
#define mpf_clear mpfr_clear
|
||||||
|
#undef mpf_cmp
|
||||||
|
#define mpf_cmp mpfr_cmp
|
||||||
|
#undef mpf_cmp_si
|
||||||
|
#define mpf_cmp_si mpfr_cmp_si
|
||||||
|
#undef mpf_cmp_ui
|
||||||
|
#define mpf_cmp_ui mpfr_cmp_ui
|
||||||
|
#undef mpf_cmp_d
|
||||||
|
#define mpf_cmp_d mpfr_cmp_d
|
||||||
|
#undef mpf_eq
|
||||||
|
#define mpf_eq mpfr_eq
|
||||||
|
#undef mpf_floor
|
||||||
|
#define mpf_floor mpfr_floor
|
||||||
|
#undef mpf_get_prec
|
||||||
|
#define mpf_get_prec mpfr_get_prec
|
||||||
|
#undef mpf_integer_p
|
||||||
|
#define mpf_integer_p mpfr_integer_p
|
||||||
|
#undef mpf_random2
|
||||||
|
#define mpf_random2 mpfr_random2
|
||||||
|
#undef mpf_set_default_prec
|
||||||
|
#define mpf_set_default_prec mpfr_set_default_prec
|
||||||
|
#undef mpf_get_default_prec
|
||||||
|
#define mpf_get_default_prec mpfr_get_default_prec
|
||||||
|
#undef mpf_set_prec
|
||||||
|
#define mpf_set_prec mpfr_set_prec
|
||||||
|
#undef mpf_set_prec_raw
|
||||||
|
#define mpf_set_prec_raw(x,p) mpfr_prec_round(x,p,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_trunc
|
||||||
|
#define mpf_trunc mpfr_trunc
|
||||||
|
#undef mpf_sgn
|
||||||
|
#define mpf_sgn mpfr_sgn
|
||||||
|
#undef mpf_swap
|
||||||
|
#define mpf_swap mpfr_swap
|
||||||
|
#undef mpf_dump
|
||||||
|
#define mpf_dump mpfr_dump
|
||||||
|
|
||||||
|
/* functions which take as argument the rounding mode */
|
||||||
|
#undef mpf_abs
|
||||||
|
#define mpf_abs(x,y) mpfr_abs(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_add
|
||||||
|
#define mpf_add(x,y,z) mpfr_add(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_add_ui
|
||||||
|
#define mpf_add_ui(x,y,z) mpfr_add_ui(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_div
|
||||||
|
#define mpf_div(x,y,z) mpfr_div(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_div_ui
|
||||||
|
#define mpf_div_ui(x,y,z) mpfr_div_ui(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_div_2exp
|
||||||
|
#define mpf_div_2exp(x,y,z) mpfr_div_2exp(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_fits_slong_p
|
||||||
|
#define mpf_fits_slong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_fits_ulong_p
|
||||||
|
#define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_fits_sint_p
|
||||||
|
#define mpf_fits_sint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_fits_uint_p
|
||||||
|
#define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_fits_sshort_p
|
||||||
|
#define mpf_fits_sshort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_fits_ushort_p
|
||||||
|
#define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_get_str
|
||||||
|
#define mpf_get_str(x,y,z,t,u) mpfr_get_str(x,y,z,t,u,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_get_d
|
||||||
|
#define mpf_get_d(x) mpfr_get_d(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_get_d_2exp
|
||||||
|
#define mpf_get_d_2exp(e,x) mpfr_get_d_2exp(e,x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_get_ui
|
||||||
|
#define mpf_get_ui(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_get_si
|
||||||
|
#define mpf_get_si(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_inp_str
|
||||||
|
#define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_set_str
|
||||||
|
#define mpf_set_str(x,y,z) mpfr_set_str(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_init_set
|
||||||
|
#define mpf_init_set(x,y) mpfr_init_set(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_init_set_d
|
||||||
|
#define mpf_init_set_d(x,y) mpfr_init_set_d(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_init_set_si
|
||||||
|
#define mpf_init_set_si(x,y) mpfr_init_set_si(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_init_set_str
|
||||||
|
#define mpf_init_set_str(x,y,z) mpfr_init_set_str(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_init_set_ui
|
||||||
|
#define mpf_init_set_ui(x,y) mpfr_init_set_ui(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_mul
|
||||||
|
#define mpf_mul(x,y,z) mpfr_mul(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_mul_2exp
|
||||||
|
#define mpf_mul_2exp(x,y,z) mpfr_mul_2exp(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_mul_ui
|
||||||
|
#define mpf_mul_ui(x,y,z) mpfr_mul_ui(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_neg
|
||||||
|
#define mpf_neg(x,y) mpfr_neg(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_out_str
|
||||||
|
#define mpf_out_str(x,y,z,t) mpfr_out_str(x,y,z,t,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_pow_ui
|
||||||
|
#define mpf_pow_ui(x,y,z) mpfr_pow_ui(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_reldiff
|
||||||
|
#define mpf_reldiff(x,y,z) mpfr_reldiff(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_set
|
||||||
|
#define mpf_set(x,y) mpfr_set(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_set_d
|
||||||
|
#define mpf_set_d(x,y) mpfr_set_d(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_set_q
|
||||||
|
#define mpf_set_q(x,y) mpfr_set_q(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_set_si
|
||||||
|
#define mpf_set_si(x,y) mpfr_set_si(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_set_ui
|
||||||
|
#define mpf_set_ui(x,y) mpfr_set_ui(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_set_z
|
||||||
|
#define mpf_set_z(x,y) mpfr_set_z(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_sqrt
|
||||||
|
#define mpf_sqrt(x,y) mpfr_sqrt(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_sqrt_ui
|
||||||
|
#define mpf_sqrt_ui(x,y) mpfr_sqrt_ui(x,y,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_sub
|
||||||
|
#define mpf_sub(x,y,z) mpfr_sub(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_sub_ui
|
||||||
|
#define mpf_sub_ui(x,y,z) mpfr_sub_ui(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_ui_div
|
||||||
|
#define mpf_ui_div(x,y,z) mpfr_ui_div(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_ui_sub
|
||||||
|
#define mpf_ui_sub(x,y,z) mpfr_ui_sub(x,y,z,MPFR_DEFAULT_RND)
|
||||||
|
#undef mpf_urandomb
|
||||||
|
#define mpf_urandomb(x,y,n) mpfr_urandomb(x,y)
|
||||||
|
|
||||||
|
#undef mpz_set_f
|
||||||
|
#define mpz_set_f(z,f) mpfr_get_z(z,f,MPFR_DEFAULT_RND)
|
||||||
|
|
||||||
|
#endif /* __MPFR_FROM_MPF__ */
|
||||||
910
deps/MPFR/mpfr/include/mpfr.h
vendored
Normal file
910
deps/MPFR/mpfr/include/mpfr.h
vendored
Normal file
@@ -0,0 +1,910 @@
|
|||||||
|
/* mpfr.h -- Include file for mpfr.
|
||||||
|
|
||||||
|
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||||
|
Contributed by the Arenaire and Cacao projects, INRIA.
|
||||||
|
|
||||||
|
This file is part of the GNU MPFR Library.
|
||||||
|
|
||||||
|
The GNU MPFR Library is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The GNU MPFR Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
|
||||||
|
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#ifndef __MPFR_H
|
||||||
|
#define __MPFR_H
|
||||||
|
|
||||||
|
/* Define MPFR version number */
|
||||||
|
#define MPFR_VERSION_MAJOR 3
|
||||||
|
#define MPFR_VERSION_MINOR 0
|
||||||
|
#define MPFR_VERSION_PATCHLEVEL 0
|
||||||
|
#define MPFR_VERSION_STRING "3.0.0"
|
||||||
|
|
||||||
|
/* Macros dealing with MPFR VERSION */
|
||||||
|
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
||||||
|
#define MPFR_VERSION \
|
||||||
|
MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL)
|
||||||
|
|
||||||
|
/* Check if GMP is included, and try to include it (Works with local GMP) */
|
||||||
|
#ifndef __GMP_H__
|
||||||
|
# include <gmp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check if stdio.h is included or if the user wants FILE */
|
||||||
|
#if defined (_GMP_H_HAVE_FILE) || defined (MPFR_USE_FILE)
|
||||||
|
# define _MPFR_H_HAVE_FILE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (_GMP_H_HAVE_VA_LIST)
|
||||||
|
# define _MPFR_H_HAVE_VA_LIST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check if <stdint.h> / <inttypes.h> is included or if the user
|
||||||
|
explicitly wants intmax_t. Automatical detection is done by
|
||||||
|
checking:
|
||||||
|
- INTMAX_C and UINTMAX_C, but not if the compiler is a C++ one
|
||||||
|
(as suggested by Patrick Pelissier) because the test does not
|
||||||
|
work well in this case. See:
|
||||||
|
http://websympa.loria.fr/wwsympa/arc/mpfr/2010-02/msg00025.html
|
||||||
|
We do not check INTMAX_MAX and UINTMAX_MAX because under Solaris,
|
||||||
|
these macros are always defined by <limits.h> (i.e. even when
|
||||||
|
<stdint.h> and <inttypes.h> are not included).
|
||||||
|
- _STDINT_H (defined by the glibc) and _STDINT_H_ (defined under
|
||||||
|
Mac OS X), but this test may not work with all implementations.
|
||||||
|
Portable software should not rely on these tests.
|
||||||
|
*/
|
||||||
|
#if (defined (INTMAX_C) && defined (UINTMAX_C) && !defined(__cplusplus)) || \
|
||||||
|
defined (MPFR_USE_INTMAX_T) || defined (_STDINT_H) || defined (_STDINT_H_)
|
||||||
|
# define _MPFR_H_HAVE_INTMAX_T 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Definition of rounding modes (DON'T USE MPFR_RNDNA!).
|
||||||
|
Warning! Changing the contents of this enum should be seen as an
|
||||||
|
interface change since the old and the new types are not compatible
|
||||||
|
(the integer type compatible with the enumerated type can even change,
|
||||||
|
see ISO C99, 6.7.2.2#4), and in Makefile.am, AGE should be set to 0.
|
||||||
|
|
||||||
|
MPFR_RNDU must appear just before MPFR_RNDD (see
|
||||||
|
MPFR_IS_RNDUTEST_OR_RNDDNOTTEST in mpfr-impl.h).
|
||||||
|
|
||||||
|
MPFR_RNDF has been added, though not implemented yet, in order to avoid
|
||||||
|
to break the ABI once faithful rounding gets implemented.
|
||||||
|
|
||||||
|
If you change the order of the rounding modes, please update the routines
|
||||||
|
in texceptions.c which assume 0=RNDN, 1=RNDZ, 2=RNDU, 3=RNDD, 4=RNDA.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
MPFR_RNDN=0, /* round to nearest, with ties to even */
|
||||||
|
MPFR_RNDZ, /* round toward zero */
|
||||||
|
MPFR_RNDU, /* round toward +Inf */
|
||||||
|
MPFR_RNDD, /* round toward -Inf */
|
||||||
|
MPFR_RNDA, /* round away from zero */
|
||||||
|
MPFR_RNDF, /* faithful rounding (not implemented yet) */
|
||||||
|
MPFR_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */
|
||||||
|
} mpfr_rnd_t;
|
||||||
|
|
||||||
|
/* kept for compatibility with MPFR 2.4.x and before */
|
||||||
|
#define GMP_RNDN MPFR_RNDN
|
||||||
|
#define GMP_RNDZ MPFR_RNDZ
|
||||||
|
#define GMP_RNDU MPFR_RNDU
|
||||||
|
#define GMP_RNDD MPFR_RNDD
|
||||||
|
|
||||||
|
/* Define precision : 1 (short), 2 (int) or 3 (long) (DON'T USE IT!)*/
|
||||||
|
#ifndef _MPFR_PREC_FORMAT
|
||||||
|
# if __GMP_MP_SIZE_T_INT == 1
|
||||||
|
# define _MPFR_PREC_FORMAT 2
|
||||||
|
# else
|
||||||
|
# define _MPFR_PREC_FORMAT 3
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Let's make mpfr_prec_t signed in order to avoid problems due to the
|
||||||
|
usual arithmetic conversions when mixing mpfr_prec_t and mpfr_exp_t
|
||||||
|
in an expression (for error analysis) if casts are forgotten. */
|
||||||
|
#if _MPFR_PREC_FORMAT == 1
|
||||||
|
typedef short mpfr_prec_t;
|
||||||
|
typedef unsigned short mpfr_uprec_t;
|
||||||
|
#elif _MPFR_PREC_FORMAT == 2
|
||||||
|
typedef int mpfr_prec_t;
|
||||||
|
typedef unsigned int mpfr_uprec_t;
|
||||||
|
#elif _MPFR_PREC_FORMAT == 3
|
||||||
|
typedef long mpfr_prec_t;
|
||||||
|
typedef unsigned long mpfr_uprec_t;
|
||||||
|
#else
|
||||||
|
# error "Invalid MPFR Prec format"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Definition of precision limits without needing <limits.h> */
|
||||||
|
/* Note: the casts allows the expression to yield the wanted behavior
|
||||||
|
for _MPFR_PREC_FORMAT == 1 (due to integer promotion rules). */
|
||||||
|
#define MPFR_PREC_MIN 2
|
||||||
|
#define MPFR_PREC_MAX ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))
|
||||||
|
|
||||||
|
/* Definition of sign */
|
||||||
|
typedef int mpfr_sign_t;
|
||||||
|
|
||||||
|
/* Definition of the exponent: same as in GMP. */
|
||||||
|
typedef mp_exp_t mpfr_exp_t;
|
||||||
|
|
||||||
|
/* Definition of the standard exponent limits */
|
||||||
|
#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((unsigned long) 1 << 30) - 1))
|
||||||
|
#define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT))
|
||||||
|
|
||||||
|
/* Definition of the main structure */
|
||||||
|
typedef struct {
|
||||||
|
mpfr_prec_t _mpfr_prec;
|
||||||
|
mpfr_sign_t _mpfr_sign;
|
||||||
|
mpfr_exp_t _mpfr_exp;
|
||||||
|
mp_limb_t *_mpfr_d;
|
||||||
|
} __mpfr_struct;
|
||||||
|
|
||||||
|
/* Compatibility with previous types of MPFR */
|
||||||
|
#ifndef mp_rnd_t
|
||||||
|
# define mp_rnd_t mpfr_rnd_t
|
||||||
|
#endif
|
||||||
|
#ifndef mp_prec_t
|
||||||
|
# define mp_prec_t mpfr_prec_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
The represented number is
|
||||||
|
_sign*(_d[k-1]/B+_d[k-2]/B^2+...+_d[0]/B^k)*2^_exp
|
||||||
|
where k=ceil(_mp_prec/GMP_NUMB_BITS) and B=2^GMP_NUMB_BITS.
|
||||||
|
|
||||||
|
For the msb (most significant bit) normalized representation, we must have
|
||||||
|
_d[k-1]>=B/2, unless the number is singular.
|
||||||
|
|
||||||
|
We must also have the last k*GMP_NUMB_BITS-_prec bits set to zero.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef __mpfr_struct mpfr_t[1];
|
||||||
|
typedef __mpfr_struct *mpfr_ptr;
|
||||||
|
typedef __gmp_const __mpfr_struct *mpfr_srcptr;
|
||||||
|
|
||||||
|
/* For those who need a direct and fast access to the sign field.
|
||||||
|
However it is not in the API, thus use it at your own risk: it might
|
||||||
|
not be supported, or change name, in further versions!
|
||||||
|
Unfortunately, it must be defined here (instead of MPFR's internal
|
||||||
|
header file mpfr-impl.h) because it is used by some macros below.
|
||||||
|
*/
|
||||||
|
#define MPFR_SIGN(x) ((x)->_mpfr_sign)
|
||||||
|
|
||||||
|
/* Stack interface */
|
||||||
|
typedef enum {
|
||||||
|
MPFR_NAN_KIND = 0,
|
||||||
|
MPFR_INF_KIND = 1, MPFR_ZERO_KIND = 2, MPFR_REGULAR_KIND = 3
|
||||||
|
} mpfr_kind_t;
|
||||||
|
|
||||||
|
/* GMP defines:
|
||||||
|
+ size_t: Standard size_t
|
||||||
|
+ __GMP_ATTRIBUTE_PURE Attribute for math functions.
|
||||||
|
+ __GMP_NOTHROW For C++: can't throw .
|
||||||
|
+ __GMP_EXTERN_INLINE Attribute for inline function.
|
||||||
|
* __gmp_const const (Supports for K&R compiler only for mpfr.h).
|
||||||
|
+ __GMP_DECLSPEC_EXPORT compiling to go into a DLL
|
||||||
|
+ __GMP_DECLSPEC_IMPORT compiling to go into a application
|
||||||
|
*/
|
||||||
|
/* Extra MPFR defines */
|
||||||
|
#define __MPFR_SENTINEL_ATTR
|
||||||
|
#if defined (__GNUC__)
|
||||||
|
# if __GNUC__ >= 4
|
||||||
|
# undef __MPFR_SENTINEL_ATTR
|
||||||
|
# define __MPFR_SENTINEL_ATTR __attribute__ ((sentinel))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Prototypes: Support of K&R compiler */
|
||||||
|
#if defined (__GMP_PROTO)
|
||||||
|
# define _MPFR_PROTO __GMP_PROTO
|
||||||
|
#elif defined (__STDC__) || defined (__cplusplus)
|
||||||
|
# define _MPFR_PROTO(x) x
|
||||||
|
#else
|
||||||
|
# define _MPFR_PROTO(x) ()
|
||||||
|
#endif
|
||||||
|
/* Support for WINDOWS Dll:
|
||||||
|
Check if we are inside a MPFR build, and if so export the functions.
|
||||||
|
Otherwise does the same thing as GMP */
|
||||||
|
#if defined(__MPFR_WITHIN_MPFR) && __GMP_LIBGMP_DLL
|
||||||
|
# define __MPFR_DECLSPEC __GMP_DECLSPEC_EXPORT
|
||||||
|
#else
|
||||||
|
# define __MPFR_DECLSPEC __GMP_DECLSPEC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Note: In order to be declared, some functions need a specific
|
||||||
|
system header to be included *before* "mpfr.h". If the user
|
||||||
|
forgets to include the header, the MPFR function prototype in
|
||||||
|
the user object file is not correct. To avoid wrong results,
|
||||||
|
we raise a linker error in that case by changing their internal
|
||||||
|
name in the library (prefixed by __gmpfr instead of mpfr). See
|
||||||
|
the lines of the form "#define mpfr_xxx __gmpfr_xxx" below. */
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC __gmp_const char * mpfr_get_version _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC __gmp_const char * mpfr_get_patches _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC int mpfr_buildopt_tls_p _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC int mpfr_buildopt_decimal_p _MPFR_PROTO ((void));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_emin _MPFR_PROTO ((mpfr_exp_t));
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_emax _MPFR_PROTO ((mpfr_exp_t));
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max _MPFR_PROTO ((void));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_default_rounding_mode _MPFR_PROTO((mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode _MPFR_PROTO((void));
|
||||||
|
__MPFR_DECLSPEC __gmp_const char *
|
||||||
|
mpfr_print_rnd_mode _MPFR_PROTO((mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void mpfr_clear_flags _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_clear_underflow _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_clear_overflow _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_clear_nanflag _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_clear_inexflag _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_clear_erangeflag _MPFR_PROTO ((void));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_underflow _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_overflow _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_nanflag _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_inexflag _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_erangeflag _MPFR_PROTO ((void));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_underflow_p _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC int mpfr_overflow_p _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC int mpfr_nanflag_p _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC int mpfr_inexflag_p _MPFR_PROTO ((void));
|
||||||
|
__MPFR_DECLSPEC int mpfr_erangeflag_p _MPFR_PROTO ((void));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_check_range _MPFR_PROTO ((mpfr_ptr, int, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void mpfr_init2 _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t));
|
||||||
|
__MPFR_DECLSPEC void mpfr_init _MPFR_PROTO ((mpfr_ptr));
|
||||||
|
__MPFR_DECLSPEC void mpfr_clear _MPFR_PROTO ((mpfr_ptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void
|
||||||
|
mpfr_inits2 _MPFR_PROTO ((mpfr_prec_t, mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
|
||||||
|
__MPFR_DECLSPEC void
|
||||||
|
mpfr_inits _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
|
||||||
|
__MPFR_DECLSPEC void
|
||||||
|
mpfr_clears _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_prec_round _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_can_round _MPFR_PROTO ((mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t,
|
||||||
|
mpfr_prec_t));
|
||||||
|
__MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_exp _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t));
|
||||||
|
__MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec _MPFR_PROTO((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_prec _MPFR_PROTO((mpfr_ptr, mpfr_prec_t));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_prec_raw _MPFR_PROTO((mpfr_ptr, mpfr_prec_t));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_default_prec _MPFR_PROTO((mpfr_prec_t));
|
||||||
|
__MPFR_DECLSPEC mpfr_prec_t mpfr_get_default_prec _MPFR_PROTO((void));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_d _MPFR_PROTO ((mpfr_ptr, double, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_flt _MPFR_PROTO ((mpfr_ptr, float, mpfr_rnd_t));
|
||||||
|
#ifdef MPFR_WANT_DECIMAL_FLOATS
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_decimal64 _MPFR_PROTO ((mpfr_ptr, _Decimal64,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
#endif
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_ld _MPFR_PROTO ((mpfr_ptr, long double, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_z _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_z_2exp _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_exp_t, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_nan _MPFR_PROTO ((mpfr_ptr));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_inf _MPFR_PROTO ((mpfr_ptr, int));
|
||||||
|
__MPFR_DECLSPEC void mpfr_set_zero _MPFR_PROTO ((mpfr_ptr, int));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_f _MPFR_PROTO ((mpfr_ptr, mpf_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_get_f _MPFR_PROTO ((mpf_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_si _MPFR_PROTO ((mpfr_ptr, long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_si_2exp _MPFR_PROTO ((mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_ui_2exp _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_exp_t,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_q _MPFR_PROTO ((mpfr_ptr, mpq_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_init_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set4 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_abs _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_neg _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_signbit _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_setsign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_copysign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
#ifdef _MPFR_H_HAVE_INTMAX_T
|
||||||
|
#define mpfr_set_sj __gmpfr_set_sj
|
||||||
|
#define mpfr_set_sj_2exp __gmpfr_set_sj_2exp
|
||||||
|
#define mpfr_set_uj __gmpfr_set_uj
|
||||||
|
#define mpfr_set_uj_2exp __gmpfr_set_uj_2exp
|
||||||
|
#define mpfr_get_sj __gmpfr_mpfr_get_sj
|
||||||
|
#define mpfr_get_uj __gmpfr_mpfr_get_uj
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_sj _MPFR_PROTO ((mpfr_t, intmax_t, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_sj_2exp _MPFR_PROTO ((mpfr_t, intmax_t, intmax_t, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_set_uj _MPFR_PROTO ((mpfr_t, uintmax_t, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int
|
||||||
|
mpfr_set_uj_2exp _MPFR_PROTO ((mpfr_t, uintmax_t, intmax_t, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC intmax_t mpfr_get_sj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC uintmax_t mpfr_get_uj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp _MPFR_PROTO ((mpz_ptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC float mpfr_get_flt _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC double mpfr_get_d _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
#ifdef MPFR_WANT_DECIMAL_FLOATS
|
||||||
|
__MPFR_DECLSPEC _Decimal64 mpfr_get_decimal64 _MPFR_PROTO ((mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
#endif
|
||||||
|
__MPFR_DECLSPEC long double mpfr_get_ld _MPFR_PROTO ((mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC double mpfr_get_d1 _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC double mpfr_get_d_2exp _MPFR_PROTO ((long*, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC long double mpfr_get_ld_2exp _MPFR_PROTO ((long*, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC long mpfr_get_si _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC unsigned long mpfr_get_ui _MPFR_PROTO ((mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC char*mpfr_get_str _MPFR_PROTO ((char*, mpfr_exp_t*, int, size_t,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_get_z _MPFR_PROTO ((mpz_ptr z, mpfr_srcptr f,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void mpfr_free_str _MPFR_PROTO ((char *));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_urandom _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_urandomb _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void mpfr_nextabove _MPFR_PROTO ((mpfr_ptr));
|
||||||
|
__MPFR_DECLSPEC void mpfr_nextbelow _MPFR_PROTO ((mpfr_ptr));
|
||||||
|
__MPFR_DECLSPEC void mpfr_nexttoward _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr));
|
||||||
|
|
||||||
|
#ifdef _MPFR_H_HAVE_FILE
|
||||||
|
#define mpfr_inp_str __gmpfr_inp_str
|
||||||
|
#define mpfr_out_str __gmpfr_out_str
|
||||||
|
__MPFR_DECLSPEC size_t mpfr_inp_str _MPFR_PROTO ((mpfr_ptr, FILE*, int,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC size_t mpfr_out_str _MPFR_PROTO ((FILE*, int, size_t,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
#define mpfr_fprintf __gmpfr_fprintf
|
||||||
|
__MPFR_DECLSPEC int mpfr_fprintf _MPFR_PROTO ((FILE*, __gmp_const char*,
|
||||||
|
...));
|
||||||
|
#endif
|
||||||
|
__MPFR_DECLSPEC int mpfr_printf _MPFR_PROTO ((__gmp_const char*, ...));
|
||||||
|
__MPFR_DECLSPEC int mpfr_asprintf _MPFR_PROTO ((char**, __gmp_const char*,
|
||||||
|
...));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sprintf _MPFR_PROTO ((char*, __gmp_const char*,
|
||||||
|
...));
|
||||||
|
__MPFR_DECLSPEC int mpfr_snprintf _MPFR_PROTO ((char*, size_t,
|
||||||
|
__gmp_const char*, ...));
|
||||||
|
|
||||||
|
#ifdef _MPFR_H_HAVE_VA_LIST
|
||||||
|
#ifdef _MPFR_H_HAVE_FILE
|
||||||
|
#define mpfr_vfprintf __gmpfr_vfprintf
|
||||||
|
__MPFR_DECLSPEC int mpfr_vfprintf _MPFR_PROTO ((FILE*, __gmp_const char*,
|
||||||
|
va_list));
|
||||||
|
#endif /* _MPFR_H_HAVE_FILE */
|
||||||
|
#define mpfr_vprintf __gmpfr_vprintf
|
||||||
|
#define mpfr_vasprintf __gmpfr_vasprintf
|
||||||
|
#define mpfr_vsprintf __gmpfr_vsprintf
|
||||||
|
#define mpfr_vsnprintf __gmpfr_vsnprintf
|
||||||
|
__MPFR_DECLSPEC int mpfr_vprintf _MPFR_PROTO ((__gmp_const char*, va_list));
|
||||||
|
__MPFR_DECLSPEC int mpfr_vasprintf _MPFR_PROTO ((char**, __gmp_const char*,
|
||||||
|
va_list));
|
||||||
|
__MPFR_DECLSPEC int mpfr_vsprintf _MPFR_PROTO ((char*, __gmp_const char*,
|
||||||
|
va_list));
|
||||||
|
__MPFR_DECLSPEC int mpfr_vsnprintf _MPFR_PROTO ((char*, size_t,
|
||||||
|
__gmp_const char*, va_list));
|
||||||
|
#endif /* _MPFR_H_HAVE_VA_LIST */
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_pow _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_pow_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
long int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_pow_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_ui_pow_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int,
|
||||||
|
unsigned long int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_ui_pow _MPFR_PROTO ((mpfr_ptr, unsigned long int,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_pow_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpz_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sqrt_ui _MPFR_PROTO ((mpfr_ptr, unsigned long,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_rec_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_add _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sub _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_add_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sub_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_ui_sub _MPFR_PROTO ((mpfr_ptr, unsigned long,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_ui_div _MPFR_PROTO ((mpfr_ptr, unsigned long,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_add_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
long int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sub_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
long int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_si_sub _MPFR_PROTO ((mpfr_ptr, long int,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
long int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
long int, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_si_div _MPFR_PROTO ((mpfr_ptr, long int,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_add_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
double, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sub_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
double, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_d_sub _MPFR_PROTO ((mpfr_ptr, double,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
double, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
double, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_d_div _MPFR_PROTO ((mpfr_ptr, double,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_sqr _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_const_pi _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_const_log2 _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_const_euler _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_const_catalan _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_agm _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_log _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_log2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_log10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_log1p _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_exp2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_exp10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_expm1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_eint _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_li2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp3 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr, int));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_d _MPFR_PROTO ((mpfr_srcptr, double));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_ld _MPFR_PROTO ((mpfr_srcptr, long double));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmpabs _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_ui _MPFR_PROTO ((mpfr_srcptr, unsigned long));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_si _MPFR_PROTO ((mpfr_srcptr, long));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_ui_2exp _MPFR_PROTO ((mpfr_srcptr, unsigned long,
|
||||||
|
mpfr_exp_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_si_2exp _MPFR_PROTO ((mpfr_srcptr, long,
|
||||||
|
mpfr_exp_t));
|
||||||
|
__MPFR_DECLSPEC void mpfr_reldiff _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_eq _MPFR_PROTO((mpfr_srcptr, mpfr_srcptr,
|
||||||
|
unsigned long));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sgn _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
long, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
long, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_rint _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_round _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_trunc _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_ceil _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_floor _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_rint_round _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_rint_trunc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_rint_ceil _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_rint_floor _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_frac _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_modf _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_remquo _MPFR_PROTO ((mpfr_ptr, long*, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_remainder _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fmod _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_fits_ulong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fits_slong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fits_uint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fits_sint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fits_ushort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fits_sshort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fits_uintmax_p _MPFR_PROTO((mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fits_intmax_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void mpfr_extract _MPFR_PROTO ((mpz_ptr, mpfr_srcptr,
|
||||||
|
unsigned int));
|
||||||
|
__MPFR_DECLSPEC void mpfr_swap _MPFR_PROTO ((mpfr_ptr, mpfr_ptr));
|
||||||
|
__MPFR_DECLSPEC void mpfr_dump _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_nan_p _MPFR_PROTO((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_inf_p _MPFR_PROTO((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_number_p _MPFR_PROTO((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_integer_p _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_zero_p _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_regular_p _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_greater_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_greaterequal_p _MPFR_PROTO ((mpfr_srcptr,
|
||||||
|
mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_less_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_lessequal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_lessgreater_p _MPFR_PROTO((mpfr_srcptr,mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_equal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC int mpfr_unordered_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_atanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_acosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_asinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_tanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sinh_cosh _MPFR_PROTO ((mpfr_ptr, mpfr_ptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_sech _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_csch _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_coth _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_acos _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_asin _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_atan _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sin _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sin_cos _MPFR_PROTO ((mpfr_ptr, mpfr_ptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cos _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_tan _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_atan2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sec _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_csc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_hypot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_erf _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_erfc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cbrt _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_root _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,unsigned long,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_gamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_lngamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_lgamma _MPFR_PROTO((mpfr_ptr,int*,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_digamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_zeta _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_zeta_ui _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fac_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_j0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_j1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_jn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_y0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_y1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_yn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_ai _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_min _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_max _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_dim _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpz_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpz_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_add_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpz_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sub_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpz_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_z _MPFR_PROTO ((mpfr_srcptr, mpz_srcptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_mul_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpq_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_div_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpq_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_add_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpq_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sub_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
|
||||||
|
mpq_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_q _MPFR_PROTO ((mpfr_srcptr, mpq_srcptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_cmp_f _MPFR_PROTO ((mpfr_srcptr, mpf_srcptr));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_fma _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
|
||||||
|
mpfr_srcptr, mpfr_rnd_t));
|
||||||
|
__MPFR_DECLSPEC int mpfr_sum _MPFR_PROTO ((mpfr_ptr, mpfr_ptr *__gmp_const,
|
||||||
|
unsigned long, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC void mpfr_free_cache _MPFR_PROTO ((void));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_subnormalize _MPFR_PROTO ((mpfr_ptr, int,
|
||||||
|
mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *,
|
||||||
|
char **, int, mpfr_rnd_t));
|
||||||
|
|
||||||
|
__MPFR_DECLSPEC size_t mpfr_custom_get_size _MPFR_PROTO ((mpfr_prec_t));
|
||||||
|
__MPFR_DECLSPEC void mpfr_custom_init _MPFR_PROTO ((void *, mpfr_prec_t));
|
||||||
|
__MPFR_DECLSPEC void * mpfr_custom_get_significand _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
__MPFR_DECLSPEC void mpfr_custom_move _MPFR_PROTO ((mpfr_ptr, void *));
|
||||||
|
__MPFR_DECLSPEC void mpfr_custom_init_set _MPFR_PROTO ((mpfr_ptr, int,
|
||||||
|
mpfr_exp_t, mpfr_prec_t, void *));
|
||||||
|
__MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DON'T USE THIS! (For MPFR-public macros only, see below.)
|
||||||
|
The mpfr_sgn macro uses the fact that __MPFR_EXP_NAN and __MPFR_EXP_ZERO
|
||||||
|
are the smallest values.
|
||||||
|
FIXME: In the following macros, the cast of an unsigned type with MSB set
|
||||||
|
to the signed type mpfr_exp_t yields an integer overflow, which can give
|
||||||
|
unexpected results with future compilers and aggressive optimisations.
|
||||||
|
Why not working only with signed types, using INT_MIN and LONG_MIN? */
|
||||||
|
#if __GMP_MP_SIZE_T_INT
|
||||||
|
#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+2))
|
||||||
|
#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+1))
|
||||||
|
#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+3))
|
||||||
|
#else
|
||||||
|
#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+2))
|
||||||
|
#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+1))
|
||||||
|
#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+3))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define MPFR_USE_EXTENSION to avoid "gcc -pedantic" warnings. */
|
||||||
|
#ifndef MPFR_EXTENSION
|
||||||
|
# if defined(MPFR_USE_EXTENSION)
|
||||||
|
# define MPFR_EXTENSION __extension__
|
||||||
|
# else
|
||||||
|
# define MPFR_EXTENSION
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Warning! This macro doesn't work with K&R C (e.g., compare the "gcc -E"
|
||||||
|
output with and without -traditional) and shouldn't be used internally.
|
||||||
|
For public use only, but see the MPFR manual. */
|
||||||
|
#define MPFR_DECL_INIT(_x, _p) \
|
||||||
|
MPFR_EXTENSION mp_limb_t __gmpfr_local_tab_##_x[((_p)-1)/GMP_NUMB_BITS+1]; \
|
||||||
|
MPFR_EXTENSION mpfr_t _x = {{(_p),1,__MPFR_EXP_NAN,__gmpfr_local_tab_##_x}}
|
||||||
|
|
||||||
|
/* Fast access macros to replace function interface.
|
||||||
|
If the USER don't want to use the macro interface, let him make happy
|
||||||
|
even if it produces faster and smaller code. */
|
||||||
|
#ifndef MPFR_USE_NO_MACRO
|
||||||
|
|
||||||
|
/* Inlining theses functions is both faster and smaller */
|
||||||
|
#define mpfr_nan_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_NAN)
|
||||||
|
#define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF)
|
||||||
|
#define mpfr_zero_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_ZERO)
|
||||||
|
#define mpfr_regular_p(_x) ((_x)->_mpfr_exp > __MPFR_EXP_INF)
|
||||||
|
#define mpfr_sgn(_x) \
|
||||||
|
((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
|
||||||
|
(mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (void) 0), 0 : \
|
||||||
|
MPFR_SIGN (_x))
|
||||||
|
|
||||||
|
/* Prevent them from using as lvalues */
|
||||||
|
#define MPFR_VALUE_OF(x) (0 ? (x) : (x))
|
||||||
|
#define mpfr_get_prec(_x) MPFR_VALUE_OF((_x)->_mpfr_prec)
|
||||||
|
#define mpfr_get_exp(_x) MPFR_VALUE_OF((_x)->_mpfr_exp)
|
||||||
|
/* Note: if need be, the MPFR_VALUE_OF can be used for other expressions
|
||||||
|
(of any type). Thanks to Wojtek Lerch and Tim Rentsch for the idea. */
|
||||||
|
|
||||||
|
#define mpfr_round(a,b) mpfr_rint((a), (b), MPFR_RNDNA)
|
||||||
|
#define mpfr_trunc(a,b) mpfr_rint((a), (b), MPFR_RNDZ)
|
||||||
|
#define mpfr_ceil(a,b) mpfr_rint((a), (b), MPFR_RNDU)
|
||||||
|
#define mpfr_floor(a,b) mpfr_rint((a), (b), MPFR_RNDD)
|
||||||
|
|
||||||
|
#define mpfr_cmp_ui(b,i) mpfr_cmp_ui_2exp((b),(i),0)
|
||||||
|
#define mpfr_cmp_si(b,i) mpfr_cmp_si_2exp((b),(i),0)
|
||||||
|
#define mpfr_set(a,b,r) mpfr_set4(a,b,r,MPFR_SIGN(b))
|
||||||
|
#define mpfr_abs(a,b,r) mpfr_set4(a,b,r,1)
|
||||||
|
#define mpfr_copysign(a,b,c,r) mpfr_set4(a,b,r,MPFR_SIGN(c))
|
||||||
|
#define mpfr_setsign(a,b,s,r) mpfr_set4(a,b,r,(s) ? -1 : 1)
|
||||||
|
#define mpfr_signbit(x) (MPFR_SIGN(x) < 0)
|
||||||
|
#define mpfr_cmp(b, c) mpfr_cmp3(b, c, 1)
|
||||||
|
#define mpfr_mul_2exp(y,x,n,r) mpfr_mul_2ui((y),(x),(n),(r))
|
||||||
|
#define mpfr_div_2exp(y,x,n,r) mpfr_div_2ui((y),(x),(n),(r))
|
||||||
|
|
||||||
|
|
||||||
|
/* When using GCC, optimize certain common comparisons and affectations.
|
||||||
|
+ Remove ICC since it defines __GNUC__ but produces a
|
||||||
|
huge number of warnings if you use this code.
|
||||||
|
VL: I couldn't reproduce a single warning when enabling these macros
|
||||||
|
with icc 10.1 20080212 on Itanium. But with this version, __ICC isn't
|
||||||
|
defined (__INTEL_COMPILER is, though), so that these macros are enabled
|
||||||
|
anyway. Checking with other ICC versions is needed. Possibly detect
|
||||||
|
whether warnings are produced or not with a configure test.
|
||||||
|
+ Remove C++ too, since it complains too much. */
|
||||||
|
#if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
|
||||||
|
#if (__GNUC__ >= 2)
|
||||||
|
#undef mpfr_cmp_ui
|
||||||
|
/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0. */
|
||||||
|
#define mpfr_cmp_ui(_f,_u) \
|
||||||
|
(__builtin_constant_p (_u) && (_u) == 0 ? \
|
||||||
|
mpfr_sgn (_f) : \
|
||||||
|
mpfr_cmp_ui_2exp ((_f),(_u),0))
|
||||||
|
#undef mpfr_cmp_si
|
||||||
|
#define mpfr_cmp_si(_f,_s) \
|
||||||
|
(__builtin_constant_p (_s) && (_s) >= 0 ? \
|
||||||
|
mpfr_cmp_ui ((_f), (_s)) : \
|
||||||
|
mpfr_cmp_si_2exp ((_f), (_s), 0))
|
||||||
|
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
|
||||||
|
#undef mpfr_set_ui
|
||||||
|
#define mpfr_set_ui(_f,_u,_r) \
|
||||||
|
(__builtin_constant_p (_u) && (_u) == 0 ? \
|
||||||
|
__extension__ ({ \
|
||||||
|
mpfr_ptr _p = (_f); \
|
||||||
|
_p->_mpfr_sign = 1; \
|
||||||
|
_p->_mpfr_exp = __MPFR_EXP_ZERO; \
|
||||||
|
(void) (_r); 0; }) : \
|
||||||
|
mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
|
||||||
|
#endif
|
||||||
|
#undef mpfr_set_si
|
||||||
|
#define mpfr_set_si(_f,_s,_r) \
|
||||||
|
(__builtin_constant_p (_s) && (_s) >= 0 ? \
|
||||||
|
mpfr_set_ui ((_f), (_s), (_r)) : \
|
||||||
|
mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Macro version of mpfr_stack interface for fast access */
|
||||||
|
#define mpfr_custom_get_size(p) ((size_t) \
|
||||||
|
(((p)+GMP_NUMB_BITS-1)/GMP_NUMB_BITS*sizeof (mp_limb_t)))
|
||||||
|
#define mpfr_custom_init(m,p) do {} while (0)
|
||||||
|
#define mpfr_custom_get_significand(x) ((void*)((x)->_mpfr_d))
|
||||||
|
#define mpfr_custom_get_exp(x) ((x)->_mpfr_exp)
|
||||||
|
#define mpfr_custom_move(x,m) do { ((x)->_mpfr_d = (mp_limb_t*)(m)); } while (0)
|
||||||
|
#define mpfr_custom_init_set(x,k,e,p,m) do { \
|
||||||
|
mpfr_ptr _x = (x); \
|
||||||
|
mpfr_exp_t _e; \
|
||||||
|
mpfr_kind_t _t; \
|
||||||
|
int _s, _k; \
|
||||||
|
_k = (k); \
|
||||||
|
if (_k >= 0) { \
|
||||||
|
_t = (mpfr_kind_t) _k; \
|
||||||
|
_s = 1; \
|
||||||
|
} else { \
|
||||||
|
_t = (mpfr_kind_t) -k; \
|
||||||
|
_s = -1; \
|
||||||
|
} \
|
||||||
|
_e = _t == MPFR_REGULAR_KIND ? (e) : \
|
||||||
|
_t == MPFR_NAN_KIND ? __MPFR_EXP_NAN : \
|
||||||
|
_t == MPFR_INF_KIND ? __MPFR_EXP_INF : __MPFR_EXP_ZERO; \
|
||||||
|
_x->_mpfr_prec = (p); \
|
||||||
|
_x->_mpfr_sign = _s; \
|
||||||
|
_x->_mpfr_exp = _e; \
|
||||||
|
_x->_mpfr_d = (mp_limb_t*) (m); \
|
||||||
|
} while (0)
|
||||||
|
#define mpfr_custom_get_kind(x) \
|
||||||
|
( (x)->_mpfr_exp > __MPFR_EXP_INF ? (int)MPFR_REGULAR_KIND*MPFR_SIGN (x) \
|
||||||
|
: (x)->_mpfr_exp == __MPFR_EXP_INF ? (int)MPFR_INF_KIND*MPFR_SIGN (x) \
|
||||||
|
: (x)->_mpfr_exp == __MPFR_EXP_NAN ? (int)MPFR_NAN_KIND \
|
||||||
|
: (int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* MPFR_USE_NO_MACRO */
|
||||||
|
|
||||||
|
/* Theses are defined to be macros */
|
||||||
|
#define mpfr_init_set_si(x, i, rnd) \
|
||||||
|
( mpfr_init(x), mpfr_set_si((x), (i), (rnd)) )
|
||||||
|
#define mpfr_init_set_ui(x, i, rnd) \
|
||||||
|
( mpfr_init(x), mpfr_set_ui((x), (i), (rnd)) )
|
||||||
|
#define mpfr_init_set_d(x, d, rnd) \
|
||||||
|
( mpfr_init(x), mpfr_set_d((x), (d), (rnd)) )
|
||||||
|
#define mpfr_init_set_ld(x, d, rnd) \
|
||||||
|
( mpfr_init(x), mpfr_set_ld((x), (d), (rnd)) )
|
||||||
|
#define mpfr_init_set_z(x, i, rnd) \
|
||||||
|
( mpfr_init(x), mpfr_set_z((x), (i), (rnd)) )
|
||||||
|
#define mpfr_init_set_q(x, i, rnd) \
|
||||||
|
( mpfr_init(x), mpfr_set_q((x), (i), (rnd)) )
|
||||||
|
#define mpfr_init_set(x, y, rnd) \
|
||||||
|
( mpfr_init(x), mpfr_set((x), (y), (rnd)) )
|
||||||
|
#define mpfr_init_set_f(x, y, rnd) \
|
||||||
|
( mpfr_init(x), mpfr_set_f((x), (y), (rnd)) )
|
||||||
|
|
||||||
|
/* Compatibility layer -- obsolete functions and macros */
|
||||||
|
#define mpfr_cmp_abs mpfr_cmpabs
|
||||||
|
#define mpfr_round_prec(x,r,p) mpfr_prec_round(x,p,r)
|
||||||
|
#define __gmp_default_rounding_mode (mpfr_get_default_rounding_mode())
|
||||||
|
#define __mpfr_emin (mpfr_get_emin())
|
||||||
|
#define __mpfr_emax (mpfr_get_emax())
|
||||||
|
#define __mpfr_default_fp_bit_precision (mpfr_get_default_fp_bit_precision())
|
||||||
|
#define MPFR_EMIN_MIN mpfr_get_emin_min()
|
||||||
|
#define MPFR_EMIN_MAX mpfr_get_emin_max()
|
||||||
|
#define MPFR_EMAX_MIN mpfr_get_emax_min()
|
||||||
|
#define MPFR_EMAX_MAX mpfr_get_emax_max()
|
||||||
|
#define mpfr_version (mpfr_get_version())
|
||||||
|
#ifndef mpz_set_fr
|
||||||
|
# define mpz_set_fr mpfr_get_z
|
||||||
|
#endif
|
||||||
|
#define mpfr_add_one_ulp(x,r) \
|
||||||
|
(mpfr_sgn (x) > 0 ? mpfr_nextabove (x) : mpfr_nextbelow (x))
|
||||||
|
#define mpfr_sub_one_ulp(x,r) \
|
||||||
|
(mpfr_sgn (x) > 0 ? mpfr_nextbelow (x) : mpfr_nextabove (x))
|
||||||
|
#define mpfr_get_z_exp mpfr_get_z_2exp
|
||||||
|
#define mpfr_custom_get_mantissa mpfr_custom_get_significand
|
||||||
|
|
||||||
|
#endif /* __MPFR_H*/
|
||||||
BIN
deps/MPFR/mpfr/lib/win32/libmpfr-4.dll
vendored
Normal file
BIN
deps/MPFR/mpfr/lib/win32/libmpfr-4.dll
vendored
Normal file
Binary file not shown.
BIN
deps/MPFR/mpfr/lib/win32/libmpfr-4.lib
vendored
Normal file
BIN
deps/MPFR/mpfr/lib/win32/libmpfr-4.lib
vendored
Normal file
Binary file not shown.
BIN
deps/MPFR/mpfr/lib/win64/libmpfr-4.dll
vendored
Normal file
BIN
deps/MPFR/mpfr/lib/win64/libmpfr-4.dll
vendored
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user