mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-31 16:08:43 +03:00
Compare commits
216 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f094d28462 | ||
|
|
b2d3a0ed41 | ||
|
|
d8dc67aea0 | ||
|
|
3cbf2d3318 | ||
|
|
ef91535e6b | ||
|
|
75c28861f5 | ||
|
|
8928344d31 | ||
|
|
9c9c716198 | ||
|
|
f25363d857 | ||
|
|
694e83c0ca | ||
|
|
ea0725bc04 | ||
|
|
5fb4188a19 | ||
|
|
357e2de750 | ||
|
|
417e890ac0 | ||
|
|
00a61f7a0b | ||
|
|
9d44a533df | ||
|
|
b0d35bd265 | ||
|
|
8a37bf9f93 | ||
|
|
edf53d8b0d | ||
|
|
25096e7aad | ||
|
|
2fa4dd2459 | ||
|
|
51438fe624 | ||
|
|
8b420304ba | ||
|
|
3954d5d13b | ||
|
|
2664036512 | ||
|
|
1f9400ddda | ||
|
|
d6408bf239 | ||
|
|
d2012d4d9b | ||
|
|
2b80442677 | ||
|
|
494970573e | ||
|
|
4ee031407d | ||
|
|
f713cb579a | ||
|
|
7f19806dd9 | ||
|
|
f4f63b9a54 | ||
|
|
07b20e3c40 | ||
|
|
535ce1e4d5 | ||
|
|
478a3cabc4 | ||
|
|
40e1a5534e | ||
|
|
019c6dbb10 | ||
|
|
3e70923483 | ||
|
|
d1902fa3d5 | ||
|
|
424a37a68c | ||
|
|
1b2437fa02 | ||
|
|
1687c5d624 | ||
|
|
b1ff57de34 | ||
|
|
bccab56220 | ||
|
|
8ecf30a51d | ||
|
|
cf13b6b6ab | ||
|
|
1c85f23870 | ||
|
|
35c97ae363 | ||
|
|
963e22db99 | ||
|
|
1338e60f8b | ||
|
|
a6c966ffd8 | ||
|
|
2c2e8aaab2 | ||
|
|
65a245af41 | ||
|
|
f2ea046ab5 | ||
|
|
313d89a44f | ||
|
|
5dc99e0fdd | ||
|
|
f2a36c90c1 | ||
|
|
1d73b29a00 | ||
|
|
39bb8169a0 | ||
|
|
205d475acb | ||
|
|
a8371bbded | ||
|
|
261cd7d6e9 | ||
|
|
c4f8a7808a | ||
|
|
a2b2cf743e | ||
|
|
07e2346d8d | ||
|
|
0a6a5f8690 | ||
|
|
51c4567a09 | ||
|
|
0b9b50fa22 | ||
|
|
1cceb727d7 | ||
|
|
49f599efbf | ||
|
|
140ee733ca | ||
|
|
3d89653ad6 | ||
|
|
59aa772875 | ||
|
|
a7ad626cdd | ||
|
|
0886a00cae | ||
|
|
e452f65575 | ||
|
|
a867b747e6 | ||
|
|
8c0ec030e1 | ||
|
|
f39d64153a | ||
|
|
3f31b3f078 | ||
|
|
74e485d913 | ||
|
|
1dad523325 | ||
|
|
b33907514e | ||
|
|
ff4834edd2 | ||
|
|
42a146b5af | ||
|
|
a8e0bd3669 | ||
|
|
d5c00a7bda | ||
|
|
bbc4409f8c | ||
|
|
a192c86e57 | ||
|
|
c8a236e92f | ||
|
|
1b698ce42e | ||
|
|
b9101f8049 | ||
|
|
a6bfd77a85 | ||
|
|
2dbf47fc36 | ||
|
|
33a54d7c36 | ||
|
|
0503b60f30 | ||
|
|
bcfcfdf58d | ||
|
|
e318ad1cc3 | ||
|
|
144552bd81 | ||
|
|
529153d41d | ||
|
|
d761a503ca | ||
|
|
b4fa60892c | ||
|
|
f1b81b3d38 | ||
|
|
9dbc216996 | ||
|
|
4f49d64e7c | ||
|
|
7e28696d35 | ||
|
|
6fd7c6dac5 | ||
|
|
729dc96934 | ||
|
|
bcb8a14ed7 | ||
|
|
b38a69d519 | ||
|
|
126f0688b3 | ||
|
|
63b19be83f | ||
|
|
8371ef3d8e | ||
|
|
9a79a617d4 | ||
|
|
2d1de91a4f | ||
|
|
60871304b5 | ||
|
|
336059534c | ||
|
|
0fa05169af | ||
|
|
5ab2212d2c | ||
|
|
a63019af97 | ||
|
|
757156b7c4 | ||
|
|
ead2acb10f | ||
|
|
fafeab0341 | ||
|
|
95a2f9f9c8 | ||
|
|
cd0e2a34e9 | ||
|
|
ce074892d3 | ||
|
|
2fe4163d88 | ||
|
|
01dc3e3ad1 | ||
|
|
5954ecf4fe | ||
|
|
603711a4c1 | ||
|
|
c3042d5c9e | ||
|
|
4a65859238 | ||
|
|
26bf542370 | ||
|
|
0cfc26b24e | ||
|
|
e12174acb6 | ||
|
|
79349676c0 | ||
|
|
5e03535305 | ||
|
|
297fda6005 | ||
|
|
aa2c60497f | ||
|
|
5adbe71d0c | ||
|
|
2de3fb95b5 | ||
|
|
dd0d4c8c4a | ||
|
|
afe5c54367 | ||
|
|
d918a96f24 | ||
|
|
ea8bd92e15 | ||
|
|
db45fc10ff | ||
|
|
fb5f0c9278 | ||
|
|
d57a16df8f | ||
|
|
bf65d80654 | ||
|
|
2fc1c21af6 | ||
|
|
29ea697608 | ||
|
|
33af4b520d | ||
|
|
3b05bd17f2 | ||
|
|
a0db7dbc6c | ||
|
|
7205bbe709 | ||
|
|
d7f9295a89 | ||
|
|
f4d80ebd58 | ||
|
|
350400a821 | ||
|
|
7420a6fc9a | ||
|
|
4408f20283 | ||
|
|
a047bfb654 | ||
|
|
3a57deb447 | ||
|
|
09a891aeec | ||
|
|
6818902fa1 | ||
|
|
ae7c0f0b25 | ||
|
|
de7d5c78db | ||
|
|
7503e6fe24 | ||
|
|
6ef43e5207 | ||
|
|
34c5379e11 | ||
|
|
dc601ef228 | ||
|
|
db11144a56 | ||
|
|
7804607b70 | ||
|
|
d38f7c15d6 | ||
|
|
cc8e9ffead | ||
|
|
17026155b3 | ||
|
|
6f42a4835e | ||
|
|
fbacefb2c3 | ||
|
|
6b64e30f8d | ||
|
|
a35e39ccd3 | ||
|
|
5b61cba396 | ||
|
|
a9f50c5fcf | ||
|
|
2738d43f69 | ||
|
|
f83a4f34aa | ||
|
|
7ec159a58d | ||
|
|
ce30eb428f | ||
|
|
f121296132 | ||
|
|
da8eb885a3 | ||
|
|
9920b2cb7a | ||
|
|
3d415772c4 | ||
|
|
96cbe77e88 | ||
|
|
bb35958d83 | ||
|
|
e39d22cad6 | ||
|
|
4426b12ce0 | ||
|
|
ba9f8377ba | ||
|
|
ae69c9f1b8 | ||
|
|
38a3e48f60 | ||
|
|
6fea85ef71 | ||
|
|
6c7618a040 | ||
|
|
98f3785554 | ||
|
|
8b9ee5356a | ||
|
|
9e16e26de5 | ||
|
|
6b87e564c9 | ||
|
|
99b2f2b529 | ||
|
|
902d2e8332 | ||
|
|
6f8669195f | ||
|
|
942ed51b40 | ||
|
|
b4cd486f2d | ||
|
|
f2e20e1a90 | ||
|
|
d7cc00c294 | ||
|
|
e80356b984 | ||
|
|
8fbb37087c | ||
|
|
1f7fa78cff | ||
|
|
60be6fd7a3 | ||
|
|
4f19e80b26 |
120
.clang-format
Normal file
120
.clang-format
Normal file
@@ -0,0 +1,120 @@
|
||||
#
|
||||
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||
#
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: true
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: true
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 140
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: true
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- forever
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^<Q.*'
|
||||
Priority: 200
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
#KeepLineBreaksForNonEmptyLines: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 150
|
||||
PenaltyBreakBeforeFirstCallParameter: 300
|
||||
PenaltyBreakComment: 500
|
||||
PenaltyBreakFirstLessLess: 400
|
||||
PenaltyBreakString: 600
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 50
|
||||
PenaltyReturnTypeOnItsOwnLine: 300
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: false
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
|
||||
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 QIDISlicer 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__
|
||||
650
CMakeLists.txt
Normal file
650
CMakeLists.txt
Normal file
@@ -0,0 +1,650 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(QIDISlicer)
|
||||
|
||||
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 QIDISlicer with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
|
||||
option(SLIC3R_GUI "Compile QIDISlicer with GUI components (OpenGL, wxWidgets)" 1)
|
||||
option(SLIC3R_FHS "Assume QIDISlicer is to be installed in a FHS directory structure" 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)
|
||||
option(SLIC3R_UBSAN "Enable UBSan on Clang and GCC" 0)
|
||||
option(SLIC3R_ENABLE_FORMAT_STEP "Enable compilation of STEP file support" 1)
|
||||
# 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 (SLIC3R_STATIC)
|
||||
# Prefer config scripts over find modules. This is helpful when building with
|
||||
# the static dependencies. Many libraries have their own export scripts
|
||||
# while having a Find<PkgName> module in standard cmake installation.
|
||||
# (e.g. CURL)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
endif ()
|
||||
|
||||
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 ()
|
||||
endif ()
|
||||
|
||||
option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF)
|
||||
option(SLIC3R_BUILD_TESTS "Build unit tests" ON)
|
||||
|
||||
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)
|
||||
# Enforce strict C++ conformance, so our code that compiles on MSVC also compiles on GCC and clang.
|
||||
add_compile_options(/permissive-)
|
||||
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 QIDISlicer 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/)
|
||||
|
||||
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)
|
||||
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}/include/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)
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS "3.1")
|
||||
# Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif()
|
||||
|
||||
# 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()
|
||||
|
||||
# Clang reports misleading indentation for some IF blocks because of mixing tabs with spaces.
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
add_compile_options(-Wno-misleading-indentation)
|
||||
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 (SLIC3R_UBSAN)
|
||||
# Stacktrace for every report is enabled by default. It can be disabled by running QIDISlicer with "UBSAN_OPTIONS=print_stacktrace=0".
|
||||
|
||||
# Define macro SLIC3R_UBSAN to allow detection in the source code if this sanitizer is enabled.
|
||||
add_compile_definitions(SLIC3R_UBSAN)
|
||||
|
||||
# Clang supports much more useful checks than GCC, so when Clang is detected, another checks will be enabled.
|
||||
# List of what GCC is checking: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
|
||||
# List of what Clang is checking: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(_ubsan_flags "-fsanitize=undefined,integer")
|
||||
else ()
|
||||
set(_ubsan_flags "-fsanitize=undefined")
|
||||
endif ()
|
||||
|
||||
add_compile_options(${_ubsan_flags} -fno-omit-frame-pointer)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_ubsan_flags}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${_ubsan_flags}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${_ubsan_flags}")
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lubsan")
|
||||
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 ()
|
||||
|
||||
# Where all the bundled libraries reside?
|
||||
set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
set(LIBDIR_BIN ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||
# For the bundled boost libraries (boost::nowide)
|
||||
include_directories(${LIBDIR})
|
||||
# For generated header files
|
||||
include_directories(${LIBDIR_BIN}/platform)
|
||||
|
||||
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 QIDISlicer 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)
|
||||
|
||||
# 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)
|
||||
slic3r_remap_configs(TBB::tbb RelWithDebInfo Release)
|
||||
slic3r_remap_configs(TBB::tbbmalloc RelWithDebInfo Release)
|
||||
# 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(CURL REQUIRED)
|
||||
|
||||
add_library(libcurl INTERFACE)
|
||||
target_link_libraries(libcurl INTERFACE CURL::libcurl)
|
||||
|
||||
# Fixing curl's cmake config script bugs
|
||||
if (NOT WIN32)
|
||||
# Required by libcurl
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_link_libraries(libcurl INTERFACE ZLIB::ZLIB)
|
||||
else()
|
||||
target_link_libraries(libcurl INTERFACE crypt32)
|
||||
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. We have our overriden FindEXPAT which exports libexpat target
|
||||
# no matter what.
|
||||
find_package(EXPAT REQUIRED)
|
||||
|
||||
add_library(libexpat INTERFACE)
|
||||
|
||||
if (TARGET EXPAT::EXPAT )
|
||||
target_link_libraries(libexpat INTERFACE EXPAT::EXPAT)
|
||||
elseif(TARGET expat::expat)
|
||||
target_link_libraries(libexpat INTERFACE expat::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 the Cereal serialization library
|
||||
find_package(cereal REQUIRED)
|
||||
add_library(libcereal INTERFACE)
|
||||
if (NOT TARGET cereal::cereal)
|
||||
target_link_libraries(libcereal INTERFACE cereal)
|
||||
else()
|
||||
target_link_libraries(libcereal INTERFACE cereal::cereal)
|
||||
endif()
|
||||
|
||||
# l10n
|
||||
set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/localization")
|
||||
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 --debug --boost
|
||||
-f "${L10N_DIR}/list.txt"
|
||||
-o "${L10N_DIR}/QIDISlicer.pot"
|
||||
COMMAND hintsToPot ${SLIC3R_RESOURCES_DIR} ${L10N_DIR}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generate pot file from strings in the source tree"
|
||||
)
|
||||
|
||||
add_custom_target(gettext_merge_community_po_with_pot
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Merge community po with new generated pot file"
|
||||
)
|
||||
file(GLOB L10N_PO_FILES "${L10N_DIR}/*/QIDISlicer*.po")
|
||||
# list of names of directories, which are licalized by PS internally
|
||||
list(APPEND PS_L10N_DIRS "cs" "de" "es" "fr" "it" "ja" "pl")
|
||||
foreach(po_file ${L10N_PO_FILES})
|
||||
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
|
||||
GET_FILENAME_COMPONENT(po_dir_name "${po_dir}" NAME)
|
||||
list(FIND PS_L10N_DIRS ${po_dir_name} found_dir_id)
|
||||
# found_dir_id==-1 means that po_dir_name wasn't found in PS_L10N_DIRS
|
||||
if(found_dir_id LESS 0)
|
||||
add_custom_command(
|
||||
TARGET gettext_merge_community_po_with_pot PRE_BUILD
|
||||
COMMAND msgmerge -N -o ${po_file} ${po_file} "${L10N_DIR}/QIDISlicer.pot"
|
||||
# delete obsolete lines from resulting PO to avoid conflicts after a merging of it with wxWidgets.po
|
||||
COMMAND msgattrib --no-obsolete -o ${po_file} ${po_file}
|
||||
DEPENDS ${po_file}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_target(gettext_concat_wx_po_with_po
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Concatenate and merge wxWidgets localization po with QIDISlicer po file"
|
||||
)
|
||||
file(GLOB L10N_PO_FILES "${L10N_DIR}/*/QIDISlicer*.po")
|
||||
foreach(po_file ${L10N_PO_FILES})
|
||||
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
|
||||
GET_FILENAME_COMPONENT(po_dir_name "${po_dir}" NAME)
|
||||
SET(wx_po_file "${L10N_DIR}/wx_locale/${po_dir_name}.po")
|
||||
#SET(po_new_file "${po_dir}/QIDISlicer_.po")
|
||||
add_custom_command(
|
||||
TARGET gettext_concat_wx_po_with_po PRE_BUILD
|
||||
COMMAND msgcat --use-first -o ${po_file} ${po_file} ${wx_po_file}
|
||||
# delete obsolete lines from resulting PO
|
||||
COMMAND msgattrib --no-obsolete -o ${po_file} ${po_file}
|
||||
DEPENDS ${po_file}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
add_custom_target(gettext_po_to_mo
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generate localization mo files (binary) from po files (texts)"
|
||||
)
|
||||
file(GLOB L10N_PO_FILES "${L10N_DIR}/*/QIDISlicer*.po")
|
||||
foreach(po_file ${L10N_PO_FILES})
|
||||
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
|
||||
SET(mo_file "${po_dir}/QIDISlicer.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()
|
||||
|
||||
find_package(NLopt 1.4 REQUIRED)
|
||||
slic3r_remap_configs(NLopt::nlopt RelWithDebInfo Release)
|
||||
|
||||
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(qidislicer_copy_dlls target)
|
||||
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}")
|
||||
elseif (_is_multi)
|
||||
set (_out_dir "$<TARGET_PROPERTY:${target},BINARY_DIR>/$<CONFIG>")
|
||||
else ()
|
||||
set (_out_dir "$<TARGET_PROPERTY:${target},BINARY_DIR>")
|
||||
endif ()
|
||||
|
||||
# This has to be a separate target due to the windows command line lenght limits
|
||||
add_custom_command(TARGET ${target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${TOP_LEVEL_PROJECT_DIR}/deps/GMP/gmp/lib/win${_bits}/libgmp-10.dll ${_out_dir}
|
||||
COMMENT "Copy gmp runtime to build tree"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_command(TARGET ${target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${TOP_LEVEL_PROJECT_DIR}/deps/MPFR/mpfr/lib/win${_bits}/libmpfr-4.dll ${_out_dir}
|
||||
COMMENT "Copy mpfr runtime to build tree"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_command(TARGET ${target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${TOP_LEVEL_PROJECT_DIR}/deps/MPFR/mpfr/lib/win${_bits}/WebView2Loader.dll ${_out_dir}
|
||||
COMMENT "Copy mpfr runtime to build tree"
|
||||
VERBATIM)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
# libslic3r, QIDISlicer GUI and the QIDISlicer executable.
|
||||
add_subdirectory(src)
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT QIDISlicer_app_console)
|
||||
|
||||
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()
|
||||
|
||||
|
||||
# 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}/QIDISlicer")
|
||||
install(DIRECTORY ${SLIC3R_RESOURCES_DIR}/ DESTINATION ${SLIC3R_FHS_RESOURCES}
|
||||
PATTERN "*/udev" EXCLUDE
|
||||
)
|
||||
install(FILES src/platform/unix/QIDISlicer.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
||||
install(FILES src/platform/unix/QIDIGcodeviewer.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
||||
foreach(SIZE 32 128 192)
|
||||
install(FILES ${SLIC3R_RESOURCES_DIR}/icons/QIDISlicer_${SIZE}px.png
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME QIDISlicer.png
|
||||
)
|
||||
install(FILES ${SLIC3R_RESOURCES_DIR}/icons/QIDISlicer-gcodeviewer_${SIZE}px.png
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME QIDISlicer-gcodeviewer.png
|
||||
)
|
||||
endforeach()
|
||||
install(DIRECTORY ${SLIC3R_RESOURCES_DIR}/udev/ DESTINATION lib/udev/rules.d)
|
||||
else ()
|
||||
install(FILES src/platform/unix/QIDISlicer.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/applications)
|
||||
install(FILES src/platform/unix/QIDIGcodeviewer.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)
|
||||
103
QIDISlicer.sublime-project
Normal file
103
QIDISlicer.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\\QIDI3D\\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
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
1.0.1
|
||||
alpha=1.0.1-alpha1
|
||||
beta=1.0.1-beta1
|
||||
1.0.5
|
||||
alpha=1.0.5-alpha1
|
||||
beta=1.0.5-beta1
|
||||
|
||||
[common]
|
||||
release = 1.0.1
|
||||
alpha = 1.0.1-alpha1
|
||||
beta = 1.0.1-beta1
|
||||
rc = 1.0.1-rc2
|
||||
release = 1.0.5
|
||||
alpha = 1.0.5-alpha1
|
||||
beta = 1.0.5-beta1
|
||||
rc = 1.0.5-rc2
|
||||
|
||||
[release:win64]
|
||||
url = https://qidi3d.com/
|
||||
size = 85814296
|
||||
url = https://github.com/QIDITECH/QIDISlicer/releases/download/V1.0.5/QIDISlicer_Setup_1.0.5_Win64.exe
|
||||
size = 71118761
|
||||
|
||||
[release:linux]
|
||||
url = https://qidi3d.com
|
||||
url = https://github.com/QIDITECH/QIDISlicer/releases/download/V1.0.4/QIDISlicer-1.0.4.AppImage
|
||||
size = 69915840
|
||||
|
||||
[release:osx]
|
||||
url = https://qidi3d.com/
|
||||
url = https://github.com/QIDITECH/QIDISlicer/releases/download/V1.0.5/QIDISlicer_Setup_1.0.5_Win64.exe
|
||||
size = 90237989
|
||||
35
README.md
35
README.md
@@ -1,5 +1,36 @@
|
||||
|
||||

|
||||

|
||||
|
||||
# QIDISlicer
|
||||
This branch is used to upload version check information.
|
||||
QIDISlicer is a professional 3D printer slicing software,which is perfectly compatible with all printers and 3D printing filaments of QIDI Technology. Multi-platform support, simple inerface, easy to use, complate functions, easy to learn 3D printing.
|
||||
|
||||
**Notice:QIDISlicer as a new software dedicated to QIDI's new high speed printers, please make sure your firmware version is V 4.0.0 or above.**
|
||||
|
||||
QIDISlicer is based on [PrusaSlicer](https://github.com/prusa3d/PrusaSlicer) by Prusa Research, which is from [Slic3r](https://github.com/Slic3r/Slic3r) by Alessandro Ranellucci and the RepRap community.
|
||||
Thanks to PrusaSlicer, Bambulab and OrcaSlicer for their contributions to the 3D printing community.
|
||||
|
||||
See the [QIDI's homepage](https://qidi3d.com) for more information.
|
||||
|
||||
### Firmware
|
||||
|
||||
You can find the printer's firmware here:
|
||||
|
||||
[X-MAX 3](https://github.com/QIDITECH/QIDI_MAX3)
|
||||
|
||||
[X-Plus 3](https://github.com/QIDITECH/QIDI_PLUS3)
|
||||
|
||||
[X-smart 3](https://github.com/QIDITECH/QIDI_SMART3)
|
||||
|
||||
### Report Issues and Make Suggestions
|
||||
|
||||
You can contact [After-Sales Service](https://qidi3d.com/pages/warranty-policy-after-sales-support) to report issues and make suggestions.
|
||||
|
||||
### License
|
||||
|
||||
QIDISlicer is licensed under the _GNU Affero General Public License, version 3_. QIDISlicer is based on PrusaSlicer by PrusaResearch.
|
||||
|
||||
PrusaSlicer is licensed under the _GNU Affero General Public License, version 3_. PrusaSlicer is owned by Prusa Research. PrusaSlicer is originally based on Slic3r by Alessandro Ranellucci.
|
||||
|
||||
Slic3r is licensed under the _GNU Affero General Public License, version 3_. Slic3r was created by Alessandro Ranellucci with the help of many other contributors.
|
||||
|
||||
The _GNU Affero General Public License, version 3_ ensures that if you use any part of this software in any way (even behind a web server), your software must be released under the same license.
|
||||
|
||||
506
build_win.bat
Normal file
506
build_win.bat
Normal file
@@ -0,0 +1,506 @@
|
||||
@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 [-PRIORITY ^<normal^|low^>]
|
||||
@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-slicer-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-slicer.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 -p -PRIORITY Build CPU priority
|
||||
@ECHO Default: normal
|
||||
@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=QIDISlicer
|
||||
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%
|
||||
SET PS_PRIORITY=normal
|
||||
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 PRIORITY" 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
|
||||
CALL :PARSE_OPTION_VALUE "normal low" PS_PRIORITY
|
||||
SET PS_PRIORITY=%PS_PRIORITY:normal= %
|
||||
SET PS_PRIORITY=%PS_PRIORITY:low=-low%
|
||||
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 Cmake always defaults to latest supported MSVC generator. Let's make sure it uses what we select.
|
||||
FOR /F "tokens=* USEBACKQ" %%I IN (`^""%VSWHERE%" %MSVC_FILTER% -nologo -property catalog_productLineVersion^"`) DO SET PS_PRODUCT_VERSION=%%I
|
||||
|
||||
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%
|
||||
SET CMAKE_GENERATOR=Visual Studio %PS_VERSION% %PS_PRODUCT_VERSION%
|
||||
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 %PS_PRIORITY% || 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 %PS_PRIORITY% || 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-slicer-console.exe >nul || GOTO :END
|
||||
start /wait /b qidi-slicer-console.exe
|
||||
) ELSE IF "%PS_RUN%" EQU "window" (
|
||||
icacls qidi-slicer.exe >nul || GOTO :END
|
||||
start qidi-slicer.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)
|
||||
130
cmake/modules/FindCURL.cmake
Normal file
130
cmake/modules/FindCURL.cmake
Normal file
@@ -0,0 +1,130 @@
|
||||
# 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.
|
||||
|
||||
# First, prefer config scripts
|
||||
set(_q "")
|
||||
if(CURL_FIND_QUIETLY)
|
||||
set(_q QUIET)
|
||||
endif()
|
||||
find_package(CURL ${CURL_FIND_VERSION} CONFIG ${_q})
|
||||
|
||||
if(NOT CURL_FIND_QUIETLY)
|
||||
if (NOT CURL_FOUND)
|
||||
message(STATUS "Falling back to MODULE search for CURL...")
|
||||
else()
|
||||
message(STATUS "CURL found in ${CURL_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT 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()
|
||||
|
||||
endif (NOT CURL_FOUND)
|
||||
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)
|
||||
36
cmake/modules/FindEXPAT.cmake
Normal file
36
cmake/modules/FindEXPAT.cmake
Normal file
@@ -0,0 +1,36 @@
|
||||
set(_q "")
|
||||
if(EXPAT_FIND_QUIETLY)
|
||||
set(_q QUIET)
|
||||
endif()
|
||||
find_package(EXPAT ${EXPAT_FIND_VERSION} CONFIG ${_q})
|
||||
|
||||
if(NOT EXPAT_FIND_QUIETLY)
|
||||
if (NOT EXPAT_FOUND)
|
||||
message(STATUS "Falling back to MODULE search for EXPAT...")
|
||||
else()
|
||||
message(STATUS "EXPAT found in ${EXPAT_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT EXPAT_FOUND)
|
||||
set(_modpath ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH "")
|
||||
include(FindEXPAT)
|
||||
set(CMAKE_MODULE_PATH ${_modpath})
|
||||
|
||||
if (NOT TARGET EXPAT::EXPAT)
|
||||
add_library(EXPAT::EXPAT INTERFACE)
|
||||
target_link_libraries(EXPAT::EXPAT INTERFACE ${EXPAT_LIBRARIES})
|
||||
target_include_directories(EXPAT::EXPAT INTERFACE ${EXPAT_INCLUDE_DIRS})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (EXPAT_FOUND AND NOT TARGET EXPAT::EXPAT)
|
||||
add_library(libexpat INTERFACE)
|
||||
add_library(EXPAT::EXPAT ALIAS libexpat)
|
||||
target_link_libraries(libexpat INTERFACE expat::expat)
|
||||
if (NOT EXPAT_LIBRARIES)
|
||||
set(EXPAT_LIBRARIES expat::expat CACHE STRING "")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
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)
|
||||
20
cmake/modules/FindGLEW.cmake
Normal file
20
cmake/modules/FindGLEW.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
set(_q "")
|
||||
if(GLEW_FIND_QUIETLY)
|
||||
set(_q QUIET)
|
||||
endif()
|
||||
find_package(GLEW ${GLEW_FIND_VERSION} CONFIG ${_q})
|
||||
|
||||
if(NOT GLEW_FIND_QUIETLY)
|
||||
if (NOT GLEW_FOUND)
|
||||
message(STATUS "Falling back to MODULE search for GLEW...")
|
||||
else()
|
||||
message(STATUS "GLEW found in ${GLEW_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT GLEW_FOUND)
|
||||
set(_modpath ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH "")
|
||||
include(FindGLEW)
|
||||
set(CMAKE_MODULE_PATH ${_modpath})
|
||||
endif()
|
||||
46
cmake/modules/FindGTK3.cmake
Normal file
46
cmake/modules/FindGTK3.cmake
Normal file
@@ -0,0 +1,46 @@
|
||||
# - 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 ()
|
||||
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()
|
||||
588
cmake/modules/FindOpenVDB.cmake
Normal file
588
cmake/modules/FindOpenVDB.cmake
Normal file
@@ -0,0 +1,588 @@
|
||||
# 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)
|
||||
|
||||
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()
|
||||
1214
cmake/modules/FindwxWidgets.cmake
Normal file
1214
cmake/modules/FindwxWidgets.cmake
Normal file
File diff suppressed because it is too large
Load Diff
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()
|
||||
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 qidislicer
|
||||
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()
|
||||
|
||||
qidislicer_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
|
||||
|
||||
168
deps/Boost/Boost.cmake
vendored
Normal file
168
deps/Boost/Boost.cmake
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
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 1940)
|
||||
# 1930-1939 = 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(_boost_layout system)
|
||||
if (MSVC)
|
||||
set(_boost_layout versioned)
|
||||
endif ()
|
||||
|
||||
set(_build_cmd ${_build_cmd}
|
||||
${_boost_flags}
|
||||
-j${NPROC}
|
||||
${_libs}
|
||||
--layout=${_boost_layout}
|
||||
--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)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# When Clang is used with enabled UndefinedBehaviorSanitizer, it produces "undefined reference to '__muloti4'" when __int128 is used.
|
||||
# Because of that, UndefinedBehaviorSanitizer is disabled for those functions that use __int128.
|
||||
list(APPEND _patch_command COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/Boost.patch)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(
|
||||
dep_Boost
|
||||
URL "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/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/qidi3d/polygon"
|
||||
# GIT_TAG qidislicer_gmp
|
||||
URL https://github.com/qidi3d/polygon/archive/refs/heads/qidislicer_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 ()
|
||||
23
deps/Boost/Boost.patch
vendored
Normal file
23
deps/Boost/Boost.patch
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
diff -u ../boost_1_75_0-orig/boost/rational.hpp ./boost/rational.hpp
|
||||
--- ../boost_1_75_0-orig/boost/rational.hpp 2020-12-03 06:02:19.000000000 +0100
|
||||
+++ ./boost/rational.hpp 2022-01-27 16:02:27.993848905 +0100
|
||||
@@ -302,6 +302,9 @@
|
||||
return *this;
|
||||
}
|
||||
template <class T>
|
||||
+ #if defined(__clang__)
|
||||
+ __attribute__((no_sanitize("undefined")))
|
||||
+ #endif
|
||||
BOOST_CXX14_CONSTEXPR typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator*= (const T& i)
|
||||
{
|
||||
// Avoid overflow and preserve normalization
|
||||
@@ -311,6 +314,9 @@
|
||||
return *this;
|
||||
}
|
||||
template <class T>
|
||||
+ #if defined(__clang__)
|
||||
+ __attribute__((no_sanitize("undefined")))
|
||||
+ #endif
|
||||
BOOST_CXX14_CONSTEXPR typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator/= (const T& i)
|
||||
{
|
||||
// Avoid repeated construction
|
||||
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 @@
|
||||
qidislicer_add_cmake_project(
|
||||
CGAL
|
||||
# GIT_REPOSITORY https://github.com/CGAL/cgal.git
|
||||
# GIT_TAG bec70a6d52d8aacb0b3d82a7b4edc3caa899184b # releases/CGAL-5.0
|
||||
# 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 dep_Boost 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()
|
||||
223
deps/CMakeLists.txt
vendored
Normal file
223
deps/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
#
|
||||
# This CMake project downloads, configures and builds QIDISlicer 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 QIDISlicer - 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 QIDISlicer.
|
||||
#
|
||||
# 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(QIDISlicer-deps)
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
include(ExternalProject)
|
||||
include(ProcessorCount)
|
||||
|
||||
ProcessorCount(NPROC)
|
||||
if (NPROC EQUAL 0)
|
||||
set(NPROC 1)
|
||||
endif ()
|
||||
|
||||
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 "QIDISlicer deps DESTDIR: ${DESTDIR}")
|
||||
message(STATUS "QIDISlicer dowload dir for source packages: ${DEP_DOWNLOAD_DIR}")
|
||||
message(STATUS "QIDISlicer 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(qidislicer_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")
|
||||
if (${projectname} STREQUAL "OCCT")
|
||||
set(_build_j "/m:1")
|
||||
endif ()
|
||||
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(qidislicer_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}")
|
||||
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 (NOT PNG_FOUND)
|
||||
include(PNG/PNG.cmake)
|
||||
set(PNG_PKG dep_PNG)
|
||||
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)
|
||||
include(Boost/Boost.cmake)
|
||||
|
||||
# The order of includes respects the dependencies between libraries
|
||||
include(Cereal/Cereal.cmake)
|
||||
include(Qhull/Qhull.cmake)
|
||||
include(GLEW/GLEW.cmake)
|
||||
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)
|
||||
|
||||
include(OpenSSL/OpenSSL.cmake)
|
||||
|
||||
set(CURL_PKG "")
|
||||
if (NOT CURL_FOUND)
|
||||
include(CURL/CURL.cmake)
|
||||
set(CURL_PKG dep_CURL)
|
||||
endif ()
|
||||
|
||||
include(JPEG/JPEG.cmake)
|
||||
include(TIFF/TIFF.cmake)
|
||||
include(NanoSVG/NanoSVG.cmake)
|
||||
include(wxWidgets/wxWidgets.cmake)
|
||||
include(OCCT/OCCT.cmake)
|
||||
|
||||
set(_dep_list
|
||||
dep_Boost
|
||||
dep_TBB
|
||||
${CURL_PKG}
|
||||
dep_wxWidgets
|
||||
dep_Cereal
|
||||
dep_NLopt
|
||||
dep_OpenVDB
|
||||
dep_OpenCSG
|
||||
dep_CGAL
|
||||
dep_Qhull
|
||||
dep_OCCT
|
||||
${PNG_PKG}
|
||||
${ZLIB_PKG}
|
||||
${EXPAT_PKG}
|
||||
)
|
||||
|
||||
# if (NOT MSVC)
|
||||
# Not working, static build has different Eigen
|
||||
#list(APPEND _dep_list "dep_libigl")
|
||||
# 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).
|
||||
80
deps/CURL/CURL.cmake
vendored
Normal file
80
deps/CURL/CURL.cmake
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
set(_curl_platform_flags
|
||||
-DENABLE_IPV6:BOOL=ON
|
||||
-DENABLE_VERSIONED_SYMBOLS:BOOL=ON
|
||||
-DENABLE_THREADED_RESOLVER:BOOL=ON
|
||||
|
||||
# -DCURL_DISABLE_LDAP:BOOL=ON
|
||||
# -DCURL_DISABLE_LDAPS:BOOL=ON
|
||||
-DENABLE_MANUAL:BOOL=OFF
|
||||
# -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
|
||||
-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)
|
||||
elseif (APPLE)
|
||||
set(_curl_platform_flags
|
||||
|
||||
${_curl_platform_flags}
|
||||
|
||||
-DCMAKE_USE_SECTRANSP:BOOL=ON
|
||||
-DCMAKE_USE_OPENSSL:BOOL=OFF
|
||||
|
||||
-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 ()
|
||||
|
||||
set(_patch_command "")
|
||||
if (UNIX AND NOT APPLE)
|
||||
# On non-apple UNIX platforms, finding the location of OpenSSL certificates is necessary at runtime, as there is no standard location usable across platforms.
|
||||
# The OPENSSL_CERT_OVERRIDE flag is understood by QIDISlicer and will trigger the search of certificates at initial application launch.
|
||||
# Then ask the user for consent about the correctness of the found location.
|
||||
set (_patch_command echo set_target_properties(CURL::libcurl PROPERTIES INTERFACE_COMPILE_DEFINITIONS OPENSSL_CERT_OVERRIDE) >> CMake/curl-config.cmake.in)
|
||||
endif ()
|
||||
|
||||
qidislicer_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
|
||||
PATCH_COMMAND "${_patch_command}"
|
||||
CMAKE_ARGS
|
||||
-DBUILD_TESTING:BOOL=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
${_curl_platform_flags}
|
||||
)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
add_dependencies(dep_CURL dep_OpenSSL)
|
||||
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 @@
|
||||
qidislicer_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
|
||||
)
|
||||
21
deps/EXPAT/EXPAT.cmake
vendored
Normal file
21
deps/EXPAT/EXPAT.cmake
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
#qidislicer_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
|
||||
#)
|
||||
|
||||
qidislicer_add_cmake_project(EXPAT
|
||||
URL https://github.com/libexpat/libexpat/archive/refs/tags/R_2_4_3.zip
|
||||
URL_HASH SHA256=8851e199d763dc785277d6d414ed3e70ff683915158b51b8d8781df0e3af950a
|
||||
SOURCE_SUBDIR expat
|
||||
CMAKE_ARGS
|
||||
-DEXPAT_BUILD_TOOLS:BOOL=OFF
|
||||
-DEXPAT_BUILD_EXAMPLES:BOOL=OFF
|
||||
-DEXPAT_BUILD_TESTS:BOOL=OFF
|
||||
-DEXPAT_BUILD_DOCS=OFF
|
||||
-DEXPAT_BUILD_PKGCONFIG=OFF
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_EXPAT)
|
||||
endif ()
|
||||
16
deps/GLEW/GLEW.cmake
vendored
Normal file
16
deps/GLEW/GLEW.cmake
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# 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)
|
||||
|
||||
qidislicer_add_cmake_project(
|
||||
GLEW
|
||||
URL https://sourceforge.net/projects/glew/files/glew/2.2.0/glew-2.2.0.zip
|
||||
URL_HASH SHA256=a9046a913774395a095edcc0b0ac2d81c3aacca61787b39839b941e9be14e0d4
|
||||
SOURCE_SUBDIR build/cmake
|
||||
CMAKE_ARGS
|
||||
-DBUILD_UTILS=OFF
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_GLEW)
|
||||
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://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2
|
||||
URL_HASH SHA256=eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c
|
||||
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
8
deps/JPEG/JPEG.cmake
vendored
Normal file
8
deps/JPEG/JPEG.cmake
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
qidislicer_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
|
||||
)
|
||||
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*/
|
||||
674
deps/MPFR/mpfr/mpfr.COPYING
vendored
Normal file
674
deps/MPFR/mpfr/mpfr.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>.
|
||||
165
deps/MPFR/mpfr/mpfr.COPYING.LESSER
vendored
Normal file
165
deps/MPFR/mpfr/mpfr.COPYING.LESSER
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER 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.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser 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
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
91
deps/MPFR/mpfr/mpfr.README
vendored
Normal file
91
deps/MPFR/mpfr/mpfr.README
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
Copyright 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.
|
||||
|
||||
##############################################################################
|
||||
|
||||
The GNU MPFR distribution contains the following files:
|
||||
(This does not apply to code retrieved by Subversion.)
|
||||
|
||||
AUTHORS - the authors of the library
|
||||
BUGS - bugs in MPFR - please read this file!
|
||||
COPYING - the GNU General Public License, version 3
|
||||
COPYING.LESSER - the GNU Lesser General Public License, version 3
|
||||
ChangeLog - the log of changes
|
||||
FAQ.html - frequently asked questions about MPFR
|
||||
INSTALL - how to install MPFR (see also mpfr.texi)
|
||||
Makefile* - files for building the library
|
||||
NEWS - new features with respect to previous versions
|
||||
PATCHES - empty file (until patches are applied)
|
||||
README - this file
|
||||
TODO - what remains to do (any help is welcome!)
|
||||
VERSION - version of MPFR (next release version if taken by Subversion)
|
||||
ac*.m4 - automatic configuration files
|
||||
ansi2knr.* - convert ANSI C to Kernighan & Ritchie C (source and man page)
|
||||
*.c - source files
|
||||
*.h - header files
|
||||
compile - auxiliary installation file
|
||||
config.* - auxiliary installation files
|
||||
configure* - configuration files
|
||||
depcomp - auxiliary installation file
|
||||
examples/ - directory containing examples
|
||||
fdl.texi - the GNU Free Documentation License
|
||||
get_patches.sh - rebuild get_patches.c when patches have been applied
|
||||
install-sh - installation file
|
||||
ltmain.sh - auxiliary installation file
|
||||
m4/ - directory containing additional configuration files
|
||||
missing - auxiliary installation file
|
||||
mparam_h.in - header file template
|
||||
mpfr.info - info file for MPFR
|
||||
mpfr.texi - texinfo documentation for MPFR (source)
|
||||
tests/ - test directory
|
||||
texinfo.tex - TeX macros to handle mpfr.texi
|
||||
|
||||
According to the special exception to the GNU General Public License,
|
||||
the autotools files compile, config.sub, config.guess, ltmain.sh,
|
||||
m4/libtool.m4 and missing are distributed under the same licence of
|
||||
GNU MPFR.
|
||||
|
||||
|
||||
You can get the latest source code by Subversion at InriaGforge:
|
||||
|
||||
svn checkout svn://scm.gforge.inria.fr/svn/mpfr/trunk mpfr
|
||||
|
||||
or
|
||||
|
||||
svn checkout https://scm.gforge.inria.fr/svn/mpfr/trunk mpfr
|
||||
|
||||
(the last argument can be any directory name). You can use
|
||||
|
||||
svn ls svn://scm.gforge.inria.fr/svn/mpfr/branches
|
||||
svn ls svn://scm.gforge.inria.fr/svn/mpfr/tags
|
||||
|
||||
to get the list of branches or tags (releases), then checkout a
|
||||
particular branch or tag instead of the trunk. Alternatively, you
|
||||
can now use the "https:" scheme (a.k.a. DAV) instead of "svn:".
|
||||
For more information about Subversion, please see:
|
||||
|
||||
* http://svnbook.red-bean.com/ (the official Subversion book);
|
||||
* http://gcc.gnu.org/wiki/SvnHelp (written for GCC developers,
|
||||
but interesting general information can be found there);
|
||||
* http://subversion.tigris.org/faq.html (the Subversion FAQ).
|
||||
|
||||
Subversion users should read the file "README.dev".
|
||||
|
||||
Note: the old CVS repository at cvs-sop.inria.fr is now closed.
|
||||
15
deps/NLopt/NLopt.cmake
vendored
Normal file
15
deps/NLopt/NLopt.cmake
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
qidislicer_add_cmake_project(NLopt
|
||||
URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
|
||||
URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
|
||||
CMAKE_ARGS
|
||||
-DNLOPT_PYTHON:BOOL=OFF
|
||||
-DNLOPT_OCTAVE:BOOL=OFF
|
||||
-DNLOPT_MATLAB:BOOL=OFF
|
||||
-DNLOPT_GUILE:BOOL=OFF
|
||||
-DNLOPT_SWIG:BOOL=OFF
|
||||
-DNLOPT_TESTS:BOOL=OFF
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_NLopt)
|
||||
endif ()
|
||||
9
deps/NanoSVG/NanoSVG.cmake
vendored
Normal file
9
deps/NanoSVG/NanoSVG.cmake
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# In QIDISlicer 2.6.0 we switched from https://github.com/memononen/nanosvg to its fork https://github.com/fltk/nanosvg
|
||||
# because this last implements the new function nsvgRasterizeXY() which we now use in GLTexture::load_from_svg()
|
||||
# for rasterizing svg files from their original size to a squared power of two texture on Windows systems using
|
||||
# AMD Radeon graphics cards
|
||||
|
||||
qidislicer_add_cmake_project(NanoSVG
|
||||
URL https://github.com/fltk/nanosvg/archive/abcd277ea45e9098bed752cf9c6875b533c0892f.zip
|
||||
URL_HASH SHA256=e859938fbaee4b351bd8a8b3d3c7a75b40c36885ce00b73faa1ce0b98aa0ad34
|
||||
)
|
||||
27
deps/OCCT/OCCT.cmake
vendored
Normal file
27
deps/OCCT/OCCT.cmake
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
qidislicer_add_cmake_project(OCCT
|
||||
#LMBBS: changed version to 7.6.2
|
||||
URL https://github.com/Open-Cascade-SAS/OCCT/archive/refs/tags/V7_6_2.zip
|
||||
URL_HASH SHA256=c696b923593e8c18d059709717dbf155b3e72fdd283c8522047a790ec3a432c5
|
||||
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/occt_toolkit.cmake ./adm/cmake/
|
||||
CMAKE_ARGS
|
||||
-DINSTALL_DIR_LAYOUT=Unix # LMBBS
|
||||
-DBUILD_LIBRARY_TYPE=Static
|
||||
-DUSE_TK=OFF
|
||||
-DUSE_TBB=OFF
|
||||
-DUSE_FREETYPE=OFF
|
||||
-DUSE_FFMPEG=OFF
|
||||
-DUSE_VTK=OFF
|
||||
-DUSE_FREETYPE=OFF
|
||||
-DBUILD_MODULE_ApplicationFramework=OFF
|
||||
#-DBUILD_MODULE_DataExchange=OFF
|
||||
-DBUILD_MODULE_Draw=OFF
|
||||
-DBUILD_MODULE_FoundationClasses=OFF
|
||||
-DBUILD_MODULE_ModelingAlgorithms=OFF
|
||||
-DBUILD_MODULE_ModelingData=OFF
|
||||
-DBUILD_MODULE_Visualization=OFF
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_OCCT)
|
||||
endif ()
|
||||
453
deps/OCCT/occt_toolkit.cmake
vendored
Normal file
453
deps/OCCT/occt_toolkit.cmake
vendored
Normal file
@@ -0,0 +1,453 @@
|
||||
# script for each OCCT toolkit
|
||||
|
||||
# filling some variables by default values(src) or using custom(tools, samples)
|
||||
set (RELATIVE_SOURCES_DIR "${RELATIVE_DIR}")
|
||||
if ("${RELATIVE_SOURCES_DIR}" STREQUAL "")
|
||||
#if it is not defined, use default directory
|
||||
set (RELATIVE_SOURCES_DIR "src")
|
||||
endif()
|
||||
|
||||
set (OCC_MODULES_LIST "${MODULES_LIST}")
|
||||
if ("${OCC_MODULES_LIST}" STREQUAL "")
|
||||
set (OCC_MODULES_LIST ${OCCT_MODULES})
|
||||
endif()
|
||||
|
||||
set (OCC_TARGET_FOLDER "${TARGET_FOLDER}")
|
||||
if ("${OCC_TARGET_FOLDER}" STREQUAL "")
|
||||
set (OCC_TARGET_FOLDER "Modules")
|
||||
endif()
|
||||
|
||||
set (OCCT_TOOLKITS_NAME_SUFFIX "${TOOLKITS_NAME_SUFFIX}")
|
||||
if ("${OCCT_TOOLKITS_NAME_SUFFIX}" STREQUAL "")
|
||||
set (OCCT_TOOLKITS_NAME_SUFFIX "TOOLKITS")
|
||||
endif()
|
||||
|
||||
# parse PACKAGES file
|
||||
FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
|
||||
if ("${USED_PACKAGES}" STREQUAL "")
|
||||
set (USED_PACKAGES ${PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
if (USE_QT)
|
||||
# Qt dependencies
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/qt_macro)
|
||||
FIND_QT_PACKAGE(PROJECT_LIBRARIES_DEBUG PROJECT_LIBRARIES_RELEASE PROJECT_INCLUDES)
|
||||
include_directories("${PROJECT_INCLUDES}")
|
||||
endif(USE_QT)
|
||||
|
||||
set (PRECOMPILED_DEFS)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
list (APPEND PRECOMPILED_DEFS "-DOCCT_NO_PLUGINS")
|
||||
if (WIN32 AND NOT EXECUTABLE_PROJECT)
|
||||
list (APPEND PRECOMPILED_DEFS "-DOCCT_STATIC_BUILD")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Get all used packages from toolkit
|
||||
UNSET(RESOURCE_FILES)
|
||||
foreach (OCCT_PACKAGE ${USED_PACKAGES})
|
||||
|
||||
#remove part after "/" in the OCCT_PACKAGE variable if exists
|
||||
string (FIND "${OCCT_PACKAGE}" "/" _index)
|
||||
if (_index GREATER -1)
|
||||
math (EXPR _index "${_index}")
|
||||
string (SUBSTRING "${OCCT_PACKAGE}" 0 ${_index} OCCT_PACKAGE_NAME)
|
||||
else()
|
||||
set (OCCT_PACKAGE_NAME "${OCCT_PACKAGE}")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
list (APPEND PRECOMPILED_DEFS "-D__${OCCT_PACKAGE_NAME}_DLL")
|
||||
endif()
|
||||
|
||||
set (SOURCE_FILES)
|
||||
set (HEADER_FILES)
|
||||
|
||||
# Generate Flex and Bison files
|
||||
if (${BUILD_YACCLEX})
|
||||
# flex files
|
||||
OCCT_ORIGIN_AND_PATCHED_FILES ("${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX)
|
||||
list (LENGTH SOURCE_FILES_FLEX SOURCE_FILES_FLEX_LEN)
|
||||
|
||||
# bison files
|
||||
OCCT_ORIGIN_AND_PATCHED_FILES ("${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON)
|
||||
list (LENGTH SOURCE_FILES_BISON SOURCE_FILES_BISON_LEN)
|
||||
|
||||
if (${SOURCE_FILES_FLEX_LEN} EQUAL ${SOURCE_FILES_BISON_LEN} AND NOT ${SOURCE_FILES_FLEX_LEN} EQUAL 0)
|
||||
|
||||
list (SORT SOURCE_FILES_FLEX)
|
||||
list (SORT SOURCE_FILES_BISON)
|
||||
|
||||
math (EXPR SOURCE_FILES_FLEX_LEN "${SOURCE_FILES_FLEX_LEN} - 1")
|
||||
foreach (FLEX_FILE_INDEX RANGE ${SOURCE_FILES_FLEX_LEN})
|
||||
|
||||
list (GET SOURCE_FILES_FLEX ${FLEX_FILE_INDEX} CURRENT_FLEX_FILE)
|
||||
get_filename_component (CURRENT_FLEX_FILE_NAME ${CURRENT_FLEX_FILE} NAME_WE)
|
||||
|
||||
list (GET SOURCE_FILES_BISON ${FLEX_FILE_INDEX} CURRENT_BISON_FILE)
|
||||
get_filename_component (CURRENT_BISON_FILE_NAME ${CURRENT_BISON_FILE} NAME_WE)
|
||||
|
||||
string (COMPARE EQUAL ${CURRENT_FLEX_FILE_NAME} ${CURRENT_BISON_FILE_NAME} ARE_FILES_EQUAL)
|
||||
|
||||
if (EXISTS "${CURRENT_FLEX_FILE}" AND EXISTS "${CURRENT_BISON_FILE}" AND ${ARE_FILES_EQUAL})
|
||||
|
||||
# Note: files are generated in original source directory (not in patch!)
|
||||
set (FLEX_BISON_TARGET_DIR "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}")
|
||||
|
||||
# choose appropriate extension for generated files: "cxx" if source file contains
|
||||
# instruction to generate C++ code, "c" otherwise
|
||||
set (BISON_OUTPUT_FILE_EXT "c")
|
||||
set (FLEX_OUTPUT_FILE_EXT "c")
|
||||
file (STRINGS "${CURRENT_BISON_FILE}" FILE_BISON_CONTENT)
|
||||
foreach (FILE_BISON_CONTENT_LINE ${FILE_BISON_CONTENT})
|
||||
string (REGEX MATCH "%language \"C\\+\\+\"" CXX_BISON_LANGUAGE_FOUND ${FILE_BISON_CONTENT_LINE})
|
||||
if (CXX_BISON_LANGUAGE_FOUND)
|
||||
set (BISON_OUTPUT_FILE_EXT "cxx")
|
||||
endif()
|
||||
endforeach()
|
||||
file (STRINGS "${CURRENT_FLEX_FILE}" FILE_FLEX_CONTENT)
|
||||
foreach (FILE_FLEX_CONTENT_LINE ${FILE_FLEX_CONTENT})
|
||||
string (REGEX MATCH "%option c\\+\\+" CXX_FLEX_LANGUAGE_FOUND ${FILE_FLEX_CONTENT_LINE})
|
||||
if (CXX_FLEX_LANGUAGE_FOUND)
|
||||
set (FLEX_OUTPUT_FILE_EXT "cxx")
|
||||
|
||||
# install copy of FlexLexer.h locally to allow further building without flex
|
||||
if (FLEX_INCLUDE_DIR AND EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
|
||||
configure_file("${FLEX_INCLUDE_DIR}/FlexLexer.h" "${FLEX_BISON_TARGET_DIR}/FlexLexer.h" @ONLY NEWLINE_STYLE LF)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
|
||||
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.${FLEX_OUTPUT_FILE_EXT})
|
||||
|
||||
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}"
|
||||
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=")
|
||||
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}"
|
||||
COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME} -L")
|
||||
ADD_FLEX_BISON_DEPENDENCY (Scanner_${CURRENT_FLEX_FILE_NAME} Parser_${CURRENT_BISON_FILE_NAME})
|
||||
|
||||
list (APPEND SOURCE_FILES ${BISON_OUTPUT_FILE} ${FLEX_OUTPUT_FILE})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# header files
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES")
|
||||
file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_M REGEX ".+[.]h")
|
||||
file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
|
||||
file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
|
||||
|
||||
file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
|
||||
if(APPLE)
|
||||
file (STRINGS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
|
||||
endif()
|
||||
else()
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_M REGEX ".+[.]h")
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
|
||||
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
|
||||
if(APPLE)
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list (APPEND HEADER_FILES ${HEADER_FILES_M} ${HEADER_FILES_LXX} ${SOURCE_FILES_GXX})
|
||||
list (APPEND SOURCE_FILES ${SOURCE_FILES_C})
|
||||
if(APPLE)
|
||||
list (APPEND SOURCE_FILES ${SOURCE_FILES_M})
|
||||
endif()
|
||||
|
||||
foreach(HEADER_FILE ${HEADER_FILES})
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
message (STATUS "Info: consider patched file: ${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
list (APPEND USED_INCFILES "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE_NAME}" FILES "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
else()
|
||||
list (APPEND USED_INCFILES "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE_NAME}" FILES "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE_FILE ${SOURCE_FILES})
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
message (STATUS "Info: consider patched file: ${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
list (APPEND USED_SRCFILES "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE_NAME}" FILES "${BUILD_PATCH}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
else()
|
||||
list (APPEND USED_SRCFILES "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE_NAME}" FILES "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (USE_QT)
|
||||
FIND_AND_INSTALL_QT_RESOURCES (${OCCT_PACKAGE} RESOURCE_FILES)
|
||||
#message("Qt Resource files are: ${QT_RESOURCE_FILES} in ${OCCT_PACKAGE}")
|
||||
endif(USE_QT)
|
||||
|
||||
#message("Resource files are: ${RESOURCE_FILES} in ${OCCT_PACKAGE}")
|
||||
foreach(RESOURCE_FILE ${RESOURCE_FILES})
|
||||
SOURCE_GROUP ("Resource Files\\${OCCT_PACKAGE_NAME}" FILES "${RESOURCE_FILE}")
|
||||
endforeach()
|
||||
endforeach()
|
||||
string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
|
||||
|
||||
set (USED_RCFILE "")
|
||||
if (MSVC)
|
||||
set (USED_RCFILE "${CMAKE_BINARY_DIR}/resources/${PROJECT_NAME}.rc")
|
||||
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in")
|
||||
configure_file("${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
|
||||
else()
|
||||
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (CURRENT_MODULE)
|
||||
foreach (OCCT_MODULE ${OCC_MODULES_LIST})
|
||||
list (FIND ${OCCT_MODULE}_${OCCT_TOOLKITS_NAME_SUFFIX} ${PROJECT_NAME} CURRENT_PROJECT_IS_BUILT)
|
||||
|
||||
if (NOT ${CURRENT_PROJECT_IS_BUILT} EQUAL -1)
|
||||
set (CURRENT_MODULE ${OCCT_MODULE})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (MSVC)
|
||||
OCCT_INSERT_CODE_FOR_TARGET ()
|
||||
endif()
|
||||
|
||||
if (USE_QT)
|
||||
FIND_AND_WRAP_MOC_FILES("${USED_INCFILES}" "${PROJECT_NAME}_MOC_FILES")
|
||||
#message("MOC files: ${${PROJECT_NAME}_MOC_FILES}")
|
||||
endif (USE_QT)
|
||||
|
||||
if (EXECUTABLE_PROJECT)
|
||||
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||
|
||||
install (TARGETS ${PROJECT_NAME}
|
||||
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.wasm DESTINATION "${INSTALL_DIR_BIN}/${OCCT_INSTALL_BIN_LETTER}")
|
||||
endif()
|
||||
else()
|
||||
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||
|
||||
if (MSVC)
|
||||
if (BUILD_FORCE_RelWithDebInfo)
|
||||
set (aReleasePdbConf "Release")
|
||||
else()
|
||||
set (aReleasePdbConf)
|
||||
endif()
|
||||
# install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
|
||||
# CONFIGURATIONS Debug ${aReleasePdbConf} RelWithDebInfo
|
||||
# DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
|
||||
set (CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
set (CMAKE_SHARED_LIBRARY_SUFFIX "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
install (TARGETS ${PROJECT_NAME}
|
||||
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
|
||||
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
|
||||
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
|
||||
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
|
||||
if (NOT WIN32)
|
||||
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
|
||||
set (LINK_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT}")
|
||||
set (LIBRARY_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
OCCT_CREATE_SYMLINK_TO_FILE (${LIBRARY_NAME} ${LINK_NAME})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CURRENT_MODULE)
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "${OCC_TARGET_FOLDER}/${CURRENT_MODULE}")
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
|
||||
if (APPLE)
|
||||
if (NOT "${INSTALL_NAME_DIR}" STREQUAL "")
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "${INSTALL_NAME_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
|
||||
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
|
||||
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
|
||||
|
||||
if (ANDROID)
|
||||
# do not append version to the filename
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
|
||||
else()
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
|
||||
SOVERSION "${OCC_VERSION_MAJOR}"
|
||||
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||
endif()
|
||||
|
||||
set (USED_TOOLKITS_BY_CURRENT_PROJECT)
|
||||
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
|
||||
|
||||
# parse EXTERNLIB file
|
||||
if (CUSTOM_EXTERNLIB)
|
||||
set (USED_EXTERNLIB_AND_TOOLKITS ${CUSTOM_EXTERNLIB})
|
||||
else()
|
||||
FILE_TO_LIST ("${RELATIVE_SOURCES_DIR}/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
|
||||
endif()
|
||||
foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM})
|
||||
if (NOT COMMENT_FOUND)
|
||||
string (REGEX MATCH "^TK" TK_FOUND ${USED_ITEM})
|
||||
string (REGEX MATCH "^vtk" VTK_FOUND ${USED_ITEM})
|
||||
|
||||
if (NOT "${TK_FOUND}" STREQUAL "" OR NOT "${VTK_FOUND}" STREQUAL "")
|
||||
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM})
|
||||
if (NOT "${VTK_FOUND}" STREQUAL "" AND BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK)
|
||||
OCCT_INSTALL_VTK(${USED_ITEM})
|
||||
endif()
|
||||
else()
|
||||
string (REGEX MATCH "^CSF_" CSF_FOUND ${USED_ITEM})
|
||||
if ("${CSF_FOUND}" STREQUAL "")
|
||||
message (STATUS "Info: ${USED_ITEM} from ${PROJECT_NAME} skipped due to it is empty")
|
||||
else() # get CSF_ value
|
||||
set (CURRENT_CSF ${${USED_ITEM}})
|
||||
if (NOT "x${CURRENT_CSF}" STREQUAL "x")
|
||||
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs")
|
||||
add_definitions (-DHAVE_OPENGL)
|
||||
endif()
|
||||
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlesLibs")
|
||||
add_definitions (-DHAVE_GLES2)
|
||||
endif()
|
||||
|
||||
set (LIBRARY_FROM_CACHE 0)
|
||||
separate_arguments (CURRENT_CSF)
|
||||
foreach (CSF_LIBRARY ${CURRENT_CSF})
|
||||
string (TOLOWER "${CSF_LIBRARY}" CSF_LIBRARY)
|
||||
string (REPLACE "+" "[+]" CSF_LIBRARY "${CSF_LIBRARY}")
|
||||
string (REPLACE "." "" CSF_LIBRARY "${CSF_LIBRARY}")
|
||||
get_cmake_property(ALL_CACHE_VARIABLES CACHE_VARIABLES)
|
||||
string (REGEX MATCHALL "(^|;)3RDPARTY_[^;]+_LIBRARY[^;]*" ALL_CACHE_VARIABLES "${ALL_CACHE_VARIABLES}")
|
||||
foreach (CACHE_VARIABLE ${ALL_CACHE_VARIABLES})
|
||||
set (CURRENT_CACHE_LIBRARY ${${CACHE_VARIABLE}})
|
||||
string (TOLOWER "${CACHE_VARIABLE}" CACHE_VARIABLE)
|
||||
|
||||
if (EXISTS "${CURRENT_CACHE_LIBRARY}" AND NOT IS_DIRECTORY "${CURRENT_CACHE_LIBRARY}")
|
||||
string (REGEX MATCH "_${CSF_LIBRARY}$" IS_ENDING "${CACHE_VARIABLE}")
|
||||
string (REGEX MATCH "^([a-z]+)" CSF_WO_VERSION "${CSF_LIBRARY}")
|
||||
string (REGEX MATCH "_${CSF_WO_VERSION}$" IS_ENDING_WO_VERSION "${CACHE_VARIABLE}")
|
||||
if ("3rdparty_${CSF_LIBRARY}_library" STREQUAL "${CACHE_VARIABLE}" OR
|
||||
"3rdparty_${CSF_WO_VERSION}_library" STREQUAL "${CACHE_VARIABLE}" OR
|
||||
NOT "x${IS_ENDING}" STREQUAL "x" OR
|
||||
NOT "x${IS_ENDING_WO_VERSION}" STREQUAL "x")
|
||||
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "${CURRENT_CACHE_LIBRARY}")
|
||||
set (LIBRARY_FROM_CACHE 1)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
if (NOT ${LIBRARY_FROM_CACHE})
|
||||
# prepare a list from a string with whitespaces
|
||||
separate_arguments (CURRENT_CSF)
|
||||
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (APPLE)
|
||||
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
|
||||
if (NOT ${IS_X11_FOUND} EQUAL -1)
|
||||
find_package (X11 COMPONENTS X11)
|
||||
if (NOT X11_FOUND)
|
||||
message (STATUS "Warning: X11 is not found. It's required to install The XQuartz project: http://www.xquartz.org")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Update list of used VTK libraries if OpenGL2 Rendering BackEnd is used.
|
||||
# Add VTK_OPENGL2_BACKEND definition.
|
||||
if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2" OR IS_VTK_9XX)
|
||||
add_definitions(-DVTK_OPENGL2_BACKEND)
|
||||
foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
|
||||
list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
|
||||
if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
|
||||
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
|
||||
if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
|
||||
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
|
||||
if(VTK_MAJOR_VERSION GREATER 6)
|
||||
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingGL2PSOpenGL2)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
if(VTK_MAJOR_VERSION EQUAL 6 AND VTK_MINOR_VERSION GREATER 2 OR VTK_MAJOR_VERSION GREATER 6)
|
||||
list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL" IS_VTK_RENDER_FREETYPE_FOUND)
|
||||
if (NOT ${IS_VTK_RENDER_FREETYPE_FOUND} EQUAL -1)
|
||||
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS OR EXECUTABLE_PROJECT)
|
||||
if(IS_VTK_9XX)
|
||||
string (REGEX REPLACE "vtk" "VTK::" USED_TOOLKITS_BY_CURRENT_PROJECT "${USED_TOOLKITS_BY_CURRENT_PROJECT}")
|
||||
endif()
|
||||
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
|
||||
endif()
|
||||
|
||||
if (USE_QT)
|
||||
foreach (PROJECT_LIBRARY_DEBUG ${PROJECT_LIBRARIES_DEBUG})
|
||||
target_link_libraries (${PROJECT_NAME} debug ${PROJECT_LIBRARY_DEBUG})
|
||||
endforeach()
|
||||
foreach (PROJECT_LIBRARY_RELEASE ${PROJECT_LIBRARIES_RELEASE})
|
||||
target_link_libraries (${PROJECT_NAME} optimized ${PROJECT_LIBRARY_RELEASE})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# suppress deprecation warnings inside OCCT itself for old gcc versions with unavailable Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6.0)
|
||||
add_definitions("-DOCCT_NO_DEPRECATED")
|
||||
message (STATUS "Warning: internal deprecation warnings by Standard_DEPRECATED have been disabled due to old gcc version being used")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# use Cotire to accelerate build via usage of precompiled headers
|
||||
if (BUILD_USE_PCH)
|
||||
if (WIN32)
|
||||
# prevent definition of min and max macros through inclusion of Windows.h
|
||||
# (for cotire builds)
|
||||
add_definitions("-DNOMINMAX")
|
||||
# avoid warnings on deprecated names from standard C library (see strsafe.h)
|
||||
add_definitions("-DSTRSAFE_NO_DEPRECATE")
|
||||
# avoid "std::Equal1" warning in QANCollection_Stl.cxx in debug mode
|
||||
# suggesting using msvc "Checked Iterators"
|
||||
add_definitions("-D_SCL_SECURE_NO_WARNINGS")
|
||||
endif()
|
||||
|
||||
# Exclude system-provided glext.h.
|
||||
# These macros are already defined within OpenGl_GlFunctions.hxx,
|
||||
# however we have to duplicate them here for building TKOpenGl with PCH.
|
||||
add_definitions("-DGL_GLEXT_LEGACY")
|
||||
add_definitions("-DGLX_GLXEXT_LEGACY")
|
||||
|
||||
# workaround for old gcc
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions("-D__STDC_CONSTANT_MACROS")
|
||||
add_definitions("-D__STDC_FORMAT_MACROS")
|
||||
endif()
|
||||
|
||||
# unity builds are not used since they do not add speed but cause conflicts
|
||||
# in TKV3d
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
|
||||
cotire(${PROJECT_NAME})
|
||||
endif()
|
||||
101
deps/OpenCSG/CMakeLists.txt.in
vendored
Normal file
101
deps/OpenCSG/CMakeLists.txt.in
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(OpenCSG)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
set(GLEW_USE_STATIC_LIBS ON)
|
||||
elseif (MSVC)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
endif()
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
set(GLEW_VERBOSE ON)
|
||||
find_package(GLEW REQUIRED)
|
||||
|
||||
set(_srcfiles
|
||||
src/area.cpp
|
||||
src/batch.cpp
|
||||
src/context.cpp
|
||||
src/channelManager.cpp
|
||||
src/frameBufferObject.cpp
|
||||
src/frameBufferObjectExt.cpp
|
||||
src/occlusionQuery.cpp
|
||||
src/opencsgRender.cpp
|
||||
src/openglHelper.cpp
|
||||
src/pBufferTexture.cpp
|
||||
src/primitive.cpp
|
||||
src/primitiveHelper.cpp
|
||||
src/renderGoldfeather.cpp
|
||||
src/renderSCS.cpp
|
||||
src/scissorMemo.cpp
|
||||
src/settings.cpp
|
||||
src/stencilManager.cpp
|
||||
RenderTexture/RenderTexture.cpp
|
||||
include/opencsg.h
|
||||
src/opencsgConfig.h
|
||||
src/area.h
|
||||
src/batch.h
|
||||
src/context.h
|
||||
src/channelManager.h
|
||||
src/frameBufferObject.h
|
||||
src/frameBufferObjectExt.h
|
||||
src/occlusionQuery.h
|
||||
src/offscreenBuffer.h
|
||||
src/opencsgRender.h
|
||||
src/openglHelper.h
|
||||
src/pBufferTexture.h
|
||||
src/primitiveHelper.h
|
||||
src/scissorMemo.h
|
||||
src/settings.h
|
||||
src/stencilManager.h
|
||||
)
|
||||
|
||||
add_library(opencsg ${_srcfiles})
|
||||
target_include_directories(opencsg PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
|
||||
target_include_directories(opencsg PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
|
||||
target_link_libraries(opencsg PRIVATE GLEW::GLEW OpenGL::GL)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
VERSION 1.4.2
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
install(TARGETS opencsg
|
||||
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}Config.cmake"
|
||||
NAMESPACE ${PROJECT_NAME}:: )
|
||||
|
||||
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
||||
|
||||
install(EXPORT ${PROJECT_NAME}Targets
|
||||
FILE
|
||||
"${PROJECT_NAME}Config.cmake"
|
||||
NAMESPACE
|
||||
${PROJECT_NAME}::
|
||||
DESTINATION
|
||||
${ConfigPackageLocation}
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
${PROJECT_SOURCE_DIR}/include/opencsg.h
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_INCLUDEDIR}/opencsg
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
DESTINATION
|
||||
${ConfigPackageLocation}
|
||||
)
|
||||
17
deps/OpenCSG/OpenCSG.cmake
vendored
Normal file
17
deps/OpenCSG/OpenCSG.cmake
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
qidislicer_add_cmake_project(OpenCSG
|
||||
# GIT_REPOSITORY https://github.com/floriankirsch/OpenCSG.git
|
||||
# GIT_TAG 83e274457b46c9ad11a4ee599203250b1618f3b9 #v1.4.2
|
||||
URL https://github.com/floriankirsch/OpenCSG/archive/refs/tags/opencsg-1-4-2-release.zip
|
||||
URL_HASH SHA256=51afe0db79af8386e2027d56d685177135581e0ee82ade9d7f2caff8deab5ec5
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in ./CMakeLists.txt
|
||||
DEPENDS dep_GLEW
|
||||
)
|
||||
|
||||
if (TARGET ${ZLIB_PKG})
|
||||
add_dependencies(dep_OpenCSG ${ZLIB_PKG})
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_OpenCSG)
|
||||
endif ()
|
||||
18
deps/OpenEXR/OpenEXR.cmake
vendored
Normal file
18
deps/OpenEXR/OpenEXR.cmake
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
qidislicer_add_cmake_project(OpenEXR
|
||||
# GIT_REPOSITORY https://github.com/openexr/openexr.git
|
||||
URL https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.zip
|
||||
URL_HASH SHA256=0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
|
||||
DEPENDS ${ZLIB_PKG}
|
||||
GIT_TAG v2.5.5
|
||||
PATCH_COMMAND COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/OpenEXR.patch
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DBUILD_TESTING=OFF
|
||||
-DPYILMBASE_ENABLE:BOOL=OFF
|
||||
-DOPENEXR_VIEWERS_ENABLE:BOOL=OFF
|
||||
-DOPENEXR_BUILD_UTILS:BOOL=OFF
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_OpenEXR)
|
||||
endif ()
|
||||
30
deps/OpenEXR/OpenEXR.patch
vendored
Normal file
30
deps/OpenEXR/OpenEXR.patch
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
--- ../OpenEXR-orig/OpenEXR/IlmImf/ImfDwaCompressor.cpp 2021-02-12 17:56:19.000000000 +0100
|
||||
+++ ./OpenEXR/IlmImf/ImfDwaCompressor.cpp 2023-06-01 13:21:32.666695400 +0200
|
||||
@@ -159,6 +159,7 @@
|
||||
#include <limits>
|
||||
|
||||
#include <cstddef>
|
||||
+#include <cstdint>
|
||||
|
||||
|
||||
// Windows specific addition to prevent the indirect import of the redefined min/max macros
|
||||
--- ../OpenEXR-orig/OpenEXR/IlmImf/ImfHuf.cpp 2021-02-12 17:56:19.000000000 +0100
|
||||
+++ ./OpenEXR/IlmImf/ImfHuf.cpp 2023-06-01 13:21:53.018583400 +0200
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
+#include <cstdint>
|
||||
|
||||
|
||||
using namespace std;
|
||||
--- ../OpenEXR-orig/OpenEXR/IlmImf/ImfMisc.cpp 2021-02-12 17:56:19.000000000 +0100
|
||||
+++ ./OpenEXR/IlmImf/ImfMisc.cpp 2023-06-01 13:22:15.777480000 +0200
|
||||
@@ -40,6 +40,7 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+#include <cstdint>
|
||||
#include <ImfMisc.h>
|
||||
#include <ImfHeader.h>
|
||||
#include <ImfAttribute.h>
|
||||
35
deps/OpenSSL/OpenSSL.cmake
vendored
Normal file
35
deps/OpenSSL/OpenSSL.cmake
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(NPROC)
|
||||
|
||||
set(_conf_cmd "./config")
|
||||
set(_cross_arch "")
|
||||
set(_cross_comp_prefix_line "")
|
||||
if (CMAKE_CROSSCOMPILING)
|
||||
set(_conf_cmd "./Configure")
|
||||
set(_cross_comp_prefix_line "--cross-compile-prefix=${TOOLCHAIN_PREFIX}-")
|
||||
|
||||
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
|
||||
set(_cross_arch "linux-aarch64")
|
||||
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armhf") # For raspbian
|
||||
# TODO: verify
|
||||
set(_cross_arch "linux-armv4")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(dep_OpenSSL
|
||||
EXCLUDE_FROM_ALL ON
|
||||
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0l.tar.gz"
|
||||
URL_HASH SHA256=e2acf0cf58d9bff2b42f2dc0aee79340c8ffe2c5e45d3ca4533dd5d4f5775b1d
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenSSL
|
||||
BUILD_IN_SOURCE ON
|
||||
CONFIGURE_COMMAND ${_conf_cmd} ${_cross_arch}
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
${_cross_comp_prefix_line}
|
||||
no-shared
|
||||
no-ssl3-method
|
||||
no-dynamic-engine
|
||||
-Wa,--noexecstack
|
||||
BUILD_COMMAND make depend && make "-j${NPROC}"
|
||||
INSTALL_COMMAND make install_sw
|
||||
)
|
||||
44
deps/OpenVDB/OpenVDB.cmake
vendored
Normal file
44
deps/OpenVDB/OpenVDB.cmake
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(_build_shared ON)
|
||||
set(_build_static OFF)
|
||||
else()
|
||||
set(_build_shared OFF)
|
||||
set(_build_static ON)
|
||||
endif()
|
||||
|
||||
set (_openvdb_vdbprint ON)
|
||||
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
|
||||
# Build fails on raspberry pi due to missing link directive to latomic
|
||||
# Let's hope it will be fixed soon.
|
||||
set (_openvdb_vdbprint OFF)
|
||||
endif ()
|
||||
|
||||
qidislicer_add_cmake_project(OpenVDB
|
||||
# 8.2 patched
|
||||
URL https://github.com/tamasmeszaros/openvdb/archive/a68fd58d0e2b85f01adeb8b13d7555183ab10aa5.zip
|
||||
URL_HASH SHA256=f353e7b99bd0cbfc27ac9082de51acf32a8bc0b3e21ff9661ecca6f205ec1d81
|
||||
DEPENDS dep_TBB dep_Blosc dep_OpenEXR dep_Boost
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DOPENVDB_BUILD_PYTHON_MODULE=OFF
|
||||
-DUSE_BLOSC=ON
|
||||
-DOPENVDB_CORE_SHARED=${_build_shared}
|
||||
-DOPENVDB_CORE_STATIC=${_build_static}
|
||||
-DOPENVDB_ENABLE_RPATH:BOOL=OFF
|
||||
-DTBB_STATIC=${_build_static}
|
||||
-DOPENVDB_BUILD_VDB_PRINT=${_openvdb_vdbprint}
|
||||
-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON # Centos6 has old zlib
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_OpenVDB BINARY_DIR)
|
||||
ExternalProject_Add_Step(dep_OpenVDB build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND ${CMAKE_COMMAND} ../dep_OpenVDB -DOPENVDB_BUILD_VDB_PRINT=OFF
|
||||
COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj
|
||||
WORKING_DIRECTORY "${BINARY_DIR}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
31
deps/PNG/PNG.cmake
vendored
Normal file
31
deps/PNG/PNG.cmake
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
if (APPLE)
|
||||
# Only disable NEON extension for Apple ARM builds, leave it enabled for Raspberry PI.
|
||||
set(_disable_neon_extension "-DPNG_ARM_NEON=off")
|
||||
else ()
|
||||
set(_disable_neon_extension "")
|
||||
endif ()
|
||||
|
||||
set(_patch_step "")
|
||||
if (APPLE)
|
||||
set(_patch_step PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/PNG.patch)
|
||||
endif ()
|
||||
|
||||
qidislicer_add_cmake_project(PNG
|
||||
# GIT_REPOSITORY https://github.com/glennrp/libpng.git
|
||||
# GIT_TAG v1.6.35
|
||||
URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.35.zip
|
||||
URL_HASH SHA256=3d22d46c566b1761a0e15ea397589b3a5f36ac09b7c785382e6470156c04247f
|
||||
DEPENDS ${ZLIB_PKG}
|
||||
"${_patch_step}"
|
||||
CMAKE_ARGS
|
||||
-DPNG_SHARED=OFF
|
||||
-DPNG_STATIC=ON
|
||||
-DPNG_PREFIX=qidislicer_
|
||||
-DPNG_TESTS=OFF
|
||||
-DDISABLE_DEPENDENCY_TRACKING=OFF
|
||||
${_disable_neon_extension}
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_PNG)
|
||||
endif ()
|
||||
26
deps/PNG/PNG.patch
vendored
Normal file
26
deps/PNG/PNG.patch
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
Common subdirectories: ../libpng-1.6.35-orig/arm and ./arm
|
||||
Common subdirectories: ../libpng-1.6.35-orig/contrib and ./contrib
|
||||
Common subdirectories: ../libpng-1.6.35-orig/intel and ./intel
|
||||
Common subdirectories: ../libpng-1.6.35-orig/mips and ./mips
|
||||
Only in ./: PNG.patch
|
||||
diff -u ../libpng-1.6.35-orig/pngrutil.c ./pngrutil.c
|
||||
--- ../libpng-1.6.35-orig/pngrutil.c 2018-07-15 20:58:00.000000000 +0200
|
||||
+++ ./pngrutil.c 2021-03-24 15:59:38.687108444 +0100
|
||||
@@ -422,13 +422,6 @@
|
||||
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
|
||||
}
|
||||
|
||||
-#if ZLIB_VERNUM >= 0x1290 && \
|
||||
- defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
|
||||
- if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
|
||||
- /* Turn off validation of the ADLER32 checksum in IDAT chunks */
|
||||
- ret = inflateValidate(&png_ptr->zstream, 0);
|
||||
-#endif
|
||||
-
|
||||
if (ret == Z_OK)
|
||||
png_ptr->zowner = owner;
|
||||
|
||||
Common subdirectories: ../libpng-1.6.35-orig/powerpc and ./powerpc
|
||||
Common subdirectories: ../libpng-1.6.35-orig/projects and ./projects
|
||||
Common subdirectories: ../libpng-1.6.35-orig/scripts and ./scripts
|
||||
Common subdirectories: ../libpng-1.6.35-orig/tests and ./tests
|
||||
11
deps/Qhull/Qhull.cmake
vendored
Normal file
11
deps/Qhull/Qhull.cmake
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
include(GNUInstallDirs)
|
||||
qidislicer_add_cmake_project(Qhull
|
||||
URL "https://github.com/qhull/qhull/archive/v8.0.1.zip"
|
||||
URL_HASH SHA256=5287f5edd6a0372588f5d6640799086a4033d89d19711023ef8229dd9301d69b
|
||||
CMAKE_ARGS
|
||||
-DINCLUDE_INSTALL_DIR=${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_Qhull)
|
||||
endif ()
|
||||
16
deps/TBB/TBB.cmake
vendored
Normal file
16
deps/TBB/TBB.cmake
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
qidislicer_add_cmake_project(
|
||||
TBB
|
||||
URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.5.0.zip"
|
||||
URL_HASH SHA256=83ea786c964a384dd72534f9854b419716f412f9d43c0be88d41874763e7bb47
|
||||
CMAKE_ARGS
|
||||
-DTBB_BUILD_SHARED=OFF
|
||||
-DTBB_TEST=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DCMAKE_DEBUG_POSTFIX=_debug
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_TBB)
|
||||
endif ()
|
||||
|
||||
|
||||
13
deps/TIFF/TIFF.cmake
vendored
Normal file
13
deps/TIFF/TIFF.cmake
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
find_package(OpenGL QUIET REQUIRED)
|
||||
|
||||
qidislicer_add_cmake_project(TIFF
|
||||
URL https://gitlab.com/libtiff/libtiff/-/archive/v4.1.0/libtiff-v4.1.0.zip
|
||||
URL_HASH SHA256=c56edfacef0a60c0de3e6489194fcb2f24c03dbb550a8a7de5938642d045bd32
|
||||
DEPENDS ${ZLIB_PKG} ${PNG_PKG} dep_JPEG
|
||||
CMAKE_ARGS
|
||||
-Dlzma:BOOL=OFF
|
||||
-Dwebp:BOOL=OFF
|
||||
-Djbig:BOOL=OFF
|
||||
-Dzstd:BOOL=OFF
|
||||
-Dpixarlog:BOOL=OFF
|
||||
)
|
||||
35006
deps/WebView2/include/WebView2.h
vendored
Normal file
35006
deps/WebView2/include/WebView2.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
149
deps/WebView2/include/WebView2EnvironmentOptions.h
vendored
Normal file
149
deps/WebView2/include/WebView2EnvironmentOptions.h
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef __core_webview2_environment_options_h__
|
||||
#define __core_webview2_environment_options_h__
|
||||
|
||||
#include <objbase.h>
|
||||
#include <wrl/implements.h>
|
||||
|
||||
#include "webview2.h"
|
||||
#define CORE_WEBVIEW_TARGET_PRODUCT_VERSION L"107.0.1418.22"
|
||||
|
||||
#define COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(p) \
|
||||
public: \
|
||||
HRESULT STDMETHODCALLTYPE get_##p(LPWSTR* value) override { \
|
||||
if (!value) \
|
||||
return E_POINTER; \
|
||||
*value = m_##p.Copy(); \
|
||||
if ((*value == nullptr) && (m_##p.Get() != nullptr)) \
|
||||
return HRESULT_FROM_WIN32(GetLastError()); \
|
||||
return S_OK; \
|
||||
} \
|
||||
HRESULT STDMETHODCALLTYPE put_##p(LPCWSTR value) override { \
|
||||
LPCWSTR result = m_##p.Set(value); \
|
||||
if ((result == nullptr) && (value != nullptr)) \
|
||||
return HRESULT_FROM_WIN32(GetLastError()); \
|
||||
return S_OK; \
|
||||
} \
|
||||
\
|
||||
protected: \
|
||||
AutoCoMemString m_##p;
|
||||
|
||||
#define COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(p) \
|
||||
public: \
|
||||
HRESULT STDMETHODCALLTYPE get_##p(BOOL* value) override { \
|
||||
if (!value) \
|
||||
return E_POINTER; \
|
||||
*value = m_##p; \
|
||||
return S_OK; \
|
||||
} \
|
||||
HRESULT STDMETHODCALLTYPE put_##p(BOOL value) override { \
|
||||
m_##p = value; \
|
||||
return S_OK; \
|
||||
} \
|
||||
\
|
||||
protected: \
|
||||
BOOL m_##p = FALSE;
|
||||
|
||||
// This is a base COM class that implements ICoreWebView2EnvironmentOptions.
|
||||
template <typename allocate_fn_t,
|
||||
allocate_fn_t allocate_fn,
|
||||
typename deallocate_fn_t,
|
||||
deallocate_fn_t deallocate_fn>
|
||||
class CoreWebView2EnvironmentOptionsBase
|
||||
: public Microsoft::WRL::Implements<
|
||||
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
|
||||
ICoreWebView2EnvironmentOptions,
|
||||
ICoreWebView2EnvironmentOptions2> {
|
||||
public:
|
||||
CoreWebView2EnvironmentOptionsBase() {
|
||||
// Initialize the target compatible browser version value to the version of
|
||||
// the browser binaries corresponding to this version of the SDK.
|
||||
m_TargetCompatibleBrowserVersion.Set(CORE_WEBVIEW_TARGET_PRODUCT_VERSION);
|
||||
}
|
||||
|
||||
protected:
|
||||
~CoreWebView2EnvironmentOptionsBase() {}
|
||||
|
||||
class AutoCoMemString {
|
||||
public:
|
||||
AutoCoMemString() {}
|
||||
~AutoCoMemString() { Release(); }
|
||||
void Release() {
|
||||
if (m_string) {
|
||||
deallocate_fn(m_string);
|
||||
m_string = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
LPCWSTR Set(LPCWSTR str) {
|
||||
Release();
|
||||
if (str) {
|
||||
m_string = MakeCoMemString(str);
|
||||
}
|
||||
return m_string;
|
||||
}
|
||||
LPCWSTR Get() { return m_string; }
|
||||
LPWSTR Copy() {
|
||||
if (m_string)
|
||||
return MakeCoMemString(m_string);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
LPWSTR MakeCoMemString(LPCWSTR source) {
|
||||
const size_t length = wcslen(source);
|
||||
const size_t bytes = (length + 1) * sizeof(*source);
|
||||
// Ensure we didn't overflow during our size calculation.
|
||||
if (bytes <= length) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
wchar_t* result = reinterpret_cast<wchar_t*>(allocate_fn(bytes));
|
||||
if (result)
|
||||
memcpy(result, source, bytes);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
LPWSTR m_string = nullptr;
|
||||
};
|
||||
|
||||
// ICoreWebView2EnvironmentOptions
|
||||
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(AdditionalBrowserArguments)
|
||||
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(Language)
|
||||
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(TargetCompatibleBrowserVersion)
|
||||
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(
|
||||
AllowSingleSignOnUsingOSPrimaryAccount)
|
||||
|
||||
// ICoreWebView2EnvironmentOptions2
|
||||
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(ExclusiveUserDataFolderAccess)
|
||||
};
|
||||
|
||||
template <typename allocate_fn_t,
|
||||
allocate_fn_t allocate_fn,
|
||||
typename deallocate_fn_t,
|
||||
deallocate_fn_t deallocate_fn>
|
||||
class CoreWebView2EnvironmentOptionsBaseClass
|
||||
: public Microsoft::WRL::RuntimeClass<
|
||||
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
|
||||
CoreWebView2EnvironmentOptionsBase<allocate_fn_t,
|
||||
allocate_fn,
|
||||
deallocate_fn_t,
|
||||
deallocate_fn>> {
|
||||
public:
|
||||
CoreWebView2EnvironmentOptionsBaseClass() {}
|
||||
|
||||
protected:
|
||||
~CoreWebView2EnvironmentOptionsBaseClass() override {}
|
||||
};
|
||||
|
||||
typedef CoreWebView2EnvironmentOptionsBaseClass<decltype(&::CoTaskMemAlloc),
|
||||
::CoTaskMemAlloc,
|
||||
decltype(&::CoTaskMemFree),
|
||||
::CoTaskMemFree>
|
||||
CoreWebView2EnvironmentOptions;
|
||||
|
||||
#endif // __core_webview2_environment_options_h__
|
||||
BIN
deps/WebView2/lib/win32/WebView2Loader.dll
vendored
Normal file
BIN
deps/WebView2/lib/win32/WebView2Loader.dll
vendored
Normal file
Binary file not shown.
BIN
deps/WebView2/lib/win32/WebView2Loader.dll.lib
vendored
Normal file
BIN
deps/WebView2/lib/win32/WebView2Loader.dll.lib
vendored
Normal file
Binary file not shown.
BIN
deps/WebView2/lib/win32/WebView2LoaderStatic.lib
vendored
Normal file
BIN
deps/WebView2/lib/win32/WebView2LoaderStatic.lib
vendored
Normal file
Binary file not shown.
BIN
deps/WebView2/lib/win64/WebView2Loader.dll
vendored
Normal file
BIN
deps/WebView2/lib/win64/WebView2Loader.dll
vendored
Normal file
Binary file not shown.
BIN
deps/WebView2/lib/win64/WebView2Loader.dll.lib
vendored
Normal file
BIN
deps/WebView2/lib/win64/WebView2Loader.dll.lib
vendored
Normal file
Binary file not shown.
BIN
deps/WebView2/lib/win64/WebView2LoaderStatic.lib
vendored
Normal file
BIN
deps/WebView2/lib/win64/WebView2LoaderStatic.lib
vendored
Normal file
Binary file not shown.
51
deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch
vendored
Normal file
51
deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
Common subdirectories: ../zlib-1.2.11/amiga and ./amiga
|
||||
diff -u ../zlib-1.2.11/CMakeLists.txt ./CMakeLists.txt
|
||||
--- ../zlib-1.2.11/CMakeLists.txt 2017-01-15 09:29:40.000000000 +0100
|
||||
+++ ./CMakeLists.txt 2021-03-24 15:24:48.190291072 +0100
|
||||
@@ -183,10 +183,12 @@
|
||||
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
||||
endif(MINGW)
|
||||
|
||||
-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
-set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||
-set_target_properties(zlib PROPERTIES SOVERSION 1)
|
||||
+add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
+if (BUILD_SHARED_LIBS)
|
||||
+ target_sources(zlib PRIVATE ${ZLIB_DLL_SRCS})
|
||||
+ set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||
+ set_target_properties(zlib PROPERTIES SOVERSION 1)
|
||||
+endif()
|
||||
|
||||
if(NOT CYGWIN)
|
||||
# This property causes shared libraries on Linux to have the full version
|
||||
@@ -201,7 +203,7 @@
|
||||
|
||||
if(UNIX)
|
||||
# On unix-like platforms the library is almost always called libz
|
||||
- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
|
||||
+ set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
|
||||
if(NOT APPLE)
|
||||
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
||||
endif()
|
||||
@@ -211,7 +213,7 @@
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||
- install(TARGETS zlib zlibstatic
|
||||
+ install(TARGETS zlib
|
||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
|
||||
Common subdirectories: ../zlib-1.2.11/contrib and ./contrib
|
||||
Common subdirectories: ../zlib-1.2.11/doc and ./doc
|
||||
Common subdirectories: ../zlib-1.2.11/examples and ./examples
|
||||
Common subdirectories: ../zlib-1.2.11/msdos and ./msdos
|
||||
Common subdirectories: ../zlib-1.2.11/nintendods and ./nintendods
|
||||
Common subdirectories: ../zlib-1.2.11/old and ./old
|
||||
Common subdirectories: ../zlib-1.2.11/os400 and ./os400
|
||||
Common subdirectories: ../zlib-1.2.11/qnx and ./qnx
|
||||
Common subdirectories: ../zlib-1.2.11/test and ./test
|
||||
Common subdirectories: ../zlib-1.2.11/watcom and ./watcom
|
||||
Common subdirectories: ../zlib-1.2.11/win32 and ./win32
|
||||
Only in ./: ZLIB.patch
|
||||
11
deps/ZLIB/ZLIB.cmake
vendored
Normal file
11
deps/ZLIB/ZLIB.cmake
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
qidislicer_add_cmake_project(ZLIB
|
||||
# GIT_REPOSITORY https://github.com/madler/zlib.git
|
||||
# GIT_TAG v1.2.11
|
||||
URL https://github.com/madler/zlib/archive/refs/tags/v1.2.11.zip
|
||||
URL_HASH SHA256=f5cc4ab910db99b2bdbba39ebbdc225ffc2aa04b4057bc2817f1b94b6978cfc3
|
||||
PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-Respect-BUILD_SHARED_LIBS.patch
|
||||
CMAKE_ARGS
|
||||
-DSKIP_INSTALL_FILES=ON # Prevent installation of man pages et al.
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
)
|
||||
|
||||
10
deps/deps-linux.cmake
vendored
Normal file
10
deps/deps-linux.cmake
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
set(DEP_CMAKE_OPTS "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
|
||||
|
||||
include("deps-unix-common.cmake")
|
||||
|
||||
# Some Linuxes may have very old libpng, so it's best to bundle it instead of relying on the system version.
|
||||
# find_package(PNG QUIET)
|
||||
# if (NOT PNG_FOUND)
|
||||
# message(WARNING "No PNG dev package found in system, building static library. You should install the system package.")
|
||||
# endif ()
|
||||
96
deps/deps-macos.cmake
vendored
Normal file
96
deps/deps-macos.cmake
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
|
||||
# This ensures dependencies don't use SDK features which are not available in the version specified by Deployment target
|
||||
# That can happen when one uses a recent SDK but specifies an older Deployment target
|
||||
set(DEP_WERRORS_SDK "-Werror=partial-availability -Werror=unguarded-availability -Werror=unguarded-availability-new")
|
||||
|
||||
set(DEP_CMAKE_OPTS
|
||||
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
|
||||
"-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEP_OSX_TARGET}"
|
||||
"-DCMAKE_CXX_FLAGS=${DEP_WERRORS_SDK}"
|
||||
"-DCMAKE_C_FLAGS=${DEP_WERRORS_SDK}"
|
||||
"-DCMAKE_FIND_FRAMEWORK=LAST"
|
||||
"-DCMAKE_FIND_APPBUNDLE=LAST"
|
||||
)
|
||||
|
||||
include("deps-unix-common.cmake")
|
||||
|
||||
find_package(CURL QUIET)
|
||||
if (NOT CURL_FOUND)
|
||||
message(WARNING "No CURL dev package found in system, building static library. Mac SDK should include CURL from at least version 10.12. Check your SDK installation.")
|
||||
endif ()
|
||||
|
||||
|
||||
# ExternalProject_Add(dep_boost
|
||||
# EXCLUDE_FROM_ALL 1
|
||||
# URL "https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.gz"
|
||||
# URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a
|
||||
# BUILD_IN_SOURCE 1
|
||||
# CONFIGURE_COMMAND ./bootstrap.sh
|
||||
# --with-toolset=clang
|
||||
# --with-libraries=system,iostreams,filesystem,thread,log,locale,regex,date_time
|
||||
# "--prefix=${DESTDIR}/usr/local"
|
||||
# BUILD_COMMAND ./b2
|
||||
# -j ${NPROC}
|
||||
# --reconfigure
|
||||
# toolset=clang
|
||||
# link=static
|
||||
# variant=release
|
||||
# threading=multi
|
||||
# boost.locale.icu=off
|
||||
# --disable-icu
|
||||
# "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}"
|
||||
# install
|
||||
# INSTALL_COMMAND "" # b2 does that already
|
||||
# )
|
||||
|
||||
# ExternalProject_Add(dep_libcurl
|
||||
# EXCLUDE_FROM_ALL 1
|
||||
# URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
|
||||
# URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
|
||||
# BUILD_IN_SOURCE 1
|
||||
# CONFIGURE_COMMAND ./configure
|
||||
# --enable-static
|
||||
# --disable-shared
|
||||
# "--with-ssl=${DESTDIR}/usr/local"
|
||||
# --with-pic
|
||||
# --enable-ipv6
|
||||
# --enable-versioned-symbols
|
||||
# --enable-threaded-resolver
|
||||
# --with-darwinssl
|
||||
# --without-ssl # disables OpenSSL
|
||||
# --disable-ldap
|
||||
# --disable-ldaps
|
||||
# --disable-manual
|
||||
# --disable-rtsp
|
||||
# --disable-dict
|
||||
# --disable-telnet
|
||||
# --disable-pop3
|
||||
# --disable-imap
|
||||
# --disable-smb
|
||||
# --disable-smtp
|
||||
# --disable-gopher
|
||||
# --without-gssapi
|
||||
# --without-libpsl
|
||||
# --without-libidn2
|
||||
# --without-gnutls
|
||||
# --without-polarssl
|
||||
# --without-mbedtls
|
||||
# --without-cyassl
|
||||
# --without-nss
|
||||
# --without-axtls
|
||||
# --without-brotli
|
||||
# --without-libmetalink
|
||||
# --without-libssh
|
||||
# --without-libssh2
|
||||
# --without-librtmp
|
||||
# --without-nghttp2
|
||||
# --without-zsh-functions-dir
|
||||
# BUILD_COMMAND make "-j${NPROC}"
|
||||
# INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
# )
|
||||
|
||||
# add_dependencies(dep_openvdb dep_boost)
|
||||
8
deps/deps-mingw.cmake
vendored
Normal file
8
deps/deps-mingw.cmake
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
set(DEP_CMAKE_OPTS "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
|
||||
set(DEP_BOOST_TOOLSET "gcc")
|
||||
set(DEP_BITS 64)
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
|
||||
# TODO make sure to build tbb with -flifetime-dse=1
|
||||
include("deps-unix-common.cmake")
|
||||
19
deps/deps-unix-common.cmake
vendored
Normal file
19
deps/deps-unix-common.cmake
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
# The unix common part expects DEP_CMAKE_OPTS to be set
|
||||
|
||||
if (MINGW)
|
||||
set(TBB_MINGW_WORKAROUND "-flifetime-dse=1")
|
||||
else ()
|
||||
set(TBB_MINGW_WORKAROUND "")
|
||||
endif ()
|
||||
|
||||
find_package(ZLIB QUIET)
|
||||
if (NOT ZLIB_FOUND)
|
||||
message(WARNING "No ZLIB dev package found in system, building static library. You should install the system package.")
|
||||
endif ()
|
||||
|
||||
# TODO Evaluate expat modifications in the bundled version and test with system versions in various distros and OSX SDKs
|
||||
# find_package(EXPAT QUIET)
|
||||
# if (NOT EXPAT_FOUND)
|
||||
# message(WARNING "No EXPAT dev package found in system, building static library. Consider installing the system package.")
|
||||
# endif ()
|
||||
68
deps/deps-windows.cmake
vendored
Normal file
68
deps/deps-windows.cmake
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
|
||||
if (MSVC_VERSION EQUAL 1800)
|
||||
# 1800 = VS 12.0 (v120 toolset)
|
||||
set(DEP_VS_VER "12")
|
||||
set(DEP_BOOST_TOOLSET "msvc-12.0")
|
||||
elseif (MSVC_VERSION EQUAL 1900)
|
||||
# 1900 = VS 14.0 (v140 toolset)
|
||||
set(DEP_VS_VER "14")
|
||||
set(DEP_BOOST_TOOLSET "msvc-14.0")
|
||||
elseif (MSVC_VERSION LESS 1920)
|
||||
# 1910-1919 = VS 15.0 (v141 toolset)
|
||||
set(DEP_VS_VER "15")
|
||||
set(DEP_BOOST_TOOLSET "msvc-14.1")
|
||||
elseif (MSVC_VERSION LESS 1930)
|
||||
# 1920-1929 = VS 16.0 (v142 toolset)
|
||||
set(DEP_VS_VER "16")
|
||||
set(DEP_BOOST_TOOLSET "msvc-14.2")
|
||||
elseif (MSVC_VERSION LESS 1940)
|
||||
# 1930-1939 = VS 17.0 (v143 toolset)
|
||||
set(DEP_VS_VER "17")
|
||||
set(DEP_BOOST_TOOLSET "msvc-14.3")
|
||||
else ()
|
||||
message(FATAL_ERROR "Unsupported MSVC version")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
set(DEP_BOOST_TOOLSET "clang-win")
|
||||
endif ()
|
||||
|
||||
if (${DEPS_BITS} EQUAL 32)
|
||||
set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}")
|
||||
set(DEP_PLATFORM "Win32")
|
||||
else ()
|
||||
if (DEP_VS_VER LESS 16)
|
||||
set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER} Win64")
|
||||
else ()
|
||||
set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}")
|
||||
endif ()
|
||||
set(DEP_PLATFORM "x64")
|
||||
endif ()
|
||||
|
||||
if (${DEP_DEBUG})
|
||||
set(DEP_BOOST_DEBUG "debug")
|
||||
else ()
|
||||
set(DEP_BOOST_DEBUG "")
|
||||
endif ()
|
||||
|
||||
macro(add_debug_dep _dep)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(${_dep} BINARY_DIR)
|
||||
ExternalProject_Add_Step(${_dep} build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj
|
||||
WORKING_DIRECTORY "${BINARY_DIR}"
|
||||
)
|
||||
endif ()
|
||||
endmacro()
|
||||
|
||||
if (${DEPS_BITS} EQUAL 32)
|
||||
set(DEP_WXWIDGETS_TARGET "")
|
||||
set(DEP_WXWIDGETS_LIBDIR "vc_lib")
|
||||
else ()
|
||||
set(DEP_WXWIDGETS_TARGET "TARGET_CPU=X64")
|
||||
set(DEP_WXWIDGETS_LIBDIR "vc_x64_lib")
|
||||
endif ()
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
666
deps/wxWidgets/0001-wxWidget-fix.patch
vendored
Normal file
666
deps/wxWidgets/0001-wxWidget-fix.patch
vendored
Normal file
@@ -0,0 +1,666 @@
|
||||
diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake
|
||||
index 0bc4f934b9..479431a69c 100644
|
||||
--- a/build/cmake/init.cmake
|
||||
+++ b/build/cmake/init.cmake
|
||||
@@ -413,7 +413,11 @@ if(wxUSE_GUI)
|
||||
else()
|
||||
find_package(OpenGL)
|
||||
if(WXGTK3 AND OpenGL_EGL_FOUND AND wxUSE_GLCANVAS_EGL)
|
||||
+ if(UNIX AND NOT APPLE)
|
||||
+ set(OPENGL_LIBRARIES OpenGL EGL)
|
||||
+ else()
|
||||
set(OPENGL_LIBRARIES OpenGL::OpenGL OpenGL::EGL)
|
||||
+ endif()
|
||||
find_package(WAYLANDEGL)
|
||||
if(WAYLANDEGL_FOUND AND wxHAVE_GDK_WAYLAND)
|
||||
list(APPEND OPENGL_LIBRARIES ${WAYLANDEGL_LIBRARIES})
|
||||
diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt
|
||||
index cc3298ff33..8adbeaea4f 100644
|
||||
--- a/build/cmake/lib/webview/CMakeLists.txt
|
||||
+++ b/build/cmake/lib/webview/CMakeLists.txt
|
||||
@@ -56,7 +56,7 @@ if(APPLE)
|
||||
elseif(WXMSW)
|
||||
if(wxUSE_WEBVIEW_EDGE)
|
||||
# Update the following variables if updating WebView2 SDK
|
||||
- set(WEBVIEW2_VERSION "1.0.705.50")
|
||||
+ set(WEBVIEW2_VERSION "1.0.1418.22")
|
||||
set(WEBVIEW2_URL "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/${WEBVIEW2_VERSION}")
|
||||
set(WEBVIEW2_SHA256 "51d2ef56196e2a9d768a6843385bcb9c6baf9ed34b2603ddb074fb4995543a99")
|
||||
|
||||
diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h
|
||||
index 09ad8c8ef3..3c0c2d8f7e 100644
|
||||
--- a/include/wx/fontutil.h
|
||||
+++ b/include/wx/fontutil.h
|
||||
@@ -294,7 +294,11 @@ public:
|
||||
wxFontEncoding GetEncoding() const;
|
||||
|
||||
void SetPointSize(int pointsize);
|
||||
- void SetFractionalPointSize(double pointsize);
|
||||
+ void SetFractionalPointSize(double pointsize
|
||||
+#if defined(__WXMSW__)
|
||||
+ , const wxWindow *window = nullptr
|
||||
+#endif
|
||||
+ );
|
||||
void SetPixelSize(const wxSize& pixelSize);
|
||||
void SetStyle(wxFontStyle style);
|
||||
void SetNumericWeight(int weight);
|
||||
@@ -307,12 +311,19 @@ public:
|
||||
|
||||
// Helper used in many ports: use the normal font size if the input is
|
||||
// negative, as we handle -1 as meaning this for compatibility.
|
||||
- void SetSizeOrDefault(double size)
|
||||
+ void SetSizeOrDefault(double size
|
||||
+#if defined(__WXMSW__)
|
||||
+ , const wxWindow *window = nullptr
|
||||
+#endif
|
||||
+ )
|
||||
{
|
||||
SetFractionalPointSize
|
||||
(
|
||||
size < 0 ? wxNORMAL_FONT->GetFractionalPointSize()
|
||||
: size
|
||||
+#if defined(__WXMSW__)
|
||||
+ ,window
|
||||
+#endif
|
||||
);
|
||||
}
|
||||
|
||||
diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h
|
||||
index e29a77627c..dc48cf9451 100644
|
||||
--- a/include/wx/gdicmn.h
|
||||
+++ b/include/wx/gdicmn.h
|
||||
@@ -38,6 +38,7 @@ class WXDLLIMPEXP_FWD_CORE wxRegion;
|
||||
class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
class WXDLLIMPEXP_FWD_CORE wxIconBundle;
|
||||
class WXDLLIMPEXP_FWD_CORE wxPoint;
|
||||
+class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// constants
|
||||
@@ -1092,7 +1093,9 @@ extern int WXDLLIMPEXP_CORE wxDisplayDepth();
|
||||
|
||||
// get the display size
|
||||
extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height);
|
||||
+extern void WXDLLIMPEXP_CORE wxDisplaySize(const wxWindow *window, int *width, int *height);
|
||||
extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize();
|
||||
+extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize(const wxWindow *window);
|
||||
extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height);
|
||||
extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM();
|
||||
extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI();
|
||||
diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h
|
||||
index d7a3890764..e4dee51d5a 100644
|
||||
--- a/include/wx/generic/grid.h
|
||||
+++ b/include/wx/generic/grid.h
|
||||
@@ -2951,9 +2951,11 @@ private:
|
||||
wxGridWindow* gridWindow);
|
||||
|
||||
// Update the width/height of the column/row being drag-resized.
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
void DoGridDragResize(const wxPoint& position,
|
||||
const wxGridOperations& oper,
|
||||
- wxGridWindow* gridWindow);
|
||||
+ wxGridWindow* gridWindow,
|
||||
+ CursorMode mode);
|
||||
|
||||
// process different clicks on grid cells
|
||||
void DoGridCellLeftDown(wxMouseEvent& event,
|
||||
diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h
|
||||
index 0f9768b44e..094d774918 100644
|
||||
--- a/include/wx/msw/font.h
|
||||
+++ b/include/wx/msw/font.h
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
// ctors and such
|
||||
wxFont() { }
|
||||
|
||||
- wxFont(const wxFontInfo& info);
|
||||
+ wxFont(const wxFontInfo& info, const wxWindow *window = nullptr);
|
||||
|
||||
wxFont(int size,
|
||||
wxFontFamily family,
|
||||
diff --git a/include/wx/msw/tooltip.h b/include/wx/msw/tooltip.h
|
||||
index 4c3be08cec..96fb378d01 100644
|
||||
--- a/include/wx/msw/tooltip.h
|
||||
+++ b/include/wx/msw/tooltip.h
|
||||
@@ -91,10 +91,10 @@ private:
|
||||
// the one and only one tooltip control we use - never access it directly
|
||||
// but use GetToolTipCtrl() which will create it when needed
|
||||
static WXHWND ms_hwndTT;
|
||||
-
|
||||
+public:
|
||||
// create the tooltip ctrl if it doesn't exist yet and return its HWND
|
||||
static WXHWND GetToolTipCtrl();
|
||||
-
|
||||
+private:
|
||||
// to be used in wxModule for deleting tooltip ctrl window when exiting mainloop
|
||||
static void DeleteToolTipCtrl();
|
||||
|
||||
diff --git a/include/wx/osx/app.h b/include/wx/osx/app.h
|
||||
index 317a0ca96f..58014ec1d4 100644
|
||||
--- a/include/wx/osx/app.h
|
||||
+++ b/include/wx/osx/app.h
|
||||
@@ -161,7 +161,7 @@ private:
|
||||
|
||||
public:
|
||||
bool OSXInitWasCalled() { return m_inited; }
|
||||
- void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; }
|
||||
+ virtual void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; }
|
||||
void OSXStorePrintFiles(const wxArrayString &files ) { m_printFiles = files ; }
|
||||
void OSXStoreOpenURL(const wxString &url ) { m_getURL = url ; }
|
||||
#endif
|
||||
diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp
|
||||
index b61aac35bf..d12b745e8c 100644
|
||||
--- a/src/common/combocmn.cpp
|
||||
+++ b/src/common/combocmn.cpp
|
||||
@@ -2141,7 +2141,7 @@ void wxComboCtrlBase::CreatePopup()
|
||||
#if !USES_GENERICTLW
|
||||
m_winPopup = new wxComboPopupWindowBase2( this, wxNO_BORDER );
|
||||
#else
|
||||
- int tlwFlags = wxNO_BORDER;
|
||||
+ int tlwFlags = wxNO_BORDER | wxSTAY_ON_TOP;
|
||||
#ifdef wxCC_GENERIC_TLW_IS_FRAME
|
||||
tlwFlags |= wxFRAME_NO_TASKBAR;
|
||||
#endif
|
||||
@@ -2285,6 +2285,9 @@ void wxComboCtrlBase::ShowPopup()
|
||||
|
||||
SetFocus();
|
||||
|
||||
+ //int displayIdx = wxDisplay::GetFromWindow(this);
|
||||
+ //wxRect displayRect = wxDisplay(displayIdx != wxNOT_FOUND ? displayIdx : 0u).GetGeometry();
|
||||
+
|
||||
// Space above and below
|
||||
int screenHeight;
|
||||
wxPoint scrPos;
|
||||
@@ -2407,9 +2410,13 @@ void wxComboCtrlBase::ShowPopup()
|
||||
|
||||
int showFlags = CanDeferShow;
|
||||
|
||||
- if ( spaceBelow < szp.y )
|
||||
+ int anchorSideVertical = m_anchorSide & (wxUP | wxDOWN);
|
||||
+ if (// Pop up as asked for by the library user.
|
||||
+ (anchorSideVertical & wxUP) ||
|
||||
+ // Automatic: Pop up if it does not fit down.
|
||||
+ (anchorSideVertical == 0 && spaceBelow < szp.y ))
|
||||
{
|
||||
- popupY = scrPos.y - szp.y;
|
||||
+ popupY = scrPos.y - szp.y + displayRect.GetTop();
|
||||
showFlags |= ShowAbove;
|
||||
}
|
||||
|
||||
diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp
|
||||
index 1f5fd4d66b..14ea2f8ef1 100644
|
||||
--- a/src/common/datavcmn.cpp
|
||||
+++ b/src/common/datavcmn.cpp
|
||||
@@ -1322,7 +1322,11 @@ wxDataViewItem wxDataViewCtrlBase::GetSelection() const
|
||||
|
||||
wxDataViewItemArray selections;
|
||||
GetSelections(selections);
|
||||
- return selections[0];
|
||||
+ // BBS
|
||||
+ if (!selections.empty())
|
||||
+ return selections[0];
|
||||
+ else
|
||||
+ return wxDataViewItem(0);
|
||||
}
|
||||
|
||||
namespace
|
||||
diff --git a/src/common/dcbufcmn.cpp b/src/common/dcbufcmn.cpp
|
||||
index 74958fce10..59844f4526 100644
|
||||
--- a/src/common/dcbufcmn.cpp
|
||||
+++ b/src/common/dcbufcmn.cpp
|
||||
@@ -82,9 +82,15 @@ private:
|
||||
const double scale = dc ? dc->GetContentScaleFactor() : 1.0;
|
||||
wxBitmap* const buffer = new wxBitmap;
|
||||
|
||||
+#if __WXMSW__
|
||||
// we must always return a valid bitmap but creating a bitmap of
|
||||
// size 0 would fail, so create a 1*1 bitmap in this case
|
||||
- buffer->CreateScaled(wxMax(w, 1), wxMax(h, 1), -1, scale);
|
||||
+ buffer->Create(wxMax(w, 1), wxMax(h, 1), 24);
|
||||
+#else
|
||||
+ // we must always return a valid bitmap but creating a bitmap of
|
||||
+ // size 0 would fail, so create a 1*1 bitmap in this case
|
||||
+ buffer->CreateScaled(wxMax(w, 1), wxMax(h, 1), -1, scale);
|
||||
+#endif
|
||||
|
||||
return buffer;
|
||||
}
|
||||
diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp
|
||||
index 20442bbc73..9a24951ec7 100644
|
||||
--- a/src/common/gdicmn.cpp
|
||||
+++ b/src/common/gdicmn.cpp
|
||||
@@ -863,11 +863,25 @@ void wxDisplaySize(int *width, int *height)
|
||||
*height = size.y;
|
||||
}
|
||||
|
||||
+void wxDisplaySize(const wxWindow *window, int *width, int *height)
|
||||
+{
|
||||
+ const wxSize size = wxGetDisplaySize(window);
|
||||
+ if ( width )
|
||||
+ *width = size.x;
|
||||
+ if ( height )
|
||||
+ *height = size.y;
|
||||
+}
|
||||
+
|
||||
wxSize wxGetDisplaySize()
|
||||
{
|
||||
return wxDisplay().GetGeometry().GetSize();
|
||||
}
|
||||
|
||||
+wxSize wxGetDisplaySize(const wxWindow *window)
|
||||
+{
|
||||
+ return window ? wxDisplay(window).GetGeometry().GetSize() : wxDisplay().GetGeometry().GetSize();
|
||||
+}
|
||||
+
|
||||
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
||||
{
|
||||
const wxRect rect = wxGetClientDisplayRect();
|
||||
diff --git a/src/common/intl.cpp b/src/common/intl.cpp
|
||||
index 0b0d8798f4..7072fab18a 100644
|
||||
--- a/src/common/intl.cpp
|
||||
+++ b/src/common/intl.cpp
|
||||
@@ -1628,6 +1628,12 @@ GetInfoFromLCID(LCID lcid,
|
||||
{
|
||||
str = buf;
|
||||
|
||||
+//FIXME Vojtech: We forcefully set the locales for a decimal point to "C", but this
|
||||
+// is not possible for the Win32 locales, therefore there is a discrepancy.
|
||||
+// It looks like we live with the discrepancy for at least half a year, so we will
|
||||
+// suppress the assert until we fix Slic3r to properly switch to "C" locales just
|
||||
+// for file import / export.
|
||||
+#if 0
|
||||
// As we get our decimal point separator from Win32 and not the
|
||||
// CRT there is a possibility of mismatch between them and this
|
||||
// can easily happen if the user code called setlocale()
|
||||
@@ -1641,6 +1647,7 @@ GetInfoFromLCID(LCID lcid,
|
||||
"Decimal separator mismatch -- did you use setlocale()?"
|
||||
"If so, use wxLocale to change the locale instead."
|
||||
);
|
||||
+#endif
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp
|
||||
index 41fd4524cf..f4a15cb839 100644
|
||||
--- a/src/generic/grid.cpp
|
||||
+++ b/src/generic/grid.cpp
|
||||
@@ -3824,7 +3824,8 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo
|
||||
{
|
||||
case WXGRID_CURSOR_RESIZE_ROW:
|
||||
{
|
||||
- DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow, WXGRID_CURSOR_RESIZE_ROW);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -4166,7 +4167,8 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo
|
||||
switch ( m_cursorMode )
|
||||
{
|
||||
case WXGRID_CURSOR_RESIZE_COL:
|
||||
- DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow, WXGRID_CURSOR_RESIZE_COL);
|
||||
break;
|
||||
|
||||
case WXGRID_CURSOR_SELECT_COL:
|
||||
@@ -4708,11 +4710,13 @@ bool wxGrid::DoGridDragEvent(wxMouseEvent& event,
|
||||
return DoGridCellDrag(event, coords, isFirstDrag);
|
||||
|
||||
case WXGRID_CURSOR_RESIZE_ROW:
|
||||
- DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow, WXGRID_CURSOR_RESIZE_ROW);
|
||||
break;
|
||||
|
||||
case WXGRID_CURSOR_RESIZE_COL:
|
||||
- DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow, WXGRID_CURSOR_RESIZE_COL);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -4803,6 +4807,8 @@ wxGrid::DoGridCellLeftDown(wxMouseEvent& event,
|
||||
case wxGridSelectCells:
|
||||
case wxGridSelectRowsOrColumns:
|
||||
// nothing to do in these cases
|
||||
+ //BBS: select this cell when first click
|
||||
+ m_selection->SelectBlock(coords.GetRow(), coords.GetCol(), coords.GetRow(), coords.GetCol(), event);
|
||||
break;
|
||||
|
||||
case wxGridSelectRows:
|
||||
@@ -5044,9 +5050,11 @@ void wxGrid::ProcessGridCellMouseEvent(wxMouseEvent& event, wxGridWindow *eventG
|
||||
}
|
||||
}
|
||||
|
||||
+//BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
void wxGrid::DoGridDragResize(const wxPoint& position,
|
||||
const wxGridOperations& oper,
|
||||
- wxGridWindow* gridWindow)
|
||||
+ wxGridWindow* gridWindow,
|
||||
+ CursorMode mode)
|
||||
{
|
||||
// Get the logical position from the physical one we're passed.
|
||||
const wxPoint
|
||||
@@ -5056,10 +5064,28 @@ void wxGrid::DoGridDragResize(const wxPoint& position,
|
||||
// orthogonal direction.
|
||||
const int linePos = oper.Dual().Select(logicalPos);
|
||||
|
||||
- const int lineStart = oper.GetLineStartPos(this, m_dragRowOrCol);
|
||||
- oper.SetLineSize(this, m_dragRowOrCol,
|
||||
+ //BBS: add logic for resize multiplexed cols
|
||||
+ if (mode == WXGRID_CURSOR_RESIZE_COL) {
|
||||
+ int col_to_resize = m_dragRowOrCol;
|
||||
+ int num_rows, num_cols;
|
||||
+ this->GetCellSize(0, m_dragRowOrCol, &num_rows, &num_cols);
|
||||
+ if (num_cols < 1)
|
||||
+ col_to_resize = m_dragRowOrCol - 1;
|
||||
+
|
||||
+ const int lineEnd = oper.GetLineEndPos(this, m_dragRowOrCol);
|
||||
+ const int lineSize = oper.GetLineSize(this, col_to_resize);
|
||||
+ int size = linePos - lineEnd + lineSize;
|
||||
+ oper.SetLineSize(this, col_to_resize,
|
||||
+ wxMax(size,
|
||||
+ oper.GetMinimalLineSize(this, col_to_resize)));
|
||||
+ }
|
||||
+ else {
|
||||
+ const int lineStart = oper.GetLineStartPos(this, m_dragRowOrCol);
|
||||
+
|
||||
+ oper.SetLineSize(this, m_dragRowOrCol,
|
||||
wxMax(linePos - lineStart,
|
||||
oper.GetMinimalLineSize(this, m_dragRowOrCol)));
|
||||
+ }
|
||||
|
||||
// TODO: generate RESIZING event, see #10754, if the size has changed.
|
||||
}
|
||||
@@ -5082,7 +5108,8 @@ wxPoint wxGrid::GetPositionForResizeEvent(int width) const
|
||||
|
||||
void wxGrid::DoEndDragResizeRow(const wxMouseEvent& event, wxGridWindow* gridWindow)
|
||||
{
|
||||
- DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow, WXGRID_CURSOR_RESIZE_ROW);
|
||||
|
||||
SendGridSizeEvent(wxEVT_GRID_ROW_SIZE, m_dragRowOrCol, -1, event);
|
||||
|
||||
@@ -5091,7 +5118,8 @@ void wxGrid::DoEndDragResizeRow(const wxMouseEvent& event, wxGridWindow* gridWin
|
||||
|
||||
void wxGrid::DoEndDragResizeCol(const wxMouseEvent& event, wxGridWindow* gridWindow)
|
||||
{
|
||||
- DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow, WXGRID_CURSOR_RESIZE_COL);
|
||||
|
||||
SendGridSizeEvent(wxEVT_GRID_COL_SIZE, -1, m_dragRowOrCol, event);
|
||||
|
||||
@@ -5105,9 +5133,10 @@ void wxGrid::DoHeaderStartDragResizeCol(int col)
|
||||
|
||||
void wxGrid::DoHeaderDragResizeCol(int width)
|
||||
{
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
DoGridDragResize(GetPositionForResizeEvent(width),
|
||||
wxGridColumnOperations(),
|
||||
- m_gridWin);
|
||||
+ m_gridWin, WXGRID_CURSOR_RESIZE_COL);
|
||||
}
|
||||
|
||||
void wxGrid::DoHeaderEndDragResizeCol(int width)
|
||||
@@ -5891,6 +5920,10 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
||||
DisableCellEditControl();
|
||||
|
||||
MoveCursorDown( event.ShiftDown() );
|
||||
+ //BBS: select this cell when first click
|
||||
+ m_selection->SelectBlock(m_currentCellCoords.GetRow(), m_currentCellCoords.GetCol(),
|
||||
+ m_currentCellCoords.GetRow(), m_currentCellCoords.GetCol(),
|
||||
+ event);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/src/msw/bmpcbox.cpp b/src/msw/bmpcbox.cpp
|
||||
index 0a2d167ad7..0aeba45ea9 100644
|
||||
--- a/src/msw/bmpcbox.cpp
|
||||
+++ b/src/msw/bmpcbox.cpp
|
||||
@@ -156,13 +156,20 @@ void wxBitmapComboBox::RecreateControl()
|
||||
|
||||
wxComboBox::DoClear();
|
||||
|
||||
- HWND hwnd = GetHwnd();
|
||||
+ WNDPROC wndproc_edit = nullptr;
|
||||
+ WinStruct<COMBOBOXINFO> combobox_info;
|
||||
+ HWND hwnd = GetHwnd();
|
||||
+if (::GetComboBoxInfo(hwnd, &combobox_info))
|
||||
+ wndproc_edit = (WNDPROC)wxGetWindowProc(combobox_info.hwndItem);
|
||||
DissociateHandle();
|
||||
::DestroyWindow(hwnd);
|
||||
|
||||
if ( !MSWCreateControl(wxT("COMBOBOX"), wxEmptyString, pos, size) )
|
||||
return;
|
||||
|
||||
+if (::GetComboBoxInfo(GetHwnd(), &combobox_info))
|
||||
+ wxSetWindowProc(combobox_info.hwndItem, wndproc_edit);
|
||||
+
|
||||
// initialize the controls contents
|
||||
for ( i = 0; i < numItems; i++ )
|
||||
{
|
||||
diff --git a/src/msw/font.cpp b/src/msw/font.cpp
|
||||
index 0bd240d79f..d38b1b00f5 100644
|
||||
--- a/src/msw/font.cpp
|
||||
+++ b/src/msw/font.cpp
|
||||
@@ -54,7 +54,7 @@ static const int PITCH_MASK = FIXED_PITCH | VARIABLE_PITCH;
|
||||
class WXDLLEXPORT wxFontRefData: public wxGDIRefData
|
||||
{
|
||||
public:
|
||||
- wxFontRefData(const wxFontInfo& info = wxFontInfo());
|
||||
+ wxFontRefData(const wxFontInfo& info = wxFontInfo(), const wxWindow* window = nullptr);
|
||||
|
||||
wxFontRefData(const wxNativeFontInfo& info, WXHFONT hFont = 0)
|
||||
{
|
||||
@@ -324,7 +324,7 @@ protected:
|
||||
// wxFontRefData
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
-wxFontRefData::wxFontRefData(const wxFontInfo& info)
|
||||
+wxFontRefData::wxFontRefData(const wxFontInfo& info, const wxWindow *window)
|
||||
{
|
||||
m_hFont = NULL;
|
||||
|
||||
@@ -335,7 +335,7 @@ wxFontRefData::wxFontRefData(const wxFontInfo& info)
|
||||
}
|
||||
else
|
||||
{
|
||||
- m_nativeFontInfo.SetSizeOrDefault(info.GetFractionalPointSize());
|
||||
+ m_nativeFontInfo.SetSizeOrDefault(info.GetFractionalPointSize(), window);
|
||||
}
|
||||
|
||||
SetStyle(info.GetStyle());
|
||||
@@ -518,12 +518,12 @@ wxFontEncoding wxNativeFontInfo::GetEncoding() const
|
||||
return wxGetFontEncFromCharSet(lf.lfCharSet);
|
||||
}
|
||||
|
||||
-void wxNativeFontInfo::SetFractionalPointSize(double pointSizeNew)
|
||||
+void wxNativeFontInfo::SetFractionalPointSize(double pointSizeNew, const wxWindow *window)
|
||||
{
|
||||
// We don't have the correct DPI to use here, so use that of the
|
||||
// primary screen and rely on WXAdjustToPPI() changing it later if
|
||||
// necessary.
|
||||
- const int ppi = ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY);
|
||||
+ const int ppi = window ? window->GetDPI().GetY() : ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY);
|
||||
lf.lfHeight = GetLogFontHeightAtPPI(pointSizeNew, ppi);
|
||||
|
||||
pointSize = pointSizeNew;
|
||||
@@ -812,9 +812,9 @@ wxFont::wxFont(const wxString& fontdesc)
|
||||
(void)Create(info);
|
||||
}
|
||||
|
||||
-wxFont::wxFont(const wxFontInfo& info)
|
||||
+wxFont::wxFont(const wxFontInfo& info, const wxWindow *window)
|
||||
{
|
||||
- m_refData = new wxFontRefData(info);
|
||||
+ m_refData = new wxFontRefData(info, window);
|
||||
}
|
||||
|
||||
bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont)
|
||||
diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp
|
||||
index 9bb397d472..30af7154a7 100644
|
||||
--- a/src/msw/menuitem.cpp
|
||||
+++ b/src/msw/menuitem.cpp
|
||||
@@ -368,6 +368,8 @@ void MenuDrawData::Init(wxWindow const* window)
|
||||
// native menu uses small top margin for separator
|
||||
if ( SeparatorMargin.cyTopHeight >= 2 )
|
||||
SeparatorMargin.cyTopHeight -= 2;
|
||||
+
|
||||
+ SeparatorSize.cy = 0;
|
||||
}
|
||||
else
|
||||
#endif // wxUSE_UXTHEME
|
||||
diff --git a/src/msw/window.cpp b/src/msw/window.cpp
|
||||
index eadc2f5700..f64fea4446 100644
|
||||
--- a/src/msw/window.cpp
|
||||
+++ b/src/msw/window.cpp
|
||||
@@ -4773,33 +4773,49 @@ static wxSize GetWindowDPI(HWND hwnd)
|
||||
}
|
||||
|
||||
/*extern*/
|
||||
-int wxGetSystemMetrics(int nIndex, const wxWindow* window)
|
||||
+int wxGetSystemMetrics(int nIndex, const wxWindow* win)
|
||||
{
|
||||
#if wxUSE_DYNLIB_CLASS
|
||||
- if ( !window )
|
||||
- window = wxApp::GetMainTopWindow();
|
||||
+ const wxWindow* window = (!win && wxTheApp) ? wxTheApp->GetTopWindow() : win;
|
||||
|
||||
- if ( window )
|
||||
+ if (window)
|
||||
{
|
||||
- typedef int (WINAPI * GetSystemMetricsForDpi_t)(int nIndex, UINT dpi);
|
||||
- static GetSystemMetricsForDpi_t s_pfnGetSystemMetricsForDpi = NULL;
|
||||
- static bool s_initDone = false;
|
||||
-
|
||||
- if ( !s_initDone )
|
||||
- {
|
||||
- wxLoadedDLL dllUser32("user32.dll");
|
||||
- wxDL_INIT_FUNC(s_pfn, GetSystemMetricsForDpi, dllUser32);
|
||||
- s_initDone = true;
|
||||
+#if 1
|
||||
+ if (window->GetHWND() && (nIndex == SM_CXSCREEN || nIndex == SM_CYSCREEN)) {
|
||||
+ HDC hdc = GetDC(window->GetHWND());
|
||||
+#if 0
|
||||
+ double dim = GetDeviceCaps(hdc, nIndex == SM_CXSCREEN ? HORZRES : VERTRES);
|
||||
+ ReleaseDC(window->GetHWND(), hdc);
|
||||
+ wxSize dpi = window->GetDPI();
|
||||
+ dim *= 96.0 / (nIndex == SM_CXSCREEN ? dpi.x : dpi.y);
|
||||
+ return int(dim + 0.5);
|
||||
+#else
|
||||
+ return int(GetDeviceCaps(hdc, nIndex == SM_CXSCREEN ? HORZRES : VERTRES));
|
||||
+#endif
|
||||
}
|
||||
-
|
||||
- if ( s_pfnGetSystemMetricsForDpi )
|
||||
+ else
|
||||
+#endif
|
||||
{
|
||||
- const int dpi = window->GetDPI().y;
|
||||
- return s_pfnGetSystemMetricsForDpi(nIndex, (UINT)dpi);
|
||||
+ typedef int (WINAPI * GetSystemMetricsForDpi_t)(int nIndex, UINT dpi);
|
||||
+ static GetSystemMetricsForDpi_t s_pfnGetSystemMetricsForDpi = NULL;
|
||||
+ static bool s_initDone = false;
|
||||
+
|
||||
+ if ( !s_initDone )
|
||||
+ {
|
||||
+ wxLoadedDLL dllUser32("user32.dll");
|
||||
+ wxDL_INIT_FUNC(s_pfn, GetSystemMetricsForDpi, dllUser32);
|
||||
+ s_initDone = true;
|
||||
+ }
|
||||
+
|
||||
+ if ( s_pfnGetSystemMetricsForDpi )
|
||||
+ {
|
||||
+ const int dpi = window->GetDPI().y;
|
||||
+ return s_pfnGetSystemMetricsForDpi(nIndex, (UINT)dpi);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
#else
|
||||
- wxUnusedVar(window);
|
||||
+ wxUnusedVar(win);
|
||||
#endif // wxUSE_DYNLIB_CLASS
|
||||
|
||||
return ::GetSystemMetrics(nIndex);
|
||||
diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm
|
||||
index 6ff0cc3088..4943f3ea38 100644
|
||||
--- a/src/osx/cocoa/dataview.mm
|
||||
+++ b/src/osx/cocoa/dataview.mm
|
||||
@@ -1734,12 +1734,22 @@ outlineView:(NSOutlineView*)outlineView
|
||||
if ( !dvc->GetEventHandler()->ProcessEvent(eventDV) )
|
||||
[super keyDown:event];
|
||||
}
|
||||
- else
|
||||
+ //FIXME Vojtech's hack to get the accelerators assigned to the wxDataViewControl working.
|
||||
+ else if (! implementation->DoHandleKeyEvent(event))
|
||||
{
|
||||
[super keyDown:event]; // all other keys
|
||||
}
|
||||
}
|
||||
|
||||
+//FIXME Vojtech: This is a workaround to get at least the "mouse move" events at the wxDataViewControl,
|
||||
+// so we can show the tooltips. The "mouse move" events are being send only if the wxDataViewControl
|
||||
+// has focus, which is a limitation of wxWidgets. We may grab focus on "mouse entry" though.
|
||||
+- (void)mouseMoved:(NSEvent *)event
|
||||
+{
|
||||
+if (! implementation->DoHandleMouseEvent(event))
|
||||
+ [super mouseMoved:event];
|
||||
+}
|
||||
+
|
||||
//
|
||||
// contextual menus
|
||||
//
|
||||
@@ -2672,12 +2682,22 @@ void wxCocoaDataViewControl::DoSetIndent(int indent)
|
||||
|
||||
void wxCocoaDataViewControl::HitTest(const wxPoint& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const
|
||||
{
|
||||
- NSPoint const nativePoint = wxToNSPoint((NSScrollView*) GetWXWidget(),point);
|
||||
+ NSTableHeaderView *headerView = [m_OutlineView headerView];
|
||||
+ if (headerView && point.y < headerView.visibleRect.size.height) {
|
||||
+ // The point is inside the header area.
|
||||
+ columnPtr = NULL;
|
||||
+ item = wxDataViewItem();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Convert from the window coordinates to the virtual scrolled view coordinates.
|
||||
+ NSScrollView *scrollView = [m_OutlineView enclosingScrollView];
|
||||
+ const NSRect &visibleRect = scrollView.contentView.visibleRect;
|
||||
+ NSPoint const nativePoint = wxToNSPoint((NSScrollView*) GetWXWidget(),
|
||||
+ wxPoint(point.x + visibleRect.origin.x, point.y + visibleRect.origin.y));
|
||||
|
||||
int indexColumn;
|
||||
int indexRow;
|
||||
|
||||
-
|
||||
indexColumn = [m_OutlineView columnAtPoint:nativePoint];
|
||||
indexRow = [m_OutlineView rowAtPoint: nativePoint];
|
||||
if ((indexColumn >= 0) && (indexRow >= 0))
|
||||
diff --git a/src/osx/cocoa/settings.mm b/src/osx/cocoa/settings.mm
|
||||
index de5f52860c..a9581174a4 100644
|
||||
--- a/src/osx/cocoa/settings.mm
|
||||
+++ b/src/osx/cocoa/settings.mm
|
||||
@@ -224,7 +224,7 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Get a system metric, e.g. scrollbar size
|
||||
-int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* WXUNUSED(win))
|
||||
+int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* win)
|
||||
{
|
||||
int value;
|
||||
|
||||
@@ -259,11 +259,11 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* WXUN
|
||||
// TODO case wxSYS_WINDOWMIN_Y:
|
||||
|
||||
case wxSYS_SCREEN_X:
|
||||
- wxDisplaySize(&value, NULL);
|
||||
+ wxDisplaySize(win, &value, NULL);
|
||||
return value;
|
||||
|
||||
case wxSYS_SCREEN_Y:
|
||||
- wxDisplaySize(NULL, &value);
|
||||
+ wxDisplaySize(win, NULL, &value);
|
||||
return value;
|
||||
|
||||
// TODO case wxSYS_FRAMESIZE_X:
|
||||
72
deps/wxWidgets/wxWidgets.cmake
vendored
Normal file
72
deps/wxWidgets/wxWidgets.cmake
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
set(_wx_git_tag v3.2.0)
|
||||
|
||||
set(_wx_toolkit "")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(_gtk_ver 2)
|
||||
if (DEP_WX_GTK3)
|
||||
set(_gtk_ver 3)
|
||||
endif ()
|
||||
set(_wx_toolkit "-DwxBUILD_TOOLKIT=gtk${_gtk_ver}")
|
||||
set(_wx_private_font "-DwxUSE_PRIVATE_FONTS=1")
|
||||
else ()
|
||||
set(_wx_private_font "-DwxUSE_PRIVATE_FONTS=0")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=ON")
|
||||
else ()
|
||||
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF")
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
set(_patch_cmd ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch)
|
||||
else ()
|
||||
set(_patch_cmd test -f WXWIDGETS_PATCHED || ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch && touch WXWIDGETS_PATCHED)
|
||||
endif ()
|
||||
|
||||
set(_unicode_utf8 OFF)
|
||||
if (UNIX AND NOT APPLE) # wxWidgets will not use char as the underlying type for wxString unless its forced to.
|
||||
set (_unicode_utf8 ON)
|
||||
endif()
|
||||
|
||||
qidislicer_add_cmake_project(wxWidgets
|
||||
URL https://github.com/prusa3d/wxWidgets/archive/78aa2dc0ea7ce99dc19adc1140f74c3e2e3f3a26.zip
|
||||
URL_HASH SHA256=94b7d972373503e380e5a8b0ca63b1ccb956da4006402298dd89a0c5c7041b1e
|
||||
#PATCH_COMMAND ${_patch_cmd}
|
||||
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} dep_TIFF dep_JPEG dep_NanoSVG
|
||||
CMAKE_ARGS
|
||||
-DwxBUILD_PRECOMP=ON
|
||||
${_wx_toolkit}
|
||||
"-DCMAKE_DEBUG_POSTFIX:STRING="
|
||||
-DwxBUILD_DEBUG_LEVEL=0
|
||||
-DwxBUILD_SAMPLES=OFF
|
||||
-DwxBUILD_SHARED=OFF
|
||||
-DwxUSE_MEDIACTRL=ON
|
||||
-DwxUSE_DETECT_SM=OFF
|
||||
-DwxUSE_UNICODE=ON
|
||||
${_wx_private_font}
|
||||
-DwxUSE_UNICODE_UTF8=${_unicode_utf8}
|
||||
-DwxUSE_OPENGL=ON
|
||||
-DwxUSE_WEBVIEW=ON
|
||||
${_wx_edge}
|
||||
-DwxUSE_WEBVIEW_IE=OFF
|
||||
-DwxUSE_STC=OFF
|
||||
-DwxUSE_AUI=ON
|
||||
-DwxUSE_LIBPNG=sys
|
||||
-DwxUSE_ZLIB=sys
|
||||
-DwxUSE_NANOSVG=sys
|
||||
-DwxUSE_NANOSVG_EXTERNAL=ON
|
||||
-DwxUSE_REGEX=OFF
|
||||
-DwxUSE_LIBXPM=builtin
|
||||
-DwxUSE_LIBJPEG=sys
|
||||
-DwxUSE_LIBTIFF=sys
|
||||
-DwxUSE_EXPAT=sys
|
||||
-DwxUSE_LIBSDL=OFF
|
||||
-DwxUSE_XTEST=OFF
|
||||
-DwxUSE_GLCANVAS_EGL=OFF
|
||||
-DwxUSE_WEBREQUEST=OFF
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_wxWidgets)
|
||||
endif ()
|
||||
51
lib/Slic3r.pm
Normal file
51
lib/Slic3r.pm
Normal file
@@ -0,0 +1,51 @@
|
||||
# This package loads all the non-GUI Slic3r perl packages.
|
||||
|
||||
package Slic3r;
|
||||
|
||||
# Copyright holder: Alessandro Ranellucci
|
||||
# This application is licensed under the GNU Affero General Public License, version 3
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Config;
|
||||
require v5.10;
|
||||
|
||||
our $VERSION = VERSION();
|
||||
our $BUILD = BUILD();
|
||||
our $FORK_NAME = FORK_NAME();
|
||||
|
||||
our $debug = 0;
|
||||
sub debugf {
|
||||
printf @_ if $debug;
|
||||
}
|
||||
|
||||
our $loglevel = 0;
|
||||
|
||||
BEGIN {
|
||||
$debug = 1 if (defined($ENV{'SLIC3R_DEBUGOUT'}) && $ENV{'SLIC3R_DEBUGOUT'} == 1);
|
||||
print "Debugging output enabled\n" if $debug;
|
||||
}
|
||||
|
||||
use FindBin;
|
||||
|
||||
use Moo 1.003001;
|
||||
|
||||
use Slic3r::XS; # import all symbols (constants etc.) before they get parsed
|
||||
use Slic3r::Config;
|
||||
use Slic3r::GCode::Reader;
|
||||
use Slic3r::Line;
|
||||
use Slic3r::Model;
|
||||
use Slic3r::Point;
|
||||
use Slic3r::Polygon;
|
||||
use Slic3r::Polyline;
|
||||
our $build = eval "use Slic3r::Build; 1";
|
||||
|
||||
# Scaling between the float and integer coordinates.
|
||||
# Floats are in mm.
|
||||
use constant SCALING_FACTOR => 0.000001;
|
||||
|
||||
# Set the logging level at the Slic3r XS module.
|
||||
$Slic3r::loglevel = (defined($ENV{'SLIC3R_LOGLEVEL'}) && $ENV{'SLIC3R_LOGLEVEL'} =~ /^[1-9]/) ? $ENV{'SLIC3R_LOGLEVEL'} : 0;
|
||||
set_logging_level($Slic3r::loglevel);
|
||||
|
||||
1;
|
||||
32
lib/Slic3r/Config.pm
Normal file
32
lib/Slic3r/Config.pm
Normal file
@@ -0,0 +1,32 @@
|
||||
# Extends C++ class Slic3r::DynamicPrintConfig
|
||||
# This perl class does not keep any perl class variables,
|
||||
# all the storage is handled by the underlying C++ code.
|
||||
package Slic3r::Config;
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
use List::Util qw(first max);
|
||||
|
||||
# C++ Slic3r::PrintConfigDef exported as a Perl hash of hashes.
|
||||
# The C++ counterpart is a constant singleton.
|
||||
our $Options = print_config_def();
|
||||
|
||||
# Generate accessors.
|
||||
{
|
||||
no strict 'refs';
|
||||
for my $opt_key (keys %$Options) {
|
||||
*{$opt_key} = sub {
|
||||
#print "Slic3r::Config::accessor $opt_key\n";
|
||||
$_[0]->get($opt_key)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
package Slic3r::Config::Static;
|
||||
use parent 'Slic3r::Config';
|
||||
|
||||
sub Slic3r::Config::GCode::new { Slic3r::Config::Static::new_GCodeConfig }
|
||||
sub Slic3r::Config::Print::new { Slic3r::Config::Static::new_PrintConfig }
|
||||
|
||||
1;
|
||||
90
lib/Slic3r/GCode/Reader.pm
Normal file
90
lib/Slic3r/GCode/Reader.pm
Normal file
@@ -0,0 +1,90 @@
|
||||
# Helper module to parse and interpret a G-code file,
|
||||
# invoking a callback for each move extracted from the G-code.
|
||||
# Currently used by the automatic tests only.
|
||||
package Slic3r::GCode::Reader;
|
||||
use Moo;
|
||||
|
||||
has 'config' => (is => 'ro', default => sub { Slic3r::Config::GCode->new });
|
||||
has 'X' => (is => 'rw', default => sub {0});
|
||||
has 'Y' => (is => 'rw', default => sub {0});
|
||||
has 'Z' => (is => 'rw', default => sub {0});
|
||||
has 'E' => (is => 'rw', default => sub {0});
|
||||
has 'F' => (is => 'rw', default => sub {0});
|
||||
has '_extrusion_axis' => (is => 'rw', default => sub {"E"});
|
||||
|
||||
our $Verbose = 0;
|
||||
my @AXES = qw(X Y Z E);
|
||||
|
||||
sub apply_print_config {
|
||||
my ($self, $print_config) = @_;
|
||||
|
||||
$self->config->apply_static($print_config);
|
||||
$self->_extrusion_axis($self->config->get_extrusion_axis);
|
||||
}
|
||||
|
||||
sub clone {
|
||||
my $self = shift;
|
||||
return (ref $self)->new(
|
||||
map { $_ => $self->$_ } (@AXES, 'F', '_extrusion_axis', 'config'),
|
||||
);
|
||||
}
|
||||
|
||||
sub parse {
|
||||
my $self = shift;
|
||||
my ($gcode, $cb) = @_;
|
||||
|
||||
foreach my $raw_line (split /\R+/, $gcode) {
|
||||
print "$raw_line\n" if $Verbose || $ENV{SLIC3R_TESTS_GCODE};
|
||||
my $line = $raw_line;
|
||||
$line =~ s/\s*;(.*)//; # strip comment
|
||||
my %info = (comment => $1, raw => $raw_line);
|
||||
|
||||
# parse command
|
||||
my ($command, @args) = split /\s+/, $line;
|
||||
$command //= '';
|
||||
my %args = map { /([A-Z])(.*)/; ($1 => $2) } @args;
|
||||
|
||||
# convert extrusion axis
|
||||
if (exists $args{ $self->_extrusion_axis }) {
|
||||
$args{E} = $args{ $self->_extrusion_axis };
|
||||
}
|
||||
|
||||
# check motion
|
||||
if ($command =~ /^G[01]$/) {
|
||||
foreach my $axis (@AXES) {
|
||||
if (exists $args{$axis}) {
|
||||
$self->$axis(0) if $axis eq 'E' && $self->config->use_relative_e_distances;
|
||||
$info{"dist_$axis"} = $args{$axis} - $self->$axis;
|
||||
$info{"new_$axis"} = $args{$axis};
|
||||
} else {
|
||||
$info{"dist_$axis"} = 0;
|
||||
$info{"new_$axis"} = $self->$axis;
|
||||
}
|
||||
}
|
||||
$info{dist_XY} = sqrt(($info{dist_X}**2) + ($info{dist_Y}**2));
|
||||
if (exists $args{E}) {
|
||||
if ($info{dist_E} > 0) {
|
||||
$info{extruding} = 1;
|
||||
} elsif ($info{dist_E} < 0) {
|
||||
$info{retracting} = 1
|
||||
}
|
||||
} else {
|
||||
$info{travel} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# run callback
|
||||
$cb->($self, $command, \%args, \%info);
|
||||
|
||||
# update coordinates
|
||||
if ($command =~ /^(?:G[01]|G92)$/) {
|
||||
for my $axis (@AXES, 'F') {
|
||||
$self->$axis($args{$axis}) if exists $args{$axis};
|
||||
}
|
||||
}
|
||||
|
||||
# TODO: update temperatures
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
37
lib/Slic3r/Geometry.pm
Normal file
37
lib/Slic3r/Geometry.pm
Normal file
@@ -0,0 +1,37 @@
|
||||
package Slic3r::Geometry;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
require Exporter;
|
||||
our @ISA = qw(Exporter);
|
||||
|
||||
# Exported by this module. The last section starting with convex_hull is exported by Geometry.xsp
|
||||
our @EXPORT_OK = qw(
|
||||
PI epsilon
|
||||
|
||||
scale
|
||||
unscale
|
||||
scaled_epsilon
|
||||
|
||||
X Y Z
|
||||
convex_hull
|
||||
chained_path_from
|
||||
deg2rad
|
||||
rad2deg
|
||||
);
|
||||
|
||||
use constant PI => 4 * atan2(1, 1);
|
||||
use constant A => 0;
|
||||
use constant B => 1;
|
||||
use constant X1 => 0;
|
||||
use constant Y1 => 1;
|
||||
use constant X2 => 2;
|
||||
use constant Y2 => 3;
|
||||
|
||||
sub epsilon () { 1E-4 }
|
||||
sub scaled_epsilon () { epsilon / &Slic3r::SCALING_FACTOR }
|
||||
|
||||
sub scale ($) { $_[0] / &Slic3r::SCALING_FACTOR }
|
||||
sub unscale ($) { $_[0] * &Slic3r::SCALING_FACTOR }
|
||||
|
||||
1;
|
||||
8
lib/Slic3r/Line.pm
Normal file
8
lib/Slic3r/Line.pm
Normal file
@@ -0,0 +1,8 @@
|
||||
package Slic3r::Line;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# a line is a two-points line
|
||||
use parent 'Slic3r::Polyline';
|
||||
|
||||
1;
|
||||
136
lib/Slic3r/Model.pm
Normal file
136
lib/Slic3r/Model.pm
Normal file
@@ -0,0 +1,136 @@
|
||||
# extends C++ class Slic3r::Model
|
||||
package Slic3r::Model;
|
||||
|
||||
use List::Util qw(first max any);
|
||||
|
||||
sub merge {
|
||||
my $class = shift;
|
||||
my @models = @_;
|
||||
|
||||
my $new_model = ref($class)
|
||||
? $class
|
||||
: $class->new;
|
||||
|
||||
$new_model->add_object($_) for map @{$_->objects}, @models;
|
||||
return $new_model;
|
||||
}
|
||||
|
||||
sub add_object {
|
||||
my $self = shift;
|
||||
|
||||
if (@_ == 1) {
|
||||
# we have a Model::Object
|
||||
my ($object) = @_;
|
||||
return $self->_add_object_clone($object);
|
||||
} else {
|
||||
my (%args) = @_;
|
||||
|
||||
my $new_object = $self->_add_object;
|
||||
|
||||
$new_object->set_name($args{name})
|
||||
if defined $args{name};
|
||||
$new_object->set_input_file($args{input_file})
|
||||
if defined $args{input_file};
|
||||
$new_object->config->apply($args{config})
|
||||
if defined $args{config};
|
||||
$new_object->set_layer_height_ranges($args{layer_height_ranges})
|
||||
if defined $args{layer_height_ranges};
|
||||
$new_object->set_origin_translation($args{origin_translation})
|
||||
if defined $args{origin_translation};
|
||||
|
||||
return $new_object;
|
||||
}
|
||||
}
|
||||
|
||||
sub set_material {
|
||||
my $self = shift;
|
||||
my ($material_id, $attributes) = @_;
|
||||
|
||||
my $material = $self->add_material($material_id);
|
||||
$material->apply($attributes // {});
|
||||
return $material;
|
||||
}
|
||||
|
||||
# Extends C++ class Slic3r::ModelMaterial
|
||||
package Slic3r::Model::Material;
|
||||
|
||||
sub apply {
|
||||
my ($self, $attributes) = @_;
|
||||
$self->set_attribute($_, $attributes{$_}) for keys %$attributes;
|
||||
}
|
||||
|
||||
# Extends C++ class Slic3r::ModelObject
|
||||
package Slic3r::Model::Object;
|
||||
|
||||
use List::Util qw(first sum);
|
||||
|
||||
sub add_volume {
|
||||
my $self = shift;
|
||||
|
||||
my $new_volume;
|
||||
if (@_ == 1) {
|
||||
# we have a Model::Volume
|
||||
my ($volume) = @_;
|
||||
|
||||
$new_volume = $self->_add_volume_clone($volume);
|
||||
|
||||
if ($volume->material_id ne '') {
|
||||
# merge material attributes and config (should we rename materials in case of duplicates?)
|
||||
if (my $material = $volume->object->model->get_material($volume->material_id)) {
|
||||
my %attributes = %{ $material->attributes };
|
||||
if ($self->model->has_material($volume->material_id)) {
|
||||
%attributes = (%attributes, %{ $self->model->get_material($volume->material_id)->attributes })
|
||||
}
|
||||
my $new_material = $self->model->set_material($volume->material_id, {%attributes});
|
||||
$new_material->config->apply($material->config);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my %args = @_;
|
||||
|
||||
$new_volume = $self->_add_volume($args{mesh});
|
||||
|
||||
$new_volume->set_name($args{name})
|
||||
if defined $args{name};
|
||||
$new_volume->set_material_id($args{material_id})
|
||||
if defined $args{material_id};
|
||||
$new_volume->set_modifier($args{modifier})
|
||||
if defined $args{modifier};
|
||||
$new_volume->config->apply($args{config})
|
||||
if defined $args{config};
|
||||
}
|
||||
|
||||
if ($new_volume->material_id ne '' && !defined $self->model->get_material($new_volume->material_id)) {
|
||||
# TODO: this should be a trigger on Volume::material_id
|
||||
$self->model->set_material($new_volume->material_id);
|
||||
}
|
||||
|
||||
$self->invalidate_bounding_box;
|
||||
|
||||
return $new_volume;
|
||||
}
|
||||
|
||||
sub add_instance {
|
||||
my $self = shift;
|
||||
|
||||
if (@_ == 1) {
|
||||
# we have a Model::Instance
|
||||
my ($instance) = @_;
|
||||
return $self->_add_instance_clone($instance);
|
||||
} else {
|
||||
my (%args) = @_;
|
||||
|
||||
my $new_instance = $self->_add_instance;
|
||||
|
||||
$new_instance->set_rotations($args{rotation})
|
||||
if defined $args{rotation};
|
||||
$new_instance->set_scaling_factors($args{scaling_factor})
|
||||
if defined $args{scaling_factor};
|
||||
$new_instance->set_offset($args{offset})
|
||||
if defined $args{offset};
|
||||
|
||||
return $new_instance;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
28
lib/Slic3r/Point.pm
Normal file
28
lib/Slic3r/Point.pm
Normal file
@@ -0,0 +1,28 @@
|
||||
package Slic3r::Point;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new_scale {
|
||||
my $class = shift;
|
||||
return $class->new(map Slic3r::Geometry::scale($_), @_);
|
||||
}
|
||||
|
||||
package Slic3r::Pointf;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new_unscale {
|
||||
my $class = shift;
|
||||
return $class->new(map Slic3r::Geometry::unscale($_), @_);
|
||||
}
|
||||
|
||||
package Slic3r::Pointf3;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new_unscale {
|
||||
my $class = shift;
|
||||
return $class->new(map Slic3r::Geometry::unscale($_), @_);
|
||||
}
|
||||
|
||||
1;
|
||||
8
lib/Slic3r/Polygon.pm
Normal file
8
lib/Slic3r/Polygon.pm
Normal file
@@ -0,0 +1,8 @@
|
||||
package Slic3r::Polygon;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# a polygon is a closed polyline.
|
||||
use parent 'Slic3r::Polyline';
|
||||
|
||||
1;
|
||||
13
lib/Slic3r/Polyline.pm
Normal file
13
lib/Slic3r/Polyline.pm
Normal file
@@ -0,0 +1,13 @@
|
||||
package Slic3r::Polyline;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Slic3r::Geometry qw(X Y);
|
||||
|
||||
sub new_scale {
|
||||
my $class = shift;
|
||||
my @points = map { ref($_) eq 'Slic3r::Point' ? $_->pp : $_ } @_;
|
||||
return $class->new(map [ Slic3r::Geometry::scale($_->[X]), Slic3r::Geometry::scale($_->[Y]) ], @points);
|
||||
}
|
||||
|
||||
1;
|
||||
261
lib/Slic3r/Test.pm
Normal file
261
lib/Slic3r/Test.pm
Normal file
File diff suppressed because one or more lines are too long
BIN
resources/calib/FlowRate/flowrate_coarse.3mf
Normal file
BIN
resources/calib/FlowRate/flowrate_coarse.3mf
Normal file
Binary file not shown.
BIN
resources/calib/FlowRate/flowrate_fine.3mf
Normal file
BIN
resources/calib/FlowRate/flowrate_fine.3mf
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