DICOM test1

This commit is contained in:
rohit 2025-06-23 19:07:37 +05:30
commit 1fe2b563f2
908 changed files with 263036 additions and 0 deletions

57
.clang-format Normal file
View File

@ -0,0 +1,57 @@
---
Language: Cpp
BasedOnStyle: LLVM
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: true
AlignTrailingComments: false
AlwaysBreakTemplateDeclarations: Yes
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 200
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ContinuationIndentWidth: 2
IncludeCategories:
- Regex: '^<.*'
Priority: 1
- Regex: '^".*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
InsertNewlineAtEOF: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
TabWidth: 2
...

37
.gitignore vendored Normal file
View File

@ -0,0 +1,37 @@
# Build directories
Build/
OrthancServer/Build/
OrthancFramework/Build/
# CMake files
CMakeFiles/
Makefile
# Compiled object files
*.o
*.obj
*.so
*.a
*.lib
*.dll
*.exe
*.out
# OS generated files
.DS_Store
Thumbs.db
# Editor/IDE files
*.swp
*.swo
*.user
*.workspace
*.idea/
*.vscode/
# Logs
*.log
# Orthanc storage (if used)
OrthancStorage/

6
.hg_archival.txt Normal file
View File

@ -0,0 +1,6 @@
repo: 3959d33612ccaadc0d4d707227fbed09ac35e5fe
node: 0d239fb160606b0007ef41060eed44d7576215c8
branch: Orthanc-1.12.8
latesttag: toa2020012703
latesttagdistance: 1957
changessincelatesttag: 2494

18
.hgignore Normal file
View File

@ -0,0 +1,18 @@
syntax: glob
ThirdPartyDownloads/
CMakeLists.txt.user
*.cpp.orig
*.h.orig
.vs/
.vscode/
*~
*.cmake.orig
.idea/
# when opening Orthanc in VSCode, it might find a java project and create files we wan't to ignore:
.settings/
.classpath
.project
Resources/Testing/Issue32/Java/bin
Resources/Testing/Issue32/Java/target
build/

4
.hgtags Normal file
View File

@ -0,0 +1,4 @@
a95beca72e99f3a1110cffd252bcf3abf5a2db27 dcmtk-3.6.1
19966d29968506773f90b733b6e34559839ca5c7 toa2020012701
dfd9a2229c18abd5c794d8fec967ef0ed10b8e91 toa2020012702
799a8278b151222ea9e8b8628b1d57b5b7943f41 toa2020012703

76
.travis.yml Normal file
View File

@ -0,0 +1,76 @@
language: cpp
env:
- TRAVIS_MINGW=OFF
#- TRAVIS_MINGW=ON # MinGW32 is not available anymore (2020-07-08)
compiler:
- gcc
- clang
os:
- osx
- linux
osx_image: xcode61
matrix:
exclude:
# This excludes OSX builds from the build matrix for gcc
- os: osx
compiler: gcc
# Do not compile for OS X or clang when MinGW is enabled
- os: osx
env: TRAVIS_MINGW=ON
- compiler: clang
env: TRAVIS_MINGW=ON
before_install:
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq && sudo apt-get install
-qq build-essential unzip cmake mercurial uuid-dev libcurl4-openssl-dev liblua5.1-0-dev
libgtest-dev libpng-dev libsqlite3-dev libssl-dev zlib1g-dev libdcmtk2-dev libwrap0-dev
libcharls-dev; fi
# For DCMTK 3.6.2 - Can't make it compile in static mode with MinGW32 on the
# Ubuntu Precise (12.04) that is used by Travis:
# - if [ $TRAVIS_OS_NAME == linux -a $TRAVIS_MINGW == ON ]; then sudo apt-get install mingw-w64 gcc-mingw-w64-i686 g++-mingw-w64-i686 wine; fi
# For DCMTK 3.6.0:
- if [ $TRAVIS_OS_NAME == linux -a $TRAVIS_MINGW == ON ]; then sudo apt-get install mingw32; fi
before_script:
- mkdir Build
- cd Build
- if [ $TRAVIS_OS_NAME == linux -a $TRAVIS_MINGW == OFF ]; then cmake
-DCMAKE_BUILD_TYPE=Debug "-DDCMTK_LIBRARIES=CharLS;dcmjpls;wrap;oflog"
-DALLOW_DOWNLOADS=ON -DUSE_SYSTEM_BOOST=OFF -DUSE_SYSTEM_CIVETWEB=OFF -DUSE_SYSTEM_JSONCPP=OFF
-DUSE_SYSTEM_GOOGLE_LOG=OFF -DUSE_SYSTEM_PUGIXML=OFF -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON
-DBOOST_LOCALE_BACKEND=icu -DUSE_SYSTEM_OPENSSL=OFF -DUSE_SYSTEM_CURL=OFF
../OrthancServer; fi
- if [ $TRAVIS_OS_NAME == linux -a $TRAVIS_MINGW == ON ]; then cmake
-DCMAKE_BUILD_TYPE=Debug -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DALLOW_DOWNLOADS=ON
-DCMAKE_TOOLCHAIN_FILE=Resources/MinGWToolchain.cmake -DDCMTK_STATIC_VERSION=3.6.0
-DUSE_LEGACY_JSONCPP=ON -DBOOST_LOCALE_BACKEND=libiconv
../OrthancServer; fi
- if [ $TRAVIS_OS_NAME == osx ]; then cmake
-DCMAKE_BUILD_TYPE=Debug -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DALLOW_DOWNLOADS=ON
-DBOOST_LOCALE_BACKEND=icu
../OrthancServer; fi
# Old releases of MinGW are not compatible with GoogleTest 1.8.1
script: make Orthanc ServeFolders ModalityWorklists && if [ $TRAVIS_MINGW == OFF ]; then make UnitTests && ./UnitTests; fi
#script: cp ../README Orthanc
#deploy:
# provider: releases
# api_key:
# secure: WU+niKLAKMoJHST5EK23BayK4qXSrXELKlJYc8wRjMO4ay1KSgvzlY2UGKeW1EPClBfZZ0Uh5VKF8l34exsfirFuwCX2qceozduZproUszZ4Z88X8wt8Ctu8tBuuKLZYFc9iNH4zw+QZyRuPyXK9iWpS0L9O20pqy5upTsagM3o=
# file_glob: true
# file:
# - 'Build/Orthanc'
# - 'Build/UnitTests'
# - 'BuildMinGW32/Orthanc.exe'
# - 'BuildMinGW32/UnitTests.exe'
# skip_cleanup: true
# on:
# all_branches: true

32
AUTHORS Normal file
View File

@ -0,0 +1,32 @@
Orthanc - A Lightweight, RESTful DICOM Server
=============================================
Authors of Orthanc
------------------
* Sebastien Jodogne <s.jodogne@orthanc-labs.com>
Overall design and lead developer.
* Department of Medical Physics
University Hospital of Liege
4000 Liege
Belgium
* Osimis S.A.
Quai Banning 6
4000 Liege
Belgium
* Orthanc Team SRL <info@orthanc.team>
Rue Joseph Marchal 14
4910 Theux
Belgium
https://orthanc.team/
* ICTEAM, UCLouvain
Place de l'Universite 1
1348 Ottignies-Louvain-la-Neuve
Belgium
https://uclouvain.be/icteam

14
CITATION.cff Normal file
View File

@ -0,0 +1,14 @@
cff-version: "1.1.0"
message: "If you use this software, please cite it using these metadata."
title: Orthanc
abstract: "Orthanc is a lightweight open-source DICOM server for medical imaging supporting representational state transfer (REST)."
authors:
-
affiliation: UCLouvain
family-names: Jodogne
given-names: "Sébastien"
doi: "10.1007/s10278-018-0082-y"
license: "GPL-3.0-or-later"
repository-code: "https://orthanc.uclouvain.be/hg/orthanc/"
version: 1.12.8
date-released: 2025-06-13

675
COPYING Normal file
View File

@ -0,0 +1,675 @@
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>.

54
DarwinCompilation.txt Normal file
View File

@ -0,0 +1,54 @@
This file is a complement to "INSTALL", which contains instructions
that are specific to Mac OS X (Darwin).
Static linking for OS X using XCode
===================================
The most simple way of building Orthanc under OS X consists in
statically linking against all the third-party dependencies. In this
case, no package manager such as Homebrew or MacPorts is required.
The build tool (CMake) will download the sources of all the required
packages and automatically compile them.
Prerequisites
-------------
1) XCode must be installed.
2) CMake must be installed (http://www.cmake.org/).
3) It is assumed that Orthanc source code is placed in the folder
"~/Orthanc" and that the binaries will be compiled to
"~/Orthanc/Build".
Prepare the build with CMake
----------------------------
# cd ./Build
# cmake -GXcode -DCMAKE_OSX_DEPLOYMENT_TARGET=10.8 -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DALLOW_DOWNLOADS=ON ../OrthancServer
NB: Adapt the value of "CMAKE_OSX_DEPLOYMENT_TARGET" with respect to
your version of OS X. This version can obtained by typing:
# sw_vers
Build the Debug version of Orthanc
----------------------------------
# xcodebuild
# ./Debug/UnitTests
The binaries of Orthanc are located at "~/Orthanc/Build/Debug/Orthanc".
Build the Release version of Orthanc
------------------------------------
# xcodebuild -configuration Release
# ./Release/UnitTests
The binaries of Orthanc are located at "~/Orthanc/Build/Release/Orthanc".

184
INSTALL Normal file
View File

@ -0,0 +1,184 @@
Orthanc - A Lightweight, RESTful DICOM Server
=============================================
Dependencies
------------
1) CMake: Orthanc uses CMake (http://www.cmake.org/) to automate its
building process.
2) Python: Some code is autogenerated through Python
(http://www.python.org/).
3) Mercurial: To use the cutting edge code, a Mercurial client must be
installed (http://mercurial.selenic.com/). We recommend TortoiseHg.
W) 7-Zip: For the native build under Windows, the 7-Zip tool is used
to uncompress the third-party packages (http://www.7-zip.org/).
You thus have to download and install CMake, Python, Mercurial and
possibly 7-Zip first. The path to their executable must be in the
"PATH" environment variable.
The other third party dependencies are automatically downloaded by the
CMake scripts. The downloaded packages are stored in the
"ThirdPartyDownloads" directory.
Building Orthanc at a glance
----------------------------
To build Orthanc, you must:
1) Download the source code (either using Mercurial, or through the
official releases). For the examples below, we assume the source
directory is "~/Orthanc".
2) Create a build directory. For the examples below, we assume the
build directory is "~/Orthanc/Build".
3) Depending on your platform, follow the build instructions below.
WARNING 1: If you do not create a fresh "~/Orthanc/Build" directory
after upgrading the source code (i.e. if you reuse the build directory
that was used to build a different version of Orthanc), the build
might fail because of changes in the compilation/linking flags. Always
prefer to force a re-build in a new directory.
WARNING 2: If cmake complains about not being able to uncompress
third-party dependencies, delete the "~/Orthanc/ThirdPartyDownloads/"
folder, then restart cmake.
WARNING 3: If performance is important to you, make sure to add the
option "-DCMAKE_BUILD_TYPE=Release" when invoking cmake. Indeed, by
default, run-time debug assertions are enabled, which can seriously
impact performance, especially if your Orthanc server stores a lot of
DICOM instances.
Native GNU/Linux Compilation
----------------------------
See the file "LinuxCompilation.txt".
Native OS X Compilation
-----------------------
See the file "DarwinCompilation.txt".
Native Windows build with Microsoft Visual Studio 2008
------------------------------------------------------
# cd [...]\Orthanc\Build
# cmake -DSTANDALONE_BUILD=ON -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON \
-DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_BOOST=ON -G "Visual Studio 9 2008" [...]\OrthancServer
Then open the "[...]\Orthanc\Build\Orthanc.sln" with Visual Studio.
NOTES:
* More recent versions of Visual Studio than 2008 should also
work. Type "cmake" without arguments to have the list of generators
that are available on your computer.
* You will have to install the Platform SDK (version 6 or above) for
Visual Studio 2005:
http://en.wikipedia.org/wiki/Microsoft_Windows_SDK.
Read the CMake FAQ: http://goo.gl/By90B
* The "-DUSE_LEGACY_JSONCPP=ON" must be set for versions of
Visual Studio that do not support C++11
Orthanc as compiled above will not work properly with some Asian
encodings (unit tests will fail). In international setups, you can
compile Orthanc together with ICU as follows:
# cmake -DSTANDALONE_BUILD=ON -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON \
-DBOOST_LOCALE_BACKEND=icu -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON \
-G "Visual Studio 9 2008" [...]\Orthanc
Native Windows build with Microsoft Visual Studio 2015, Ninja and QtCreator
---------------------------------------------------------------------------
Open a Visual Studio 2015 x64 Command Prompt.
# cd [...]\Orthanc\Build
# cmake -G Ninja -DSTATIC_BUILD=ON [...]\OrthancServer
# ninja
Then, you can open an existing project in QtCreator:
* Select the CMakeLists.txt in [...]\OrthancServer
* Import build from [...]\Build
Instructions to include support for Asian encodings:
# cmake -G Ninja -T host=x64 -DSTATIC_BUILD=ON -DBOOST_LOCALE_BACKEND=icu [...]\OrthancServer
The option "-T host=x64" is necessary to prevent error "C1060:
compiler is out of heap space" when compiling Orthanc with ICU.
Native 64-bit Windows build with Microsoft Visual Studio 2017 (msbuild)
-----------------------------------------------------------------------
# cd [...]\Build
# cmake -G "Visual Studio 15 2017 Win64" -DMSVC_MULTIPLE_PROCESSES=ON -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DALLOW_DOWNLOADS=ON [...]\OrthancServer
Instructions to include support for Asian encodings:
# cmake -G "Visual Studio 15 2017 Win64" -T host=x64 -DSTATIC_BUILD=ON -DBOOST_LOCALE_BACKEND=icu -DMSVC_MULTIPLE_PROCESSES=ON -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DALLOW_DOWNLOADS=ON [...]\OrthancServer
Native 64-bit Windows build with Microsoft Visual Studio 2019 (msbuild)
-----------------------------------------------------------------------
# cd [...]\Build
# cmake -G "Visual Studio 16 2019" -A x64 -DMSVC_MULTIPLE_PROCESSES=ON -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DALLOW_DOWNLOADS=ON [...]\OrthancServer
Instructions to include support for Asian encodings:
# cmake -G "Visual Studio 16 2019" -A x64 -T host=x64 -DSTATIC_BUILD=ON -DBOOST_LOCALE_BACKEND=icu -DMSVC_MULTIPLE_PROCESSES=ON -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DALLOW_DOWNLOADS=ON [...]\OrthancServer
Cross-Compilation for Windows under GNU/Linux
---------------------------------------------
Some versions of MinGW-W64 may have insufficient support C++11 to
compile recent versions of Boost or ICU (notably those shipped in
Ubuntu 22.04 LTS, in the "g++-mingw-w64-i686-win32" package). Use the
following command to disable C++11 in Boost and ICU:
# cd ~/Orthanc/Build
# cmake ../OrthancServer \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake \
-DSTANDALONE_BUILD=ON \
-DSTATIC_BUILD=ON \
-DBOOST_LOCALE_BACKEND=icu \
-DUSE_LEGACY_BOOST=ON \
-DUSE_LEGACY_LIBICU=ON
# make
NB: Use the toolchain "MinGW-W64-Toolchain64.cmake" to produce 64bit
Windows binaries.
Legacy MinGW32 compilers (notably those shipped in Ubuntu 14.04 LTS,
in the "mingw32" package) are incompatible with DCMTK 3.6.2 and
C++11. Use the following command to force using DCMTK 3.6.0 and
disable C++11:
# cd ~/Orthanc/Build
# cmake ../OrthancServer \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/MinGWToolchain.cmake \
-DSTANDALONE_BUILD=ON \
-DSTATIC_BUILD=ON \
-DDCMTK_STATIC_VERSION=3.6.0 \
-DUSE_LEGACY_JSONCPP=ON \
-DUSE_LEGACY_BOOST=ON \
-DUSE_LEGACY_LIBICU=ON
# make

270
LinuxCompilation.txt Normal file
View File

@ -0,0 +1,270 @@
This file is a complement to "INSTALL", which contains instructions
that are specific to GNU/Linux.
Static linking for GNU/Linux
============================
The most simple way of building Orthanc under GNU/Linux consists in
statically linking against all the third-party dependencies. In this
case, the system-wide libraries will not be used. The build tool
(CMake) will download the sources of all the required packages and
automatically compile them.
This process should work on any GNU/Linux distribution, provided that a
C/C++ compiler ("build-essential" in Debian-based systems), the Python
interpreter, CMake, the "unzip" system tool, and the development
package for libuuid ("uuid-dev" in Debian) are installed.
We now make the assumption that Orthanc source code is placed in the
folder "~/Orthanc" and that the binaries will be compiled to
"~/Orthanc/Build". To build binaries with debug information:
# cd ./Build
# cmake -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Debug ../OrthancServer/
# make
# make doc
To build a release version:
# cd ./Build
# cmake -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release ../OrthancServer/
# make
# make doc
Note 1- When the "STATIC_BUILD" option is set to "ON", the build tool
will not ask you the permission to download packages from the
Internet.
Note 2- If the development package of libuuid was not installed when
first invoking cmake, you will have to manually remove the build
directory ("rm -rf ~/Orthanc/Build") after installing this package,
then run cmake again.
Note 3- To build the documentation, you will have to install doxygen.
Use system-wide libraries under GNU/Linux
=========================================
Under GNU/Linux, by default, Orthanc links against the shared
libraries of your system (the "STATIC_BUILD" option is set to
"OFF"). This greatly speeds up the compilation. This is also required
when building packages for GNU/Linux distributions. Because using
system libraries is the default behavior, you just have to use:
# cd ./Build
# cmake -DCMAKE_BUILD_TYPE=Debug ../OrthancServer
# make
Note that to build the documentation, you will have to install doxygen.
However, on some GNU/Linux distributions, it is still required to
download and static link against some third-party dependencies,
e.g. when the system-wide library is not shipped or is
outdated. Because of difference in the packaging of the various
GNU/Linux distribution, it is also sometimes required to fine-tune
some options.
You will find below build instructions for specific GNU/Linux
distributions. Distributions tagged by "SUPPORTED" are tested by
Sébastien Jodogne. Distributions tagged by "CONTRIBUTED" come from
Orthanc users.
SUPPORTED - Debian Jessie/Sid
-----------------------------
# sudo apt-get install build-essential unzip cmake mercurial patch \
uuid-dev libcurl4-openssl-dev liblua5.1-0-dev \
libgtest-dev libpng-dev libjpeg-dev \
libsqlite3-dev libssl-dev zlib1g-dev libdcmtk2-dev \
libboost-all-dev libwrap0-dev libjsoncpp-dev libpugixml-dev
# cd ./Build
# cmake -DALLOW_DOWNLOADS=ON \
-DUSE_SYSTEM_CIVETWEB=OFF \
-DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
-DDCMTK_LIBRARIES=dcmjpls \
-DCMAKE_BUILD_TYPE=Release \
../OrthancServer/
# make
Note: Have also a look at the official package:
http://anonscm.debian.org/viewvc/debian-med/trunk/packages/orthanc/trunk/debian/
SUPPORTED - Ubuntu 14.04 LTS
----------------------------
# sudo apt-get install build-essential unzip cmake mercurial patch \
uuid-dev libcurl4-openssl-dev \
libgtest-dev libpng-dev libsqlite3-dev libssl-dev libjpeg-dev \
zlib1g-dev libdcmtk2-dev libboost-all-dev libwrap0-dev \
libcharls-dev libjsoncpp-dev libpugixml-dev
# cd ./Build
# cmake -DALLOW_DOWNLOADS=ON \
-DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
-DUSE_SYSTEM_BOOST=OFF \
-DUSE_SYSTEM_CIVETWEB=OFF \
-DUSE_SYSTEM_DCMTK=OFF \
-DUSE_SYSTEM_JSONCPP=OFF \
-DUSE_SYSTEM_LUA=OFF \
-DCIVETWEB_OPENSSL_API=1.0 \
-DCMAKE_BUILD_TYPE=Release \
../OrthancServer/
# make
SUPPORTED - Ubuntu 16.04 LTS
----------------------------
# sudo apt-get install build-essential unzip cmake mercurial patch \
uuid-dev libcurl4-openssl-dev liblua5.3-dev \
libgtest-dev libpng-dev libsqlite3-dev libssl-dev libjpeg-dev \
zlib1g-dev libdcmtk-dev libboost-all-dev libwrap0-dev \
libcharls-dev libjsoncpp-dev libpugixml-dev tzdata
# cd ./Build
# cmake -DALLOW_DOWNLOADS=ON \
-DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
-DUSE_SYSTEM_CIVETWEB=OFF \
-DCIVETWEB_OPENSSL_API=1.0 \
-DDCMTK_LIBRARIES=dcmjpls \
-DCMAKE_BUILD_TYPE=Release \
../OrthancServer/
# make
NB: Instructions to use clang and ninja:
# sudo apt-get install ninja-build
# cd ./Build
# CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -G Ninja \
-DALLOW_DOWNLOADS=ON \
-DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
-DUSE_SYSTEM_CIVETWEB=OFF \
-DDCMTK_LIBRARIES=dcmjpls \
-DCMAKE_BUILD_TYPE=Release \
../OrthancServer/
# ninja
SUPPORTED - Ubuntu 18.04 LTS
----------------------------
# sudo apt-get install build-essential unzip cmake mercurial patch \
uuid-dev libcurl4-openssl-dev liblua5.3-dev \
libgtest-dev libpng-dev libsqlite3-dev libssl-dev libjpeg-dev \
zlib1g-dev libdcmtk-dev libboost-all-dev libwrap0-dev \
libcharls-dev libjsoncpp-dev libpugixml-dev locales protobuf-compiler
# cd ./Build
# cmake -DALLOW_DOWNLOADS=ON \
-DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
-DUSE_SYSTEM_CIVETWEB=OFF \
-DDCMTK_LIBRARIES=dcmjpls \
-DCMAKE_BUILD_TYPE=Release \
../OrthancServer/
# make
NB: A suitable environment for locales can be setup as follows:
# echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
# locale-gen
SUPPORTED - Fedora 20-22
------------------------
# sudo yum install unzip make automake gcc gcc-c++ python cmake \
boost-devel curl-devel dcmtk-devel \
gtest-devel libpng-devel libsqlite3x-devel libuuid-devel jpeg-devel \
mongoose-devel openssl-devel jsoncpp-devel lua-devel pugixml-devel
You will also have to install "gflags-devel" on Fedora 21&22:
# sudo yum install gflags-devel
# cd ./Build
# cmake "-DDCMTK_LIBRARIES=CharLS" \
-DCIVETWEB_OPENSSL_API=1.0 \
-DENABLE_CIVETWEB=OFF \
-DSYSTEM_MONGOOSE_USE_CALLBACKS=OFF \
-DCMAKE_BUILD_TYPE=Release \
../OrthancServer/
# make
Note: Have also a look at the official package:
http://pkgs.fedoraproject.org/cgit/orthanc.git/tree/?h=f18
SUPPORTED - FreeBSD 10.1
------------------------
# pkg install jsoncpp pugixml lua51 curl googletest dcmtk cmake jpeg \
e2fsprogs-libuuid boost-libs sqlite3 python libiconv
# cd ./Build
# cmake -DALLOW_DOWNLOADS=ON \
-DUSE_SYSTEM_CIVETWEB=OFF \
-DDCMTK_LIBRARIES="dcmdsig;charls;dcmjpls" \
-DCMAKE_BUILD_TYPE=Release \
../OrthancServer/
# make
Other GNU/Linux distributions?
------------------------------
Don't hesitate to send us your build instructions (by a mail to
s.jodogne@orthanc-labs.com)!
The file "./Resources/OldBuildInstructions.txt" contains build
instructions that once worked for older versions of Orthanc or older
GNU/Linux distributions, but are not tested anymore. Even if they may
not work anymore as such, they can serve as a basis.
You can find build instructions for Orthanc up to 0.7.0 on the
following Wiki page:
https://orthanc.uclouvain.be/book/faq/compiling-old.html
These instructions will not work as such beyond Orthanc 0.7.0, but
they might give indications.
Additional information
----------------------
* It has been reported that distributions coming with Boost >= 1.70.0
might need the option "-DBoost_NO_BOOST_CMAKE=ON" to be added to the
"cmake" command line.
https://groups.google.com/d/msg/orthanc-users/nXq2qOndw9c/0PGnaOqiAgAJ
* Starting with Orthanc 1.10.0, if you use a distribution with an old
version of gcc (typically gcc 4.8 on CentOS), you might have to add
the option "-DCMAKE_CXX_FLAGS=-std=c++11" when invoking the "cmake"
command line. This flag was previously automatically added, but this
feature was removed according to the following discussion:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000222
Using ccache
============
Under GNU/Linux, you also have the opportunity to use "ccache" to
dramatically decrease the compilation time when rebuilding
Orthanc. This is especially useful for developers. To this end, you
would use:
# CC="ccache gcc" CXX="ccache g++" cmake ../OrthancServer/ [Other Options]

2860
NEWS Normal file

File diff suppressed because it is too large Load Diff

166
OrthancFramework/COPYING Normal file
View File

@ -0,0 +1,166 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://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.

View File

@ -0,0 +1,80 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
set(EMBED_RESOURCES_PYTHON "${CMAKE_CURRENT_LIST_DIR}/../EmbedResources.py"
CACHE INTERNAL "Path to the EmbedResources.py script from Orthanc")
set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
set(AUTOGENERATED_SOURCES)
file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
include_directories(${AUTOGENERATED_DIR})
macro(EmbedResources)
# Convert a semicolon separated list to a whitespace separated string
set(SCRIPT_OPTIONS)
set(SCRIPT_ARGUMENTS)
set(DEPENDENCIES)
set(IS_PATH_NAME false)
set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
# Loop over the arguments of the function
foreach(arg ${ARGN})
# Extract the first character of the argument
string(SUBSTRING "${arg}" 0 1 FIRST_CHAR)
if (${FIRST_CHAR} STREQUAL "-")
# If the argument starts with a dash "-", this is an option to
# EmbedResources.py
if (${arg} MATCHES "--target=.*")
# Does the argument starts with "--target="?
string(SUBSTRING "${arg}" 9 -1 TARGET) # 9 is the length of "--target="
set(TARGET_BASE "${AUTOGENERATED_DIR}/${TARGET}")
else()
list(APPEND SCRIPT_OPTIONS ${arg})
endif()
else()
if (${IS_PATH_NAME})
list(APPEND SCRIPT_ARGUMENTS "${arg}")
list(APPEND DEPENDENCIES "${arg}")
set(IS_PATH_NAME false)
else()
list(APPEND SCRIPT_ARGUMENTS "${arg}")
set(IS_PATH_NAME true)
endif()
endif()
endforeach()
add_custom_command(
OUTPUT
"${TARGET_BASE}.h"
"${TARGET_BASE}.cpp"
COMMAND ${PYTHON_EXECUTABLE} ${EMBED_RESOURCES_PYTHON}
${SCRIPT_OPTIONS} "${TARGET_BASE}" ${SCRIPT_ARGUMENTS}
DEPENDS
${EMBED_RESOURCES_PYTHON}
${DEPENDENCIES}
)
list(APPEND AUTOGENERATED_SOURCES
"${TARGET_BASE}.cpp"
)
endmacro()

View File

@ -0,0 +1,451 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_BOOST)
set(BOOST_STATIC 1)
else()
# https://cmake.org/cmake/help/latest/policy/CMP0167.html
if (CMAKE_VERSION VERSION_GREATER "3.30")
find_package(Boost CONFIG)
else()
include(FindBoost)
endif()
set(BOOST_STATIC 0)
#set(Boost_DEBUG 1)
#set(Boost_USE_STATIC_LIBS ON)
if (ENABLE_LOCALE)
list(APPEND ORTHANC_BOOST_COMPONENTS locale)
endif()
list(APPEND ORTHANC_BOOST_COMPONENTS filesystem thread system date_time regex iostreams)
find_package(Boost COMPONENTS ${ORTHANC_BOOST_COMPONENTS})
if (NOT Boost_FOUND)
foreach (item ${ORTHANC_BOOST_COMPONENTS})
string(TOUPPER ${item} tmp)
if (Boost_${tmp}_FOUND)
set(tmp2 "found")
else()
set(tmp2 "missing")
endif()
message("Boost component ${item} - ${tmp2}")
endforeach()
message(FATAL_ERROR "Unable to locate Boost on this system")
endif()
# Patch by xnox to fix issue #166 (CMake find_boost version is now
# broken with newer boost/cmake)
# https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=166
if (POLICY CMP0093)
set(BOOST144 1.44)
else()
set(BOOST144 104400)
endif()
# Boost releases 1.44 through 1.47 supply both V2 and V3 filesystem
# http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/index.htm
if (${Boost_VERSION} LESS ${BOOST144})
add_definitions(
-DBOOST_HAS_FILESYSTEM_V3=0
)
else()
add_definitions(
-DBOOST_HAS_FILESYSTEM_V3=1
-DBOOST_FILESYSTEM_VERSION=3
)
endif()
include_directories(${Boost_INCLUDE_DIRS})
link_libraries(${Boost_LIBRARIES})
endif()
if (BOOST_STATIC AND USE_LEGACY_BOOST)
include(${CMAKE_CURRENT_LIST_DIR}/BoostConfigurationStatic-1.69.0.cmake)
endif()
if (BOOST_STATIC AND NOT USE_LEGACY_BOOST)
##
## Parameters for static compilation of Boost
##
set(BOOST_NAME boost_1_86_0)
set(BOOST_VERSION 1.86.0)
set(BOOST_BCP_SUFFIX bcpdigest-1.12.5)
set(BOOST_MD5 "20b9c325c0dde830889ee75a9e64ded8")
set(BOOST_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz")
set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME})
if (IS_DIRECTORY "${BOOST_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${BOOST_MD5} ${BOOST_URL} "${BOOST_SOURCES_DIR}")
##
## Apply the patches to remove threads from boost::locale (required
## since around Emscripten 3.x)
##
if (FirstRun)
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/boost-1.86.0-emscripten.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
##
## Generic configuration of Boost
##
if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-isystem ${BOOST_SOURCES_DIR})
endif()
include_directories(
BEFORE
${BOOST_SOURCES_DIR}
${BOOST_SOURCES_DIR}/libs/atomic/src/
${BOOST_SOURCES_DIR}/libs/locale/src/
)
if (ORTHANC_BUILDING_FRAMEWORK_LIBRARY)
add_definitions(
# Packaging Boost inside the Orthanc Framework DLL
-DBOOST_ALL_DYN_LINK # Expose Boost symbols into the DLL
-DBOOST_THREAD_BUILD_DLL
-DBOOST_REGEX_BUILD_DLL
-DBOOST_IOSTREAMS_SOURCE
)
else()
add_definitions(
# Static build of Boost (this was the only possibility in
# Orthanc <= 1.7.1)
-DBOOST_ALL_NO_LIB
-DBOOST_ALL_NOLIB
-DBOOST_DATE_TIME_NO_LIB
-DBOOST_THREAD_BUILD_LIB
-DBOOST_PROGRAM_OPTIONS_NO_LIB
-DBOOST_REGEX_NO_LIB
-DBOOST_SYSTEM_NO_LIB
-DBOOST_LOCALE_NO_LIB
)
endif()
add_definitions(
# In static builds, explicitly prevent Boost from using the system
# locale in lexical casts. This is notably important if
# "boost::lexical_cast<double>()" is applied to strings containing
# "," instead of "." as decimal separators. Check out function
# "OrthancStone::LinearAlgebra::ParseVector()".
-DBOOST_LEXICAL_CAST_ASSUME_C_LOCALE
# Those definitions are necessary since Boost 1.80.0
# https://github.com/RGLab/cytolib/issues/49
-DBOOST_NO_AUTO_PTR
-DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF
-DBOOST_FILESYSTEM_HAS_POSIX_AT_APIS
)
set(BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
)
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase" OR
"${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
add_definitions(
-DBOOST_SYSTEM_USE_STRERROR=1
)
endif()
##
## Configuration of boost::thread
##
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR
CMAKE_SYSTEM_NAME STREQUAL "Android")
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/atomic/src/lock_pool.cpp
${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
)
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase" OR
CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl64")
add_definitions(-DBOOST_HAS_SCHED_YIELD=1)
endif()
# Fix for error: "boost_1_69_0/boost/chrono/detail/inlined/mac/thread_clock.hpp:54:28:
# error: use of undeclared identifier 'pthread_mach_thread_np'"
# https://github.com/envoyproxy/envoy/pull/1785
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions(-D_DARWIN_C_SOURCE=1)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp
${BOOST_SOURCES_DIR}/libs/thread/src/win32/thread.cpp
${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_pe.cpp
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
# No support for threads in asm.js/WebAssembly
else()
message(FATAL_ERROR "Support your platform here")
endif()
##
## Configuration of boost::regex
##
aux_source_directory(${BOOST_SOURCES_DIR}/libs/regex/src BOOST_REGEX_SOURCES)
list(APPEND BOOST_SOURCES
${BOOST_REGEX_SOURCES}
)
##
## Configuration of boost::datetime
##
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp
)
##
## Configuration of boost::filesystem and boost::iostreams
##
if (CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR
CMAKE_SYSTEM_NAME STREQUAL "Android")
# boost::filesystem is not available on PNaCl
add_definitions(
-DBOOST_HAS_FILESYSTEM_V3=0
-D__INTEGRITY=1
)
else()
add_definitions(
-DBOOST_HAS_FILESYSTEM_V3=1
)
list(APPEND BOOST_SOURCES
${BOOST_NAME}/libs/filesystem/src/codecvt_error_category.cpp
${BOOST_NAME}/libs/filesystem/src/directory.cpp
${BOOST_NAME}/libs/filesystem/src/exception.cpp
${BOOST_NAME}/libs/filesystem/src/operations.cpp
${BOOST_NAME}/libs/filesystem/src/path.cpp
${BOOST_NAME}/libs/filesystem/src/path_traits.cpp
${BOOST_NAME}/libs/filesystem/src/portability.cpp
${BOOST_NAME}/libs/filesystem/src/unique_path.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/filesystem/src/utf8_codecvt_facet.cpp
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND BOOST_SOURCES
${BOOST_NAME}/libs/filesystem/src/windows_file_codecvt.cpp
)
endif()
endif()
list(APPEND BOOST_SOURCES
${BOOST_NAME}/libs/iostreams/src/file_descriptor.cpp
)
##
## Configuration of boost::locale
##
if (NOT ENABLE_LOCALE)
message("boost::locale is disabled")
else()
set(BOOST_ICU_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/boundary.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/codecvt.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/collator.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/conversion.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/date_time.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/formatter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/formatters_cache.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/icu_backend.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/numeric.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/icu/time_zone.cpp
)
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/encoding/codepage.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/shared/date_time.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/shared/formatting.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/shared/generator.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/shared/iconv_codecvt.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/shared/ids.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/shared/localization_backend.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/shared/message.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/shared/mo_lambda.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/util/codecvt_converter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/util/default_locale.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/util/encoding.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/util/gregorian.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/util/info.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/util/locale_data.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
CMAKE_SYSTEM_VERSION STREQUAL "LinuxStandardBase")
add_definitions(
-DBOOST_LOCALE_NO_WINAPI_BACKEND=1
-DBOOST_LOCALE_NO_POSIX_BACKEND=1
)
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/std/codecvt.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/std/collate.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/std/converter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/std/numeric.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/std/std_backend.cpp
)
if (BOOST_LOCALE_BACKEND STREQUAL "gcc" OR
BOOST_LOCALE_BACKEND STREQUAL "libiconv")
add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
else()
message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR
CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # For WebAssembly or asm.js
add_definitions(
-DBOOST_LOCALE_NO_WINAPI_BACKEND=1
-DBOOST_LOCALE_NO_STD_BACKEND=1
)
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/posix/codecvt.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/posix/collate.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/posix/converter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/posix/numeric.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/posix/posix_backend.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR
BOOST_LOCALE_BACKEND STREQUAL "gcc" OR
BOOST_LOCALE_BACKEND STREQUAL "libiconv")
# In WebAssembly or asm.js, we rely on the version of iconv
# that is shipped with the stdlib
add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
else()
message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_definitions(
-DBOOST_LOCALE_NO_POSIX_BACKEND=1
-DBOOST_LOCALE_NO_STD_BACKEND=1
)
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/win32/collate.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/win32/converter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/win32/lcid.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/win32/numeric.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/boost/locale/win32/win_backend.cpp
)
# Starting with release 0.8.2, Orthanc statically links against
# libiconv on Windows. Indeed, the "WCONV" library of Windows XP
# seems not to support properly several codepages (notably
# "Latin3", "Hebrew", and "Arabic"). Set "BOOST_LOCALE_BACKEND"
# to "wconv" to use WCONV anyway.
if (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
elseif (BOOST_LOCALE_BACKEND STREQUAL "wconv")
message("Using Window's wconv")
add_definitions(-DBOOST_LOCALE_WITH_WCONV=1)
else()
message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND on Windows: ${BOOST_LOCALE_BACKEND}")
endif()
else()
message(FATAL_ERROR "Support your platform here")
endif()
endif()
source_group(ThirdParty\\boost REGULAR_EXPRESSION ${BOOST_SOURCES_DIR}/.*)
endif()

View File

@ -0,0 +1,73 @@
#!/bin/bash
set -e
set -u
## Starting with version 0.6.2, Orthanc is shipped with a subset of the
## Boost libraries that is generated with the BCP tool:
##
## http://www.boost.org/doc/libs/1_54_0/tools/bcp/doc/html/index.html
##
## This script generates this subset.
##
## History:
## - Orthanc between 0.6.2 and 0.7.3: Boost 1.54.0
## - Orthanc between 0.7.4 and 0.9.1: Boost 1.55.0
## - Orthanc between 0.9.2 and 0.9.4: Boost 1.58.0
## - Orthanc between 0.9.5 and 1.0.0: Boost 1.59.0
## - Orthanc between 1.1.0 and 1.2.0: Boost 1.60.0
## - Orthanc 1.3.0: Boost 1.64.0
## - Orthanc 1.3.1: Boost 1.65.1
## - Orthanc 1.3.2: Boost 1.66.0
## - Orthanc between 1.4.0 and 1.4.2: Boost 1.67.0
## - Orthanc between 1.5.0 and 1.5.4: Boost 1.68.0
## - Orthanc between 1.5.5 and 1.11.1: Boost 1.69.0
## - Orthanc between 1.11.2 and 1.12.0: Boost 1.80.0
## - Orthanc 1.12.1: Boost 1.82.0
## - Orthanc 1.12.2: Boost 1.83.0
## - Orthanc 1.12.3: Boost 1.84.0
## - Orthanc > 1.12.3: Boost 1.85.0
## - Orthanc 1.12.5: Boost 1.86.0
BOOST_VERSION=1_86_0
ORTHANC_VERSION=1.12.5
rm -rf /tmp/boost_${BOOST_VERSION}
rm -rf /tmp/bcp/boost_${BOOST_VERSION}
cd /tmp
echo "Uncompressing the sources of Boost ${BOOST_VERSION}..."
tar xfz ./boost_${BOOST_VERSION}.tar.gz
echo "Generating the subset..."
mkdir -p /tmp/bcp/boost_${BOOST_VERSION}
bcp --boost=/tmp/boost_${BOOST_VERSION} thread system locale date_time filesystem math/special_functions algorithm uuid atomic iostreams program_options numeric/ublas geometry polygon signals2 chrono /tmp/bcp/boost_${BOOST_VERSION}
echo "Removing documentation..."
rm -rf /tmp/bcp/boost_${BOOST_VERSION}/libs/locale/doc/html
rm -rf /tmp/bcp/boost_${BOOST_VERSION}/libs/algorithm/doc/html
rm -rf /tmp/bcp/boost_${BOOST_VERSION}/libs/geometry/doc/html
rm -rf /tmp/bcp/boost_${BOOST_VERSION}/libs/geometry/doc/doxy/doxygen_output/html
rm -rf /tmp/bcp/boost_${BOOST_VERSION}/libs/filesystem/example/
# https://stackoverflow.com/questions/1655372/longest-line-in-a-file
LONGEST_FILENAME=`find /tmp/bcp/ | awk '{print length, $0}' | sort -nr | head -1`
LONGEST=`echo "$LONGEST_FILENAME" | cut -d ' ' -f 1`
echo
echo "Longest filename (${LONGEST} characters):"
echo "${LONGEST_FILENAME}"
echo
if [ ${LONGEST} -ge 128 ]; then
echo "ERROR: Too long filename for Windows!"
echo
exit -1
fi
echo "Compressing the subset..."
cd /tmp/bcp
tar cfz boost_${BOOST_VERSION}_bcpdigest-${ORTHANC_VERSION}.tar.gz boost_${BOOST_VERSION}
ls -l boost_${BOOST_VERSION}_bcpdigest-${ORTHANC_VERSION}.tar.gz
md5sum boost_${BOOST_VERSION}_bcpdigest-${ORTHANC_VERSION}.tar.gz
readlink -f boost_${BOOST_VERSION}_bcpdigest-${ORTHANC_VERSION}.tar.gz

View File

@ -0,0 +1,361 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (BOOST_STATIC)
##
## Parameters for static compilation of Boost
##
set(BOOST_NAME boost_1_69_0)
set(BOOST_VERSION 1.69.0)
set(BOOST_BCP_SUFFIX bcpdigest-1.5.6)
set(BOOST_MD5 "579bccc0ea4d1a261c1d0c5e27446c3d")
set(BOOST_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz")
set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME})
if (IS_DIRECTORY "${BOOST_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${BOOST_MD5} ${BOOST_URL} "${BOOST_SOURCES_DIR}")
##
## Patching boost
##
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/boost-${BOOST_VERSION}-linux-standard-base.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (FirstRun AND Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
##
## Generic configuration of Boost
##
if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-isystem ${BOOST_SOURCES_DIR})
endif()
include_directories(
BEFORE ${BOOST_SOURCES_DIR}
)
if (ORTHANC_BUILDING_FRAMEWORK_LIBRARY)
add_definitions(
# Packaging Boost inside the Orthanc Framework DLL
-DBOOST_ALL_DYN_LINK # Expose Boost symbols into the DLL
-DBOOST_THREAD_BUILD_DLL
-DBOOST_REGEX_BUILD_DLL
-DBOOST_IOSTREAMS_SOURCE
)
else()
add_definitions(
# Static build of Boost (this was the only possibility in
# Orthanc <= 1.7.1)
-DBOOST_ALL_NO_LIB
-DBOOST_ALL_NOLIB
-DBOOST_DATE_TIME_NO_LIB
-DBOOST_THREAD_BUILD_LIB
-DBOOST_PROGRAM_OPTIONS_NO_LIB
-DBOOST_REGEX_NO_LIB
-DBOOST_SYSTEM_NO_LIB
-DBOOST_LOCALE_NO_LIB
)
endif()
add_definitions(
# In static builds, explicitly prevent Boost from using the system
# locale in lexical casts. This is notably important if
# "boost::lexical_cast<double>()" is applied to strings containing
# "," instead of "." as decimal separators. Check out function
# "OrthancStone::LinearAlgebra::ParseVector()".
-DBOOST_LEXICAL_CAST_ASSUME_C_LOCALE
)
set(BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
)
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase" OR
"${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
add_definitions(
-DBOOST_SYSTEM_USE_STRERROR=1
)
endif()
##
## Configuration of boost::thread
##
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR
CMAKE_SYSTEM_NAME STREQUAL "Android")
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/atomic/src/lockpool.cpp
${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
)
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase" OR
CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl64")
add_definitions(-DBOOST_HAS_SCHED_YIELD=1)
endif()
# Fix for error: "boost_1_69_0/boost/chrono/detail/inlined/mac/thread_clock.hpp:54:28:
# error: use of undeclared identifier 'pthread_mach_thread_np'"
# https://github.com/envoyproxy/envoy/pull/1785
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions(-D_DARWIN_C_SOURCE=1)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp
${BOOST_SOURCES_DIR}/libs/thread/src/win32/thread.cpp
${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_pe.cpp
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
# No support for threads in asm.js/WebAssembly
else()
message(FATAL_ERROR "Support your platform here")
endif()
##
## Configuration of boost::regex
##
aux_source_directory(${BOOST_SOURCES_DIR}/libs/regex/src BOOST_REGEX_SOURCES)
list(APPEND BOOST_SOURCES
${BOOST_REGEX_SOURCES}
)
##
## Configuration of boost::datetime
##
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp
)
##
## Configuration of boost::filesystem and boost::iostreams
##
if (CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR
CMAKE_SYSTEM_NAME STREQUAL "Android")
# boost::filesystem is not available on PNaCl
add_definitions(
-DBOOST_HAS_FILESYSTEM_V3=0
-D__INTEGRITY=1
)
else()
add_definitions(
-DBOOST_HAS_FILESYSTEM_V3=1
)
list(APPEND BOOST_SOURCES
${BOOST_NAME}/libs/filesystem/src/codecvt_error_category.cpp
${BOOST_NAME}/libs/filesystem/src/operations.cpp
${BOOST_NAME}/libs/filesystem/src/path.cpp
${BOOST_NAME}/libs/filesystem/src/path_traits.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/filesystem/src/utf8_codecvt_facet.cpp
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND BOOST_SOURCES
${BOOST_NAME}/libs/filesystem/src/windows_file_codecvt.cpp
)
endif()
endif()
list(APPEND BOOST_SOURCES
${BOOST_NAME}/libs/iostreams/src/file_descriptor.cpp
)
##
## Configuration of boost::locale
##
if (NOT ENABLE_LOCALE)
message("boost::locale is disabled")
else()
set(BOOST_ICU_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/icu/boundary.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/icu/codecvt.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/icu/collator.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/icu/conversion.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/icu/date_time.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/icu/formatter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/icu/icu_backend.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/icu/numeric.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/icu/time_zone.cpp
)
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/shared/generator.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/shared/date_time.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/shared/formatting.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/shared/ids.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/shared/localization_backend.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/shared/message.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/shared/mo_lambda.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/util/codecvt_converter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/util/default_locale.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/util/gregorian.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/util/info.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/util/locale_data.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
CMAKE_SYSTEM_VERSION STREQUAL "LinuxStandardBase")
add_definitions(
-DBOOST_LOCALE_NO_WINAPI_BACKEND=1
-DBOOST_LOCALE_NO_POSIX_BACKEND=1
)
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/std/codecvt.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/std/collate.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/std/converter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/std/numeric.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/std/std_backend.cpp
)
if (BOOST_LOCALE_BACKEND STREQUAL "gcc" OR
BOOST_LOCALE_BACKEND STREQUAL "libiconv")
add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
else()
message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "PNaCl" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR
CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # For WebAssembly or asm.js
add_definitions(
-DBOOST_LOCALE_NO_WINAPI_BACKEND=1
-DBOOST_LOCALE_NO_STD_BACKEND=1
)
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/posix/codecvt.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/posix/collate.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/posix/converter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/posix/numeric.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/posix/posix_backend.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR
BOOST_LOCALE_BACKEND STREQUAL "gcc" OR
BOOST_LOCALE_BACKEND STREQUAL "libiconv")
# In WebAssembly or asm.js, we rely on the version of iconv
# that is shipped with the stdlib
add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
else()
message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_definitions(
-DBOOST_LOCALE_NO_POSIX_BACKEND=1
-DBOOST_LOCALE_NO_STD_BACKEND=1
)
list(APPEND BOOST_SOURCES
${BOOST_SOURCES_DIR}/libs/locale/src/win32/collate.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/win32/converter.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/win32/lcid.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/win32/numeric.cpp
${BOOST_SOURCES_DIR}/libs/locale/src/win32/win_backend.cpp
)
# Starting with release 0.8.2, Orthanc statically links against
# libiconv on Windows. Indeed, the "WCONV" library of Windows XP
# seems not to support properly several codepages (notably
# "Latin3", "Hebrew", and "Arabic"). Set "BOOST_LOCALE_BACKEND"
# to "wconv" to use WCONV anyway.
if (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
elseif (BOOST_LOCALE_BACKEND STREQUAL "wconv")
message("Using Window's wconv")
add_definitions(-DBOOST_LOCALE_WITH_WCONV=1)
else()
message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND on Windows: ${BOOST_LOCALE_BACKEND}")
endif()
else()
message(FATAL_ERROR "Support your platform here")
endif()
endif()
source_group(ThirdParty\\boost REGULAR_EXPRESSION ${BOOST_SOURCES_DIR}/.*)
endif()

View File

@ -0,0 +1,143 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_CIVETWEB)
## WARNING: "civetweb-1.14.tar.gz" comes with a subfolder
## "civetweb-1.14/test/nonlatin" that cannot be removed by "hg purge
## --all" on Windows hosts. We thus created a custom
## "civetweb-1.14-fixed.tar.gz" as follows:
##
## $ cd /tmp
## $ wget https://orthanc.uclouvain.be/downloads/third-party-downloads/civetweb-1.14.tar.gz
## $ tar xvf civetweb-1.14.tar.gz
## $ rm -rf civetweb-1.14/src/third_party/ civetweb-1.14/test/
## $ tar cvfz civetweb-1.14-fixed.tar.gz civetweb-1.14
##
set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.14)
set(CIVETWEB_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/civetweb-1.14-fixed.tar.gz")
set(CIVETWEB_MD5 "1f25d516b7a4e65d8b270d1cc399e0a9")
if (IS_DIRECTORY "${CIVETWEB_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${CIVETWEB_MD5} ${CIVETWEB_URL} "${CIVETWEB_SOURCES_DIR}")
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/civetweb-1.14.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (FirstRun AND Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
include_directories(
${CIVETWEB_SOURCES_DIR}/include
)
set(CIVETWEB_SOURCES
${CIVETWEB_SOURCES_DIR}/src/civetweb.c
)
# New in Orthanc 1.6.0: Enable support of compression in civetweb
set(tmp "USE_ZLIB=1")
if (ENABLE_SSL)
add_definitions(
-DNO_SSL_DL=1
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
link_libraries(dl)
endif()
if (CIVETWEB_OPENSSL_API STREQUAL "1.0")
set(tmp "${tmp};OPENSSL_API_1_0=1")
elseif (CIVETWEB_OPENSSL_API STREQUAL "1.1")
set(tmp "${tmp};OPENSSL_API_1_1=1")
else()
message(FATAL_ERROR "Unsupported value for CIVETWEB_OPENSSL_API: ${CIVETWEB_OPENSSL_API}")
endif()
else()
add_definitions(
-DNO_SSL=1 # Remove SSL support from civetweb
)
endif()
set_source_files_properties(
${CIVETWEB_SOURCES}
PROPERTIES COMPILE_DEFINITIONS "${tmp}"
)
source_group(ThirdParty\\Civetweb REGULAR_EXPRESSION ${CIVETWEB_SOURCES_DIR}/.*)
add_definitions(
-DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1
-DCIVETWEB_HAS_WEBDAV_WRITING=1
)
else()
CHECK_INCLUDE_FILE_CXX(civetweb.h HAVE_CIVETWEB_H)
if (NOT HAVE_CIVETWEB_H)
message(FATAL_ERROR "Please install the libcivetweb-dev package")
endif()
cmake_reset_check_state()
set(CMAKE_REQUIRED_LIBRARIES dl pthread)
CHECK_LIBRARY_EXISTS(civetweb mg_start "" HAVE_CIVETWEB_LIB)
if (NOT HAVE_CIVETWEB_LIB)
message(FATAL_ERROR "Please install the libcivetweb-dev package")
endif()
link_libraries(civetweb)
# Check whether the system distribution of civetweb contains the
# patch "../Patches/civetweb-1.13.patch" that allows to disable
# keep-alive on selected HTTP connections. This is useful to speed
# up multipart transfers, as encountered in DICOMweb.
CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1) # From "../Patches/civetweb-1.13.patch"
CHECK_LIBRARY_EXISTS(civetweb mg_disable_connection_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2) # From civetweb >= 1.14
if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1 OR
CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2)
add_definitions(
-DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1
-DCIVETWEB_HAS_WEBDAV_WRITING=1
)
message("Performance: Your system-wide distribution of civetweb is configured for best performance")
else()
message(WARNING "Performance: Your system-wide distribution of civetweb does not feature the mg_disable_keep_alive() function, and WebDAV will only be available for read-only access")
add_definitions(
-DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0
-DCIVETWEB_HAS_WEBDAV_WRITING=0
)
endif()
unset(CMAKE_REQUIRED_LIBRARIES) # This reset must be after "CHECK_LIBRARY_EXISTS"
endif()

View File

@ -0,0 +1,315 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
# This file sets all the compiler-related flags
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
# Since Orthanc 1.12.7 that allows CMake 4.0, builds for macOS
# require the C++ standard to be explicitly set to C++11. Do *not*
# do this on GNU/Linux, as third-party system libraries could have
# been compiled with higher versions of the C++ standard.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
# Save the current compiler flags to the cache every time cmake configures the project
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "compiler flags" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "compiler flags" FORCE)
include(CheckLibraryExists)
if ((CMAKE_CROSSCOMPILING AND NOT
"${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") OR
"${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
# Cross-compilation necessarily implies standalone and static build
SET(STATIC_BUILD ON)
SET(STANDALONE_BUILD ON)
endif()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
# Cache the environment variables "LSB_CC" and "LSB_CXX" for further
# use by "ExternalProject" in CMake
SET(CMAKE_LSB_CC $ENV{LSB_CC} CACHE STRING "")
SET(CMAKE_LSB_CXX $ENV{LSB_CXX} CACHE STRING "")
# This is necessary to build "Orthanc mainline - Framework LSB
# Release" on "buildbot-worker-debian11"
set(LSB_PTHREAD_NONSHARED "${LSB_PATH}/lib64-${LSB_TARGET_VERSION}/libpthread_nonshared.a")
if (EXISTS ${LSB_PTHREAD_NONSHARED})
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LSB_PTHREAD_NONSHARED}")
endif()
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long")
# --std=c99 makes libcurl not to compile
# -pedantic gives a lot of warnings on OpenSSL
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -Wno-variadic-macros")
if (CMAKE_CROSSCOMPILING)
# http://stackoverflow.com/a/3543845/881731
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -I<CMAKE_CURRENT_SOURCE_DIR> <SOURCE> <OBJECT>")
endif()
elseif (MSVC)
# Use static runtime under Visual Studio
# http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace
# http://stackoverflow.com/a/6510446
foreach(flag_var
CMAKE_C_FLAGS_DEBUG
CMAKE_CXX_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
# Add /Zm256 compiler option to Visual Studio to fix PCH errors
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm256")
# New in Orthanc 1.5.5
if (MSVC_MULTIPLE_PROCESSES)
# "If you omit the processMax argument in the /MP option, the
# compiler obtains the number of effective processors from the
# operating system, and then creates one process per effective
# processor"
# https://blog.kitware.com/cmake-building-with-all-your-cores/
# https://docs.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
add_definitions(
-D_CRT_SECURE_NO_WARNINGS=1
-D_CRT_SECURE_NO_DEPRECATE=1
)
if (MSVC_VERSION LESS 1600)
# Starting with Visual Studio >= 2010 (i.e. macro _MSC_VER >=
# 1600), Microsoft ships a standard-compliant <stdint.h>
# header. For earlier versions of Visual Studio, give access to a
# compatibility header.
# http://stackoverflow.com/a/70630/881731
# https://en.wikibooks.org/wiki/C_Programming/C_Reference/stdint.h#External_links
include_directories(${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/VisualStudio)
endif()
link_libraries(netapi32)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
# In FreeBSD/OpenBSD, the "/usr/local/" folder contains the ports and need to be imported
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/local/include")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L/usr/local/lib")
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
if (# NOT ${CMAKE_SYSTEM_VERSION} STREQUAL "LinuxStandardBase" AND
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
# The "--no-undefined" linker flag makes the shared libraries
# (plugins ModalityWorklists and ServeFolders) fail to compile on
# OpenBSD, and make the PostgreSQL plugin complain about missing
# "environ" global variable in FreeBSD.
#
# TODO - Furthermore, on Linux Standard Base running on Debian 12,
# the "-Wl,--no-undefined" seems to break the compilation (added
# after Orthanc 1.12.2). This is disabled for now.
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
endif()
# Remove the "-rdynamic" option
# http://www.mail-archive.com/cmake@cmake.org/msg08837.html
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
link_libraries(pthread)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
link_libraries(rt)
endif()
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
link_libraries(dl)
endif()
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
# The "--as-needed" linker flag is not available on FreeBSD and OpenBSD
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
endif()
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
# FreeBSD/OpenBSD have just one single interface for file
# handling, which is 64bit clean, so there is no need to define macro
# for LFS (Large File Support).
# https://ohse.de/uwe/articles/lfs.html
add_definitions(
-D_LARGEFILE64_SOURCE=1
-D_FILE_OFFSET_BITS=64
)
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if (MSVC)
message("MSVC compiler version = " ${MSVC_VERSION} "\n")
# Starting Visual Studio 2013 (version 1800), it is not possible
# to target Windows XP anymore
if (MSVC_VERSION LESS 1800)
add_definitions(
-DWINVER=0x0501
-D_WIN32_WINNT=0x0501
)
endif()
else()
add_definitions(
-DWINVER=0x0501
-D_WIN32_WINNT=0x0501
)
endif()
add_definitions(
-D_CRT_SECURE_NO_WARNINGS=1
)
link_libraries(rpcrt4 ws2_32 iphlpapi) # "iphlpapi" is for "SystemToolbox::GetMacAddresses()"
if (CMAKE_COMPILER_IS_GNUCXX)
# Some additional C/C++ compiler flags for MinGW
SET(MINGW_NO_WARNINGS "-Wno-unused-function -Wno-unused-variable")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MINGW_NO_WARNINGS} -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MINGW_NO_WARNINGS}")
if (DYNAMIC_MINGW_STDLIB)
else()
# This is a patch for MinGW64
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
endif()
CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD)
if (HAVE_WIN_PTHREAD)
if (DYNAMIC_MINGW_STDLIB)
else()
# This line is necessary to compile with recent versions of MinGW,
# otherwise "libwinpthread-1.dll" is not statically linked.
SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
endif()
add_definitions(-DHAVE_WIN_PTHREAD=1)
else()
add_definitions(-DHAVE_WIN_PTHREAD=0)
endif()
endif()
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
# fix this error that appears with recent compilers on MacOS: boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for this enumeration type [-Wenum-constexpr-conversion]
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-enum-constexpr-conversion")
add_definitions(
-D_XOPEN_SOURCE=1
)
# Linking with iconv breaks the Universal builds on modern compilers
# link_libraries(iconv)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
message("Building using Emscripten (for WebAssembly or asm.js targets)")
include(${CMAKE_CURRENT_LIST_DIR}/EmscriptenParameters.cmake)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Android")
else()
message("Unknown target platform: ${CMAKE_SYSTEM_NAME}")
message(FATAL_ERROR "Support your platform here")
endif()
if (DEFINED ENABLE_PROFILING AND ENABLE_PROFILING)
if (CMAKE_COMPILER_IS_GNUCXX OR
CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pg")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
else()
message(FATAL_ERROR "Don't know how to enable profiling on your configuration")
endif()
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
# "When creating a static library using binutils (ar) and there
# exist a duplicate object name (e.g. a/Foo.cpp.o, b/Foo.cpp.o), the
# resulting static library can end up having only one of the
# duplicate objects. [...] This bug only happens if there are many
# objects." The trick consists in replacing the "r" argument
# ("replace") provided to "ar" (as used in CMake < 3.1) by the "q"
# argument ("quick append"). This is because of the fact that CMake
# will invoke "ar" several times with several batches of ".o"
# objects, and using "r" would overwrite symbols defined in
# preceding batches. https://cmake.org/Bug/view.php?id=14874
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> <LINK_FLAGS> q <TARGET> <OBJECTS>")
endif()
# This function defines macro "__ORTHANC_FILE__" as a replacement to
# macro "__FILE__", as the latter leaks the full path of the source
# files in the binaries
# https://stackoverflow.com/questions/8487986/file-macro-shows-full-path
# https://twitter.com/wget42/status/1676877802375634944?s=20
function(DefineSourceBasenameForTarget targetname)
# Microsoft Visual Studio is extremely slow if using
# "set_property()", we only enable this feature for gcc and clang
if (CMAKE_COMPILER_IS_GNUCXX OR
CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
get_target_property(source_files "${targetname}" SOURCES)
foreach(sourcefile ${source_files})
get_filename_component(basename "${sourcefile}" NAME)
set_property(
SOURCE "${sourcefile}" APPEND
PROPERTY COMPILE_DEFINITIONS "__ORTHANC_FILE__=\"${basename}\"")
endforeach()
endif()
endfunction()

View File

@ -0,0 +1,335 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (NOT DEFINED ENABLE_DCMTK_NETWORKING)
set(ENABLE_DCMTK_NETWORKING ON)
endif()
if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK)
if (DCMTK_STATIC_VERSION STREQUAL "3.6.0")
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.0.cmake)
elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.2")
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.2.cmake)
elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.4")
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.4.cmake)
elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.5")
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.5.cmake)
elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.6")
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.6.cmake)
elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.7")
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.7.cmake)
elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.8")
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.8.cmake)
elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.9")
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.9.cmake)
else()
message(FATAL_ERROR "Unsupported version of DCMTK: ${DCMTK_STATIC_VERSION}")
endif()
##
## Commands shared by all versions of DCMTK
##
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES)
LIST(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/ofstd/libsrc/offilsys.cc
${DCMTK_SOURCES_DIR}/ofstd/libsrc/ofwhere.c # Needed since DCMTK 3.6.9
)
endif()
if (ENABLE_DCMTK_NETWORKING)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES)
include_directories(
${DCMTK_SOURCES_DIR}/dcmnet/include
)
endif()
if (ENABLE_DCMTK_TRANSCODING)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmimgle/libsrc DCMTK_SOURCES)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmimage/libsrc DCMTK_SOURCES)
include_directories(
${DCMTK_SOURCES_DIR}/dcmimage/include
)
endif()
if (ENABLE_DCMTK_TRANSCODING OR ENABLE_DCMTK_JPEG OR ENABLE_DCMTK_JPEG_LOSSLESS)
include_directories(
${DCMTK_SOURCES_DIR}/dcmimgle/include
)
endif()
if (ENABLE_DCMTK_JPEG)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 DCMTK_SOURCES)
include_directories(
${DCMTK_SOURCES_DIR}/dcmjpeg/include
${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8
${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12
${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16
)
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc
# Solves linking problem in WebAssembly: "wasm-ld: error:
# duplicate symbol: jaritab" (modification in Orthanc 1.5.9)
${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8/jaricom.c
${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12/jaricom.c
${DCMTK_SOURCES_DIR}/dcmjpeg/libijg24/jaricom.c
)
if (NOT ENABLE_DCMTK_TRANSCODING)
list(REMOVE_ITEM DCMTK_SOURCES
# Disable support for encoding JPEG (modification in Orthanc 1.0.1)
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djcodece.cc
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsv1.cc
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencbas.cc
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencpro.cc
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djenclol.cc
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencode.cc
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencext.cc
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsps.cc
)
endif()
endif()
if (ENABLE_DCMTK_JPEG_LOSSLESS)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libsrc DCMTK_SOURCES)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libcharls DCMTK_SOURCES)
include_directories(
${DCMTK_SOURCES_DIR}/dcmjpeg/include
${DCMTK_SOURCES_DIR}/dcmjpls/include
${DCMTK_SOURCES_DIR}/dcmjpls/libcharls
)
list(APPEND DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc
)
if (NOT ENABLE_DCMTK_TRANSCODING)
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc
# Disable support for encoding JPEG-LS (modification in Orthanc 1.0.1)
${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djencode.cc
)
endif()
endif()
# New in Orthanc 1.9.0 for DICOM TLS
if (ENABLE_DCMTK_NETWORKING AND ENABLE_SSL)
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmtls/libsrc DCMTK_SOURCES)
include_directories(
${DCMTK_SOURCES_DIR}/dcmtls/include
)
if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL)
# The function "SSL_CTX_get0_param()" is available on both
# OpenSSL 1.0.x and 1.1.x that are used for static builds
set(HAVE_SSL_CTX_GET0_PARAM ON)
else()
# The call below requires "OpenSslConfiguration.cmake" to have
# been included beforehand (which is automatically done if using
# "OrthancFrameworkConfiguration.cmake")
CHECK_LIBRARY_EXISTS(ssl "SSL_CTX_get0_param" "" HAVE_SSL_CTX_GET0_PARAM)
endif()
if (HAVE_SSL_CTX_GET0_PARAM)
message("Have SSL_CTX_get0_param(): yes")
add_definitions(-DHAVE_SSL_CTX_GET0_PARAM=1)
else()
message("Have SSL_CTX_get0_param(): no")
endif()
add_definitions(-DWITH_OPENSSL=1)
endif()
# This fixes crashes related to the destruction of the DCMTK OFLogger
# http://support.dcmtk.org/docs-snapshot/file_macros.html
add_definitions(
-DLOG4CPLUS_DISABLE_FATAL=1
-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}
)
if (NOT ENABLE_DCMTK_LOG)
# Disable logging internal to DCMTK
# https://groups.google.com/d/msg/orthanc-users/v2SzzAmY948/VxT1QVGiBAAJ
add_definitions(
-DDCMTK_LOG4CPLUS_DISABLE_FATAL=1
-DDCMTK_LOG4CPLUS_DISABLE_ERROR=1
-DDCMTK_LOG4CPLUS_DISABLE_WARN=1
-DDCMTK_LOG4CPLUS_DISABLE_INFO=1
-DDCMTK_LOG4CPLUS_DISABLE_DEBUG=1
)
endif()
include_directories(
#${DCMTK_SOURCES_DIR}
${DCMTK_SOURCES_DIR}/config/include
${DCMTK_SOURCES_DIR}/ofstd/include
${DCMTK_SOURCES_DIR}/oflog/include
${DCMTK_SOURCES_DIR}/dcmdata/include
)
source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*)
if (STANDALONE_BUILD)
set(DCMTK_USE_EMBEDDED_DICTIONARIES 1)
set(DCMTK_DICTIONARIES
DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic
DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic
DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic
)
else()
set(DCMTK_USE_EMBEDDED_DICTIONARIES 0)
endif()
else()
if (CMAKE_CROSSCOMPILING AND
"${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg")
CHECK_INCLUDE_FILE_CXX(dcmtk/dcmdata/dcfilefo.h HAVE_DCMTK_H)
if (NOT HAVE_DCMTK_H)
message(FATAL_ERROR "Please install the libdcmtk-dev package")
endif()
CHECK_LIBRARY_EXISTS(dcmdata "dcmDataDict" "" HAVE_DCMTK_LIB)
if (NOT HAVE_DCMTK_LIB)
message(FATAL_ERROR "Please install the libdcmtk package")
endif()
find_path(DCMTK_INCLUDE_DIRS dcmtk/config/osconfig.h
/usr/include
)
link_libraries(dcmdata dcmnet dcmjpeg oflog ofstd)
else()
# The following line allows one to manually add libraries at the
# command-line, which is necessary for Ubuntu/Debian packages
set(tmp "${DCMTK_LIBRARIES}")
include(FindDCMTK)
list(APPEND DCMTK_LIBRARIES "${tmp}")
include_directories(${DCMTK_INCLUDE_DIRS})
endif()
add_definitions(
-DHAVE_CONFIG_H=1
)
if (EXISTS "${DCMTK_config_INCLUDE_DIR}/cfunix.h")
set(DCMTK_CONFIGURATION_FILE "${DCMTK_config_INCLUDE_DIR}/cfunix.h")
elseif (EXISTS "${DCMTK_config_INCLUDE_DIR}/osconfig.h") # This is for Arch Linux
set(DCMTK_CONFIGURATION_FILE "${DCMTK_config_INCLUDE_DIR}/osconfig.h")
elseif (EXISTS "${DCMTK_INCLUDE_DIRS}/dcmtk/config/osconfig.h") # This is for Debian Buster
set(DCMTK_CONFIGURATION_FILE "${DCMTK_INCLUDE_DIRS}/dcmtk/config/osconfig.h")
else()
message(FATAL_ERROR "Please install libdcmtk*-dev")
endif()
message("DCMTK configuration file: ${DCMTK_CONFIGURATION_FILE}")
# Autodetection of the version of DCMTK
file(STRINGS
"${DCMTK_CONFIGURATION_FILE}"
DCMTK_VERSION_NUMBER1 REGEX
".*PACKAGE_VERSION .*")
string(REGEX REPLACE
".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$"
"\\1\\2\\3"
DCMTK_VERSION_NUMBER
${DCMTK_VERSION_NUMBER1})
set(DCMTK_USE_EMBEDDED_DICTIONARIES 0)
endif()
add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER})
message("DCMTK version: ${DCMTK_VERSION_NUMBER}")
add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=${DCMTK_USE_EMBEDDED_DICTIONARIES})
if (NOT DCMTK_USE_EMBEDDED_DICTIONARIES)
# Lookup for DICOM dictionaries, if none is specified by the user
if (DCMTK_DICTIONARY_DIR STREQUAL "")
find_path(DCMTK_DICTIONARY_DIR_AUTO dicom.dic
/usr/share/dcmtk
/usr/share/dcmtk-3.6.8
/usr/share/dcmtk-3.6.9
/usr/share/libdcmtk1
/usr/share/libdcmtk2
/usr/share/libdcmtk3
/usr/share/libdcmtk4
/usr/share/libdcmtk5
/usr/share/libdcmtk6
/usr/share/libdcmtk7
/usr/share/libdcmtk8
/usr/share/libdcmtk9
/usr/share/libdcmtk10
/usr/share/libdcmtk11
/usr/share/libdcmtk12
/usr/share/libdcmtk13
/usr/share/libdcmtk14
/usr/share/libdcmtk15
/usr/share/libdcmtk16
/usr/share/libdcmtk17
/usr/share/libdcmtk18
/usr/share/libdcmtk19
/usr/share/libdcmtk20
/usr/local/share/dcmtk
/usr/local/share/dcmtk-3.6.8
)
if (${DCMTK_DICTIONARY_DIR_AUTO} MATCHES "DCMTK_DICTIONARY_DIR_AUTO-NOTFOUND")
message(FATAL_ERROR "Cannot locate the DICOM dictionary on this system")
endif()
if (CMAKE_CROSSCOMPILING AND
"${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg")
# Remove the sysroot prefix
file(RELATIVE_PATH tmp ${CMAKE_FIND_ROOT_PATH} ${DCMTK_DICTIONARY_DIR_AUTO})
set(DCMTK_DICTIONARY_DIR_AUTO /${tmp} CACHE INTERNAL "")
endif()
message("Autodetected path to the DICOM dictionaries: ${DCMTK_DICTIONARY_DIR_AUTO}")
add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR_AUTO}")
else()
add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR}")
endif()
endif()

View File

@ -0,0 +1,197 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(DCMTK_VERSION_NUMBER 360)
SET(DCMTK_PACKAGE_VERSION "3.6.0")
SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.0.zip")
SET(DCMTK_MD5 "219ad631b82031806147e4abbfba4fa4")
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
# If using DCMTK 3.6.0, backport the "private.dic" file from DCMTK
# 3.6.2. This adds support for more private tags, and fixes some
# import problems with Philips MRI Achieva.
if (USE_DCMTK_362_PRIVATE_DIC)
message("Using the dictionary of private tags from DCMTK 3.6.2")
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.2-private.dic
${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic
COPYONLY)
else()
message("Using the dictionary of private tags from DCMTK 3.6.0")
endif()
# Patches specific to DCMTK 3.6.0
message("Applying patch to solve vulnerability in DCMTK 3.6.0")
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.0-dulparse-vulnerability.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
# This patch is not needed anymore thanks to the following commit
# (information sent by Jorg Riesmeier on Twitter on 2017-07-19):
# http://git.dcmtk.org/?p=dcmtk.git;a=commit;h=8df1f5e517b8629ae09088d0935c2a8dd333c76f
message("Applying patch for speed in DCMTK 3.6.0")
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.0-speed.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
else()
message("The patches for DCMTK have already been applied")
endif()
# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
IF (CMAKE_CROSSCOMPILING)
if (CMAKE_COMPILER_IS_GNUCXX AND
CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW
SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js
# Check out "../WebAssembly/ArithmeticTests/" to regenerate the
# "arith.h" file
configure_file(
${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
COPYONLY)
UNSET(C_CHAR_UNSIGNED CACHE)
SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
else()
message(FATAL_ERROR "Support your platform here")
endif()
ENDIF()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.2-linux-standard-base.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (FirstRun AND Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or
# asm.js The macros below are not properly discovered by DCMTK
# when using WebAssembly. Check out "../WebAssembly/arith.h" for
# how we produced these values. This step MUST be after
# "GenerateDCMTKConfigure" and before the generation of
# "osconfig.h".
UNSET(SIZEOF_VOID_P CACHE)
UNSET(SIZEOF_CHAR CACHE)
UNSET(SIZEOF_DOUBLE CACHE)
UNSET(SIZEOF_FLOAT CACHE)
UNSET(SIZEOF_INT CACHE)
UNSET(SIZEOF_LONG CACHE)
UNSET(SIZEOF_SHORT CACHE)
UNSET(SIZEOF_VOID_P CACHE)
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "")
SET(SIZEOF_FLOAT 4 CACHE INTERNAL "")
SET(SIZEOF_INT 4 CACHE INTERNAL "")
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
endif()
set(DCMTK_PACKAGE_VERSION_SUFFIX "")
set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
CONFIGURE_FILE(
${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
# Source for the logging facility of DCMTK
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
)
if (CMAKE_COMPILER_IS_GNUCXX)
# This is a patch for DCMTK 3.6.0 and MinGW64
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.0-mingw64.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure AND FirstRun)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
endif()

View File

@ -0,0 +1,216 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(DCMTK_VERSION_NUMBER 362)
SET(DCMTK_PACKAGE_VERSION "3.6.2")
SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.2)
SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.2.tar.gz")
SET(DCMTK_MD5 "d219a4152772985191c9b89d75302d12")
macro(DCMTK_UNSET)
endmacro()
macro(DCMTK_UNSET_CACHE)
endmacro()
set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js
else()
set(DCMTK_WITH_THREADS ON)
endif()
add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
# "3.6.2 CXX11 fails on Linux; patch suggestions included"
# https://forum.dcmtk.org/viewtopic.php?f=3&t=4637
message("Applying patch to detect mathematic primitives in DCMTK 3.6.2 with C++11")
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.2.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
COPYONLY)
else()
message("The patches for DCMTK have already been applied")
endif()
# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
IF (CMAKE_CROSSCOMPILING)
if (CMAKE_COMPILER_IS_GNUCXX AND
CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW
SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js
# Check out "../WebAssembly/ArithmeticTests/" to regenerate the
# "arith.h" file
configure_file(
${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
COPYONLY)
UNSET(C_CHAR_UNSIGNED CACHE)
SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
else()
message(FATAL_ERROR "Support your platform here")
endif()
ENDIF()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
if (FirstRun)
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.2-linux-standard-base.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
endif()
SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or
# asm.js The macros below are not properly discovered by DCMTK
# when using WebAssembly. Check out "../WebAssembly/arith.h" for
# how we produced these values. This step MUST be after
# "GenerateDCMTKConfigure" and before the generation of
# "osconfig.h".
UNSET(SIZEOF_VOID_P CACHE)
UNSET(SIZEOF_CHAR CACHE)
UNSET(SIZEOF_DOUBLE CACHE)
UNSET(SIZEOF_FLOAT CACHE)
UNSET(SIZEOF_INT CACHE)
UNSET(SIZEOF_LONG CACHE)
UNSET(SIZEOF_SHORT CACHE)
UNSET(SIZEOF_VOID_P CACHE)
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "")
SET(SIZEOF_FLOAT 4 CACHE INTERNAL "")
SET(SIZEOF_INT 4 CACHE INTERNAL "")
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
endif()
set(DCMTK_PACKAGE_VERSION_SUFFIX "")
set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
CONFIGURE_FILE(
${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
link_libraries(netapi32) # For NetWkstaUserGetInfo@12
link_libraries(iphlpapi) # For GetAdaptersInfo@8
# Configure Wine if cross-compiling for Windows
if (CMAKE_COMPILER_IS_GNUCXX)
include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
FIND_PROGRAM(WINE_WINE_PROGRAM wine)
FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
endif()
endif()
# This step must be after the generation of "osconfig.h"
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
endif()
# Source for the logging facility of DCMTK
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
)
endif()
#set_source_files_properties(${DCMTK_SOURCES}
# PROPERTIES COMPILE_DEFINITIONS
# "PACKAGE_VERSION=\"${DCMTK_PACKAGE_VERSION}\";PACKAGE_VERSION_NUMBER=\"${DCMTK_VERSION_NUMBER}\"")
# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
# default since this does not seem to be appropriate (anymore) for
# most modern operating systems. In order to change this default, the
# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
# be defined to change this setting at compilation time (see
# macros.txt for details).
# https://forum.dcmtk.org/viewtopic.php?t=4632
add_definitions(
-DDISABLE_NAGLE_ALGORITHM=1
)

View File

@ -0,0 +1,201 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(DCMTK_VERSION_NUMBER 364)
SET(DCMTK_PACKAGE_VERSION "3.6.4")
SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.4)
SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.4.tar.gz")
SET(DCMTK_MD5 "97597439a2ae7a39086066318db5f3bc")
macro(DCMTK_UNSET)
endmacro()
macro(DCMTK_UNSET_CACHE)
endmacro()
set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js
else()
set(DCMTK_WITH_THREADS ON)
endif()
add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.4.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
COPYONLY)
else()
message("The patches for DCMTK have already been applied")
endif()
include_directories(
${DCMTK_SOURCES_DIR}/dcmiod/include
)
# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
IF (CMAKE_CROSSCOMPILING)
if (CMAKE_COMPILER_IS_GNUCXX AND
CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW
SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js
# Check out "../WebAssembly/ArithmeticTests/" to regenerate the
# "arith.h" file
configure_file(
${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
COPYONLY)
UNSET(C_CHAR_UNSIGNED CACHE)
SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
else()
message(FATAL_ERROR "Support your platform here")
endif()
ENDIF()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
endif()
SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or
# asm.js The macros below are not properly discovered by DCMTK
# when using WebAssembly. Check out "../WebAssembly/arith.h" for
# how we produced these values. This step MUST be after
# "GenerateDCMTKConfigure" and before the generation of
# "osconfig.h".
UNSET(SIZEOF_VOID_P CACHE)
UNSET(SIZEOF_CHAR CACHE)
UNSET(SIZEOF_DOUBLE CACHE)
UNSET(SIZEOF_FLOAT CACHE)
UNSET(SIZEOF_INT CACHE)
UNSET(SIZEOF_LONG CACHE)
UNSET(SIZEOF_SHORT CACHE)
UNSET(SIZEOF_VOID_P CACHE)
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "")
SET(SIZEOF_FLOAT 4 CACHE INTERNAL "")
SET(SIZEOF_INT 4 CACHE INTERNAL "")
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
endif()
set(DCMTK_PACKAGE_VERSION_SUFFIX "")
set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
CONFIGURE_FILE(
${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
link_libraries(netapi32) # For NetWkstaUserGetInfo@12
link_libraries(iphlpapi) # For GetAdaptersInfo@8
# Configure Wine if cross-compiling for Windows
if (CMAKE_COMPILER_IS_GNUCXX)
include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
FIND_PROGRAM(WINE_WINE_PROGRAM wine)
FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
endif()
endif()
# This step must be after the generation of "osconfig.h"
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
endif()
# Source for the logging facility of DCMTK
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
)
endif()
# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
# default since this does not seem to be appropriate (anymore) for
# most modern operating systems. In order to change this default, the
# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
# be defined to change this setting at compilation time (see
# macros.txt for details).
# https://forum.dcmtk.org/viewtopic.php?t=4632
add_definitions(
-DDISABLE_NAGLE_ALGORITHM=1
)

View File

@ -0,0 +1,226 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(DCMTK_VERSION_NUMBER 365)
SET(DCMTK_PACKAGE_VERSION "3.6.5")
SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.5)
SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.5.tar.gz")
SET(DCMTK_MD5 "e19707f64ee5695c496b9c1e48e39d07")
macro(DCMTK_UNSET)
endmacro()
macro(DCMTK_UNSET_CACHE)
endmacro()
set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js
else()
set(DCMTK_WITH_THREADS ON)
endif()
add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.5.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
COPYONLY)
else()
message("The patches for DCMTK have already been applied")
endif()
include_directories(
${DCMTK_SOURCES_DIR}/dcmiod/include
)
# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
IF (CMAKE_CROSSCOMPILING)
if (CMAKE_COMPILER_IS_GNUCXX AND
CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW
SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js
# Check out "../WebAssembly/ArithmeticTests/" to regenerate the
# "arith.h" file
configure_file(
${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
COPYONLY)
UNSET(C_CHAR_UNSIGNED CACHE)
SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
else()
message(FATAL_ERROR "Support your platform here")
endif()
ENDIF()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
endif()
SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or
# asm.js The macros below are not properly discovered by DCMTK
# when using WebAssembly. Check out "../WebAssembly/arith.h" for
# how we produced these values. This step MUST be after
# "GenerateDCMTKConfigure" and before the generation of
# "osconfig.h".
UNSET(SIZEOF_VOID_P CACHE)
UNSET(SIZEOF_CHAR CACHE)
UNSET(SIZEOF_DOUBLE CACHE)
UNSET(SIZEOF_FLOAT CACHE)
UNSET(SIZEOF_INT CACHE)
UNSET(SIZEOF_LONG CACHE)
UNSET(SIZEOF_SHORT CACHE)
UNSET(SIZEOF_VOID_P CACHE)
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "")
SET(SIZEOF_FLOAT 4 CACHE INTERNAL "")
SET(SIZEOF_INT 4 CACHE INTERNAL "")
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
endif()
set(DCMTK_PACKAGE_VERSION_SUFFIX "")
set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
CONFIGURE_FILE(
${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
link_libraries(netapi32) # For NetWkstaUserGetInfo@12
link_libraries(iphlpapi) # For GetAdaptersInfo@8
# Configure Wine if cross-compiling for Windows
if (CMAKE_COMPILER_IS_GNUCXX)
include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
FIND_PROGRAM(WINE_WINE_PROGRAM wine)
FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
endif()
endif()
# This step must be after the generation of "osconfig.h"
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
endif()
# Source for the logging facility of DCMTK
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
)
endif()
# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
# default since this does not seem to be appropriate (anymore) for
# most modern operating systems. In order to change this default, the
# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
# be defined to change this setting at compilation time (see
# macros.txt for details).
# https://forum.dcmtk.org/viewtopic.php?t=4632
add_definitions(
-DDISABLE_NAGLE_ALGORITHM=1
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# For compatibility with Windows XP, avoid using fiber-local-storage
# in log4cplus, but use thread-local-storage instead. Otherwise,
# Windows XP complains about missing "FlsGetValue()" in KERNEL32.dll
add_definitions(
-DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS
)
if (CMAKE_COMPILER_IS_GNUCXX OR # MinGW
"${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # MSVC for 32bit (*)
# (*) With multithreaded logging enabled, Visual Studio 2008 fails
# with error: ".\dcmtk-3.6.5\oflog\libsrc\globinit.cc(422) : error
# C2664: 'dcmtk::log4cplus::thread::impl::tls_init' : cannot
# convert parameter 1 from 'void (__stdcall *)(void *)' to
# 'dcmtk::log4cplus::thread::impl::tls_init_cleanup_func_type'"
# None of the functions with this name in scope match the target type
add_definitions(
-DDCMTK_LOG4CPLUS_SINGLE_THREADED
)
endif()
endif()

View File

@ -0,0 +1,226 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(DCMTK_VERSION_NUMBER 366)
SET(DCMTK_PACKAGE_VERSION "3.6.6")
SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.6)
SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.6.tar.gz")
SET(DCMTK_MD5 "f815879d315b916366a9da71339c7575")
macro(DCMTK_UNSET)
endmacro()
macro(DCMTK_UNSET_CACHE)
endmacro()
set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js
else()
set(DCMTK_WITH_THREADS ON)
endif()
add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.6.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
COPYONLY)
else()
message("The patches for DCMTK have already been applied")
endif()
include_directories(
${DCMTK_SOURCES_DIR}/dcmiod/include
)
# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
IF (CMAKE_CROSSCOMPILING)
if (CMAKE_COMPILER_IS_GNUCXX AND
CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW
SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js
# Check out "../WebAssembly/ArithmeticTests/" to regenerate the
# "arith.h" file
configure_file(
${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
COPYONLY)
UNSET(C_CHAR_UNSIGNED CACHE)
SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
else()
message(FATAL_ERROR "Support your platform here")
endif()
ENDIF()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
endif()
SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or
# asm.js The macros below are not properly discovered by DCMTK
# when using WebAssembly. Check out "../WebAssembly/arith.h" for
# how we produced these values. This step MUST be after
# "GenerateDCMTKConfigure" and before the generation of
# "osconfig.h".
UNSET(SIZEOF_VOID_P CACHE)
UNSET(SIZEOF_CHAR CACHE)
UNSET(SIZEOF_DOUBLE CACHE)
UNSET(SIZEOF_FLOAT CACHE)
UNSET(SIZEOF_INT CACHE)
UNSET(SIZEOF_LONG CACHE)
UNSET(SIZEOF_SHORT CACHE)
UNSET(SIZEOF_VOID_P CACHE)
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "")
SET(SIZEOF_FLOAT 4 CACHE INTERNAL "")
SET(SIZEOF_INT 4 CACHE INTERNAL "")
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
endif()
set(DCMTK_PACKAGE_VERSION_SUFFIX "")
set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
CONFIGURE_FILE(
${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
link_libraries(netapi32) # For NetWkstaUserGetInfo@12
link_libraries(iphlpapi) # For GetAdaptersInfo@8
# Configure Wine if cross-compiling for Windows
if (CMAKE_COMPILER_IS_GNUCXX)
include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
FIND_PROGRAM(WINE_WINE_PROGRAM wine)
FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
endif()
endif()
# This step must be after the generation of "osconfig.h"
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
endif()
# Source for the logging facility of DCMTK
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
)
endif()
# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
# default since this does not seem to be appropriate (anymore) for
# most modern operating systems. In order to change this default, the
# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
# be defined to change this setting at compilation time (see
# macros.txt for details).
# https://forum.dcmtk.org/viewtopic.php?t=4632
add_definitions(
-DDISABLE_NAGLE_ALGORITHM=1
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# For compatibility with Windows XP, avoid using fiber-local-storage
# in log4cplus, but use thread-local-storage instead. Otherwise,
# Windows XP complains about missing "FlsGetValue()" in KERNEL32.dll
add_definitions(
-DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS
)
if (CMAKE_COMPILER_IS_GNUCXX OR # MinGW
"${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # MSVC for 32bit (*)
# (*) With multithreaded logging enabled, Visual Studio 2008 fails
# with error: ".\dcmtk-3.6.6\oflog\libsrc\globinit.cc(422) : error
# C2664: 'dcmtk::log4cplus::thread::impl::tls_init' : cannot
# convert parameter 1 from 'void (__stdcall *)(void *)' to
# 'dcmtk::log4cplus::thread::impl::tls_init_cleanup_func_type'"
# None of the functions with this name in scope match the target type
add_definitions(
-DDCMTK_LOG4CPLUS_SINGLE_THREADED
)
endif()
endif()

View File

@ -0,0 +1,272 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(DCMTK_VERSION_NUMBER 367)
SET(DCMTK_PACKAGE_VERSION "3.6.7")
SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.7)
SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.7.tar.gz")
SET(DCMTK_MD5 "e4d519bb315ec3944f3f1d61df465cbd")
macro(DCMTK_UNSET)
endmacro()
macro(DCMTK_UNSET_CACHE)
endmacro()
set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js
else()
set(DCMTK_WITH_THREADS ON)
endif()
add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.7.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
if (MSVC)
# Older versions of Microsoft Visual Studio (notably MSVC2008)
# don't like void usage of function arguments in C source files,
# in order to avoid a warning about unused arguments. This patch
# removes such usages that were not present in DCMTK <= 3.6.6.
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.7-visual-studio.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
COPYONLY)
else()
message("The patches for DCMTK have already been applied")
endif()
include_directories(
${DCMTK_SOURCES_DIR}/dcmiod/include
)
# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
IF (CMAKE_CROSSCOMPILING)
if (CMAKE_COMPILER_IS_GNUCXX AND
CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW
SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js
# Check out "../WebAssembly/ArithmeticTests/" to regenerate the
# "arith.h" file
configure_file(
${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
COPYONLY)
UNSET(C_CHAR_UNSIGNED CACHE)
SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
else()
message(FATAL_ERROR "Support your platform here")
endif()
ENDIF()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
endif()
SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or
# asm.js The macros below are not properly discovered by DCMTK
# when using WebAssembly. Check out "../WebAssembly/arith.h" for
# how we produced these values. This step MUST be after
# "GenerateDCMTKConfigure" and before the generation of
# "osconfig.h".
UNSET(SIZEOF_VOID_P CACHE)
UNSET(SIZEOF_CHAR CACHE)
UNSET(SIZEOF_DOUBLE CACHE)
UNSET(SIZEOF_FLOAT CACHE)
UNSET(SIZEOF_INT CACHE)
UNSET(SIZEOF_LONG CACHE)
UNSET(SIZEOF_SHORT CACHE)
UNSET(SIZEOF_VOID_P CACHE)
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "")
SET(SIZEOF_FLOAT 4 CACHE INTERNAL "")
SET(SIZEOF_INT 4 CACHE INTERNAL "")
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
endif()
set(DCMTK_PACKAGE_VERSION_SUFFIX "")
set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
# For the dcmtls module, necessary since DCMTK 3.6.7 (cf. file
# "dcmtls/libsrc/tlslayer.cc"). This must be done before the
# invokation of "configure_file()"!
if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL)
# The "CHECK_FUNCTIONWITHHEADER_EXISTS()" provided by DCMTK only
# works with the system-wide version of OpenSSL. If statically
# linking against OpenSSL, we manually provide information about
# OpenSSL 3.0.x
set(HAVE_OPENSSL_PROTOTYPE_DH_BITS 1)
set(HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS 1)
set(HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID 1)
set(HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM 1)
else()
CHECK_FUNCTIONWITHHEADER_EXISTS("DH_bits" "openssl/dh.h" HAVE_OPENSSL_PROTOTYPE_DH_BITS)
CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_base_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_cert_store" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_ciphers" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS)
CHECK_FUNCTIONWITHHEADER_EXISTS("X509_STORE_get0_param" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM)
CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get_signature_nid" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID)
endif()
CONFIGURE_FILE(
${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
link_libraries(netapi32) # For NetWkstaUserGetInfo@12
link_libraries(iphlpapi) # For GetAdaptersInfo@8
# Configure Wine if cross-compiling for Windows
if (CMAKE_COMPILER_IS_GNUCXX)
include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
FIND_PROGRAM(WINE_WINE_PROGRAM wine)
FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
endif()
endif()
# This step must be after the generation of "osconfig.h"
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
endif()
# Source for the logging facility of DCMTK
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
)
endif()
# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
# default since this does not seem to be appropriate (anymore) for
# most modern operating systems. In order to change this default, the
# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
# be defined to change this setting at compilation time (see
# macros.txt for details).
# https://forum.dcmtk.org/viewtopic.php?t=4632
add_definitions(
-DDISABLE_NAGLE_ALGORITHM=1
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# For compatibility with Windows XP, avoid using fiber-local-storage
# in log4cplus, but use thread-local-storage instead. Otherwise,
# Windows XP complains about missing "FlsGetValue()" in KERNEL32.dll
add_definitions(
-DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS
)
if (CMAKE_COMPILER_IS_GNUCXX OR # MinGW
"${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # MSVC for 32bit (*)
# (*) With multithreaded logging enabled, Visual Studio 2008 fails
# with error: ".\dcmtk-3.6.7\oflog\libsrc\globinit.cc(422) : error
# C2664: 'dcmtk::log4cplus::thread::impl::tls_init' : cannot
# convert parameter 1 from 'void (__stdcall *)(void *)' to
# 'dcmtk::log4cplus::thread::impl::tls_init_cleanup_func_type'"
# None of the functions with this name in scope match the target type
add_definitions(
-DDCMTK_LOG4CPLUS_SINGLE_THREADED
)
endif()
endif()

View File

@ -0,0 +1,285 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(DCMTK_VERSION_NUMBER 368)
SET(DCMTK_PACKAGE_VERSION "3.6.8")
SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-DCMTK-3.6.8)
SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.8.tar.gz")
SET(DCMTK_MD5 "ce3e878c05165f1a3322c29e67f2426f")
macro(DCMTK_UNSET)
endmacro()
macro(DCMTK_UNSET_CACHE)
endmacro()
set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js
else()
set(DCMTK_WITH_THREADS ON)
endif()
add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.8.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
if (MSVC)
# Older versions of Microsoft Visual Studio (notably MSVC2008)
# don't like void usage of function arguments in C source files,
# in order to avoid a warning about unused arguments. This patch
# removes such usages that were not present in DCMTK <= 3.6.6.
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.8-visual-studio.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
COPYONLY)
else()
message("The patches for DCMTK have already been applied")
endif()
include_directories(
${DCMTK_SOURCES_DIR}/dcmiod/include
${DCMTK_SOURCES_DIR}/oficonv/include
)
# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
IF (CMAKE_CROSSCOMPILING)
if (CMAKE_COMPILER_IS_GNUCXX AND
CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW
SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js
# Check out "../WebAssembly/ArithmeticTests/" to regenerate the
# "arith.h" file
configure_file(
${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
COPYONLY)
UNSET(C_CHAR_UNSIGNED CACHE)
SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
else()
message(FATAL_ERROR "Support your platform here")
endif()
ENDIF()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
endif()
SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or
# asm.js The macros below are not properly discovered by DCMTK
# when using WebAssembly. Check out "../WebAssembly/arith.h" for
# how we produced these values. This step MUST be after
# "GenerateDCMTKConfigure" and before the generation of
# "osconfig.h".
UNSET(SIZEOF_VOID_P CACHE)
UNSET(SIZEOF_CHAR CACHE)
UNSET(SIZEOF_DOUBLE CACHE)
UNSET(SIZEOF_FLOAT CACHE)
UNSET(SIZEOF_INT CACHE)
UNSET(SIZEOF_LONG CACHE)
UNSET(SIZEOF_SHORT CACHE)
UNSET(SIZEOF_VOID_P CACHE)
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "")
SET(SIZEOF_FLOAT 4 CACHE INTERNAL "")
SET(SIZEOF_INT 4 CACHE INTERNAL "")
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
endif()
set(DCMTK_PACKAGE_VERSION_SUFFIX "")
set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
# For the dcmtls module, necessary since DCMTK 3.6.7 (cf. file
# "dcmtls/libsrc/tlslayer.cc"). This must be done before the
# invokation of "configure_file()"!
if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL)
# The "CHECK_FUNCTIONWITHHEADER_EXISTS()" provided by DCMTK only
# works with the system-wide version of OpenSSL. If statically
# linking against OpenSSL, we manually provide information about
# OpenSSL 3.0.x
set(HAVE_OPENSSL_PROTOTYPE_DH_BITS 1)
set(HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS 1)
set(HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID 1)
set(HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM 1)
else()
CHECK_FUNCTIONWITHHEADER_EXISTS("DH_bits" "openssl/dh.h" HAVE_OPENSSL_PROTOTYPE_DH_BITS)
CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_base_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_cert_store" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_ciphers" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS)
CHECK_FUNCTIONWITHHEADER_EXISTS("X509_STORE_get0_param" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM)
CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get_signature_nid" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID)
endif()
# "DCMTK_ENABLE_CHARSET_CONVERSION" is defined by "osconfig.h.in"
if (NOT DEFINED BOOST_LOCALE_BACKEND OR # This is the case if locale support is disabled (e.g. in Stone)
BOOST_LOCALE_BACKEND STREQUAL "gcc")
set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV" CACHE STRING "" FORCE)
elseif (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICONV" CACHE STRING "" FORCE)
elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICU" CACHE STRING "" FORCE)
else()
message(FATAL_ERROR "Invalid value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
endif()
CONFIGURE_FILE(
${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
link_libraries(netapi32) # For NetWkstaUserGetInfo@12
link_libraries(iphlpapi) # For GetAdaptersInfo@8
# Configure Wine if cross-compiling for Windows
if (CMAKE_COMPILER_IS_GNUCXX)
include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
FIND_PROGRAM(WINE_WINE_PROGRAM wine)
FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
endif()
endif()
# This step must be after the generation of "osconfig.h"
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
endif()
# Source for the logging facility of DCMTK
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
)
endif()
# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
# default since this does not seem to be appropriate (anymore) for
# most modern operating systems. In order to change this default, the
# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
# be defined to change this setting at compilation time (see
# macros.txt for details).
# https://forum.dcmtk.org/viewtopic.php?t=4632
add_definitions(
-DDISABLE_NAGLE_ALGORITHM=1
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# For compatibility with Windows XP, avoid using fiber-local-storage
# in log4cplus, but use thread-local-storage instead. Otherwise,
# Windows XP complains about missing "FlsGetValue()" in KERNEL32.dll
add_definitions(
-DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS
)
if (CMAKE_COMPILER_IS_GNUCXX OR # MinGW
"${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # MSVC for 32bit (*)
# (*) With multithreaded logging enabled, Visual Studio 2008 fails
# with error: ".\dcmtk-3.6.7\oflog\libsrc\globinit.cc(422) : error
# C2664: 'dcmtk::log4cplus::thread::impl::tls_init' : cannot
# convert parameter 1 from 'void (__stdcall *)(void *)' to
# 'dcmtk::log4cplus::thread::impl::tls_init_cleanup_func_type'"
# None of the functions with this name in scope match the target type
add_definitions(
-DDCMTK_LOG4CPLUS_SINGLE_THREADED
)
endif()
endif()

View File

@ -0,0 +1,309 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(DCMTK_VERSION_NUMBER 369)
SET(DCMTK_PACKAGE_VERSION "3.6.9")
SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.9)
SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.9.tar.gz")
SET(DCMTK_MD5 "cb30587f8da760c832a4f19d159acda5")
macro(DCMTK_UNSET)
endmacro()
macro(DCMTK_UNSET_CACHE)
endmacro()
set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js
else()
set(DCMTK_WITH_THREADS ON)
endif()
add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.9.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
if (MSVC)
# Older versions of Microsoft Visual Studio (notably MSVC2008)
# don't like void usage of function arguments in C source files,
# in order to avoid a warning about unused arguments. This patch
# removes such usages that were not present in DCMTK <= 3.6.6.
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.9-visual-studio.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc
${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
COPYONLY)
else()
message("The patches for DCMTK have already been applied")
endif()
include_directories(
${DCMTK_SOURCES_DIR}/dcmiod/include
${DCMTK_SOURCES_DIR}/oficonv/include
)
# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
IF (CMAKE_CROSSCOMPILING)
if (CMAKE_COMPILER_IS_GNUCXX AND
CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW
SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js
# Check out "../WebAssembly/ArithmeticTests/" to regenerate the
# "arith.h" file
configure_file(
${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
COPYONLY)
UNSET(C_CHAR_UNSIGNED CACHE)
SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
else()
message(FATAL_ERROR "Support your platform here")
endif()
ENDIF()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
endif()
SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
include(GNUInstallDirs) # Needed since DCMTK 3.6.9
include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or
# asm.js The macros below are not properly discovered by DCMTK
# when using WebAssembly. Check out "../WebAssembly/arith.h" for
# how we produced these values. This step MUST be after
# "GenerateDCMTKConfigure" and before the generation of
# "osconfig.h".
UNSET(SIZEOF_VOID_P CACHE)
UNSET(SIZEOF_CHAR CACHE)
UNSET(SIZEOF_DOUBLE CACHE)
UNSET(SIZEOF_FLOAT CACHE)
UNSET(SIZEOF_INT CACHE)
UNSET(SIZEOF_LONG CACHE)
UNSET(SIZEOF_SHORT CACHE)
UNSET(SIZEOF_VOID_P CACHE)
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "")
SET(SIZEOF_FLOAT 4 CACHE INTERNAL "")
SET(SIZEOF_INT 4 CACHE INTERNAL "")
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
SET(SIZEOF_VOID_P 4 CACHE INTERNAL "")
endif()
set(DCMTK_PACKAGE_VERSION_SUFFIX "")
set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
# For the dcmtls module, necessary since DCMTK 3.6.7 (cf. file
# "dcmtls/libsrc/tlslayer.cc"). This must be done before the
# invokation of "configure_file()"!
if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL)
# The "CHECK_FUNCTIONWITHHEADER_EXISTS()" provided by DCMTK only
# works with the system-wide version of OpenSSL. If statically
# linking against OpenSSL, we manually provide information about
# OpenSSL 3.0.x
set(HAVE_OPENSSL_PROTOTYPE_DH_BITS 1)
set(HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE 1)
set(HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS 1)
set(HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID 1)
set(HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM 1)
else()
CHECK_FUNCTIONWITHHEADER_EXISTS("DH_bits" "openssl/dh.h" HAVE_OPENSSL_PROTOTYPE_DH_BITS)
CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_base_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_cert_store" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE)
CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_ciphers" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS)
CHECK_FUNCTIONWITHHEADER_EXISTS("X509_STORE_get0_param" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM)
CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get_signature_nid" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID)
endif()
# "DCMTK_ENABLE_CHARSET_CONVERSION" is defined by "osconfig.h.in"
if (NOT DEFINED DCMTK_LOCALE_BACKEND OR # This is the case if locale support is disabled (e.g. in Stone)
DCMTK_LOCALE_BACKEND STREQUAL "gcc")
set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV" CACHE STRING "" FORCE)
elseif (DCMTK_LOCALE_BACKEND STREQUAL "libiconv")
set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICONV" CACHE STRING "" FORCE)
elseif (DCMTK_LOCALE_BACKEND STREQUAL "icu")
message(FATAL_ERROR "Support for ICU has been removed since DCMTK 3.6.9")
elseif (DCMTK_LOCALE_BACKEND STREQUAL "oficonv")
set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_OFICONV" CACHE STRING "" FORCE)
else()
message(FATAL_ERROR "Invalid value for DCMTK_LOCALE_BACKEND: ${DCMTK_LOCALE_BACKEND}")
endif()
# Enable support of the 1.2.840.10008.1.2.1.99 transfer syntax in
# static builds of Orthanc (Deflated Explicit VR Little
# Endian). Defining "WITH_ZLIB" is always OK, as zlib is part of the
# core dependencies of the Orthanc framework.
# https://discourse.orthanc-server.org/t/transcoding-to-deflated-transfer-syntax-fails/
set(WITH_ZLIB ON)
CONFIGURE_FILE(
${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
link_libraries(netapi32) # For NetWkstaUserGetInfo@12
link_libraries(iphlpapi) # For GetAdaptersInfo@8
# Configure Wine if cross-compiling for Windows
if (CMAKE_COMPILER_IS_GNUCXX)
include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
FIND_PROGRAM(WINE_WINE_PROGRAM wine)
FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
endif()
endif()
# This step must be after the generation of "osconfig.h" => Removed since DCMTK 3.6.9
#if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
# INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
#endif()
# Source for the logging facility of DCMTK
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(REMOVE_ITEM DCMTK_SOURCES
${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
)
endif()
# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
# default since this does not seem to be appropriate (anymore) for
# most modern operating systems. In order to change this default, the
# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
# be defined to change this setting at compilation time (see
# macros.txt for details).
# https://forum.dcmtk.org/viewtopic.php?t=4632
add_definitions(
-DDISABLE_NAGLE_ALGORITHM=1
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# For compatibility with Windows XP, avoid using fiber-local-storage
# in log4cplus, but use thread-local-storage instead. Otherwise,
# Windows XP complains about missing "FlsGetValue()" in KERNEL32.dll
add_definitions(
-DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS
)
if (CMAKE_COMPILER_IS_GNUCXX OR # MinGW
"${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # MSVC for 32bit (*)
# (*) With multithreaded logging enabled, Visual Studio 2008 fails
# with error: ".\dcmtk-3.6.7\oflog\libsrc\globinit.cc(422) : error
# C2664: 'dcmtk::log4cplus::thread::impl::tls_init' : cannot
# convert parameter 1 from 'void (__stdcall *)(void *)' to
# 'dcmtk::log4cplus::thread::impl::tls_init_cleanup_func_type'"
# None of the functions with this name in scope match the target type
add_definitions(
-DDCMTK_LOG4CPLUS_SINGLE_THREADED
)
endif()
if (CMAKE_COMPILER_IS_GNUCXX) # MinGW
# Necessary since DCMTK 3.6.9
add_definitions(
-DENABLE_OLD_OFSTD_FTOA_IMPLEMENTATION
-DENABLE_OLD_OFSTD_ATOF_IMPLEMENTATION
)
endif()
endif()
if (DCMTK_LOCALE_BACKEND STREQUAL "oficonv")
AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oficonv/libsrc DCMTK_SOURCES)
endif()

View File

@ -0,0 +1,592 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
##
## Check whether the parent script sets the mandatory variables
##
if (NOT DEFINED ORTHANC_FRAMEWORK_SOURCE OR
(NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system" AND
NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND
NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "web" AND
NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" AND
NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "path"))
message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"system\", \"hg\", \"web\", \"archive\" or \"path\"")
endif()
##
## Detection of the requested version
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR
ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR
ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
if (NOT DEFINED ORTHANC_FRAMEWORK_VERSION)
message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_VERSION must be set")
endif()
if (DEFINED ORTHANC_FRAMEWORK_MAJOR OR
DEFINED ORTHANC_FRAMEWORK_MINOR OR
DEFINED ORTHANC_FRAMEWORK_REVISION OR
DEFINED ORTHANC_FRAMEWORK_MD5)
message(FATAL_ERROR "Some internal variable has been set")
endif()
set(ORTHANC_FRAMEWORK_MD5 "")
if (NOT DEFINED ORTHANC_FRAMEWORK_BRANCH)
if (ORTHANC_FRAMEWORK_VERSION STREQUAL "mainline")
set(ORTHANC_FRAMEWORK_BRANCH "default")
set(ORTHANC_FRAMEWORK_MAJOR 999)
set(ORTHANC_FRAMEWORK_MINOR 999)
set(ORTHANC_FRAMEWORK_REVISION 999)
else()
set(ORTHANC_FRAMEWORK_BRANCH "Orthanc-${ORTHANC_FRAMEWORK_VERSION}")
set(RE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
string(REGEX REPLACE ${RE} "\\1" ORTHANC_FRAMEWORK_MAJOR ${ORTHANC_FRAMEWORK_VERSION})
string(REGEX REPLACE ${RE} "\\2" ORTHANC_FRAMEWORK_MINOR ${ORTHANC_FRAMEWORK_VERSION})
string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION})
if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR
NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR
NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$")
message("Bad version of the Orthanc framework, assuming a pre-release: ${ORTHANC_FRAMEWORK_VERSION}")
set(ORTHANC_FRAMEWORK_MAJOR 999)
set(ORTHANC_FRAMEWORK_MINOR 999)
set(ORTHANC_FRAMEWORK_REVISION 999)
endif()
if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1")
set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2")
set(ORTHANC_FRAMEWORK_MD5 "d0ccdf68e855d8224331f13774992750")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.0")
set(ORTHANC_FRAMEWORK_MD5 "81e15f34d97ac32bbd7d26e85698835a")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.1")
set(ORTHANC_FRAMEWORK_MD5 "9b6f6114264b17ed421b574cd6476127")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.2")
set(ORTHANC_FRAMEWORK_MD5 "d1ee84927dcf668e60eb5868d24b9394")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.0")
set(ORTHANC_FRAMEWORK_MD5 "4429d8d9dea4ff6648df80ec3c64d79e")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.1")
set(ORTHANC_FRAMEWORK_MD5 "099671538865e5da96208b37494d6718")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.2")
set(ORTHANC_FRAMEWORK_MD5 "8867050f3e9a1ce6157c1ea7a9433b1b")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.3")
set(ORTHANC_FRAMEWORK_MD5 "bf2f5ed1adb8b0fc5f10d278e68e1dfe")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.4")
set(ORTHANC_FRAMEWORK_MD5 "404baef5d4c43e7c5d9410edda8ef5a5")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.5")
set(ORTHANC_FRAMEWORK_MD5 "cfc437e0687ae4bd725fd93dc1f08bc4")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.6")
set(ORTHANC_FRAMEWORK_MD5 "3c29de1e289b5472342947168f0105c0")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.7")
set(ORTHANC_FRAMEWORK_MD5 "e1b76f01116d9b5d4ac8cc39980560e3")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.8")
set(ORTHANC_FRAMEWORK_MD5 "82323e8c49a667f658a3639ea4dbc336")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.0")
set(ORTHANC_FRAMEWORK_MD5 "eab428d6e53f61e847fa360bb17ebe25")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.1")
set(ORTHANC_FRAMEWORK_MD5 "3971f5de96ba71dc9d3f3690afeaa7c0")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.0")
set(ORTHANC_FRAMEWORK_MD5 "ce5f689e852b01d3672bd3d2f952a5ef")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.1")
set(ORTHANC_FRAMEWORK_MD5 "3c171217f930abe80246997bdbcaf7cc")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.2")
set(ORTHANC_FRAMEWORK_MD5 "328f94dcbd78c169655a13f7ad58a2c2")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.3")
set(ORTHANC_FRAMEWORK_MD5 "3f1ba9502ec7c5449971d3b56087bcde")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.4")
set(ORTHANC_FRAMEWORK_MD5 "19fcb7c21876af86546baa048a22c6c0")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.0")
set(ORTHANC_FRAMEWORK_MD5 "f8ec7554ef5d23ea4ce474b1e8214de9")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.1")
set(ORTHANC_FRAMEWORK_MD5 "db094f96399cbe8b9bbdbce34884c220")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.2")
set(ORTHANC_FRAMEWORK_MD5 "8bfa10e66c9931e74111be0bfb1f4548")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.0")
set(ORTHANC_FRAMEWORK_MD5 "cea0b02ce184671eaf1bd668beefbf28")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.1")
set(ORTHANC_FRAMEWORK_MD5 "08eebc66ef93c3b40115c38501db5fbd")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.2")
set(ORTHANC_FRAMEWORK_MD5 "3ea66c09f64aca990016683b6375734e")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.3")
set(ORTHANC_FRAMEWORK_MD5 "9b86e6f00e03278293cd15643cc0233f")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.4")
set(ORTHANC_FRAMEWORK_MD5 "6d5ca4a73ac7d42445041ca79de1624d")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.5")
set(ORTHANC_FRAMEWORK_MD5 "10fc64de1254a095e5d3ed3931f0cfbb")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.6")
set(ORTHANC_FRAMEWORK_MD5 "4b5d05683d747c29b2860ad79d11e62e")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.7")
set(ORTHANC_FRAMEWORK_MD5 "c912bbb860d640d3ae3003b5c9698205")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.10.0")
set(ORTHANC_FRAMEWORK_MD5 "8610c82d9153f22e929f2110f8f60279")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.10.1")
set(ORTHANC_FRAMEWORK_MD5 "caf667fc5ea452b3d0c2f70bfd02599c")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.0")
set(ORTHANC_FRAMEWORK_MD5 "962c4a4a706a2ef28b390d8515dd7091")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.1")
set(ORTHANC_FRAMEWORK_MD5 "a39661c406adf22cf574fde290cf4bbf")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.2")
set(ORTHANC_FRAMEWORK_MD5 "ede3de356493a8868545f8cb4b8bc8b5")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.3")
set(ORTHANC_FRAMEWORK_MD5 "e48fc0cb09c4856803791a1be28c07dc")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.0")
set(ORTHANC_FRAMEWORK_MD5 "d32a0cde03b6eb603d8dd2b33d38bf1b")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.1")
set(ORTHANC_FRAMEWORK_MD5 "8a435140efc8ff4a01d8242f092f21de")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.2")
set(ORTHANC_FRAMEWORK_MD5 "d2476b9e796e339ac320b5333489bdb3")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.3")
set(ORTHANC_FRAMEWORK_MD5 "975f5bf2142c22cb1777b4f6a0a614c5")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.4")
set(ORTHANC_FRAMEWORK_MD5 "1e61779ea4a7cd705720bdcfed8a6a73")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.5")
set(ORTHANC_FRAMEWORK_MD5 "5bb69f092981fdcfc11dec0a0f9a7db3")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.6")
set(ORTHANC_FRAMEWORK_MD5 "0e971f32f4f3e4951e0f3b5de49a3da6")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.7")
set(ORTHANC_FRAMEWORK_MD5 "f27c27d7a7a694dab1fd7f0a99d9715a")
# Below this point are development snapshots that were used to
# release some plugin, before an official release of the Orthanc
# framework was available. Here is the command to be used to
# generate a proper archive:
#
# $ hg archive /tmp/Orthanc-`hg id -i | sed 's/\+//'`.tar.gz
#
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "ae0e3fd609df")
# DICOMweb 1.1 (framework pre-1.6.0)
set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "82652c5fc04f")
# Stone Web viewer 1.0 (framework pre-1.8.1)
set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
set(ORTHANC_FRAMEWORK_MD5 "d77331d68917e66a3f4f9b807bbdab7f")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "4a3ba4bf4ba7")
# PostgreSQL 3.3 (framework pre-1.8.2)
set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
set(ORTHANC_FRAMEWORK_MD5 "2d82bddf06f9cfe82095495cb3b8abde")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "23ad1b9c7800")
# For "Toolbox::ReadJson()" and "Toolbox::Write{...}Json()" (pre-1.9.0)
set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
set(ORTHANC_FRAMEWORK_MD5 "9af92080e57c60dd288eba46ce606c00")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "b2e08d83e21d")
# WSI 1.1 (framework pre-1.10.0), to remove "-std=c++11"
set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
set(ORTHANC_FRAMEWORK_MD5 "2eaa073cbb4b44ffba199ad93393b2b1")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "daf4807631c5")
# DICOMweb 1.15 (framework pre-1.12.2)
set(ORTHANC_FRAMEWORK_PRE_RELEASE ON)
set(ORTHANC_FRAMEWORK_MD5 "ebe8bdf388319f1c9536b2b680451848")
endif()
endif()
endif()
elseif (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path")
message("Using the Orthanc framework from a path of the filesystem. Assuming mainline version.")
set(ORTHANC_FRAMEWORK_MAJOR 999)
set(ORTHANC_FRAMEWORK_MINOR 999)
set(ORTHANC_FRAMEWORK_REVISION 999)
endif()
##
## Detection of the third-party software
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg")
find_program(ORTHANC_FRAMEWORK_HG hg)
if (${ORTHANC_FRAMEWORK_HG} MATCHES "ORTHANC_FRAMEWORK_HG-NOTFOUND")
message(FATAL_ERROR "Please install Mercurial")
endif()
endif()
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR
ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
find_program(ORTHANC_FRAMEWORK_7ZIP 7z
PATHS
"$ENV{ProgramFiles}/7-Zip"
"$ENV{ProgramW6432}/7-Zip"
)
if (${ORTHANC_FRAMEWORK_7ZIP} MATCHES "ORTHANC_FRAMEWORK_7ZIP-NOTFOUND")
message(FATAL_ERROR "Please install the '7-zip' software (http://www.7-zip.org/)")
endif()
else()
find_program(ORTHANC_FRAMEWORK_TAR tar)
if (${ORTHANC_FRAMEWORK_TAR} MATCHES "ORTHANC_FRAMEWORK_TAR-NOTFOUND")
message(FATAL_ERROR "Please install the 'tar' package")
endif()
endif()
endif()
##
## Case of the Orthanc framework specified as a path on the filesystem
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path")
if (NOT DEFINED ORTHANC_FRAMEWORK_ROOT OR
ORTHANC_FRAMEWORK_ROOT STREQUAL "")
message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ROOT must provide the path to the sources of Orthanc")
endif()
if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT})
message(FATAL_ERROR "Non-existing directory: ${ORTHANC_FRAMEWORK_ROOT}")
endif()
endif()
##
## Case of the Orthanc framework cloned using Mercurial
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg")
if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS)
message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
endif()
set(ORTHANC_ROOT ${CMAKE_BINARY_DIR}/orthanc)
if (EXISTS ${ORTHANC_ROOT})
message("Updating the Orthanc source repository using Mercurial")
execute_process(
COMMAND ${ORTHANC_FRAMEWORK_HG} pull
WORKING_DIRECTORY ${ORTHANC_ROOT}
RESULT_VARIABLE Failure
)
else()
message("Forking the Orthanc source repository using Mercurial")
execute_process(
COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://orthanc.uclouvain.be/hg/orthanc/"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
endif()
if (Failure OR NOT EXISTS ${ORTHANC_ROOT})
message(FATAL_ERROR "Cannot fork the Orthanc repository")
endif()
message("Setting branch of the Orthanc repository to: ${ORTHANC_FRAMEWORK_BRANCH}")
execute_process(
COMMAND ${ORTHANC_FRAMEWORK_HG} update -c ${ORTHANC_FRAMEWORK_BRANCH}
WORKING_DIRECTORY ${ORTHANC_ROOT}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while running Mercurial")
endif()
endif()
##
## Case of the Orthanc framework provided as a source archive on the
## filesystem
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive")
if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE OR
ORTHANC_FRAMEWORK_ARCHIVE STREQUAL "")
message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ARCHIVE must provide the path to the sources of Orthanc")
endif()
endif()
##
## Case of the Orthanc framework downloaded from the Web
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
if (DEFINED ORTHANC_FRAMEWORK_URL)
string(REGEX REPLACE "^.*/" "" ORTHANC_FRAMEMORK_FILENAME "${ORTHANC_FRAMEWORK_URL}")
else()
# Default case: Download from the official Web site
set(ORTHANC_FRAMEMORK_FILENAME Orthanc-${ORTHANC_FRAMEWORK_VERSION}.tar.gz)
if (ORTHANC_FRAMEWORK_PRE_RELEASE)
set(ORTHANC_FRAMEWORK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/orthanc-framework/${ORTHANC_FRAMEMORK_FILENAME}")
else()
set(ORTHANC_FRAMEWORK_URL "https://orthanc.uclouvain.be/downloads/sources/orthanc/${ORTHANC_FRAMEMORK_FILENAME}")
endif()
endif()
set(ORTHANC_FRAMEWORK_ARCHIVE "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${ORTHANC_FRAMEMORK_FILENAME}")
if (NOT EXISTS "${ORTHANC_FRAMEWORK_ARCHIVE}")
if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS)
message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
endif()
message("Downloading: ${ORTHANC_FRAMEWORK_URL}")
file(DOWNLOAD
"${ORTHANC_FRAMEWORK_URL}" "${ORTHANC_FRAMEWORK_ARCHIVE}"
SHOW_PROGRESS EXPECTED_MD5 "${ORTHANC_FRAMEWORK_MD5}"
TIMEOUT 60
INACTIVITY_TIMEOUT 60
)
else()
message("Using local copy of: ${ORTHANC_FRAMEWORK_URL}")
endif()
endif()
##
## Uncompressing the Orthanc framework, if it was retrieved from a
## source archive on the filesystem, or from the official Web site
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR
ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE OR
NOT DEFINED ORTHANC_FRAMEWORK_VERSION OR
NOT DEFINED ORTHANC_FRAMEWORK_MD5)
message(FATAL_ERROR "Internal error")
endif()
if (ORTHANC_FRAMEWORK_MD5 STREQUAL "")
message(FATAL_ERROR "Unknown release of Orthanc: ${ORTHANC_FRAMEWORK_VERSION}")
endif()
file(MD5 ${ORTHANC_FRAMEWORK_ARCHIVE} ActualMD5)
if (NOT "${ActualMD5}" STREQUAL "${ORTHANC_FRAMEWORK_MD5}")
message(FATAL_ERROR "The MD5 hash of the Orthanc archive is invalid: ${ORTHANC_FRAMEWORK_ARCHIVE}")
endif()
set(ORTHANC_ROOT "${CMAKE_BINARY_DIR}/Orthanc-${ORTHANC_FRAMEWORK_VERSION}")
if (NOT IS_DIRECTORY "${ORTHANC_ROOT}")
if (NOT ORTHANC_FRAMEWORK_ARCHIVE MATCHES ".tar.gz$")
message(FATAL_ERROR "Archive should have the \".tar.gz\" extension: ${ORTHANC_FRAMEWORK_ARCHIVE}")
endif()
message("Uncompressing: ${ORTHANC_FRAMEWORK_ARCHIVE}")
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
# How to silently extract files using 7-zip
# http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly
execute_process(
COMMAND ${ORTHANC_FRAMEWORK_7ZIP} e -y ${ORTHANC_FRAMEWORK_ARCHIVE}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
OUTPUT_QUIET
)
if (Failure)
message(FATAL_ERROR "Error while running the uncompression tool")
endif()
get_filename_component(TMP_FILENAME "${ORTHANC_FRAMEWORK_ARCHIVE}" NAME)
string(REGEX REPLACE ".gz$" "" TMP_FILENAME2 "${TMP_FILENAME}")
execute_process(
COMMAND ${ORTHANC_FRAMEWORK_7ZIP} x -y ${TMP_FILENAME2}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
OUTPUT_QUIET
)
else()
execute_process(
COMMAND sh -c "${ORTHANC_FRAMEWORK_TAR} xfz ${ORTHANC_FRAMEWORK_ARCHIVE}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
endif()
if (Failure)
message(FATAL_ERROR "Error while running the uncompression tool")
endif()
if (NOT IS_DIRECTORY "${ORTHANC_ROOT}")
message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.")
endif()
endif()
endif()
##
## Determine the path to the sources of the Orthanc framework
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR
ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR
ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
if (NOT DEFINED ORTHANC_ROOT OR
NOT DEFINED ORTHANC_FRAMEWORK_MAJOR OR
NOT DEFINED ORTHANC_FRAMEWORK_MINOR OR
NOT DEFINED ORTHANC_FRAMEWORK_REVISION)
message(FATAL_ERROR "Internal error in the DownloadOrthancFramework.cmake file")
endif()
unset(ORTHANC_FRAMEWORK_ROOT CACHE)
if ("${ORTHANC_FRAMEWORK_MAJOR}.${ORTHANC_FRAMEWORK_MINOR}.${ORTHANC_FRAMEWORK_REVISION}" VERSION_LESS "1.7.2")
set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/Core" CACHE
STRING "Path to the Orthanc framework source directory")
set(ENABLE_PLUGINS_VERSION_SCRIPT OFF)
else()
set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework/Sources" CACHE
STRING "Path to the Orthanc framework source directory")
endif()
unset(ORTHANC_ROOT)
endif()
if (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/OrthancException.h OR
NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake)
message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_FRAMEWORK_ROOT}")
endif()
endif()
##
## Case of the Orthanc framework installed as a shared library in a
## GNU/Linux distribution (typically Debian). New in Orthanc 1.7.2.
##
if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
set(ORTHANC_FRAMEWORK_LIBDIR "" CACHE PATH "")
set(ORTHANC_FRAMEWORK_USE_SHARED ON CACHE BOOL "Whether to use the shared library or the static library")
set(ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES "" CACHE STRING "Additional libraries to link against, separated by whitespaces, typically needed if using the static library (a common minimal value is \"boost_filesystem boost_iostreams boost_locale boost_regex boost_thread jsoncpp pugixml uuid\")")
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND
CMAKE_COMPILER_IS_GNUCXX) # MinGW
set(DYNAMIC_MINGW_STDLIB ON) # Disable static linking against libc (to throw exceptions)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
endif()
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
if(CMAKE_VERSION VERSION_GREATER "3.11")
find_package(Python REQUIRED COMPONENTS Interpreter)
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
else()
include(FindPythonInterp)
find_package(PythonInterp REQUIRED)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py)
if (ORTHANC_FRAMEWORK_USE_SHARED)
list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix)
else()
list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
list(GET CMAKE_FIND_LIBRARY_SUFFIXES 1 Suffix)
endif()
# The "OrthancFramework" library must be the first one to be included
if ("${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
set(ORTHANC_FRAMEWORK_LIBRARIES ${Prefix}OrthancFramework${Suffix})
else ()
set(ORTHANC_FRAMEWORK_LIBRARIES ${ORTHANC_FRAMEWORK_LIBDIR}/${Prefix}OrthancFramework${Suffix})
endif()
if (NOT ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES STREQUAL "")
# https://stackoverflow.com/a/5272993/881731
string(REPLACE " " ";" tmp ${ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES})
list(APPEND ORTHANC_FRAMEWORK_LIBRARIES ${tmp})
endif()
# Look for the version of the mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake)
if (CMAKE_CROSSCOMPILING)
set(JSONCPP_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT}/..)
else()
find_path(JSONCPP_INCLUDE_DIR json/reader.h
${ORTHANC_FRAMEWORK_ROOT}/..
/usr/include/jsoncpp
/usr/local/include/jsoncpp
)
endif()
message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}")
include_directories(${JSONCPP_INCLUDE_DIR})
CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
if (NOT HAVE_JSONCPP_H)
message(FATAL_ERROR "Please install the libjsoncpp-dev package")
endif()
# Look for Orthanc framework shared library
include(CheckCXXSymbolExists)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT})
else()
find_path(ORTHANC_FRAMEWORK_INCLUDE_DIR OrthancFramework.h
/usr/include/orthanc-framework
/usr/local/include/orthanc-framework
${ORTHANC_FRAMEWORK_ROOT}
)
endif()
if (${ORTHANC_FRAMEWORK_INCLUDE_DIR} STREQUAL "ORTHANC_FRAMEWORK_INCLUDE_DIR-NOTFOUND")
message(FATAL_ERROR "Cannot locate the OrthancFramework.h header")
endif()
message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR})
if (ORTHANC_FRAMEWORK_USE_SHARED)
set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${ORTHANC_FRAMEWORK_LIBRARIES}")
check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK)
if (NOT HAVE_ORTHANC_FRAMEWORK)
message(FATAL_ERROR "Cannot find the Orthanc framework")
endif()
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
endif()
endif()

View File

@ -0,0 +1,287 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
macro(GetUrlFilename TargetVariable Url)
string(REGEX REPLACE "^.*/" "" ${TargetVariable} "${Url}")
endmacro()
macro(GetUrlExtension TargetVariable Url)
#string(REGEX REPLACE "^.*/[^.]*\\." "" TMP "${Url}")
string(REGEX REPLACE "^.*\\." "" TMP "${Url}")
string(TOLOWER "${TMP}" "${TargetVariable}")
endmacro()
##
## Setup the patch command-line tool
##
if (NOT ORTHANC_DISABLE_PATCH)
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
set(PATCH_EXECUTABLE ${CMAKE_CURRENT_LIST_DIR}/../ThirdParty/patch/patch.exe)
if (NOT EXISTS ${PATCH_EXECUTABLE})
message(FATAL_ERROR "Unable to find the patch.exe tool that is shipped with Orthanc")
endif()
else ()
find_program(PATCH_EXECUTABLE patch)
if (${PATCH_EXECUTABLE} MATCHES "PATCH_EXECUTABLE-NOTFOUND")
message(FATAL_ERROR "Please install the 'patch' standard command-line tool")
endif()
endif()
endif()
##
## Check the existence of the required decompression tools
##
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
find_program(ZIP_EXECUTABLE 7z
PATHS
"$ENV{ProgramFiles}/7-Zip"
"$ENV{ProgramW6432}/7-Zip"
)
if (${ZIP_EXECUTABLE} MATCHES "ZIP_EXECUTABLE-NOTFOUND")
message(FATAL_ERROR "Please install the '7-zip' software (http://www.7-zip.org/)")
endif()
else()
find_program(UNZIP_EXECUTABLE unzip)
if (${UNZIP_EXECUTABLE} MATCHES "UNZIP_EXECUTABLE-NOTFOUND")
message(FATAL_ERROR "Please install the 'unzip' package")
endif()
find_program(TAR_EXECUTABLE tar)
if (${TAR_EXECUTABLE} MATCHES "TAR_EXECUTABLE-NOTFOUND")
message(FATAL_ERROR "Please install the 'tar' package")
endif()
find_program(GUNZIP_EXECUTABLE gunzip)
if (${GUNZIP_EXECUTABLE} MATCHES "GUNZIP_EXECUTABLE-NOTFOUND")
message(FATAL_ERROR "Please install the 'gzip' package")
endif()
endif()
macro(DownloadFile MD5 Url)
GetUrlFilename(TMP_FILENAME "${Url}")
set(TMP_PATH "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${TMP_FILENAME}")
if (NOT EXISTS "${TMP_PATH}")
message("Downloading ${Url}")
# This fixes issue 6: "I think cmake shouldn't download the
# packages which are not in the system, it should stop and let
# user know."
# https://code.google.com/p/orthanc/issues/detail?id=6
if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS)
message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
endif()
foreach (retry RANGE 1 5) # Retries 5 times
if ("${MD5}" STREQUAL "no-check")
message(WARNING "Not checking the MD5 of: ${Url}")
file(DOWNLOAD "${Url}" "${TMP_PATH}"
SHOW_PROGRESS TIMEOUT 30 INACTIVITY_TIMEOUT 10
STATUS Failure)
else()
file(DOWNLOAD "${Url}" "${TMP_PATH}"
SHOW_PROGRESS TIMEOUT 30 INACTIVITY_TIMEOUT 10
EXPECTED_MD5 "${MD5}" STATUS Failure)
endif()
list(GET Failure 0 Status)
if (Status EQUAL 0)
break() # Successful download
endif()
endforeach()
if (NOT Status EQUAL 0)
file(REMOVE ${TMP_PATH})
message(FATAL_ERROR "Cannot download file: ${Url}")
endif()
else()
message("Using local copy of ${Url}")
if ("${MD5}" STREQUAL "no-check")
message(WARNING "Not checking the MD5 of: ${Url}")
else()
file(MD5 ${TMP_PATH} ActualMD5)
if (NOT "${ActualMD5}" STREQUAL "${MD5}")
message(FATAL_ERROR "The MD5 hash of a previously download file is invalid: ${TMP_PATH}")
endif()
endif()
endif()
endmacro()
macro(DownloadPackage MD5 Url TargetDirectory)
if (NOT IS_DIRECTORY "${TargetDirectory}")
DownloadFile("${MD5}" "${Url}")
GetUrlExtension(TMP_EXTENSION "${Url}")
#message(${TMP_EXTENSION})
message("Uncompressing ${TMP_FILENAME}")
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
# How to silently extract files using 7-zip
# http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly
if (("${TMP_EXTENSION}" STREQUAL "gz") OR
("${TMP_EXTENSION}" STREQUAL "tgz") OR
("${TMP_EXTENSION}" STREQUAL "xz"))
execute_process(
COMMAND ${ZIP_EXECUTABLE} e -y ${TMP_PATH}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
OUTPUT_QUIET
)
if (Failure)
message(FATAL_ERROR "Error while running the uncompression tool")
endif()
if ("${TMP_EXTENSION}" STREQUAL "tgz")
string(REGEX REPLACE ".tgz$" ".tar" TMP_FILENAME2 "${TMP_FILENAME}")
elseif ("${TMP_EXTENSION}" STREQUAL "gz")
string(REGEX REPLACE ".gz$" "" TMP_FILENAME2 "${TMP_FILENAME}")
elseif ("${TMP_EXTENSION}" STREQUAL "xz")
string(REGEX REPLACE ".xz" "" TMP_FILENAME2 "${TMP_FILENAME}")
endif()
execute_process(
COMMAND ${ZIP_EXECUTABLE} x -y ${TMP_FILENAME2}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
OUTPUT_QUIET
)
elseif ("${TMP_EXTENSION}" STREQUAL "zip")
execute_process(
COMMAND ${ZIP_EXECUTABLE} x -y ${TMP_PATH}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
OUTPUT_QUIET
)
else()
message(FATAL_ERROR "Unsupported package extension: ${TMP_EXTENSION}")
endif()
else()
if ("${TMP_EXTENSION}" STREQUAL "zip")
execute_process(
COMMAND sh -c "${UNZIP_EXECUTABLE} -q ${TMP_PATH}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
elseif (("${TMP_EXTENSION}" STREQUAL "gz") OR ("${TMP_EXTENSION}" STREQUAL "tgz"))
#message("tar xvfz ${TMP_PATH}")
execute_process(
COMMAND sh -c "${TAR_EXECUTABLE} xfz ${TMP_PATH}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
elseif ("${TMP_EXTENSION}" STREQUAL "bz2")
execute_process(
COMMAND sh -c "${TAR_EXECUTABLE} xfj ${TMP_PATH}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
elseif ("${TMP_EXTENSION}" STREQUAL "xz")
execute_process(
COMMAND sh -c "${TAR_EXECUTABLE} xf ${TMP_PATH}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
else()
message(FATAL_ERROR "Unsupported package extension: ${TMP_EXTENSION}")
endif()
endif()
if (Failure)
message(FATAL_ERROR "Error while running the uncompression tool")
endif()
if (NOT IS_DIRECTORY "${TargetDirectory}")
message(FATAL_ERROR "The package was not uncompressed at the proper location. Check the CMake instructions.")
endif()
endif()
endmacro()
macro(DownloadCompressedFile MD5 Url TargetFile)
if (NOT EXISTS "${TargetFile}")
DownloadFile("${MD5}" "${Url}")
GetUrlExtension(TMP_EXTENSION "${Url}")
#message(${TMP_EXTENSION})
message("Uncompressing ${TMP_FILENAME}")
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
# How to silently extract files using 7-zip
# http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly
if ("${TMP_EXTENSION}" STREQUAL "gz")
execute_process(
# "-so" writes uncompressed file to stdout
COMMAND ${ZIP_EXECUTABLE} e -so -y ${TMP_PATH}
OUTPUT_FILE "${TargetFile}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
OUTPUT_QUIET
)
if (Failure)
message(FATAL_ERROR "Error while running the uncompression tool")
endif()
else()
message(FATAL_ERROR "Unsupported file extension: ${TMP_EXTENSION}")
endif()
else()
if ("${TMP_EXTENSION}" STREQUAL "gz")
execute_process(
COMMAND sh -c "${GUNZIP_EXECUTABLE} -c ${TMP_PATH}"
OUTPUT_FILE "${TargetFile}"
RESULT_VARIABLE Failure
)
else()
message(FATAL_ERROR "Unsupported file extension: ${TMP_EXTENSION}")
endif()
endif()
if (Failure)
message(FATAL_ERROR "Error while running the uncompression tool")
endif()
if (NOT EXISTS "${TargetFile}")
message(FATAL_ERROR "The file was not uncompressed at the proper location. Check the CMake instructions.")
endif()
endif()
endmacro()

View File

@ -0,0 +1,65 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
# https://github.com/emscripten-core/emscripten/blob/master/src/settings.js
if (NOT "${EMSCRIPTEN_TRAP_MODE}" STREQUAL "")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s BINARYEN_TRAP_MODE='\"${EMSCRIPTEN_TRAP_MODE}\"'")
endif()
# If "-O3" is used (the default in "Release" mode), this results in a
# too large memory consumption in "wasm-opt", at least in Emscripten
# 3.1.7, which ultimately crashes the compiler. So we force "-O2"
# (this also has the advantage of speeding up the build):
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
# "DISABLE_EXCEPTION_CATCHING" is a "compile+link" option. HOWEVER,
# setting it inside "WASM_FLAGS" creates link errors, at least with
# side modules. TODO: Understand why
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
# "-Wno-unused-command-line-argument" is used to avoid annoying
# warnings about setting WASM, FETCH and ASSERTIONS, which was
# required for earlier versions of emsdk:
# https://groups.google.com/g/emscripten-discuss/c/VX4enWfadUE
set(WASM_FLAGS "${WASM_FLAGS} -Wno-unused-command-line-argument")
#set(WASM_FLAGS "${WASM_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
if (EMSCRIPTEN_TARGET_MODE STREQUAL "wasm")
# WebAssembly
set(WASM_FLAGS "${WASM_FLAGS} -s WASM=1")
elseif (EMSCRIPTEN_TARGET_MODE STREQUAL "asm.js")
# asm.js targeting IE 11
set(WASM_FLAGS "-s WASM=0 -s ASM_JS=2 -s LEGACY_VM_SUPPORT=1")
else()
message(FATAL_ERROR "Bad value for EMSCRIPTEN_TARGET_MODE: ${EMSCRIPTEN_TARGET_MODE}")
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1 -s ASSERTIONS=1")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}")

View File

@ -0,0 +1,91 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (USE_GOOGLE_TEST_DEBIAN_PACKAGE)
find_path(GOOGLE_TEST_DEBIAN_SOURCES_DIR
NAMES src/gtest-all.cc
PATHS
${CROSSTOOL_NG_IMAGE}/usr/src/gtest
${CROSSTOOL_NG_IMAGE}/usr/src/googletest/googletest
PATH_SUFFIXES src
)
find_path(GOOGLE_TEST_DEBIAN_INCLUDE_DIR
NAMES gtest.h
PATHS
${CROSSTOOL_NG_IMAGE}/usr/include/gtest
)
message("Path to the Debian Google Test sources: ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}")
message("Path to the Debian Google Test includes: ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}")
set(GOOGLE_TEST_SOURCES
${GOOGLE_TEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc
)
include_directories(${GOOGLE_TEST_DEBIAN_SOURCES_DIR})
if (NOT EXISTS ${GOOGLE_TEST_SOURCES} OR
NOT EXISTS ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}/gtest.h)
message(FATAL_ERROR "Please install the libgtest-dev package")
endif()
elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST)
set(GOOGLE_TEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/googletest-release-1.8.1)
set(GOOGLE_TEST_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/gtest-1.8.1.tar.gz")
set(GOOGLE_TEST_MD5 "2e6fbeb6a91310a16efe181886c59596")
DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}")
include_directories(
${GOOGLE_TEST_SOURCES_DIR}/googletest
${GOOGLE_TEST_SOURCES_DIR}/googletest/include
${GOOGLE_TEST_SOURCES_DIR}
)
set(GOOGLE_TEST_SOURCES
${GOOGLE_TEST_SOURCES_DIR}/googletest/src/gtest-all.cc
)
# https://code.google.com/p/googletest/issues/detail?id=412
if (MSVC) # VS2012 does not support tuples correctly yet
add_definitions(/D _VARIADIC_MAX=10)
endif()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
add_definitions(-DGTEST_HAS_CLONE=0)
endif()
source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GOOGLE_TEST_SOURCES_DIR}/.*)
else()
include(FindGTest)
if (NOT GTEST_FOUND)
message(FATAL_ERROR "Unable to find GoogleTest")
endif()
include_directories(${GTEST_INCLUDE_DIRS})
# The variable GTEST_LIBRARIES contains the shared library of
# Google Test, create an alias for more uniformity
set(GOOGLE_TEST_LIBRARIES ${GTEST_LIBRARIES})
endif()

View File

@ -0,0 +1,102 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
set(JSONCPP_CXX11 OFF)
if (STATIC_BUILD OR NOT USE_SYSTEM_JSONCPP)
if (USE_LEGACY_JSONCPP)
set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.7)
set(JSONCPP_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/jsoncpp-0.10.7.tar.gz")
set(JSONCPP_MD5 "3a8072ca6a1fa9cbaf7715ae625f134f")
add_definitions(-DORTHANC_LEGACY_JSONCPP=1)
else()
set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-1.9.5)
set(JSONCPP_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/jsoncpp-1.9.5.tar.gz")
set(JSONCPP_MD5 "d6c8c609f2162eff373db62b90a051c7")
add_definitions(-DORTHANC_LEGACY_JSONCPP=0)
set(JSONCPP_CXX11 ON)
endif()
DownloadPackage(${JSONCPP_MD5} ${JSONCPP_URL} "${JSONCPP_SOURCES_DIR}")
set(JSONCPP_SOURCES
${JSONCPP_SOURCES_DIR}/src/lib_json/json_reader.cpp
${JSONCPP_SOURCES_DIR}/src/lib_json/json_value.cpp
${JSONCPP_SOURCES_DIR}/src/lib_json/json_writer.cpp
)
include_directories(
${JSONCPP_SOURCES_DIR}/include
)
if (NOT ENABLE_LOCALE)
add_definitions(-DJSONCPP_NO_LOCALE_SUPPORT=1)
endif()
source_group(ThirdParty\\JsonCpp REGULAR_EXPRESSION ${JSONCPP_SOURCES_DIR}/.*)
else()
find_path(JSONCPP_INCLUDE_DIR json/reader.h
/usr/include/jsoncpp
/usr/local/include/jsoncpp
)
message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}")
include_directories(${JSONCPP_INCLUDE_DIR})
link_libraries(jsoncpp)
CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
if (NOT HAVE_JSONCPP_H)
message(FATAL_ERROR "Please install the libjsoncpp-dev package")
endif()
# Detect if the version of JsonCpp is >= 1.0.0
if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h)
file(STRINGS
"${JSONCPP_INCLUDE_DIR}/json/version.h"
JSONCPP_VERSION_MAJOR1 REGEX
".*define JSONCPP_VERSION_MAJOR.*")
if (NOT JSONCPP_VERSION_MAJOR1)
message(FATAL_ERROR "Unable to extract the major version of JsonCpp")
endif()
string(REGEX REPLACE
".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1"
JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
if (JSONCPP_VERSION_MAJOR GREATER 0)
set(JSONCPP_CXX11 ON)
endif()
else()
message("Unable to detect the major version of JsonCpp, assuming < 1.0.0")
endif()
endif()
if (JSONCPP_CXX11)
# Osimis has encountered problems when this macro is left at its
# default value (1000), so we increase this limit
# https://gitlab.kitware.com/third-party/jsoncpp/commit/56df2068470241f9043b676bfae415ed62a0c172
add_definitions(-DJSONCPP_DEPRECATED_STACK_LIMIT=5000)
endif()

View File

@ -0,0 +1,364 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_CURL)
SET(CURL_SOURCES_DIR ${CMAKE_BINARY_DIR}/curl-8.9.0)
SET(CURL_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/curl-8.9.0.tar.gz")
SET(CURL_MD5 "f9bca5d4d5bac1f04e6c5eb4d0418618")
if (IS_DIRECTORY "${CURL_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${CURL_MD5} ${CURL_URL} "${CURL_SOURCES_DIR}")
if (FirstRun)
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/curl-8.9.0.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
include_directories(
${CURL_SOURCES_DIR}/include
)
AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib CURL_SOURCES)
AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib/vauth CURL_SOURCES)
AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib/vssh CURL_SOURCES)
AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib/vtls CURL_SOURCES)
AUX_SOURCE_DIRECTORY(${CURL_SOURCES_DIR}/lib/vquic CURL_SOURCES)
source_group(ThirdParty\\LibCurl REGULAR_EXPRESSION ${CURL_SOURCES_DIR}/.*)
add_definitions(
-DBUILDING_LIBCURL=1
-DCURL_STATICLIB=1
-DCURL_DISABLE_LDAPS=1
-DCURL_DISABLE_LDAP=1
-DCURL_DISABLE_DICT=1
-DCURL_DISABLE_FILE=1
-DCURL_DISABLE_FTP=1
-DCURL_DISABLE_GOPHER=1
-DCURL_DISABLE_LDAP=1
-DCURL_DISABLE_LDAPS=1
-DCURL_DISABLE_POP3=1
#-DCURL_DISABLE_PROXY=1
-DCURL_DISABLE_RTSP=1
-DCURL_DISABLE_TELNET=1
-DCURL_DISABLE_TFTP=1
)
if (ENABLE_SSL)
add_definitions(
#-DHAVE_LIBSSL=1
-DUSE_OPENSSL=1
-DHAVE_OPENSSL_ENGINE_H=1
-DUSE_SSLEAY=1
)
endif()
if (NOT EXISTS "${CURL_SOURCES_DIR}/lib/vauth/vauth/vauth.h")
file(WRITE ${CURL_SOURCES_DIR}/lib/vauth/vauth/digest.h "#include \"../digest.h\"\n")
file(WRITE ${CURL_SOURCES_DIR}/lib/vauth/vauth/ntlm.h "#include \"../ntlm.h\"\n")
file(WRITE ${CURL_SOURCES_DIR}/lib/vauth/vauth/vauth.h "#include \"../vauth.h\"\n")
file(WRITE ${CURL_SOURCES_DIR}/lib/vauth/vtls/vtls.h "#include \"../../vtls/vtls.h\"\n")
file(WRITE ${CURL_SOURCES_DIR}/lib/vssh/curl_setup.h "#include \"../curl_setup.h\"\n")
file(WRITE ${CURL_SOURCES_DIR}/lib/vtls/vauth/vauth.h "#include \"../../vauth/vauth.h\"\n")
file(GLOB CURL_LIBS_HEADERS ${CURL_SOURCES_DIR}/lib/*.h)
foreach (header IN LISTS CURL_LIBS_HEADERS)
get_filename_component(filename ${header} NAME)
file(WRITE ${CURL_SOURCES_DIR}/lib/vauth/${filename} "#include \"../${filename}\"\n")
file(WRITE ${CURL_SOURCES_DIR}/lib/vquic/${filename} "#include \"../${filename}\"\n")
file(WRITE ${CURL_SOURCES_DIR}/lib/vtls/${filename} "#include \"../${filename}\"\n")
endforeach()
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
SET(TMP_OS "x86_64")
else()
SET(TMP_OS "x86")
endif()
set_property(
SOURCE ${CURL_SOURCES} APPEND
PROPERTY COMPILE_DEFINITIONS "HAVE_CONFIG_H=1;OS=\"${TMP_OS}\""
)
include(${CURL_SOURCES_DIR}/CMake/Macros.cmake)
# WARNING: Do *not* reorder the "check_include_file_concat()" below!
check_include_file_concat("stdio.h" HAVE_STDIO_H)
check_include_file_concat("inttypes.h" HAVE_INTTYPES_H)
check_include_file_concat("sys/filio.h" HAVE_SYS_FILIO_H)
check_include_file_concat("sys/ioctl.h" HAVE_SYS_IOCTL_H)
check_include_file_concat("sys/param.h" HAVE_SYS_PARAM_H)
check_include_file_concat("sys/poll.h" HAVE_SYS_POLL_H)
check_include_file_concat("sys/resource.h" HAVE_SYS_RESOURCE_H)
check_include_file_concat("sys/select.h" HAVE_SYS_SELECT_H)
check_include_file_concat("sys/socket.h" HAVE_SYS_SOCKET_H)
check_include_file_concat("sys/sockio.h" HAVE_SYS_SOCKIO_H)
check_include_file_concat("sys/stat.h" HAVE_SYS_STAT_H)
check_include_file_concat("sys/time.h" HAVE_SYS_TIME_H)
check_include_file_concat("sys/types.h" HAVE_SYS_TYPES_H)
check_include_file_concat("sys/uio.h" HAVE_SYS_UIO_H)
check_include_file_concat("sys/un.h" HAVE_SYS_UN_H)
check_include_file_concat("sys/utime.h" HAVE_SYS_UTIME_H)
check_include_file_concat("sys/xattr.h" HAVE_SYS_XATTR_H)
check_include_file_concat("alloca.h" HAVE_ALLOCA_H)
check_include_file_concat("arpa/inet.h" HAVE_ARPA_INET_H)
check_include_file_concat("arpa/tftp.h" HAVE_ARPA_TFTP_H)
check_include_file_concat("assert.h" HAVE_ASSERT_H)
check_include_file_concat("crypto.h" HAVE_CRYPTO_H)
check_include_file_concat("des.h" HAVE_DES_H)
check_include_file_concat("err.h" HAVE_ERR_H)
check_include_file_concat("errno.h" HAVE_ERRNO_H)
check_include_file_concat("fcntl.h" HAVE_FCNTL_H)
check_include_file_concat("idn2.h" HAVE_IDN2_H)
check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H)
check_include_file_concat("io.h" HAVE_IO_H)
check_include_file_concat("krb.h" HAVE_KRB_H)
check_include_file_concat("libgen.h" HAVE_LIBGEN_H)
check_include_file_concat("limits.h" HAVE_LIMITS_H)
check_include_file_concat("locale.h" HAVE_LOCALE_H)
check_include_file_concat("net/if.h" HAVE_NET_IF_H)
check_include_file_concat("netdb.h" HAVE_NETDB_H)
check_include_file_concat("netinet/in.h" HAVE_NETINET_IN_H)
check_include_file_concat("netinet/tcp.h" HAVE_NETINET_TCP_H)
check_include_file_concat("pem.h" HAVE_PEM_H)
check_include_file_concat("poll.h" HAVE_POLL_H)
check_include_file_concat("pwd.h" HAVE_PWD_H)
check_include_file_concat("rsa.h" HAVE_RSA_H)
check_include_file_concat("setjmp.h" HAVE_SETJMP_H)
check_include_file_concat("sgtty.h" HAVE_SGTTY_H)
check_include_file_concat("signal.h" HAVE_SIGNAL_H)
check_include_file_concat("ssl.h" HAVE_SSL_H)
check_include_file_concat("stdbool.h" HAVE_STDBOOL_H)
check_include_file_concat("stdint.h" HAVE_STDINT_H)
check_include_file_concat("stdio.h" HAVE_STDIO_H)
check_include_file_concat("stdlib.h" HAVE_STDLIB_H)
check_include_file_concat("string.h" HAVE_STRING_H)
check_include_file_concat("strings.h" HAVE_STRINGS_H)
check_include_file_concat("stropts.h" HAVE_STROPTS_H)
check_include_file_concat("termio.h" HAVE_TERMIO_H)
check_include_file_concat("termios.h" HAVE_TERMIOS_H)
check_include_file_concat("time.h" HAVE_TIME_H)
check_include_file_concat("unistd.h" HAVE_UNISTD_H)
check_include_file_concat("utime.h" HAVE_UTIME_H)
check_include_file_concat("x509.h" HAVE_X509_H)
check_include_file_concat("process.h" HAVE_PROCESS_H)
check_include_file_concat("stddef.h" HAVE_STDDEF_H)
check_include_file_concat("dlfcn.h" HAVE_DLFCN_H)
check_include_file_concat("malloc.h" HAVE_MALLOC_H)
check_include_file_concat("memory.h" HAVE_MEMORY_H)
check_include_file_concat("netinet/if_ether.h" HAVE_NETINET_IF_ETHER_H)
check_include_file_concat("stdint.h" HAVE_STDINT_H)
check_include_file_concat("sockio.h" HAVE_SOCKIO_H)
check_include_file_concat("sys/utsname.h" HAVE_SYS_UTSNAME_H)
check_type_size("size_t" SIZEOF_SIZE_T)
check_type_size("ssize_t" SIZEOF_SSIZE_T)
check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size("long" SIZEOF_LONG)
check_type_size("short" SIZEOF_SHORT)
check_type_size("int" SIZEOF_INT)
check_type_size("__int64" SIZEOF___INT64)
check_type_size("long double" SIZEOF_LONG_DOUBLE)
check_type_size("time_t" SIZEOF_TIME_T)
check_type_size("off_t" SIZEOF_OFF_T)
check_type_size("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T)
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
# poll on macOS is unreliable, it first did not exist, then was broken until
# fixed in 10.9 only to break again in 10.12.
if(NOT APPLE)
check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL)
endif()
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
check_symbol_exists(strdup "${CURL_INCLUDES}" HAVE_STRDUP)
check_symbol_exists(strstr "${CURL_INCLUDES}" HAVE_STRSTR)
check_symbol_exists(strtok_r "${CURL_INCLUDES}" HAVE_STRTOK_R)
check_symbol_exists(strftime "${CURL_INCLUDES}" HAVE_STRFTIME)
check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME)
check_symbol_exists(strcasecmp "${CURL_INCLUDES}" HAVE_STRCASECMP)
check_symbol_exists(stricmp "${CURL_INCLUDES}" HAVE_STRICMP)
check_symbol_exists(strcmpi "${CURL_INCLUDES}" HAVE_STRCMPI)
check_symbol_exists(strncmpi "${CURL_INCLUDES}" HAVE_STRNCMPI)
check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM)
if(NOT HAVE_STRNCMPI)
set(HAVE_STRCMPI)
endif(NOT HAVE_STRNCMPI)
check_symbol_exists(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR)
check_symbol_exists(gethostbyaddr_r "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR_R)
check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY)
check_symbol_exists(inet_addr "${CURL_INCLUDES}" HAVE_INET_ADDR)
check_symbol_exists(inet_ntoa "${CURL_INCLUDES}" HAVE_INET_NTOA)
check_symbol_exists(inet_ntoa_r "${CURL_INCLUDES}" HAVE_INET_NTOA_R)
check_symbol_exists(tcsetattr "${CURL_INCLUDES}" HAVE_TCSETATTR)
check_symbol_exists(tcgetattr "${CURL_INCLUDES}" HAVE_TCGETATTR)
check_symbol_exists(perror "${CURL_INCLUDES}" HAVE_PERROR)
check_symbol_exists(closesocket "${CURL_INCLUDES}" HAVE_CLOSESOCKET)
check_symbol_exists(setvbuf "${CURL_INCLUDES}" HAVE_SETVBUF)
check_symbol_exists(sigsetjmp "${CURL_INCLUDES}" HAVE_SIGSETJMP)
check_symbol_exists(getpass_r "${CURL_INCLUDES}" HAVE_GETPASS_R)
check_symbol_exists(strlcat "${CURL_INCLUDES}" HAVE_STRLCAT)
check_symbol_exists(getpwuid "${CURL_INCLUDES}" HAVE_GETPWUID)
check_symbol_exists(geteuid "${CURL_INCLUDES}" HAVE_GETEUID)
check_symbol_exists(utime "${CURL_INCLUDES}" HAVE_UTIME)
check_symbol_exists(gmtime_r "${CURL_INCLUDES}" HAVE_GMTIME_R)
check_symbol_exists(localtime_r "${CURL_INCLUDES}" HAVE_LOCALTIME_R)
check_symbol_exists(gethostbyname "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME)
check_symbol_exists(gethostbyname_r "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME_R)
check_symbol_exists(signal "${CURL_INCLUDES}" HAVE_SIGNAL_FUNC)
check_symbol_exists(SIGALRM "${CURL_INCLUDES}" HAVE_SIGNAL_MACRO)
if(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO)
set(HAVE_SIGNAL 1)
endif(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO)
check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME)
check_symbol_exists(strtoll "${CURL_INCLUDES}" HAVE_STRTOLL)
check_symbol_exists(_strtoi64 "${CURL_INCLUDES}" HAVE__STRTOI64)
check_symbol_exists(strerror_r "${CURL_INCLUDES}" HAVE_STRERROR_R)
check_symbol_exists(siginterrupt "${CURL_INCLUDES}" HAVE_SIGINTERRUPT)
check_symbol_exists(perror "${CURL_INCLUDES}" HAVE_PERROR)
check_symbol_exists(fork "${CURL_INCLUDES}" HAVE_FORK)
check_symbol_exists(getaddrinfo "${CURL_INCLUDES}" HAVE_GETADDRINFO)
check_symbol_exists(freeaddrinfo "${CURL_INCLUDES}" HAVE_FREEADDRINFO)
check_symbol_exists(freeifaddrs "${CURL_INCLUDES}" HAVE_FREEIFADDRS)
check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE)
check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE)
check_symbol_exists(getprotobyname "${CURL_INCLUDES}" HAVE_GETPROTOBYNAME)
check_symbol_exists(getrlimit "${CURL_INCLUDES}" HAVE_GETRLIMIT)
check_symbol_exists(setlocale "${CURL_INCLUDES}" HAVE_SETLOCALE)
check_symbol_exists(setmode "${CURL_INCLUDES}" HAVE_SETMODE)
check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT)
check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL)
check_symbol_exists(ioctl "${CURL_INCLUDES}" HAVE_IOCTL)
check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT)
if(HAVE_SIZEOF_LONG_LONG)
set(HAVE_LONGLONG 1)
set(HAVE_LL 1)
endif(HAVE_SIZEOF_LONG_LONG)
check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
check_function_exists(gethostname HAVE_GETHOSTNAME)
check_include_file_concat("pthread.h" HAVE_PTHREAD_H)
check_symbol_exists(recv "sys/socket.h" HAVE_RECV)
check_symbol_exists(send "sys/socket.h" HAVE_SEND)
check_struct_has_member("struct sockaddr_un" sun_path "sys/un.h" USE_UNIX_SOCKETS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CURL_SOURCES_DIR}/include")
set(CMAKE_EXTRA_INCLUDE_FILES "curl/system.h")
check_type_size("curl_off_t" SIZEOF_CURL_OFF_T)
add_definitions(-DHAVE_GLIBC_STRERROR_R=1)
include(${CURL_SOURCES_DIR}/CMake/OtherTests.cmake)
foreach(CURL_TEST
HAVE_FCNTL_O_NONBLOCK
HAVE_IOCTLSOCKET
HAVE_IOCTLSOCKET_CAMEL
HAVE_IOCTLSOCKET_CAMEL_FIONBIO
HAVE_IOCTLSOCKET_FIONBIO
HAVE_IOCTL_FIONBIO
HAVE_IOCTL_SIOCGIFADDR
HAVE_SETSOCKOPT_SO_NONBLOCK
HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
TIME_WITH_SYS_TIME
HAVE_O_NONBLOCK
HAVE_GETHOSTBYADDR_R_5
HAVE_GETHOSTBYADDR_R_7
HAVE_GETHOSTBYADDR_R_8
HAVE_GETHOSTBYADDR_R_5_REENTRANT
HAVE_GETHOSTBYADDR_R_7_REENTRANT
HAVE_GETHOSTBYADDR_R_8_REENTRANT
HAVE_GETHOSTBYNAME_R_3
HAVE_GETHOSTBYNAME_R_5
HAVE_GETHOSTBYNAME_R_6
HAVE_GETHOSTBYNAME_R_3_REENTRANT
HAVE_GETHOSTBYNAME_R_5_REENTRANT
HAVE_GETHOSTBYNAME_R_6_REENTRANT
HAVE_SOCKLEN_T
HAVE_IN_ADDR_T
HAVE_BOOL_T
STDC_HEADERS
RETSIGTYPE_TEST
HAVE_INET_NTOA_R_DECL
HAVE_INET_NTOA_R_DECL_REENTRANT
HAVE_GETADDRINFO
HAVE_FILE_OFFSET_BITS
)
curl_internal_test(${CURL_TEST})
endforeach(CURL_TEST)
configure_file(
${CURL_SOURCES_DIR}/lib/curl_config.h.cmake
${CURL_SOURCES_DIR}/lib/curl_config.h
)
endif()
elseif (CMAKE_CROSSCOMPILING AND
"${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg")
CHECK_INCLUDE_FILE_CXX(curl/curl.h HAVE_CURL_H)
if (NOT HAVE_CURL_H)
message(FATAL_ERROR "Please install the libcurl-dev package")
endif()
CHECK_LIBRARY_EXISTS(curl "curl_easy_init" "" HAVE_CURL_LIB)
if (NOT HAVE_CURL_LIB)
message(FATAL_ERROR "Please install the libcurl package")
endif()
link_libraries(curl)
else()
include(FindCURL)
include_directories(${CURL_INCLUDE_DIRS})
link_libraries(${CURL_LIBRARIES})
if (NOT ${CURL_FOUND})
message(FATAL_ERROR "Unable to find LibCurl")
endif()
endif()

View File

@ -0,0 +1,112 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
message("Using libiconv")
if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICONV)
set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.15)
set(LIBICONV_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/libiconv-1.15.tar.gz")
set(LIBICONV_MD5 "ace8b5f2db42f7b3b3057585e80d9808")
DownloadPackage(${LIBICONV_MD5} ${LIBICONV_URL} "${LIBICONV_SOURCES_DIR}")
# Disable the support of libiconv that is shipped by default with
# the C standard library on Linux. Setting this macro redirects
# calls from "iconv*()" to "libiconv*()" by defining macros in the
# C headers of "libiconv-1.15".
add_definitions(-DLIBICONV_PLUG=1)
# https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ
add_definitions(
-DBUILDING_LIBICONV=1
-DIN_LIBRARY=1
-DLIBDIR=""
-DICONV_CONST=
#-DENABLE_EXTRA=1
)
configure_file(
${LIBICONV_SOURCES_DIR}/srclib/localcharset.h
${LIBICONV_SOURCES_DIR}/include
COPYONLY)
set(HAVE_VISIBILITY 0)
set(ICONV_CONST ${ICONV_CONST})
set(USE_MBSTATE_T 1)
set(BROKEN_WCHAR_H 0)
set(EILSEQ)
set(HAVE_WCHAR_T 1)
configure_file(
${LIBICONV_SOURCES_DIR}/include/iconv.h.build.in
${LIBICONV_SOURCES_DIR}/include/iconv.h
)
unset(HAVE_VISIBILITY)
unset(ICONV_CONST)
unset(USE_MBSTATE_T)
unset(BROKEN_WCHAR_H)
unset(EILSEQ)
unset(HAVE_WCHAR_T)
if (NOT EXISTS ${LIBICONV_SOURCES_DIR}/include/config.h)
# Create an empty "config.h" for libiconv
file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "")
endif()
include_directories(
${LIBICONV_SOURCES_DIR}/include
)
set(LIBICONV_SOURCES
${LIBICONV_SOURCES_DIR}/lib/iconv.c
${LIBICONV_SOURCES_DIR}/lib/relocatable.c
${LIBICONV_SOURCES_DIR}/libcharset/lib/localcharset.c
${LIBICONV_SOURCES_DIR}/libcharset/lib/relocatable.c
)
source_group(ThirdParty\\libiconv REGULAR_EXPRESSION ${LIBICONV_SOURCES_DIR}/.*)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0)
else()
add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1)
endif()
else()
CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV_H)
if (NOT HAVE_ICONV_H)
message(FATAL_ERROR "Please install the libiconv-dev package")
endif()
# Check whether the support for libiconv is bundled within the
# standard C library
CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV_LIB)
if (NOT HAVE_ICONV_LIB)
# No builtin support for libiconv, try and find an external library.
# Open question: Does this make sense on any platform?
CHECK_LIBRARY_EXISTS(iconv iconv_open "" HAVE_ICONV_LIB_2)
if (NOT HAVE_ICONV_LIB_2)
message(FATAL_ERROR "Please install the libiconv-dev package")
else()
link_libraries(iconv)
endif()
endif()
endif()

View File

@ -0,0 +1,102 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
# Check out: ../ThirdParty/icu/README.txt
# http://userguide.icu-project.org/packaging
# http://userguide.icu-project.org/howtouseicu
message("Using libicu")
if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICU)
include(${CMAKE_CURRENT_LIST_DIR}/../ThirdParty/icu/Version.cmake)
DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}")
# Use the gzip-compressed data
DownloadFile(${LIBICU_DATA_COMPRESSED_MD5} ${LIBICU_DATA_URL})
set(LIBICU_RESOURCES
LIBICU_DATA ${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${LIBICU_DATA}
)
set_source_files_properties(
${CMAKE_BINARY_DIR}/${LIBICU_DATA}
PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t"
)
include_directories(BEFORE
${LIBICU_SOURCES_DIR}/source/common
${LIBICU_SOURCES_DIR}/source/i18n
)
aux_source_directory(${LIBICU_SOURCES_DIR}/source/common LIBICU_SOURCES)
aux_source_directory(${LIBICU_SOURCES_DIR}/source/i18n LIBICU_SOURCES)
add_definitions(
#-DU_COMBINED_IMPLEMENTATION
#-DU_DEF_ICUDATA_ENTRY_POINT=icudt63l_dat
#-DU_LIB_SUFFIX_C_NAME=l
#-DUCONFIG_NO_SERVICE=1
-DU_COMMON_IMPLEMENTATION
-DU_STATIC_IMPLEMENTATION
-DU_ENABLE_DYLOAD=0
-DU_HAVE_STD_STRING=1
-DU_I18N_IMPLEMENTATION
-DU_IO_IMPLEMENTATION
-DU_STATIC_IMPLEMENTATION=1
#-DU_CHARSET_IS_UTF8
-DUNISTR_FROM_STRING_EXPLICIT=
-DORTHANC_STATIC_ICU=1
-DORTHANC_ICU_DATA_MD5="${LIBICU_DATA_UNCOMPRESSED_MD5}"
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_source_files_properties(
${LIBICU_SOURCES_DIR}/source/common/locmap.c
PROPERTIES COMPILE_DEFINITIONS "LOCALE_SNAME=0x0000005c"
)
endif()
source_group(ThirdParty\\libicu REGULAR_EXPRESSION ${LIBICU_SOURCES_DIR}/.*)
else()
CHECK_INCLUDE_FILE_CXX(unicode/uvernum.h HAVE_ICU_H)
if (NOT HAVE_ICU_H)
message(FATAL_ERROR "Please install the libicu-dev package")
endif()
find_library(LIBICU_PATH_1 NAMES icuuc)
find_library(LIBICU_PATH_2 NAMES icui18n)
if (NOT LIBICU_PATH_1 OR
NOT LIBICU_PATH_2)
message(FATAL_ERROR "Please install the libicu-dev package")
else()
link_libraries(${LIBICU_PATH_1} ${LIBICU_PATH_2})
endif()
add_definitions(
-DORTHANC_STATIC_ICU=0
)
endif()

View File

@ -0,0 +1,117 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_LIBJPEG)
set(LIBJPEG_SOURCES_DIR ${CMAKE_BINARY_DIR}/jpeg-9f)
DownloadPackage(
"9ca58d68febb0fa9c1c087045b9a5483"
"https://orthanc.uclouvain.be/downloads/third-party-downloads/jpegsrc.v9f.tar.gz"
"${LIBJPEG_SOURCES_DIR}")
include_directories(
${LIBJPEG_SOURCES_DIR}
)
list(APPEND LIBJPEG_SOURCES
${LIBJPEG_SOURCES_DIR}/jaricom.c
${LIBJPEG_SOURCES_DIR}/jcapimin.c
${LIBJPEG_SOURCES_DIR}/jcapistd.c
${LIBJPEG_SOURCES_DIR}/jcarith.c
${LIBJPEG_SOURCES_DIR}/jccoefct.c
${LIBJPEG_SOURCES_DIR}/jccolor.c
${LIBJPEG_SOURCES_DIR}/jcdctmgr.c
${LIBJPEG_SOURCES_DIR}/jchuff.c
${LIBJPEG_SOURCES_DIR}/jcinit.c
${LIBJPEG_SOURCES_DIR}/jcmarker.c
${LIBJPEG_SOURCES_DIR}/jcmaster.c
${LIBJPEG_SOURCES_DIR}/jcomapi.c
${LIBJPEG_SOURCES_DIR}/jcparam.c
${LIBJPEG_SOURCES_DIR}/jcprepct.c
${LIBJPEG_SOURCES_DIR}/jcsample.c
${LIBJPEG_SOURCES_DIR}/jctrans.c
${LIBJPEG_SOURCES_DIR}/jdapimin.c
${LIBJPEG_SOURCES_DIR}/jdapistd.c
${LIBJPEG_SOURCES_DIR}/jdarith.c
${LIBJPEG_SOURCES_DIR}/jdatadst.c
${LIBJPEG_SOURCES_DIR}/jdatasrc.c
${LIBJPEG_SOURCES_DIR}/jdcoefct.c
${LIBJPEG_SOURCES_DIR}/jdcolor.c
${LIBJPEG_SOURCES_DIR}/jddctmgr.c
${LIBJPEG_SOURCES_DIR}/jdhuff.c
${LIBJPEG_SOURCES_DIR}/jdinput.c
${LIBJPEG_SOURCES_DIR}/jcmainct.c
${LIBJPEG_SOURCES_DIR}/jdmainct.c
${LIBJPEG_SOURCES_DIR}/jdmarker.c
${LIBJPEG_SOURCES_DIR}/jdmaster.c
${LIBJPEG_SOURCES_DIR}/jdmerge.c
${LIBJPEG_SOURCES_DIR}/jdpostct.c
${LIBJPEG_SOURCES_DIR}/jdsample.c
${LIBJPEG_SOURCES_DIR}/jdtrans.c
${LIBJPEG_SOURCES_DIR}/jerror.c
${LIBJPEG_SOURCES_DIR}/jfdctflt.c
${LIBJPEG_SOURCES_DIR}/jfdctfst.c
${LIBJPEG_SOURCES_DIR}/jfdctint.c
${LIBJPEG_SOURCES_DIR}/jidctflt.c
${LIBJPEG_SOURCES_DIR}/jidctfst.c
${LIBJPEG_SOURCES_DIR}/jidctint.c
#${LIBJPEG_SOURCES_DIR}/jmemansi.c
#${LIBJPEG_SOURCES_DIR}/jmemdos.c
#${LIBJPEG_SOURCES_DIR}/jmemmac.c
${LIBJPEG_SOURCES_DIR}/jmemmgr.c
#${LIBJPEG_SOURCES_DIR}/jmemname.c
${LIBJPEG_SOURCES_DIR}/jmemnobs.c
${LIBJPEG_SOURCES_DIR}/jquant1.c
${LIBJPEG_SOURCES_DIR}/jquant2.c
${LIBJPEG_SOURCES_DIR}/jutils.c
# ${LIBJPEG_SOURCES_DIR}/rdbmp.c
# ${LIBJPEG_SOURCES_DIR}/rdcolmap.c
# ${LIBJPEG_SOURCES_DIR}/rdgif.c
# ${LIBJPEG_SOURCES_DIR}/rdppm.c
# ${LIBJPEG_SOURCES_DIR}/rdrle.c
# ${LIBJPEG_SOURCES_DIR}/rdswitch.c
# ${LIBJPEG_SOURCES_DIR}/rdtarga.c
# ${LIBJPEG_SOURCES_DIR}/transupp.c
# ${LIBJPEG_SOURCES_DIR}/wrbmp.c
# ${LIBJPEG_SOURCES_DIR}/wrgif.c
# ${LIBJPEG_SOURCES_DIR}/wrppm.c
# ${LIBJPEG_SOURCES_DIR}/wrrle.c
# ${LIBJPEG_SOURCES_DIR}/wrtarga.c
)
configure_file(
${LIBJPEG_SOURCES_DIR}/jconfig.txt
${LIBJPEG_SOURCES_DIR}/jconfig.h COPYONLY
)
source_group(ThirdParty\\libjpeg REGULAR_EXPRESSION ${LIBJPEG_SOURCES_DIR}/.*)
else()
include(FindJPEG)
if (NOT JPEG_FOUND)
message(FATAL_ERROR "Unable to find libjpeg")
endif()
include_directories(${JPEG_INCLUDE_DIR})
link_libraries(${JPEG_LIBRARIES})
endif()

View File

@ -0,0 +1,100 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_LIBP11)
if (NOT STATIC_BUILD AND USE_SYSTEM_OPENSSL)
message(FATAL_ERROR "If statically linking against libp11, one must also statically link against OpenSSL")
endif()
SET(LIBP11_SOURCES_DIR ${CMAKE_BINARY_DIR}/libp11-0.4.0)
SET(LIBP11_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/libp11-0.4.0.tar.gz")
SET(LIBP11_MD5 "00b3e41db5be840d822bda12f3ab2ca7")
if (IS_DIRECTORY "${LIBP11_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${LIBP11_MD5} ${LIBP11_URL} "${LIBP11_SOURCES_DIR}")
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${CMAKE_CURRENT_LIST_DIR}/../Patches/libp11-0.4.0.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure AND FirstRun)
message(FATAL_ERROR "Error while patching libp11")
endif()
# This command MUST be after applying the patch
file(COPY
${LIBP11_SOURCES_DIR}/src/engine.h
${LIBP11_SOURCES_DIR}/src/libp11.h
DESTINATION ${AUTOGENERATED_DIR}/libp11)
file(WRITE ${AUTOGENERATED_DIR}/libp11/config.h "")
set(LIBP11_SOURCES
#${LIBP11_SOURCES_DIR}/src/eng_front.c
${LIBP11_SOURCES_DIR}/src/eng_back.c
${LIBP11_SOURCES_DIR}/src/eng_parse.c
${LIBP11_SOURCES_DIR}/src/libpkcs11.c
${LIBP11_SOURCES_DIR}/src/p11_attr.c
${LIBP11_SOURCES_DIR}/src/p11_cert.c
${LIBP11_SOURCES_DIR}/src/p11_ec.c
${LIBP11_SOURCES_DIR}/src/p11_err.c
${LIBP11_SOURCES_DIR}/src/p11_front.c
${LIBP11_SOURCES_DIR}/src/p11_key.c
${LIBP11_SOURCES_DIR}/src/p11_load.c
${LIBP11_SOURCES_DIR}/src/p11_misc.c
${LIBP11_SOURCES_DIR}/src/p11_rsa.c
${LIBP11_SOURCES_DIR}/src/p11_slot.c
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
list(APPEND LIBP11_SOURCES
${LIBP11_SOURCES_DIR}/src/atfork.c
)
endif()
source_group(ThirdParty\\libp11 REGULAR_EXPRESSION ${LIBP11_SOURCES_DIR}/.*)
else()
check_include_file_cxx(libp11.h HAVE_LIBP11_H)
if (NOT HAVE_LIBP11_H)
message(FATAL_ERROR "Please install the libp11-dev package")
endif()
check_library_exists(p11 PKCS11_login "" HAVE_LIBP11_LIB)
if (NOT HAVE_LIBP11_LIB)
message(FATAL_ERROR "Please install the libp11-dev package")
endif()
link_libraries(p11)
endif()

View File

@ -0,0 +1,82 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_LIBPNG)
SET(LIBPNG_SOURCES_DIR ${CMAKE_BINARY_DIR}/libpng-1.6.40)
SET(LIBPNG_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/libpng-1.6.40.tar.gz")
SET(LIBPNG_MD5 "ec4b597c3a9b1f8d2826575f530367b7")
DownloadPackage(${LIBPNG_MD5} ${LIBPNG_URL} "${LIBPNG_SOURCES_DIR}")
include_directories(
${LIBPNG_SOURCES_DIR}
)
configure_file(
${LIBPNG_SOURCES_DIR}/scripts/pnglibconf.h.prebuilt
${LIBPNG_SOURCES_DIR}/pnglibconf.h
)
set(LIBPNG_SOURCES
#${LIBPNG_SOURCES_DIR}/example.c
${LIBPNG_SOURCES_DIR}/png.c
${LIBPNG_SOURCES_DIR}/pngerror.c
${LIBPNG_SOURCES_DIR}/pngget.c
${LIBPNG_SOURCES_DIR}/pngmem.c
${LIBPNG_SOURCES_DIR}/pngpread.c
${LIBPNG_SOURCES_DIR}/pngread.c
${LIBPNG_SOURCES_DIR}/pngrio.c
${LIBPNG_SOURCES_DIR}/pngrtran.c
${LIBPNG_SOURCES_DIR}/pngrutil.c
${LIBPNG_SOURCES_DIR}/pngset.c
#${LIBPNG_SOURCES_DIR}/pngtest.c
${LIBPNG_SOURCES_DIR}/pngtrans.c
${LIBPNG_SOURCES_DIR}/pngwio.c
${LIBPNG_SOURCES_DIR}/pngwrite.c
${LIBPNG_SOURCES_DIR}/pngwtran.c
${LIBPNG_SOURCES_DIR}/pngwutil.c
)
add_definitions(
-DPNG_NO_CONFIG_H=1
-DPNG_NO_CONSOLE_IO=1
-DPNG_NO_STDIO=1
# disable ARM neon optimization for Apple M1 builds (TODO: try adding arm/filter_neon_intrinscis.c ... )
-DPNG_ARM_NEON_OPT=0
# The following declaration avoids "__declspec(dllexport)" in
# libpng to prevent publicly exposing its symbols by the DLLs
-DPNG_IMPEXP=
)
source_group(ThirdParty\\libpng REGULAR_EXPRESSION ${LIBPNG_SOURCES_DIR}/.*)
else()
include(FindPNG)
if (NOT PNG_FOUND)
message(FATAL_ERROR "Unable to find libpng")
endif()
include_directories(${PNG_INCLUDE_DIRS})
link_libraries(${PNG_LIBRARIES})
add_definitions(${PNG_DEFINITIONS})
endif()

View File

@ -0,0 +1,180 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_LUA)
SET(LUA_SOURCES_DIR ${CMAKE_BINARY_DIR}/lua-5.4.7)
SET(LUA_MD5 "fc3f3291353bbe6ee6dec85ee61331e8")
SET(LUA_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/lua-5.4.7.tar.gz")
DownloadPackage(${LUA_MD5} ${LUA_URL} "${LUA_SOURCES_DIR}")
if (ENABLE_LUA_MODULES)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
# Enable loading of shared libraries (for UNIX-like)
add_definitions(-DLUA_USE_DLOPEN=1)
# Publish the functions of the Lua engine (that are built within
# the Orthanc binary) as global symbols, so that the external
# shared libraries can call them
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-dynamic")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
add_definitions(-DLUA_USE_LINUX=1)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
add_definitions(
-DLUA_USE_LINUX=1
-DLUA_USE_READLINE=1
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
add_definitions(-DLUA_USE_POSIX=1)
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
add_definitions(
-DLUA_DL_DLL=1 # Enable loading of shared libraries (for Microsoft Windows)
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
add_definitions(
-DLUA_USE_MACOSX=1
-DLUA_DL_DYLD=1 # Enable loading of shared libraries (for Apple OS X)
)
else()
message(FATAL_ERROR "Support your platform here")
endif()
endif()
add_definitions(
-DLUA_COMPAT_5_2=1
)
include_directories(
${LUA_SOURCES_DIR}/src
)
set(LUA_SOURCES
# Don't compile the Lua command-line
#${LUA_SOURCES_DIR}/src/lua.c
#${LUA_SOURCES_DIR}/src/luac.c
# Core Lua
${LUA_SOURCES_DIR}/src/lapi.c
${LUA_SOURCES_DIR}/src/lcode.c
${LUA_SOURCES_DIR}/src/lctype.c
${LUA_SOURCES_DIR}/src/ldebug.c
${LUA_SOURCES_DIR}/src/ldo.c
${LUA_SOURCES_DIR}/src/ldump.c
${LUA_SOURCES_DIR}/src/lfunc.c
${LUA_SOURCES_DIR}/src/lgc.c
${LUA_SOURCES_DIR}/src/llex.c
${LUA_SOURCES_DIR}/src/lmem.c
${LUA_SOURCES_DIR}/src/lobject.c
${LUA_SOURCES_DIR}/src/lopcodes.c
${LUA_SOURCES_DIR}/src/lparser.c
${LUA_SOURCES_DIR}/src/lstate.c
${LUA_SOURCES_DIR}/src/lstring.c
${LUA_SOURCES_DIR}/src/ltable.c
${LUA_SOURCES_DIR}/src/ltm.c
${LUA_SOURCES_DIR}/src/lundump.c
${LUA_SOURCES_DIR}/src/lvm.c
${LUA_SOURCES_DIR}/src/lzio.c
# Base Lua modules
${LUA_SOURCES_DIR}/src/lauxlib.c
${LUA_SOURCES_DIR}/src/lbaselib.c
${LUA_SOURCES_DIR}/src/lcorolib.c
${LUA_SOURCES_DIR}/src/ldblib.c
${LUA_SOURCES_DIR}/src/liolib.c
${LUA_SOURCES_DIR}/src/lmathlib.c
${LUA_SOURCES_DIR}/src/loadlib.c
${LUA_SOURCES_DIR}/src/loslib.c
${LUA_SOURCES_DIR}/src/lstrlib.c
${LUA_SOURCES_DIR}/src/ltablib.c
${LUA_SOURCES_DIR}/src/lutf8lib.c
${LUA_SOURCES_DIR}/src/linit.c
)
source_group(ThirdParty\\Lua REGULAR_EXPRESSION ${LUA_SOURCES_DIR}/.*)
elseif ((CMAKE_CROSSCOMPILING AND
"${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") OR
NOT "${ORTHANC_LUA_VERSION}" STREQUAL "")
if ("${ORTHANC_LUA_VERSION}" STREQUAL "")
set(LUA_VERSIONS 5.3 5.2 5.1)
else()
# New in Orthanc 1.9.3
set(LUA_VERSIONS ${ORTHANC_LUA_VERSION})
endif()
unset(LUA_VERSION)
foreach(version IN ITEMS ${LUA_VERSIONS})
CHECK_INCLUDE_FILE(lua${version}/lua.h HAVE_LUA${version}_H)
if (HAVE_LUA${version}_H)
set(LUA_VERSION ${version})
break()
endif()
endforeach()
if (NOT LUA_VERSION)
message(FATAL_ERROR "Please install the liblua-dev package")
endif()
if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg")
set(LUA_INCLUDE_DIR ${CROSSTOOL_NG_IMAGE}/usr/include/lua${LUA_VERSION})
else()
# New in Orthanc 1.9.3
find_path(LUA_INCLUDE_DIR
NAMES lua.h
PATHS
/usr/include/lua${LUA_VERSION}
/usr/local/include/lua${LUA_VERSION}
)
endif()
message("Lua include dir: ${LUA_INCLUDE_DIR}")
include_directories(${LUA_INCLUDE_DIR})
CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_call" "${LUA_LIB_DIR}" HAVE_LUA_LIB_1) # Lua 5.1
CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_callk" "${LUA_LIB_DIR}" HAVE_LUA_LIB_2) # Lua 5.3
if (NOT HAVE_LUA_LIB_1 AND NOT HAVE_LUA_LIB_2)
message(FATAL_ERROR "Please install the liblua package")
endif()
link_libraries(lua${LUA_VERSION})
else()
include(FindLua)
if (NOT LUA_FOUND)
message(FATAL_ERROR "Please install the liblua-dev package")
endif()
include_directories(${LUA_INCLUDE_DIR})
link_libraries(${LUA_LIBRARIES})
endif()

View File

@ -0,0 +1,117 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_MONGOOSE)
SET(MONGOOSE_SOURCES_DIR ${CMAKE_BINARY_DIR}/mongoose)
if (IS_DIRECTORY "${MONGOOSE_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
if (0)
# Use Mongoose 3.1
DownloadPackage(
"e718fc287b4eb1bd523be3fa00942bb0"
"https://orthanc.uclouvain.be/downloads/third-party-downloads/mongoose-3.1.tgz"
"${MONGOOSE_SOURCES_DIR}")
add_definitions(-DMONGOOSE_USE_CALLBACKS=0)
set(MONGOOSE_PATCH ${CMAKE_CURRENT_LIST_DIR}/../Patches/mongoose-3.1-patch.diff)
else()
# Use Mongoose 3.8
DownloadPackage(
"7e3296295072792cdc3c633f9404e0c3"
"https://orthanc.uclouvain.be/downloads/third-party-downloads/mongoose-3.8.tgz"
"${MONGOOSE_SOURCES_DIR}")
add_definitions(-DMONGOOSE_USE_CALLBACKS=1)
set(MONGOOSE_PATCH ${CMAKE_CURRENT_LIST_DIR}/../Patches/mongoose-3.8-patch.diff)
endif()
# Patch mongoose
execute_process(
COMMAND ${PATCH_EXECUTABLE} -N mongoose.c
INPUT_FILE ${MONGOOSE_PATCH}
WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR}
RESULT_VARIABLE Failure
)
if (Failure AND FirstRun)
message(FATAL_ERROR "Error while patching a file")
endif()
include_directories(
${MONGOOSE_SOURCES_DIR}
)
set(MONGOOSE_SOURCES
${MONGOOSE_SOURCES_DIR}/mongoose.c
)
if (ENABLE_SSL)
add_definitions(
-DNO_SSL_DL=1
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
link_libraries(dl)
endif()
else()
add_definitions(
-DNO_SSL=1 # Remove SSL support from mongoose
)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if (CMAKE_COMPILER_IS_GNUCXX)
# This is a patch for MinGW64
add_definitions(-D_TIMESPEC_DEFINED=1)
endif()
endif()
source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*)
else()
CHECK_INCLUDE_FILE_CXX(mongoose.h HAVE_MONGOOSE_H)
if (NOT HAVE_MONGOOSE_H)
message(FATAL_ERROR "Please install the mongoose-devel package")
endif()
CHECK_LIBRARY_EXISTS(mongoose mg_start "" HAVE_MONGOOSE_LIB)
if (NOT HAVE_MONGOOSE_LIB)
message(FATAL_ERROR "Please install the mongoose-devel package")
endif()
if (SYSTEM_MONGOOSE_USE_CALLBACKS)
add_definitions(-DMONGOOSE_USE_CALLBACKS=1)
else()
add_definitions(-DMONGOOSE_USE_CALLBACKS=0)
endif()
link_libraries(mongoose)
endif()

View File

@ -0,0 +1,69 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL)
if (OPENSSL_STATIC_VERSION STREQUAL "1.1.1")
# Still used by orthanc-gcp (Google Cloud Platform) as of its release 1.0
include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfigurationStatic-1.1.1.cmake)
elseif (OPENSSL_STATIC_VERSION STREQUAL "3.0")
include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfigurationStatic-3.0.cmake)
else()
message(FATAL_ERROR "Unsupported version of OpenSSL: ${OPENSSL_STATIC_VERSION}")
endif()
source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*)
elseif (CMAKE_CROSSCOMPILING AND
"${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg")
CHECK_INCLUDE_FILE_CXX(openssl/opensslv.h HAVE_OPENSSL_H)
if (NOT HAVE_OPENSSL_H)
message(FATAL_ERROR "Please install the libopenssl-dev package")
endif()
CHECK_LIBRARY_EXISTS(crypto "OPENSSL_init" "" HAVE_OPENSSL_CRYPTO_LIB)
if (NOT HAVE_OPENSSL_CRYPTO_LIB)
message(FATAL_ERROR "Please install the libopenssl package")
endif()
# The "SSL_library_init" is for OpenSSL <= 1.0.2, whereas
# "OPENSSL_init_ssl" is for OpenSSL >= 1.1.0
CHECK_LIBRARY_EXISTS(ssl "SSL_library_init" "" HAVE_OPENSSL_SSL_LIB)
if (NOT HAVE_OPENSSL_SSL_LIB)
CHECK_LIBRARY_EXISTS(ssl "OPENSSL_init_ssl" "" HAVE_OPENSSL_SSL_LIB_2)
if (NOT HAVE_OPENSSL_SSL_LIB_2)
message(FATAL_ERROR "Please install the libopenssl package")
endif()
endif()
link_libraries(crypto ssl)
else()
include(FindOpenSSL)
if (NOT OPENSSL_FOUND)
message(FATAL_ERROR "Unable to find OpenSSL")
endif()
include_directories(${OPENSSL_INCLUDE_DIR})
link_libraries(${OPENSSL_LIBRARIES})
endif()

View File

@ -0,0 +1,310 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.1.1k)
SET(OPENSSL_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/openssl-1.1.1k.tar.gz")
SET(OPENSSL_MD5 "c4e7d95f782b08116afa27b30393dd27")
if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}")
if (FirstRun)
file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/buildinf.h "
#define DATE \"\"
#define PLATFORM \"\"
#define compiler_flags \"\"
")
file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/bn_conf.h "")
file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/dso_conf.h "")
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../Patches/openssl-1.1.1-conf.h.in
${OPENSSL_SOURCES_DIR}/include/openssl/opensslconf.h
)
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/openssl-1.1.1k.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
file(RENAME
${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h
${OPENSSL_SOURCES_DIR}/include/openssl/e_os2_source.h)
# The following patch of "e_os2.h" prevents from building OpenSSL
# as a DLL under Windows. Otherwise, symbols have inconsistent
# linkage if ${OPENSSL_SOURCES} is used to create a DLL (notably
# if building an Orthanc plugin such as PostgreSQL or MySQL).
file(WRITE ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h "
#include \"e_os2_source.h\"
#if defined(_WIN32)
# undef OPENSSL_EXPORT
# undef OPENSSL_IMPORT
# undef OPENSSL_EXTERN
# undef OPENSSL_GLOBAL
# define OPENSSL_EXPORT
# define OPENSSL_IMPORT
# define OPENSSL_EXTERN extern
# define OPENSSL_GLOBAL
#endif
")
else()
message("The patches for OpenSSL have already been applied")
endif()
add_definitions(
-DOPENSSL_THREADS
-DOPENSSL_IA32_SSE2
-DOPENSSL_NO_ASM
-DOPENSSL_NO_DYNAMIC_ENGINE
-DOPENSSL_NO_DEVCRYPTOENG
-DOPENSSL_NO_BF
-DOPENSSL_NO_CAMELLIA
-DOPENSSL_NO_CAST
-DOPENSSL_NO_EC_NISTP_64_GCC_128
-DOPENSSL_NO_GMP
-DOPENSSL_NO_GOST
-DOPENSSL_NO_HW
-DOPENSSL_NO_JPAKE
-DOPENSSL_NO_IDEA
-DOPENSSL_NO_KRB5
-DOPENSSL_NO_MD2
-DOPENSSL_NO_MDC2
#-DOPENSSL_NO_MD4 # MD4 is necessary for MariaDB/MySQL client
-DOPENSSL_NO_RC2
-DOPENSSL_NO_RC4
-DOPENSSL_NO_RC5
-DOPENSSL_NO_RFC3779
-DOPENSSL_NO_SCTP
-DOPENSSL_NO_STORE
-DOPENSSL_NO_SEED
-DOPENSSL_NO_WHIRLPOOL
-DOPENSSL_NO_RIPEMD
-DOPENSSL_NO_AFALGENG
-DOPENSSLDIR="/usr/local/ssl"
)
include_directories(
${OPENSSL_SOURCES_DIR}
${OPENSSL_SOURCES_DIR}/crypto
${OPENSSL_SOURCES_DIR}/crypto/asn1
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_32
${OPENSSL_SOURCES_DIR}/crypto/evp
${OPENSSL_SOURCES_DIR}/crypto/include
${OPENSSL_SOURCES_DIR}/crypto/modes
${OPENSSL_SOURCES_DIR}/include
)
set(OPENSSL_SOURCES_SUBDIRS
${OPENSSL_SOURCES_DIR}/crypto
${OPENSSL_SOURCES_DIR}/crypto/aes
${OPENSSL_SOURCES_DIR}/crypto/aria
${OPENSSL_SOURCES_DIR}/crypto/asn1
${OPENSSL_SOURCES_DIR}/crypto/async
${OPENSSL_SOURCES_DIR}/crypto/async/arch
${OPENSSL_SOURCES_DIR}/crypto/bio
${OPENSSL_SOURCES_DIR}/crypto/blake2
${OPENSSL_SOURCES_DIR}/crypto/bn
${OPENSSL_SOURCES_DIR}/crypto/buffer
${OPENSSL_SOURCES_DIR}/crypto/chacha
${OPENSSL_SOURCES_DIR}/crypto/cmac
${OPENSSL_SOURCES_DIR}/crypto/cms
${OPENSSL_SOURCES_DIR}/crypto/comp
${OPENSSL_SOURCES_DIR}/crypto/conf
${OPENSSL_SOURCES_DIR}/crypto/ct
${OPENSSL_SOURCES_DIR}/crypto/des
${OPENSSL_SOURCES_DIR}/crypto/dh
${OPENSSL_SOURCES_DIR}/crypto/dsa
${OPENSSL_SOURCES_DIR}/crypto/dso
${OPENSSL_SOURCES_DIR}/crypto/ec
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_32
${OPENSSL_SOURCES_DIR}/crypto/err
${OPENSSL_SOURCES_DIR}/crypto/evp
${OPENSSL_SOURCES_DIR}/crypto/hmac
${OPENSSL_SOURCES_DIR}/crypto/kdf
${OPENSSL_SOURCES_DIR}/crypto/lhash
${OPENSSL_SOURCES_DIR}/crypto/md4
${OPENSSL_SOURCES_DIR}/crypto/md5
${OPENSSL_SOURCES_DIR}/crypto/modes
${OPENSSL_SOURCES_DIR}/crypto/objects
${OPENSSL_SOURCES_DIR}/crypto/ocsp
${OPENSSL_SOURCES_DIR}/crypto/pem
${OPENSSL_SOURCES_DIR}/crypto/pkcs12
${OPENSSL_SOURCES_DIR}/crypto/pkcs7
${OPENSSL_SOURCES_DIR}/crypto/poly1305
${OPENSSL_SOURCES_DIR}/crypto/pqueue
${OPENSSL_SOURCES_DIR}/crypto/rand
${OPENSSL_SOURCES_DIR}/crypto/ripemd
${OPENSSL_SOURCES_DIR}/crypto/rsa
${OPENSSL_SOURCES_DIR}/crypto/sha
${OPENSSL_SOURCES_DIR}/crypto/siphash
${OPENSSL_SOURCES_DIR}/crypto/sm2
${OPENSSL_SOURCES_DIR}/crypto/sm3
${OPENSSL_SOURCES_DIR}/crypto/sm4
${OPENSSL_SOURCES_DIR}/crypto/srp
${OPENSSL_SOURCES_DIR}/crypto/stack
${OPENSSL_SOURCES_DIR}/crypto/store
${OPENSSL_SOURCES_DIR}/crypto/ts
${OPENSSL_SOURCES_DIR}/crypto/txt_db
${OPENSSL_SOURCES_DIR}/crypto/ui
${OPENSSL_SOURCES_DIR}/crypto/x509
${OPENSSL_SOURCES_DIR}/crypto/x509v3
${OPENSSL_SOURCES_DIR}/ssl
${OPENSSL_SOURCES_DIR}/ssl/record
${OPENSSL_SOURCES_DIR}/ssl/statem
)
if (ENABLE_OPENSSL_ENGINES)
add_definitions(
#-DENGINESDIR="/usr/local/lib/engines-1.1" # On GNU/Linux
-DENGINESDIR="."
)
list(APPEND OPENSSL_SOURCES_SUBDIRS
${OPENSSL_SOURCES_DIR}/engines
${OPENSSL_SOURCES_DIR}/crypto/engine
)
else()
add_definitions(-DOPENSSL_NO_ENGINE)
endif()
list(APPEND OPENSSL_SOURCES_SUBDIRS
# EC, ECDH and ECDSA are necessary for PKCS11, and for contacting
# HTTPS servers that use TLS certificate encrypted with ECDSA
# (check the output of a recent version of the "sslscan"
# command). Until Orthanc <= 1.4.1, these features were only
# enabled if ENABLE_PKCS11 support was set to "ON".
# https://groups.google.com/d/msg/orthanc-users/2l-bhYIMEWg/oMmK33bYBgAJ
${OPENSSL_SOURCES_DIR}/crypto/ec
${OPENSSL_SOURCES_DIR}/crypto/ecdh
${OPENSSL_SOURCES_DIR}/crypto/ecdsa
)
foreach(d ${OPENSSL_SOURCES_SUBDIRS})
AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES)
endforeach()
list(REMOVE_ITEM OPENSSL_SOURCES
${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_win.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_win32.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_wince.c
${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c
${OPENSSL_SOURCES_DIR}/crypto/armcap.c
${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c
${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c
${OPENSSL_SOURCES_DIR}/crypto/engine/eng_devcrypto.c
${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_base2_44.c # Cannot be compiled with MinGW
${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_ieee754.c # Cannot be compiled with MinGW
${OPENSSL_SOURCES_DIR}/crypto/ppccap.c
${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c
${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
${OPENSSL_SOURCES_DIR}/engines/e_afalg.c # Cannot be compiled with MinGW
)
# Check out "${OPENSSL_SOURCES_DIR}/Configurations/README": "This is
# default if no option is specified, it works on any supported
# system." It is mandatory to define it as a macro, as it is used by
# all the source files that include OpenSSL (e.g. "Core/Toolbox.cpp"
# or curl)
add_definitions(-DTHIRTY_TWO_BIT)
if (NOT CMAKE_COMPILER_IS_GNUCXX OR
"${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR
"${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
# Disable the use of a gcc extension, that is neither available on
# MinGW, nor on LSB
add_definitions(
-DOPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
)
endif()
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(OPENSSL_DEFINITIONS
"${OPENSSL_DEFINITIONS};OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;NO_WINDOWS_BRAINDEATH")
if (ENABLE_OPENSSL_ENGINES)
link_libraries(crypt32)
endif()
add_definitions(
-DOPENSSL_RAND_SEED_OS # ${OPENSSL_SOURCES_DIR}/crypto/rand/rand_win.c
)
elseif ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
add_definitions(
# In order for "crypto/mem_sec.c" to compile on LSB
-DOPENSSL_NO_SECURE_MEMORY
# The "OPENSSL_RAND_SEED_OS" value implies a syscall() to
# "__NR_getrandom" (i.e. system call "getentropy(2)") in
# "rand_unix.c", which is not available in LSB.
-DOPENSSL_RAND_SEED_DEVRANDOM
# If "OPENSSL_NO_ERR" is not defined, the PostgreSQL plugin
# crashes with segmentation fault in function
# "build_SYS_str_reasons()", that is called from
# "OPENSSL_init_ssl()"
# https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=193
-DOPENSSL_NO_ERR
)
else()
# Fixes error "OpenSSL error: error:2406C06E:random number
# generator:RAND_DRBG_instantiate:error retrieving entropy" that was
# present in Orthanc 1.6.0, if statically linking on Ubuntu 18.04
add_definitions(
-DOPENSSL_RAND_SEED_OS
)
endif()
set_source_files_properties(
${OPENSSL_SOURCES}
PROPERTIES COMPILE_DEFINITIONS
"${OPENSSL_DEFINITIONS};DSO_NONE"
)

View File

@ -0,0 +1,415 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
set(OPENSSL_VERSION_MAJOR 3)
set(OPENSSL_VERSION_MINOR 1)
set(OPENSSL_VERSION_PATCH 4)
set(OPENSSL_VERSION_PRE_RELEASE "")
set(OPENSSL_VERSION_FULL "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_PATCH}${OPENSSL_VERSION_PRE_RELEASE}")
SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-${OPENSSL_VERSION_FULL})
SET(OPENSSL_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/openssl-${OPENSSL_VERSION_FULL}.tar.gz")
SET(OPENSSL_MD5 "653ad58812c751b887e8ec37e02bba70")
if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}")
if (FirstRun)
# Apply the patches
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/openssl-${OPENSSL_VERSION_FULL}.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_LIST_DIR}/../Patches/OpenSSL-ConfigureHeaders.py
"${OPENSSL_SOURCES_DIR}"
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while configuring the OpenSSL headers")
endif()
file(WRITE ${OPENSSL_SOURCES_DIR}/include/openssl/opensslv.h "")
file(WRITE ${OPENSSL_SOURCES_DIR}/include/crypto/bn_conf.h "")
file(WRITE ${OPENSSL_SOURCES_DIR}/include/crypto/dso_conf.h "")
file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/buildinf.h "
#define DATE \"\"
#define PLATFORM \"\"
#define compiler_flags \"\"
")
else()
message("The patches for OpenSSL have already been applied")
endif()
if (OPENSSL_VERSION_PRE_RELEASE STREQUAL "")
set(VERSION_VERSION_OFFSET 0)
else()
set(VERSION_VERSION_OFFSET 15)
endif()
math(EXPR OPENSSL_CONFIGURED_API "${OPENSSL_VERSION_MAJOR} * 10000 + ${OPENSSL_VERSION_MINOR} * 100")
# This macro is normally defined in "opensslv.h.in"
math(EXPR OPENSSL_VERSION_NUMBER "(${OPENSSL_VERSION_MAJOR} << 28) + (${OPENSSL_VERSION_MINOR} << 20) + (${OPENSSL_VERSION_PATCH} << 4) + ${VERSION_VERSION_OFFSET}")
list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 OPENSSL_DSO_EXTENSION)
add_definitions(
-DOPENSSL_VERSION_MAJOR=${OPENSSL_VERSION_MAJOR}
-DOPENSSL_VERSION_MINOR=${OPENSSL_VERSION_MINOR}
-DOPENSSL_VERSION_PATCH=${OPENSSL_VERSION_PATCH}
-DOPENSSL_CONFIGURED_API=${OPENSSL_CONFIGURED_API}
-DOPENSSL_VERSION_NUMBER=${OPENSSL_VERSION_NUMBER}
-DOPENSSL_VERSION_PRE_RELEASE="${OPENSSL_VERSION_PRE_RELEASE}"
-DOPENSSL_VERSION_BUILD_METADATA=""
-DOPENSSL_VERSION_TEXT="OpenSSL ${OPENSSL_VERSION_FULL}"
-DOPENSSL_VERSION_STR="${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_PATCH}"
-DOPENSSL_FULL_VERSION_STR="${OPENSSL_VERSION_FULL}"
-DDSO_EXTENSION="${OPENSSL_DSO_EXTENSION}"
-DOPENSSLDIR="/usr/local/ssl"
-DMODULESDIR="" # TODO
-DOPENSSL_BUILDING_OPENSSL
-DOPENSSL_THREADS
-DOPENSSL_IA32_SSE2
-DOPENSSL_NO_AFALGENG
-DOPENSSL_NO_ASM
-DOPENSSL_NO_CHACHA # Necessary for VC2015-64 since openssl-3.0.1
-DOPENSSL_NO_DEVCRYPTOENG
-DOPENSSL_NO_DYNAMIC_ENGINE
-DOPENSSL_NO_EC_NISTP_64_GCC_128
-DOPENSSL_NO_GOST
-DOPENSSL_NO_RFC3779
-DOPENSSL_NO_SCTP
-DOPENSSL_NO_KTLS # TODO ?
)
include_directories(
BEFORE
${OPENSSL_SOURCES_DIR}
${OPENSSL_SOURCES_DIR}/crypto/asn1
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_32
${OPENSSL_SOURCES_DIR}/crypto/evp
${OPENSSL_SOURCES_DIR}/crypto/include
${OPENSSL_SOURCES_DIR}/crypto/modes
${OPENSSL_SOURCES_DIR}/include
${OPENSSL_SOURCES_DIR}/providers/common/include
${OPENSSL_SOURCES_DIR}/providers/implementations/include
)
set(OPENSSL_SOURCES_SUBDIRS
## Assembly is disabled
# ${OPENSSL_SOURCES_DIR}/crypto/aes/asm
# ${OPENSSL_SOURCES_DIR}/crypto/bf/asm
# ${OPENSSL_SOURCES_DIR}/crypto/bn/asm
# ${OPENSSL_SOURCES_DIR}/crypto/camellia/asm
# ${OPENSSL_SOURCES_DIR}/crypto/cast/asm
# ${OPENSSL_SOURCES_DIR}/crypto/chacha/asm
# ${OPENSSL_SOURCES_DIR}/crypto/des/asm
# ${OPENSSL_SOURCES_DIR}/crypto/ec/asm
# ${OPENSSL_SOURCES_DIR}/crypto/md5/asm
# ${OPENSSL_SOURCES_DIR}/crypto/modes/asm
# ${OPENSSL_SOURCES_DIR}/crypto/poly1305/asm
# ${OPENSSL_SOURCES_DIR}/crypto/rc4/asm
# ${OPENSSL_SOURCES_DIR}/crypto/rc5/asm
# ${OPENSSL_SOURCES_DIR}/crypto/ripemd/asm
# ${OPENSSL_SOURCES_DIR}/crypto/sha/asm
# ${OPENSSL_SOURCES_DIR}/crypto/whrlpool/asm
${OPENSSL_SOURCES_DIR}/crypto
${OPENSSL_SOURCES_DIR}/crypto/aes
${OPENSSL_SOURCES_DIR}/crypto/aria
${OPENSSL_SOURCES_DIR}/crypto/asn1
${OPENSSL_SOURCES_DIR}/crypto/async
${OPENSSL_SOURCES_DIR}/crypto/async/arch
${OPENSSL_SOURCES_DIR}/crypto/bf
${OPENSSL_SOURCES_DIR}/crypto/bio
${OPENSSL_SOURCES_DIR}/crypto/bn
${OPENSSL_SOURCES_DIR}/crypto/buffer
${OPENSSL_SOURCES_DIR}/crypto/camellia
${OPENSSL_SOURCES_DIR}/crypto/cast
${OPENSSL_SOURCES_DIR}/crypto/chacha
${OPENSSL_SOURCES_DIR}/crypto/cmac
${OPENSSL_SOURCES_DIR}/crypto/cmp
${OPENSSL_SOURCES_DIR}/crypto/cms
${OPENSSL_SOURCES_DIR}/crypto/comp
${OPENSSL_SOURCES_DIR}/crypto/conf
${OPENSSL_SOURCES_DIR}/crypto/crmf
${OPENSSL_SOURCES_DIR}/crypto/ct
${OPENSSL_SOURCES_DIR}/crypto/des
${OPENSSL_SOURCES_DIR}/crypto/dh
${OPENSSL_SOURCES_DIR}/crypto/dsa
${OPENSSL_SOURCES_DIR}/crypto/dso
${OPENSSL_SOURCES_DIR}/crypto/ec
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_32
${OPENSSL_SOURCES_DIR}/crypto/ec/curve448/arch_64
${OPENSSL_SOURCES_DIR}/crypto/encode_decode
${OPENSSL_SOURCES_DIR}/crypto/engine
${OPENSSL_SOURCES_DIR}/crypto/err
${OPENSSL_SOURCES_DIR}/crypto/ess
${OPENSSL_SOURCES_DIR}/crypto/evp
${OPENSSL_SOURCES_DIR}/crypto/ffc
${OPENSSL_SOURCES_DIR}/crypto/hmac
${OPENSSL_SOURCES_DIR}/crypto/http
${OPENSSL_SOURCES_DIR}/crypto/idea
${OPENSSL_SOURCES_DIR}/crypto/kdf
${OPENSSL_SOURCES_DIR}/crypto/lhash
${OPENSSL_SOURCES_DIR}/crypto/md2
${OPENSSL_SOURCES_DIR}/crypto/md4
${OPENSSL_SOURCES_DIR}/crypto/md5
${OPENSSL_SOURCES_DIR}/crypto/mdc2
${OPENSSL_SOURCES_DIR}/crypto/modes
${OPENSSL_SOURCES_DIR}/crypto/objects
${OPENSSL_SOURCES_DIR}/crypto/ocsp
${OPENSSL_SOURCES_DIR}/crypto/pem
${OPENSSL_SOURCES_DIR}/crypto/perlasm
${OPENSSL_SOURCES_DIR}/crypto/pkcs12
${OPENSSL_SOURCES_DIR}/crypto/pkcs7
${OPENSSL_SOURCES_DIR}/crypto/poly1305
${OPENSSL_SOURCES_DIR}/crypto/property
${OPENSSL_SOURCES_DIR}/crypto/rand
${OPENSSL_SOURCES_DIR}/crypto/rc2
${OPENSSL_SOURCES_DIR}/crypto/rc4
${OPENSSL_SOURCES_DIR}/crypto/rc5
${OPENSSL_SOURCES_DIR}/crypto/ripemd
${OPENSSL_SOURCES_DIR}/crypto/rsa
${OPENSSL_SOURCES_DIR}/crypto/seed
${OPENSSL_SOURCES_DIR}/crypto/sha
${OPENSSL_SOURCES_DIR}/crypto/siphash
${OPENSSL_SOURCES_DIR}/crypto/sm2
${OPENSSL_SOURCES_DIR}/crypto/sm3
${OPENSSL_SOURCES_DIR}/crypto/sm4
${OPENSSL_SOURCES_DIR}/crypto/srp
${OPENSSL_SOURCES_DIR}/crypto/stack
${OPENSSL_SOURCES_DIR}/crypto/store
${OPENSSL_SOURCES_DIR}/crypto/ts
${OPENSSL_SOURCES_DIR}/crypto/txt_db
${OPENSSL_SOURCES_DIR}/crypto/ui
${OPENSSL_SOURCES_DIR}/crypto/whrlpool
${OPENSSL_SOURCES_DIR}/crypto/x509
# ${OPENSSL_SOURCES_DIR}/providers/implementations/rands/seeding # OS-specific
${OPENSSL_SOURCES_DIR}/providers
${OPENSSL_SOURCES_DIR}/providers/common
${OPENSSL_SOURCES_DIR}/providers/common/der
${OPENSSL_SOURCES_DIR}/providers/implementations/asymciphers
${OPENSSL_SOURCES_DIR}/providers/implementations/ciphers
${OPENSSL_SOURCES_DIR}/providers/implementations/digests
${OPENSSL_SOURCES_DIR}/providers/implementations/encode_decode
${OPENSSL_SOURCES_DIR}/providers/implementations/exchange
${OPENSSL_SOURCES_DIR}/providers/implementations/kdfs
${OPENSSL_SOURCES_DIR}/providers/implementations/kem
${OPENSSL_SOURCES_DIR}/providers/implementations/keymgmt
${OPENSSL_SOURCES_DIR}/providers/implementations/macs
${OPENSSL_SOURCES_DIR}/providers/implementations/rands
${OPENSSL_SOURCES_DIR}/providers/implementations/signature
${OPENSSL_SOURCES_DIR}/providers/implementations/storemgmt
${OPENSSL_SOURCES_DIR}/ssl
${OPENSSL_SOURCES_DIR}/ssl/record
${OPENSSL_SOURCES_DIR}/ssl/statem
)
if (ENABLE_OPENSSL_ENGINES)
add_definitions(
#-DENGINESDIR="/usr/local/lib/engines-1.1" # On GNU/Linux
-DENGINESDIR="."
)
list(APPEND OPENSSL_SOURCES_SUBDIRS
${OPENSSL_SOURCES_DIR}/engines
${OPENSSL_SOURCES_DIR}/crypto/engine
)
else()
add_definitions(-DOPENSSL_NO_ENGINE)
endif()
list(APPEND OPENSSL_SOURCES_SUBDIRS
# EC, ECDH and ECDSA are necessary for PKCS11, and for contacting
# HTTPS servers that use TLS certificate encrypted with ECDSA
# (check the output of a recent version of the "sslscan"
# command). Until Orthanc <= 1.4.1, these features were only
# enabled if ENABLE_PKCS11 support was set to "ON".
# https://groups.google.com/d/msg/orthanc-users/2l-bhYIMEWg/oMmK33bYBgAJ
${OPENSSL_SOURCES_DIR}/crypto/ec
${OPENSSL_SOURCES_DIR}/crypto/ecdh
${OPENSSL_SOURCES_DIR}/crypto/ecdsa
)
foreach(d ${OPENSSL_SOURCES_SUBDIRS})
AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES)
endforeach()
list(REMOVE_ITEM OPENSSL_SOURCES
# Files below are not part of the "libcrypto.a" and "libssl.a" that
# are created by compiling OpenSSL from sources
${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_win.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_win32.c
${OPENSSL_SOURCES_DIR}/crypto/LPdir_wince.c
${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c
${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistp224.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistp256.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistp521.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_s390x_nistp.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecx_s390x.c
${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_base2_44.c
${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa_acvp_test_params.c
${OPENSSL_SOURCES_DIR}/engines/e_devcrypto.c
${OPENSSL_SOURCES_DIR}/engines/e_loader_attic.c
${OPENSSL_SOURCES_DIR}/providers/common/securitycheck_fips.c
${OPENSSL_SOURCES_DIR}/providers/implementations/macs/blake2_mac_impl.c
${OPENSSL_SOURCES_DIR}/engines/e_afalg.c # Fails on OS X and Visual Studio
${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_ieee754.c # Fails on Visual Studio
${OPENSSL_SOURCES_DIR}/ssl/ktls.c # TODO ?
# Disable PowerPC sources
${OPENSSL_SOURCES_DIR}/crypto/bn/bn_ppc.c
${OPENSSL_SOURCES_DIR}/crypto/chacha/chacha_ppc.c
${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_ppc.c
${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_ppc.c
${OPENSSL_SOURCES_DIR}/crypto/sha/sha_ppc.c
# Disable SPARC sources
${OPENSSL_SOURCES_DIR}/crypto/bn/bn_sparc.c
# Disable CPUID for non-x86 platforms
${OPENSSL_SOURCES_DIR}/crypto/armcap.c
${OPENSSL_SOURCES_DIR}/crypto/loongarchcap.c
${OPENSSL_SOURCES_DIR}/crypto/ppccap.c
${OPENSSL_SOURCES_DIR}/crypto/riscvcap.c
${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c
${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
APPLE)
list(APPEND OPENSSL_SOURCES
${OPENSSL_SOURCES_DIR}/providers/implementations/rands/seeding/rand_unix.c
)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
list(APPEND OPENSSL_SOURCES
${OPENSSL_SOURCES_DIR}/providers/implementations/rands/seeding/rand_win.c
)
endif()
# Check out "${OPENSSL_SOURCES_DIR}/Configurations/README.md": "This
# is default if no option is specified, it works on any supported
# system." It is mandatory to define it as a macro, as it is used by
# all the source files that include OpenSSL (e.g. "Core/Toolbox.cpp"
# or curl)
add_definitions(-DTHIRTY_TWO_BIT)
if (NOT CMAKE_COMPILER_IS_GNUCXX OR
"${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR
"${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
# Disable the use of a gcc extension, that is neither available on
# MinGW, nor on LSB
add_definitions(
-DOPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
)
endif()
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(OPENSSL_DEFINITIONS
"${OPENSSL_DEFINITIONS};OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;NO_WINDOWS_BRAINDEATH")
if (ENABLE_OPENSSL_ENGINES)
link_libraries(crypt32)
endif()
add_definitions(
-DOPENSSL_RAND_SEED_OS # ${OPENSSL_SOURCES_DIR}/crypto/rand/rand_win.c
)
elseif ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
add_definitions(
# In order for "crypto/mem_sec.c" to compile on LSB
-DOPENSSL_NO_SECURE_MEMORY
# The "OPENSSL_RAND_SEED_OS" value implies a syscall() to
# "__NR_getrandom" (i.e. system call "getentropy(2)") in
# "rand_unix.c", which is not available in LSB.
-DOPENSSL_RAND_SEED_DEVRANDOM
# If "OPENSSL_NO_ERR" is not defined, the PostgreSQL plugin
# crashes with segmentation fault in function
# "build_SYS_str_reasons()", that is called from
# "OPENSSL_init_ssl()"
# https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=193
-DOPENSSL_NO_ERR
)
else()
# Fixes error "OpenSSL error: error:2406C06E:random number
# generator:RAND_DRBG_instantiate:error retrieving entropy" that was
# present in Orthanc 1.6.0, if statically linking on Ubuntu 18.04
add_definitions(
-DOPENSSL_RAND_SEED_OS
)
endif()
set_source_files_properties(
${OPENSSL_SOURCES}
PROPERTIES COMPILE_DEFINITIONS
"${OPENSSL_DEFINITIONS};DSO_NONE"
)

View File

@ -0,0 +1,787 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
##
## This is a CMake configuration file that configures the core
## libraries of Orthanc. This file can be used by external projects so
## as to gain access to the Orthanc APIs (the most prominent examples
## are currently "Stone of Orthanc" and "Orthanc for whole-slide
## imaging plugin").
##
#####################################################################
## Configuration of the components
#####################################################################
# Some basic inclusions
include(CMakePushCheckState)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckTypeSize)
if(CMAKE_VERSION VERSION_GREATER "3.11")
find_package(Python REQUIRED COMPONENTS Interpreter)
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
else()
include(FindPythonInterp)
find_package(PythonInterp REQUIRED)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake)
#####################################################################
## Disable unneeded macros
#####################################################################
if (NOT ENABLE_SQLITE)
unset(USE_SYSTEM_SQLITE CACHE)
add_definitions(-DORTHANC_ENABLE_SQLITE=0)
endif()
if (NOT ENABLE_CRYPTO_OPTIONS)
unset(ENABLE_SSL CACHE)
unset(ENABLE_PKCS11 CACHE)
unset(ENABLE_OPENSSL_ENGINES CACHE)
unset(OPENSSL_STATIC_VERSION CACHE)
unset(USE_SYSTEM_OPENSSL CACHE)
unset(USE_SYSTEM_LIBP11 CACHE)
add_definitions(
-DORTHANC_ENABLE_SSL=0
-DORTHANC_ENABLE_PKCS11=0
)
endif()
if (NOT ENABLE_WEB_CLIENT)
unset(USE_SYSTEM_CURL CACHE)
add_definitions(-DORTHANC_ENABLE_CURL=0)
endif()
if (NOT ENABLE_WEB_SERVER)
unset(ENABLE_CIVETWEB CACHE)
unset(USE_SYSTEM_CIVETWEB CACHE)
unset(USE_SYSTEM_MONGOOSE CACHE)
add_definitions(
-DORTHANC_ENABLE_CIVETWEB=0
-DORTHANC_ENABLE_MONGOOSE=0
)
endif()
if (NOT ENABLE_JPEG)
unset(USE_SYSTEM_LIBJPEG CACHE)
add_definitions(-DORTHANC_ENABLE_JPEG=0)
endif()
if (NOT ENABLE_ZLIB)
unset(USE_SYSTEM_ZLIB CACHE)
add_definitions(-DORTHANC_ENABLE_ZLIB=0)
endif()
if (NOT ENABLE_PNG)
unset(USE_SYSTEM_LIBPNG CACHE)
add_definitions(-DORTHANC_ENABLE_PNG=0)
endif()
if (NOT ENABLE_LUA)
unset(USE_SYSTEM_LUA CACHE)
unset(ENABLE_LUA_MODULES CACHE)
unset(ORTHANC_LUA_VERSION)
add_definitions(-DORTHANC_ENABLE_LUA=0)
endif()
if (NOT ENABLE_PUGIXML)
unset(USE_SYSTEM_PUGIXML CACHE)
add_definitions(-DORTHANC_ENABLE_PUGIXML=0)
endif()
if (NOT ENABLE_LOCALE)
unset(BOOST_LOCALE_BACKEND CACHE)
add_definitions(-DORTHANC_ENABLE_LOCALE=0)
endif()
if (NOT ENABLE_GOOGLE_TEST)
unset(USE_SYSTEM_GOOGLE_TEST CACHE)
unset(USE_GOOGLE_TEST_DEBIAN_PACKAGE CACHE)
endif()
if (NOT ENABLE_DCMTK)
add_definitions(
-DORTHANC_ENABLE_DCMTK=0
-DORTHANC_ENABLE_DCMTK_JPEG=0
-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=0
-DORTHANC_ENABLE_DCMTK_NETWORKING=0
-DORTHANC_ENABLE_DCMTK_TRANSCODING=0
)
unset(DCMTK_DICTIONARY_DIR CACHE)
unset(DCMTK_VERSION CACHE)
unset(USE_DCMTK_362_PRIVATE_DIC CACHE)
unset(USE_SYSTEM_DCMTK CACHE)
unset(ENABLE_DCMTK_JPEG CACHE)
unset(ENABLE_DCMTK_JPEG_LOSSLESS CACHE)
unset(DCMTK_STATIC_VERSION CACHE)
unset(ENABLE_DCMTK_LOG CACHE)
endif()
if (NOT ENABLE_PROTOBUF)
unset(USE_SYSTEM_PROTOBUF CACHE)
add_definitions(-DORTHANC_ENABLE_PROTOBUF=0)
endif()
#####################################################################
## List of source files
#####################################################################
set(ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Cache/MemoryCache.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Cache/MemoryObjectCache.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/ChunkedBuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomPath.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomTag.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/Window.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/EnumerationDictionary.h
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Enumerations.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/FileInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/MemoryStorageArea.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/PluginStorageAreaAdapter.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/CStringMatcher.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpContentNegociation.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpToolbox.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/MultipartStreamReader.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/StringMatcher.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Logging.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/MallocMemoryBuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/OrthancException.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/OrthancFramework.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApiHierarchy.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApiPath.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SerializationToolbox.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/StringMemoryBuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Toolbox.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/WebServiceParameters.cpp
)
if (ENABLE_MODULE_IMAGES)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/Font.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/FontRegistry.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/IImageWriter.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/Image.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/ImageAccessor.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/ImageBuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/ImageProcessing.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/NumpyWriter.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/PamReader.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/PamWriter.cpp
)
endif()
if (ENABLE_MODULE_DICOM)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomArray.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomElement.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomImageInformation.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomInstanceHasher.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomIntegerPixelAccessor.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomMap.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomStreamReader.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/DicomValue.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomFormat/StreamBlockReader.cpp
)
endif()
if (ENABLE_MODULE_JOBS)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/GenericJobUnserializer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/JobInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/JobStatus.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/JobStepResult.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/Operations/JobOperationValues.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/Operations/LogJobOperation.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/Operations/NullOperationValue.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/Operations/SequenceOfOperationsJob.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/Operations/StringOperationValue.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/SetOfCommandsJob.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/SetOfInstancesJob.cpp
)
endif()
#####################################################################
## Configuration of optional third-party dependencies
#####################################################################
##
## Embedded database: SQLite
##
if (ENABLE_SQLITE)
include(${CMAKE_CURRENT_LIST_DIR}/SQLiteConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_SQLITE=1)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SQLite/Connection.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SQLite/FunctionContext.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SQLite/Statement.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SQLite/StatementId.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SQLite/StatementReference.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SQLite/Transaction.cpp
)
endif()
##
## Cryptography: OpenSSL and libp11
## Must be above "ENABLE_WEB_CLIENT" and "ENABLE_WEB_SERVER"
##
if (ENABLE_CRYPTO_OPTIONS)
if (ENABLE_SSL)
include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_SSL=1)
else()
unset(ENABLE_OPENSSL_ENGINES CACHE)
unset(USE_SYSTEM_OPENSSL CACHE)
add_definitions(-DORTHANC_ENABLE_SSL=0)
endif()
if (ENABLE_PKCS11)
if (ENABLE_SSL)
include(${CMAKE_CURRENT_LIST_DIR}/LibP11Configuration.cmake)
add_definitions(-DORTHANC_ENABLE_PKCS11=1)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Pkcs11.cpp
)
else()
message(FATAL_ERROR "OpenSSL is required to enable PKCS#11 support")
endif()
else()
add_definitions(-DORTHANC_ENABLE_PKCS11=0)
endif()
endif()
##
## HTTP client: libcurl
##
if (ENABLE_WEB_CLIENT)
include(${CMAKE_CURRENT_LIST_DIR}/LibCurlConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_CURL=1)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpClient.cpp
)
endif()
##
## HTTP server: Mongoose 3.8 or Civetweb
##
if (ENABLE_WEB_SERVER)
if (ENABLE_CIVETWEB)
include(${CMAKE_CURRENT_LIST_DIR}/CivetwebConfiguration.cmake)
add_definitions(
-DORTHANC_ENABLE_CIVETWEB=1
-DORTHANC_ENABLE_MONGOOSE=0
)
set(ORTHANC_ENABLE_CIVETWEB 1)
else()
include(${CMAKE_CURRENT_LIST_DIR}/MongooseConfiguration.cmake)
endif()
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/BufferHttpSender.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/FilesystemHttpHandler.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/FilesystemHttpSender.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpFileSender.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpOutput.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpServer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpStreamTranscoder.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/IHttpHandler.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/StringHttpOutput.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApi.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApiCall.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApiCallDocumentation.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApiGetCall.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApiOutput.cpp
)
if (ENABLE_PUGIXML)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/IWebDavBucket.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/WebDavStorage.cpp
)
endif()
endif()
if (ORTHANC_ENABLE_CIVETWEB)
add_definitions(-DORTHANC_ENABLE_CIVETWEB=1)
else()
add_definitions(-DORTHANC_ENABLE_CIVETWEB=0)
endif()
if (ORTHANC_ENABLE_MONGOOSE)
add_definitions(-DORTHANC_ENABLE_MONGOOSE=1)
else()
add_definitions(-DORTHANC_ENABLE_MONGOOSE=0)
endif()
##
## JPEG support: libjpeg
##
if (ENABLE_JPEG)
if (NOT ENABLE_MODULE_IMAGES)
message(FATAL_ERROR "Image processing primitives must be enabled if enabling libjpeg support")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/LibJpegConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_JPEG=1)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/JpegErrorManager.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/JpegReader.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/JpegWriter.cpp
)
endif()
##
## zlib support
##
if (ENABLE_ZLIB)
include(${CMAKE_CURRENT_LIST_DIR}/ZlibConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_ZLIB=1)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Compression/DeflateBaseCompressor.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Compression/GzipCompressor.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Compression/IBufferCompressor.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Compression/ZipReader.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Compression/ZlibCompressor.cpp
)
if (NOT ORTHANC_SANDBOXED)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Compression/HierarchicalZipWriter.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Compression/ZipWriter.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/StorageAccessor.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/StorageCache.cpp
)
endif()
endif()
##
## PNG support: libpng (in conjunction with zlib)
##
if (ENABLE_PNG)
if (NOT ENABLE_ZLIB)
message(FATAL_ERROR "Support for zlib must be enabled if enabling libpng support")
endif()
if (NOT ENABLE_MODULE_IMAGES)
message(FATAL_ERROR "Image processing primitives must be enabled if enabling libpng support")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/LibPngConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_PNG=1)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/PngReader.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Images/PngWriter.cpp
)
endif()
##
## Lua support
##
if (ENABLE_LUA)
include(${CMAKE_CURRENT_LIST_DIR}/LuaConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_LUA=1)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Lua/LuaContext.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Lua/LuaFunctionCall.cpp
)
endif()
##
## XML support: pugixml
##
if (ENABLE_PUGIXML)
include(${CMAKE_CURRENT_LIST_DIR}/PugixmlConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_PUGIXML=1)
endif()
##
## Locale support
##
if (ENABLE_LOCALE)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
# In WebAssembly or asm.js, we rely on the version of iconv that
# is shipped with the stdlib
unset(BOOST_LOCALE_BACKEND CACHE)
else()
if (BOOST_LOCALE_BACKEND STREQUAL "gcc" OR
BOOST_LOCALE_BACKEND STREQUAL "oficonv")
elseif (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
include(${CMAKE_CURRENT_LIST_DIR}/LibIconvConfiguration.cmake)
elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
include(${CMAKE_CURRENT_LIST_DIR}/LibIcuConfiguration.cmake)
elseif (BOOST_LOCALE_BACKEND STREQUAL "wconv")
message("Using Microsoft Window's wconv")
else()
message(FATAL_ERROR "Invalid value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
endif()
endif()
add_definitions(-DORTHANC_ENABLE_LOCALE=1)
endif()
##
## Google Test for unit testing
##
if (ENABLE_GOOGLE_TEST)
include(${CMAKE_CURRENT_LIST_DIR}/GoogleTestConfiguration.cmake)
endif()
##
## Google Protocol Buffers
##
if (ENABLE_PROTOBUF)
include(${CMAKE_CURRENT_LIST_DIR}/ProtobufConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_PROTOBUF=1)
endif()
#####################################################################
## Inclusion of mandatory third-party dependencies
#####################################################################
include(${CMAKE_CURRENT_LIST_DIR}/JsonCppConfiguration.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/UuidConfiguration.cmake)
# We put Boost as the last dependency, as it is the heaviest to
# configure, which allows one to quickly spot problems when configuring
# static builds in other dependencies
include(${CMAKE_CURRENT_LIST_DIR}/BoostConfiguration.cmake)
#####################################################################
## Optional configuration of DCMTK
#####################################################################
if (ENABLE_DCMTK)
if (NOT ENABLE_LOCALE)
message(FATAL_ERROR "Support for locales must be enabled if enabling DCMTK support")
endif()
if (NOT ENABLE_MODULE_DICOM)
message(FATAL_ERROR "DICOM module must be enabled if enabling DCMTK support")
endif()
# WARNING - MUST be after "OpenSslConfiguration.cmake", otherwise
# DICOM TLS will not be corrected detected
include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfiguration.cmake)
add_definitions(-DORTHANC_ENABLE_DCMTK=1)
if (ENABLE_DCMTK_JPEG)
add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG=1)
else()
add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG=0)
endif()
if (ENABLE_DCMTK_JPEG_LOSSLESS)
add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=1)
else()
add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=0)
endif()
set(ORTHANC_DICOM_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/DicomFindAnswers.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/DicomModification.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/DicomWebJsonVisitor.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/FromDcmtkBridge.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/ParsedDicomCache.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/ParsedDicomDir.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/ParsedDicomFile.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/ToDcmtkBridge.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/Internals/DicomFrameIndex.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/Internals/DicomImageDecoder.cpp
)
if (NOT ORTHANC_SANDBOXED)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/DicomDirWriter.cpp
)
endif()
if (ENABLE_DCMTK_NETWORKING)
add_definitions(-DORTHANC_ENABLE_DCMTK_NETWORKING=1)
list(APPEND ORTHANC_DICOM_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/DicomAssociation.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/DicomAssociationParameters.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/DicomControlUserConnection.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/DicomServer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/DicomStoreUserConnection.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/Internals/CommandDispatcher.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/Internals/FindScp.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/Internals/MoveScp.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/Internals/GetScp.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/Internals/StoreScp.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/RemoteModalityParameters.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/TimeoutDicomConnectionManager.cpp
)
if (ENABLE_SSL)
list(APPEND ORTHANC_DICOM_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomNetworking/Internals/DicomTls.cpp
)
endif()
else()
add_definitions(-DORTHANC_ENABLE_DCMTK_NETWORKING=0)
endif()
# New in Orthanc 1.6.0
if (ENABLE_DCMTK_TRANSCODING)
add_definitions(-DORTHANC_ENABLE_DCMTK_TRANSCODING=1)
list(APPEND ORTHANC_DICOM_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/DcmtkTranscoder.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/IDicomTranscoder.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/MemoryBufferTranscoder.cpp
)
else()
add_definitions(-DORTHANC_ENABLE_DCMTK_TRANSCODING=0)
endif()
endif()
#####################################################################
## Configuration of the C/C++ macros
#####################################################################
add_definitions(
-DORTHANC_API_VERSION=${ORTHANC_API_VERSION}
-DORTHANC_DATABASE_VERSION=${ORTHANC_DATABASE_VERSION}
-DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
-DORTHANC_ENABLE_BASE64=1
-DORTHANC_ENABLE_MD5=1
-DORTHANC_MAXIMUM_TAG_LENGTH=256
-DORTHANC_VERSION="${ORTHANC_VERSION}"
)
if (ORTHANC_BUILDING_FRAMEWORK_LIBRARY)
add_definitions(-DORTHANC_BUILDING_FRAMEWORK_LIBRARY=1)
else()
add_definitions(-DORTHANC_BUILDING_FRAMEWORK_LIBRARY=0)
endif()
if (ORTHANC_SANDBOXED)
add_definitions(
-DORTHANC_SANDBOXED=1
)
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(ORTHANC_ENABLE_LOGGING ON)
set(ORTHANC_ENABLE_LOGGING_STDIO ON)
else()
set(ORTHANC_ENABLE_LOGGING OFF)
endif()
else()
set(ORTHANC_ENABLE_LOGGING ON)
set(ORTHANC_ENABLE_LOGGING_STDIO OFF)
add_definitions(
-DORTHANC_SANDBOXED=0
)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Cache/MemoryStringCache.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/Cache/SharedArchive.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileBuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/FilesystemStorage.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/MetricsRegistry.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/MultiThreading/RunnableWorkersPool.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/MultiThreading/Semaphore.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/MultiThreading/SharedMessageQueue.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SharedLibrary.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/SystemToolbox.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/TemporaryFile.cpp
)
if (ENABLE_MODULE_JOBS)
list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/JobsEngine.cpp
${CMAKE_CURRENT_LIST_DIR}/../../Sources/JobsEngine/JobsRegistry.cpp
)
endif()
endif()
if (ORTHANC_ENABLE_LOGGING)
add_definitions(-DORTHANC_ENABLE_LOGGING=1)
else()
add_definitions(-DORTHANC_ENABLE_LOGGING=0)
endif()
if (ORTHANC_ENABLE_LOGGING_STDIO)
add_definitions(-DORTHANC_ENABLE_LOGGING_STDIO=1)
else()
add_definitions(-DORTHANC_ENABLE_LOGGING_STDIO=0)
endif()
#####################################################################
## Configuration of Orthanc versioning macros (new in Orthanc 1.5.0)
#####################################################################
if (ORTHANC_VERSION STREQUAL "mainline")
set(ORTHANC_VERSION_MAJOR "999")
set(ORTHANC_VERSION_MINOR "999")
set(ORTHANC_VERSION_REVISION "999")
else()
string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\1" ORTHANC_VERSION_MAJOR ${ORTHANC_VERSION})
string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\2" ORTHANC_VERSION_MINOR ${ORTHANC_VERSION})
string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\3" ORTHANC_VERSION_REVISION ${ORTHANC_VERSION})
if (NOT ORTHANC_VERSION STREQUAL
"${ORTHANC_VERSION_MAJOR}.${ORTHANC_VERSION_MINOR}.${ORTHANC_VERSION_REVISION}")
message(FATAL_ERROR "Error in the (x.y.z) format of the Orthanc version: ${ORTHANC_VERSION}")
endif()
endif()
add_definitions(
-DORTHANC_VERSION_MAJOR=${ORTHANC_VERSION_MAJOR}
-DORTHANC_VERSION_MINOR=${ORTHANC_VERSION_MINOR}
-DORTHANC_VERSION_REVISION=${ORTHANC_VERSION_REVISION}
)
#####################################################################
## Gathering of all the source code
#####################################################################
# The "xxx_INTERNAL" variables list the source code that belongs to
# the Orthanc project. It can be used to configure precompiled headers
# if using Microsoft Visual Studio.
# The "xxx_DEPENDENCIES" variables list the source code coming from
# third-party dependencies.
set(ORTHANC_CORE_SOURCES_DEPENDENCIES
${BOOST_SOURCES}
${CIVETWEB_SOURCES}
${CURL_SOURCES}
${JSONCPP_SOURCES}
${LIBICONV_SOURCES}
${LIBICU_SOURCES}
${LIBJPEG_SOURCES}
${LIBP11_SOURCES}
${LIBPNG_SOURCES}
${LUA_SOURCES}
${MONGOOSE_SOURCES}
${OPENSSL_SOURCES}
${PROTOBUF_LIBRARY_SOURCES}
${PUGIXML_SOURCES}
${SQLITE_SOURCES}
${UUID_SOURCES}
${ZLIB_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/md5/md5.c
${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/base64/base64.cpp
)
if (ENABLE_ZLIB AND NOT ORTHANC_SANDBOXED)
list(APPEND ORTHANC_CORE_SOURCES_DEPENDENCIES
# This is the minizip distribution to create/decode ZIP files using zlib
${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/ioapi.c
${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/unzip.c
${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/zip.c
)
endif()
if (NOT "${LIBICU_RESOURCES}" STREQUAL "" OR
NOT "${DCMTK_DICTIONARIES}" STREQUAL "")
EmbedResources(
--namespace=Orthanc.FrameworkResources
--target=OrthancFrameworkResources
--framework-path=${CMAKE_CURRENT_LIST_DIR}/../../Sources
${LIBICU_RESOURCES}
${DCMTK_DICTIONARIES}
)
endif()
set(ORTHANC_CORE_SOURCES
${ORTHANC_CORE_SOURCES_INTERNAL}
${ORTHANC_CORE_SOURCES_DEPENDENCIES}
)
if (ENABLE_DCMTK)
list(APPEND ORTHANC_DICOM_SOURCES_DEPENDENCIES
${DCMTK_SOURCES}
)
set(ORTHANC_DICOM_SOURCES
${ORTHANC_DICOM_SOURCES_INTERNAL}
${ORTHANC_DICOM_SOURCES_DEPENDENCIES}
)
endif()

View File

@ -0,0 +1,155 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#####################################################################
## Versioning information
#####################################################################
# Version of the build, should always be "mainline" except in release branches
set(ORTHANC_VERSION "1.12.8")
# Version of the database schema. History:
# * Orthanc 0.1.0 -> Orthanc 0.3.0 = no versioning
# * Orthanc 0.3.1 = version 2
# * Orthanc 0.4.0 -> Orthanc 0.7.2 = version 3
# * Orthanc 0.7.3 -> Orthanc 0.8.4 = version 4
# * Orthanc 0.8.5 -> Orthanc 0.9.4 = version 5
# * Orthanc 0.9.5 -> mainline = version 6
set(ORTHANC_DATABASE_VERSION 6)
# Version of the Orthanc API, can be retrieved from "/system" URI in
# order to check whether new URI endpoints are available even if using
# the mainline version of Orthanc
set(ORTHANC_API_VERSION "29")
#####################################################################
## CMake parameters tunable by the user
#####################################################################
# Support of static compilation
set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
# Generic parameters of the build
set(ENABLE_CIVETWEB ON CACHE BOOL "Use Civetweb instead of Mongoose (Mongoose was the default embedded HTTP server in Orthanc <= 1.5.1)")
set(ENABLE_PKCS11 OFF CACHE BOOL "Enable PKCS#11 for HTTPS client authentication using hardware security modules and smart cards")
set(ENABLE_PROFILING OFF CACHE BOOL "Whether to enable the generation of profiling information with gprof")
set(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
set(ENABLE_LUA_MODULES OFF CACHE BOOL "Enable support for loading external Lua modules (only meaningful if using static version of the Lua engine)")
# Parameters to fine-tune linking against system libraries
set(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
set(USE_SYSTEM_CIVETWEB ON CACHE BOOL "Use the system version of Civetweb (experimental)")
set(USE_SYSTEM_CURL ON CACHE BOOL "Use the system version of LibCurl")
set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
set(USE_SYSTEM_LIBICONV ON CACHE BOOL "Use the system version of libiconv")
set(USE_SYSTEM_LIBICU ON CACHE BOOL "Use the system version of libicu")
set(USE_SYSTEM_LIBJPEG ON CACHE BOOL "Use the system version of libjpeg")
set(USE_SYSTEM_LIBP11 OFF CACHE BOOL "Use the system version of libp11 (PKCS#11 wrapper library)")
set(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of libpng")
set(USE_SYSTEM_LUA ON CACHE BOOL "Use the system version of Lua")
set(USE_SYSTEM_MONGOOSE ON CACHE BOOL "Use the system version of Mongoose")
set(USE_SYSTEM_OPENSSL ON CACHE BOOL "Use the system version of OpenSSL")
set(USE_SYSTEM_PROTOBUF ON CACHE BOOL "Use the system version of Google Protocol Buffers")
set(USE_SYSTEM_PUGIXML ON CACHE BOOL "Use the system version of Pugixml")
set(USE_SYSTEM_SQLITE ON CACHE BOOL "Use the system version of SQLite")
set(USE_SYSTEM_UUID ON CACHE BOOL "Use the system version of the uuid library from e2fsprogs")
set(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of ZLib")
# Parameters specific to DCMTK
set(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)")
set(DCMTK_STATIC_VERSION "3.6.9" CACHE STRING "Version of DCMTK to be used in static builds (can be \"3.6.0\", \"3.6.2\", \"3.6.4\", \"3.6.5\", \"3.6.6\", \"3.6.7\", \"3.6.8\", or \"3.6.9\")")
set(USE_DCMTK_362_PRIVATE_DIC ON CACHE BOOL "Use the dictionary of private tags from DCMTK 3.6.2 if using DCMTK 3.6.0")
set(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK")
set(ENABLE_DCMTK_LOG ON CACHE BOOL "Enable logging internal to DCMTK")
set(ENABLE_DCMTK_JPEG ON CACHE BOOL "Enable JPEG-LS (Lossless) decompression")
set(ENABLE_DCMTK_JPEG_LOSSLESS ON CACHE BOOL "Enable JPEG-LS (Lossless) decompression")
# Advanced and distribution-specific parameters
set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
set(SYSTEM_MONGOOSE_USE_CALLBACKS ON CACHE BOOL "The system version of Mongoose uses callbacks (version >= 3.7)")
set(BOOST_LOCALE_BACKEND "libiconv" CACHE STRING "Back-end for locales that is used by Boost (can be \"gcc\", \"libiconv\", \"icu\", or \"wconv\" on Windows)")
set(DCMTK_LOCALE_BACKEND "oficonv" CACHE STRING "Back-end for locales that is used by DCMTK (can be \"gcc\", \"libiconv\", \"icu\" (only up to DCMTK 3.6.8), \"oficonv\")")
set(USE_PUGIXML ON CACHE BOOL "Use the Pugixml parser (turn off only for debug)")
set(USE_LEGACY_JSONCPP OFF CACHE BOOL "Use the old branch 0.x.y of JsonCpp, that does not require a C++11 compiler (for LSB and old versions of Visual Studio)")
set(USE_LEGACY_LIBICU OFF CACHE BOOL "Use icu icu4c-58_2, latest version not requiring a C++11 compiler (for LSB and old versions of Visual Studio)")
set(USE_LEGACY_BOOST OFF CACHE BOOL "Use boost 1.69.0, latest version to be compatible with LSB")
set(MSVC_MULTIPLE_PROCESSES OFF CACHE BOOL "Add the /MP option to build with multiple processes if using Visual Studio")
set(EMSCRIPTEN_TARGET_MODE "wasm" CACHE STRING "Sets the target mode for Emscripten (can be \"wasm\" or \"asm.js\")")
set(EMSCRIPTEN_TRAP_MODE "" CACHE STRING "Sets the trap mode for Emscripten for numeric errors (can notably be empty, or \"clamp\")")
set(OPENSSL_STATIC_VERSION "3.0" CACHE STRING "Version of OpenSSL to be used in static builds (can be \"1.1.1\" or \"3.0\")")
set(CIVETWEB_OPENSSL_API "1.1" CACHE STRING "Version of the OpenSSL API to be used in civetweb in static builds (can be \"1.0\" or \"1.1\"")
set(ORTHANC_LUA_VERSION "" CACHE STRING "Force the version of Lua to be used by Orthanc (for instance \"5.3\"), if empty, this will be autodetected")
mark_as_advanced(CIVETWEB_OPENSSL_API)
mark_as_advanced(EMSCRIPTEN_TARGET_MODE)
mark_as_advanced(EMSCRIPTEN_TRAP_MODE)
mark_as_advanced(SYSTEM_MONGOOSE_USE_CALLBACKS)
mark_as_advanced(USE_DCMTK_362_PRIVATE_DIC)
mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
mark_as_advanced(USE_PUGIXML)
#####################################################################
## Internal CMake parameters to enable the optional subcomponents of
## the Orthanc framework
#####################################################################
# These options must be set to "ON" if compiling Orthanc, but might be
# set to "OFF" by third-party projects if their associated features
# are not required
set(ENABLE_CRYPTO_OPTIONS OFF CACHE INTERNAL "Show options related to cryptography")
set(ENABLE_JPEG OFF CACHE INTERNAL "Enable support of JPEG")
set(ENABLE_GOOGLE_TEST OFF CACHE INTERNAL "Enable support of Google Test")
set(ENABLE_LOCALE OFF CACHE INTERNAL "Enable support for locales (notably in Boost)")
set(ENABLE_LUA OFF CACHE INTERNAL "Enable support of Lua scripting")
set(ENABLE_PNG OFF CACHE INTERNAL "Enable support of PNG")
set(ENABLE_PROTOBUF OFF CACHE INTERNAL "Enable support for Google Protocol Buffers' library")
set(ENABLE_PROTOBUF_COMPILER OFF CACHE INTERNAL "Enable support for Google Protocol Buffers' compiler")
set(ENABLE_PUGIXML OFF CACHE INTERNAL "Enable support of XML through Pugixml")
set(ENABLE_SQLITE OFF CACHE INTERNAL "Enable support of SQLite databases")
set(ENABLE_ZLIB OFF CACHE INTERNAL "Enable support of zlib")
set(ENABLE_WEB_CLIENT OFF CACHE INTERNAL "Enable Web client")
set(ENABLE_WEB_SERVER OFF CACHE INTERNAL "Enable embedded Web server")
set(ENABLE_DCMTK OFF CACHE INTERNAL "Enable DCMTK")
set(ENABLE_DCMTK_NETWORKING OFF CACHE INTERNAL "Enable DICOM networking in DCMTK")
set(ENABLE_DCMTK_TRANSCODING OFF CACHE INTERNAL "Enable DICOM transcoding in DCMTK")
set(ENABLE_OPENSSL_ENGINES OFF CACHE INTERNAL "Enable support of engines in OpenSSL")
set(ORTHANC_SANDBOXED OFF CACHE INTERNAL
"Whether Orthanc runs inside a sandboxed environment (such as Google NaCl or WebAssembly)")
set(ORTHANC_BUILDING_FRAMEWORK_LIBRARY OFF CACHE INTERNAL
"Whether we are in the process of building the Orthanc Framework shared library")
#
# These options can be used to turn off some modules of the Orthanc
# framework, in order to speed up the compilation time of third-party
# projects.
#
set(ENABLE_MODULE_IMAGES ON CACHE INTERNAL "Enable module for image processing")
set(ENABLE_MODULE_JOBS ON CACHE INTERNAL "Enable module for jobs")
set(ENABLE_MODULE_DICOM ON CACHE INTERNAL "Enable module for DICOM handling")

View File

@ -0,0 +1,86 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_PROTOBUF)
if (ENABLE_PROTOBUF_COMPILER)
include(ExternalProject)
externalproject_add(ProtobufCompiler
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../ProtocolBuffers"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/ProtobufCompiler-build"
# this helps triggering build when changing the external project
BUILD_ALWAYS 1
CMAKE_ARGS
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}
)
# The "protoc" compiler is built using "externalproject_add",
# which builds for the host platform, not for the target platform
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(Suffix ".exe")
else()
set(Suffix "")
endif()
set(PROTOC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/protoc${Suffix})
endif()
include(${CMAKE_CURRENT_LIST_DIR}/../ProtocolBuffers/ProtobufLibrary.cmake)
source_group(ThirdParty\\Protobuf REGULAR_EXPRESSION ${PROTOBUF_SOURCE_DIR}/.*)
else()
if (CMAKE_CROSSCOMPILING)
message(FATAL_ERROR "If cross-compiling, the static version of Protocol Buffers should be used to avoid version mismatch")
endif()
if (ENABLE_PROTOBUF_COMPILER)
find_program(PROTOC_EXECUTABLE protoc)
if (${PROTOC_EXECUTABLE} MATCHES "PROTOC_EXECUTABLE-NOTFOUND")
message(FATAL_ERROR "Please install the 'protoc' compiler for Protocol Buffers (package 'protobuf-compiler' on Debian/Ubuntu)")
endif()
add_custom_target(ProtobufCompiler)
endif()
check_include_file_cxx(google/protobuf/any.h HAVE_PROTOBUF_H)
if (NOT HAVE_PROTOBUF_H)
message(FATAL_ERROR "Please install the libprotobuf-dev package")
endif()
set(CMAKE_REQUIRED_LIBRARIES "protobuf")
include(CheckCXXSourceCompiles)
check_cxx_source_compiles(
"
#include <google/protobuf/descriptor.h>
int main()
{
google::protobuf::FieldDescriptor::TypeName(google::protobuf::FieldDescriptor::TYPE_FLOAT);
}
" HAVE_PROTOBUF_LIB)
if (NOT HAVE_PROTOBUF_LIB)
message(FATAL_ERROR "Cannot find the protobuf library")
endif()
unset(CMAKE_REQUIRED_LIBRARIES)
link_libraries(protobuf)
endif()

View File

@ -0,0 +1,48 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_PUGIXML)
set(PUGIXML_SOURCES_DIR ${CMAKE_BINARY_DIR}/pugixml-1.14)
set(PUGIXML_MD5 "06e4242ee2352ee63c2b6627c6e3addb")
set(PUGIXML_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/pugixml-1.14.tar.gz")
DownloadPackage(${PUGIXML_MD5} ${PUGIXML_URL} "${PUGIXML_SOURCES_DIR}")
include_directories(
${PUGIXML_SOURCES_DIR}/src
)
set(PUGIXML_SOURCES
#${PUGIXML_SOURCES_DIR}/src/vlog_is_on.cc
${PUGIXML_SOURCES_DIR}/src/pugixml.cpp
)
source_group(ThirdParty\\pugixml REGULAR_EXPRESSION ${PUGIXML_SOURCES_DIR}/.*)
else()
CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H)
if (NOT HAVE_PUGIXML_H)
message(FATAL_ERROR "Please install the libpugixml-dev package")
endif()
link_libraries(pugixml)
endif()

View File

@ -0,0 +1,90 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_SQLITE)
set(SQLITE_STATIC ON)
else()
set(SQLITE_STATIC OFF)
endif()
if (SQLITE_STATIC)
SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3460100)
SET(SQLITE_MD5 "1fb0f7ebbee45752098cf453b6dffff3")
SET(SQLITE_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/sqlite-amalgamation-3460100.zip")
set(ORTHANC_SQLITE_VERSION 3046001)
DownloadPackage(${SQLITE_MD5} ${SQLITE_URL} "${SQLITE_SOURCES_DIR}")
set(SQLITE_SOURCES
${SQLITE_SOURCES_DIR}/sqlite3.c
)
add_definitions(
# For SQLite to run in the "Serialized" thread-safe mode
# http://www.sqlite.org/threadsafe.html
-DSQLITE_THREADSAFE=1
-DSQLITE_OMIT_LOAD_EXTENSION # Disable SQLite plugins
)
include_directories(
${SQLITE_SOURCES_DIR}
)
source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*)
else()
CHECK_INCLUDE_FILE(sqlite3.h HAVE_SQLITE_H)
if (NOT HAVE_SQLITE_H)
message(FATAL_ERROR "Please install the libsqlite3-dev package")
endif()
find_path(SQLITE_INCLUDE_DIR
NAMES sqlite3.h
PATHS
/usr/include
/usr/local/include
)
message("SQLite include dir: ${SQLITE_INCLUDE_DIR}")
# Autodetection of the version of SQLite
file(STRINGS "${SQLITE_INCLUDE_DIR}/sqlite3.h" SQLITE_VERSION_NUMBER1 REGEX "#define SQLITE_VERSION_NUMBER.*$")
string(REGEX REPLACE "#define SQLITE_VERSION_NUMBER(.*)$" "\\1" SQLITE_VERSION_NUMBER2 ${SQLITE_VERSION_NUMBER1})
# Remove the trailing spaces to convert the string to a proper integer
string(STRIP ${SQLITE_VERSION_NUMBER2} ORTHANC_SQLITE_VERSION)
message("Detected version of SQLite: ${ORTHANC_SQLITE_VERSION}")
IF (${ORTHANC_SQLITE_VERSION} LESS 3007000)
# "sqlite3_create_function_v2" is not defined in SQLite < 3.7.0
message(FATAL_ERROR "SQLite version must be above 3.7.0. Please set the CMake variable USE_SYSTEM_SQLITE to OFF.")
ENDIF()
link_libraries(sqlite3)
endif()
add_definitions(
-DORTHANC_SQLITE_VERSION=${ORTHANC_SQLITE_VERSION}
)

View File

@ -0,0 +1,25 @@
# Code taken from the CMake FAQ
# http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

View File

@ -0,0 +1,154 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if (STATIC_BUILD OR NOT USE_SYSTEM_UUID)
SET(E2FSPROGS_SOURCES_DIR ${CMAKE_BINARY_DIR}/e2fsprogs-1.44.5)
SET(E2FSPROGS_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/e2fsprogs-1.44.5.tar.gz")
SET(E2FSPROGS_MD5 "8d78b11d04d26c0b2dd149529441fa80")
if (IS_DIRECTORY "${E2FSPROGS_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${E2FSPROGS_MD5} ${E2FSPROGS_URL} "${E2FSPROGS_SOURCES_DIR}")
##
## Patch for OS X, in order to be compatible with Cocoa, and for
## WebAssembly (used in Stone)
##
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_CURRENT_LIST_DIR}/../Patches/e2fsprogs-1.44.5.patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE Failure
)
if (FirstRun AND Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
include_directories(
BEFORE ${E2FSPROGS_SOURCES_DIR}/lib
)
set(UUID_SOURCES
#${E2FSPROGS_SOURCES_DIR}/lib/uuid/tst_uuid.c
#${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_time.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/clear.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/compare.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/copy.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/gen_uuid.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/isnull.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/pack.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/parse.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/unpack.c
${E2FSPROGS_SOURCES_DIR}/lib/uuid/unparse.c
)
check_include_file("net/if.h" HAVE_NET_IF_H)
check_include_file("net/if_dl.h" HAVE_NET_IF_DL_H)
check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
check_include_file("stdlib.h" HAVE_STDLIB_H)
check_include_file("sys/file.h" HAVE_SYS_FILE_H)
check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H)
check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H)
check_include_file("sys/time.h" HAVE_SYS_TIME_H)
check_include_file("sys/un.h" HAVE_SYS_UN_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
if (NOT HAVE_NET_IF_H) # This is the case of OpenBSD
unset(HAVE_NET_IF_H CACHE)
check_include_files("sys/socket.h;net/if.h" HAVE_NET_IF_H)
endif()
if (NOT HAVE_NETINET_TCP_H) # This is the case of OpenBSD
unset(HAVE_NETINET_TCP_H CACHE)
check_include_files("sys/socket.h;netinet/tcp.h" HAVE_NETINET_TCP_H)
endif()
if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h)
file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake "
#cmakedefine HAVE_NET_IF_H \@HAVE_NET_IF_H\@
#cmakedefine HAVE_NET_IF_DL_H \@HAVE_NET_IF_DL_H\@
#cmakedefine HAVE_NETINET_IN_H \@HAVE_NETINET_IN_H\@
#cmakedefine HAVE_STDLIB_H \@HAVE_STDLIB_H \@
#cmakedefine HAVE_SYS_FILE_H \@HAVE_SYS_FILE_H\@
#cmakedefine HAVE_SYS_IOCTL_H \@HAVE_SYS_IOCTL_H\@
#cmakedefine HAVE_SYS_RESOURCE_H \@HAVE_SYS_RESOURCE_H\@
#cmakedefine HAVE_SYS_SOCKET_H \@HAVE_SYS_SOCKET_H\@
#cmakedefine HAVE_SYS_SOCKIO_H \@HAVE_SYS_SOCKIO_H\@
#cmakedefine HAVE_SYS_SYSCALL_H \@HAVE_SYS_SYSCALL_H\@
#cmakedefine HAVE_SYS_TIME_H \@HAVE_SYS_TIME_H\@
#cmakedefine HAVE_SYS_UN_H \@HAVE_SYS_UN_H\@
#cmakedefine HAVE_UNISTD_H \@HAVE_UNISTD_H\@
")
endif()
configure_file(
${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake
${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h
)
configure_file(
${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h.in
${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h
)
if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h)
file(WRITE
${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
"#include <stdint.h>\n")
endif()
source_group(ThirdParty\\uuid REGULAR_EXPRESSION ${E2FSPROGS_SOURCES_DIR}/.*)
else()
CHECK_INCLUDE_FILE(uuid/uuid.h HAVE_UUID_H)
if (NOT HAVE_UUID_H)
message(FATAL_ERROR "Please install uuid-dev, e2fsprogs (OpenBSD) or e2fsprogs-libuuid (FreeBSD)")
endif()
find_library(LIBUUID uuid
PATHS
/usr/lib
/usr/local/lib
)
check_library_exists(${LIBUUID} uuid_generate_random "" HAVE_LIBUUID)
if (NOT HAVE_LIBUUID)
message(FATAL_ERROR "Unable to find the uuid library")
endif()
link_libraries(${LIBUUID})
endif()
endif()

View File

@ -0,0 +1,36 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
macro(ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS PrecompiledHeaders PrecompiledSource Sources Target)
get_filename_component(PrecompiledBasename ${PrecompiledHeaders} NAME_WE)
set(PrecompiledBinary "${PrecompiledBasename}_${CMAKE_BUILD_TYPE}_${CMAKE_GENERATOR_PLATFORM}.pch")
set_source_files_properties(${PrecompiledSource}
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeaders}\" /Fp\"${PrecompiledBinary}\""
OBJECT_OUTPUTS "${PrecompiledBinary}")
set_source_files_properties(${${Sources}}
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeaders}\" /FI\"${PrecompiledHeaders}\" /Fp\"${PrecompiledBinary}\""
OBJECT_DEPENDS "${PrecompiledBinary}")
set(${Target} ${PrecompiledSource})
endmacro()

View File

@ -0,0 +1,122 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
# source ~/Downloads/emsdk/emsdk_env.sh
# cmake .. -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/tmp/wasm-install/
# make install
# cd /tmp/wasm-install
# python -m SimpleHTTPServer 8000
# firefox http://localhost:8000/
# -> Copy the result as "../arith.h"
cmake_minimum_required(VERSION 2.8.3...4.0)
#####################################################################
## Configuration of the Emscripten compiler for WebAssembly target
#####################################################################
set(WASM_FLAGS "-s WASM=1 -s DISABLE_EXCEPTION_CATCHING=0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}")
# Turn on support for debug exceptions
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
#####################################################################
## Prepare DCMTK 3.6.2
#####################################################################
include(${CMAKE_SOURCE_DIR}/../../Compiler.cmake)
include(${CMAKE_SOURCE_DIR}/../../DownloadPackage.cmake)
set(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.2)
set(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.2.tar.gz")
set(DCMTK_MD5 "d219a4152772985191c9b89d75302d12")
if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
set(FirstRun OFF)
else()
set(FirstRun ON)
endif()
DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
if (FirstRun)
message("Patching file")
execute_process(
COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
${CMAKE_SOURCE_DIR}/arith.patch
WORKING_DIRECTORY ${DCMTK_SOURCES_DIR}/config/tests
RESULT_VARIABLE Failure
)
if (Failure)
message(FATAL_ERROR "Error while patching a file")
endif()
endif()
#####################################################################
## Build the DCMTK tests for arithmetics
#####################################################################
# https://github.com/kripken/emscripten/wiki/WebAssembly#web-server-setup
file(WRITE ${CMAKE_BINARY_DIR}/.htaccess "
AddType application/wasm .wasm
AddOutputFilterByType DEFLATE application/wasm
")
file(WRITE ${CMAKE_BINARY_DIR}/dcmtk/config/osconfig.h "
#pragma once
#define HAVE_CMATH 1
#define HAVE_MATH_H 1
#define HAVE_PROTOTYPE_FINITE 1
#define HAVE_PROTOTYPE_STD__ISINF 1
#define HAVE_PROTOTYPE_STD__ISNAN 1
#define HAVE_STD_NAMESPACE 1
#define HAVE_STRSTREAM 1
#define SIZEOF_VOID_P 4
#define USE_STD_CXX_INCLUDES
")
include_directories(
${DCMTK_SOURCES_DIR}/ofstd/include
${CMAKE_BINARY_DIR}
)
add_executable(dcmtk
${DCMTK_SOURCES_DIR}/config/tests/arith.cc
${CMAKE_SOURCE_DIR}/Run2.cpp
)
install(TARGETS dcmtk DESTINATION .)
install(FILES
${CMAKE_BINARY_DIR}/.htaccess
${CMAKE_BINARY_DIR}/dcmtk.wasm
${CMAKE_SOURCE_DIR}/app.js
${CMAKE_SOURCE_DIR}/index.html
DESTINATION .
)

View File

@ -0,0 +1,22 @@
#include <iostream>
#include <emscripten/emscripten.h>
extern "C"
{
void EMSCRIPTEN_KEEPALIVE Run2()
{
// This stuff is not properly discovered by DCMTK 3.6.2 configuration scripts
std::cerr << std::endl << std::endl;
std::cerr << "/**" << std::endl;
std::cerr << "#define SIZEOF_CHAR " << sizeof(char) << std::endl;
std::cerr << "#define SIZEOF_DOUBLE " << sizeof(double) << std::endl;
std::cerr << "#define SIZEOF_FLOAT " << sizeof(float) << std::endl;
std::cerr << "#define SIZEOF_INT " << sizeof(int) << std::endl;
std::cerr << "#define SIZEOF_LONG " << sizeof(long) << std::endl;
std::cerr << "#define SIZEOF_SHORT " << sizeof(short) << std::endl;
std::cerr << "#define SIZEOF_VOID_P " << sizeof(void*) << std::endl;
std::cerr << "#define C_CHAR_UNSIGNED " << (!std::is_signed<char>()) << std::endl;
std::cerr << "**/" << std::endl;
std::cerr << std::endl << std::endl;
}
}

View File

@ -0,0 +1,34 @@
function Initialize()
{
Module.ccall('Run2', // name of C function
null, // return type
[], // argument types
[]);
Module.ccall('Run', // name of C function
'number', // return type
[], // argument types
[]);
}
var Module = {
preRun: [],
postRun: [ Initialize ],
print: function(text) {
console.log(text);
},
printErr: function(text) {
if (text != 'Calling stub instead of signal()')
{
document.getElementById("stderr").textContent += text + '\n';
}
},
totalDependencies: 0
};
if (!('WebAssembly' in window)) {
alert('Sorry, your browser does not support WebAssembly :(');
} else {
}

View File

@ -0,0 +1,46 @@
--- /home/jodogne/Subversion/orthanc/Resources/WebAssembly/ArithmeticTests/i/dcmtk-3.6.2/config/tests/arith.cc 2017-07-14 17:41:11.000000000 +0200
+++ arith.cc 2018-03-28 13:53:34.242234303 +0200
@@ -19,6 +19,8 @@
* for being used within oflimits.h.
*/
+#include <emscripten/emscripten.h>
+
// Note: This depends on some files of ofstd and osconfig.h,
// although it is part of configure testing itself.
// Therefore, ensure osconfig.h has already been generated
@@ -514,7 +516,9 @@
}
#endif
-int main( int argc, char** argv )
+extern "C"
+{
+int EMSCRIPTEN_KEEPALIVE Run()
{
#ifdef HAVE_WINDOWS_H
// Activate the fallback workaround, it will only be used
@@ -524,6 +528,8 @@
#endif
COUT << "Inspecting fundamental arithmetic types... " << OFendl;
+
+#if 0
if( argc != 2 )
{
STD_NAMESPACE cerr << "-- " << "Error: missing destination file "
@@ -532,6 +538,9 @@
}
STD_NAMESPACE ofstream out( argv[1] );
+#else
+ std::ostream& out = std::cerr;
+#endif
out << "#ifndef CONFIG_ARITH_H" << '\n';
out << "#define CONFIG_ARITH_H" << '\n';
@@ -619,3 +628,4 @@
return 0;
}
+}

View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>DCMTK - Inspect arithmetic types</title>
</head>
<body>
<pre id="stderr"></pre>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" async src="dcmtk.js"></script>
</body>
</html>

View File

@ -0,0 +1,70 @@
/**
#define SIZEOF_CHAR 1
#define SIZEOF_DOUBLE 8
#define SIZEOF_FLOAT 4
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_SHORT 2
#define SIZEOF_VOID_P 4
#define C_CHAR_UNSIGNED 0
**/
#ifndef CONFIG_ARITH_H
#define CONFIG_ARITH_H
#define DCMTK_SIGNED_CHAR_DIGITS10 2
#define DCMTK_UNSIGNED_CHAR_DIGITS10 2
#define DCMTK_SIGNED_SHORT_DIGITS10 4
#define DCMTK_UNSIGNED_SHORT_DIGITS10 4
#define DCMTK_SIGNED_INT_DIGITS10 9
#define DCMTK_UNSIGNED_INT_DIGITS10 9
#define DCMTK_SIGNED_LONG_DIGITS10 9
#define DCMTK_UNSIGNED_LONG_DIGITS10 9
#define DCMTK_FLOAT_MAX_DIGITS10 9
#define DCMTK_DOUBLE_MAX_DIGITS10 17
#define DCMTK_CHAR_TRAPS OFFalse
#define DCMTK_CHAR_MODULO OFTrue
#define DCMTK_SIGNED_CHAR_TRAPS OFFalse
#define DCMTK_SIGNED_CHAR_MODULO OFTrue
#define DCMTK_UNSIGNED_CHAR_TRAPS OFFalse
#define DCMTK_UNSIGNED_CHAR_MODULO OFTrue
#define DCMTK_SIGNED_SHORT_TRAPS OFFalse
#define DCMTK_SIGNED_SHORT_MODULO OFTrue
#define DCMTK_UNSIGNED_SHORT_TRAPS OFFalse
#define DCMTK_UNSIGNED_SHORT_MODULO OFTrue
#define DCMTK_SIGNED_INT_TRAPS OFFalse
#define DCMTK_SIGNED_INT_MODULO OFTrue
#define DCMTK_UNSIGNED_INT_TRAPS OFFalse
#define DCMTK_UNSIGNED_INT_MODULO OFTrue
#define DCMTK_SIGNED_LONG_TRAPS OFFalse
#define DCMTK_SIGNED_LONG_MODULO OFTrue
#define DCMTK_UNSIGNED_LONG_TRAPS OFFalse
#define DCMTK_UNSIGNED_LONG_MODULO OFTrue
#define DCMTK_FLOAT_TRAPS OFFalse
#define DCMTK_DOUBLE_TRAPS OFFalse
#define DCMTK_FLOAT_HAS_INFINITY OFTrue
#define DCMTK_FLOAT_INFINITY *OFreinterpret_cast( const float*, "\000\000\200\177" )
#define DCMTK_DOUBLE_HAS_INFINITY OFTrue
#define DCMTK_DOUBLE_INFINITY *OFreinterpret_cast( const double*, "\000\000\000\000\000\000\360\177" )
#define DCMTK_FLOAT_HAS_QUIET_NAN OFTrue
#define DCMTK_FLOAT_QUIET_NAN *OFreinterpret_cast( const float*, "\000\000\300\177" )
#define DCMTK_DOUBLE_HAS_QUIET_NAN OFTrue
#define DCMTK_DOUBLE_QUIET_NAN *OFreinterpret_cast( const double*, "\000\000\000\000\000\000\370\177" )
#define DCMTK_FLOAT_HAS_SIGNALING_NAN OFFalse
#define DCMTK_FLOAT_SIGNALING_NAN *OFreinterpret_cast( const float*, "\001\000\200\177" )
#define DCMTK_DOUBLE_HAS_SIGNALING_NAN OFFalse
#define DCMTK_DOUBLE_SIGNALING_NAN *OFreinterpret_cast( const double*, "\001\000\000\000\000\000\360\177" )
#define DCMTK_FLOAT_IS_IEC559 OFFalse
#define DCMTK_DOUBLE_IS_IEC559 OFFalse
#define DCMTK_FLOAT_HAS_DENORM OFdenorm_present
#define DCMTK_FLOAT_DENORM_MIN *OFreinterpret_cast( const float*, "\001\000\000\000" )
#define DCMTK_DOUBLE_HAS_DENORM OFdenorm_present
#define DCMTK_DOUBLE_DENORM_MIN *OFreinterpret_cast( const double*, "\001\000\000\000\000\000\000\000" )
#define DCMTK_FLOAT_TINYNESS_BEFORE OFFalse
#define DCMTK_DOUBLE_TINYNESS_BEFORE OFFalse
#define DCMTK_FLOAT_HAS_DENORM_LOSS OFFalse
#define DCMTK_DOUBLE_HAS_DENORM_LOSS OFFalse
#define DCMTK_ROUND_STYLE 1
#endif // CONFIG_ARITH_H

View File

@ -0,0 +1,73 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if (STATIC_BUILD OR NOT USE_SYSTEM_ZLIB)
SET(ZLIB_SOURCES_DIR ${CMAKE_BINARY_DIR}/zlib-1.3.1)
SET(ZLIB_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/zlib-1.3.1.tar.gz")
SET(ZLIB_MD5 "9855b6d802d7fe5b7bd5b196a2271655")
DownloadPackage(${ZLIB_MD5} ${ZLIB_URL} "${ZLIB_SOURCES_DIR}")
include_directories(
${ZLIB_SOURCES_DIR}
)
list(APPEND ZLIB_SOURCES
${ZLIB_SOURCES_DIR}/adler32.c
${ZLIB_SOURCES_DIR}/compress.c
${ZLIB_SOURCES_DIR}/crc32.c
${ZLIB_SOURCES_DIR}/deflate.c
${ZLIB_SOURCES_DIR}/infback.c
${ZLIB_SOURCES_DIR}/inffast.c
${ZLIB_SOURCES_DIR}/inflate.c
${ZLIB_SOURCES_DIR}/inftrees.c
${ZLIB_SOURCES_DIR}/trees.c
${ZLIB_SOURCES_DIR}/uncompr.c
${ZLIB_SOURCES_DIR}/zutil.c
)
if (NOT ORTHANC_SANDBOXED)
# The source files below require access to the filesystem
list(APPEND ZLIB_SOURCES
${ZLIB_SOURCES_DIR}/gzlib.c
${ZLIB_SOURCES_DIR}/gzclose.c
${ZLIB_SOURCES_DIR}/gzread.c
${ZLIB_SOURCES_DIR}/gzwrite.c
)
endif()
source_group(ThirdParty\\zlib REGULAR_EXPRESSION ${ZLIB_SOURCES_DIR}/.*)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
# "ioapi.c" from zlib (minizip) expects the "IOAPI_NO_64" macro to be set to "true"
# https://ohse.de/uwe/articles/lfs.html
add_definitions(
-DIOAPI_NO_64=1
)
endif()
else()
include(FindZLIB)
include_directories(${ZLIB_INCLUDE_DIRS})
link_libraries(${ZLIB_LIBRARIES})
endif()

View File

@ -0,0 +1,351 @@
#!/usr/bin/env python
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
##
## This maintenance script detects all the public methods in the
## Orthanc framework that come with an inlined implementation in the
## header file. Such methods can break the ABI of the shared library,
## as the actual implementation might change over versions.
##
# Ubuntu 20.04:
# sudo apt-get install python-clang-6.0
# ./ParseWebAssemblyExports.py --libclang=libclang-6.0.so.1 ./Test.cpp
# Ubuntu 18.04:
# sudo apt-get install python-clang-4.0
# ./ParseWebAssemblyExports.py --libclang=libclang-4.0.so.1 ./Test.cpp
# Ubuntu 14.04:
# ./ParseWebAssemblyExports.py --libclang=libclang-3.6.so.1 ./Test.cpp
import os
import sys
import clang.cindex
import argparse
##
## Parse the command-line arguments
##
parser = argparse.ArgumentParser(description = 'Parse WebAssembly C++ source file, and create a basic JavaScript wrapper.')
parser.add_argument('--libclang',
default = '',
help = 'manually provides the path to the libclang shared library')
parser.add_argument('--target-cpp-size',
default = '',
help = 'where to store C++ source to display the size of each public class')
args = parser.parse_args()
if len(args.libclang) != 0:
clang.cindex.Config.set_library_file(args.libclang)
index = clang.cindex.Index.create()
ROOT = os.path.abspath(os.path.dirname(sys.argv[0]))
SOURCES = []
for root, dirs, files in os.walk(os.path.join(ROOT, '..', 'Sources')):
for name in files:
if (os.path.splitext(name)[1] == '.h' and
not name.endswith('.impl.h')):
SOURCES.append(os.path.join(root, name))
AMALGAMATION = '/tmp/CheckOrthancFrameworkSymbols.cpp'
with open(AMALGAMATION, 'w') as f:
f.write('#include "%s"\n' % os.path.join(ROOT, '..', 'Sources', 'OrthancFramework.h'))
for source in SOURCES:
f.write('#include "%s"\n' % source)
tu = index.parse(AMALGAMATION, [
'--std=c++11',
'-DORTHANC_BUILDING_FRAMEWORK_LIBRARY=1',
'-DORTHANC_BUILD_UNIT_TESTS=0',
'-DORTHANC_ENABLE_BASE64=1',
'-DORTHANC_ENABLE_CIVETWEB=1',
'-DORTHANC_ENABLE_CURL=1',
'-DORTHANC_ENABLE_DCMTK=1',
'-DORTHANC_ENABLE_DCMTK_JPEG=1',
'-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=1',
'-DORTHANC_ENABLE_DCMTK_NETWORKING=1',
'-DORTHANC_ENABLE_DCMTK_TRANSCODING=1',
'-DORTHANC_ENABLE_JPEG=1',
'-DORTHANC_ENABLE_LOCALE=1',
'-DORTHANC_ENABLE_LOGGING=1',
'-DORTHANC_ENABLE_LOGGING_STDIO=0',
'-DORTHANC_ENABLE_LUA=1',
'-DORTHANC_ENABLE_MD5=1',
'-DORTHANC_ENABLE_MONGOOSE=1',
'-DORTHANC_ENABLE_PKCS11=1',
'-DORTHANC_ENABLE_PNG=1',
'-DORTHANC_ENABLE_PUGIXML=1',
'-DORTHANC_ENABLE_SQLITE=1',
'-DORTHANC_ENABLE_SSL=1',
'-DORTHANC_ENABLE_ZLIB=1',
'-DORTHANC_SANDBOXED=0',
'-DORTHANC_SQLITE_STANDALONE=0',
'-DORTHANC_SQLITE_VERSION=3027001',
'-I/usr/include/jsoncpp', # On Ubuntu 18.04
'-I/usr/include/lua5.3', # On Ubuntu 18.04
])
if len(tu.diagnostics) != 0:
for d in tu.diagnostics:
print(' ** %s' % d)
print('')
raise Exception('Error')
FILES = []
COUNT = 0
ALL_TYPES = []
def ReportProblem(message, fqn, cursor):
global FILES, COUNT
FILES.append(os.path.normpath(str(cursor.location.file)))
COUNT += 1
print('%s: %s::%s()' % (message, '::'.join(fqn), cursor.spelling))
def ExploreClass(child, fqn):
# Safety check
if (child.kind != clang.cindex.CursorKind.CLASS_DECL and
child.kind != clang.cindex.CursorKind.STRUCT_DECL):
raise Exception()
# Ignore forward declaration of classes
if not child.is_definition():
return
##
## Verify that the class is publicly exported (its visibility must
## be "default")
##
visible = False
for i in child.get_children():
if (i.kind == clang.cindex.CursorKind.VISIBILITY_ATTR and
i.spelling == 'default'):
visible = True
if not visible:
return
global ALL_TYPES
ALL_TYPES.append('::'.join(fqn))
##
## Ignore pure abstract interfaces, by checking the following
## criteria:
## - It must be a C++ class (not a struct)
## - It must start with "I"
## - All its methods must be pure virtual (abstract) and public
## - Its destructor must be public, virtual, and must do nothing
##
if (child.kind == clang.cindex.CursorKind.CLASS_DECL and
child.spelling[0] == 'I' and
child.spelling[1].isupper()):
abstract = True
isPublic = False
for i in child.get_children():
if i.kind == clang.cindex.CursorKind.VISIBILITY_ATTR: # "default"
pass
elif i.kind == clang.cindex.CursorKind.CXX_ACCESS_SPEC_DECL:
isPublic = (i.access_specifier == clang.cindex.AccessSpecifier.PUBLIC)
elif i.kind == clang.cindex.CursorKind.CXX_BASE_SPECIFIER:
if i.spelling != 'boost::noncopyable':
abstract = False
elif isPublic:
if i.kind == clang.cindex.CursorKind.CXX_METHOD:
if i.is_pure_virtual_method():
pass # pure virtual is ok
elif i.is_static_method():
# static method without an inline implementation is ok
for j in i.get_children():
if j.kind == clang.cindex.CursorKind.COMPOUND_STMT:
abstract = False
else:
abstract = False
elif (i.kind == clang.cindex.CursorKind.DESTRUCTOR and
i.is_virtual_method()):
# The destructor must be virtual, and must do nothing
c = list(i.get_children())
if (len(c) != 1 or
c[0].kind != clang.cindex.CursorKind.COMPOUND_STMT or
len(list(c[0].get_children())) != 0):
abstract = False
elif i.kind == clang.cindex.CursorKind.CLASS_DECL:
ExploreClass(i, fqn + [ i.spelling ])
elif (i.kind == clang.cindex.CursorKind.TYPEDEF_DECL or # Allow "typedef"
i.kind == clang.cindex.CursorKind.ENUM_DECL): # Allow enums
pass
else:
abstract = False
if abstract:
print('Detected a pure interface (this is fine): %s' % ('::'.join(fqn)))
else:
ReportProblem('Not a pure interface', fqn, child)
return
##
## We are facing a standard C++ class or struct
##
isPublic = (child.kind == clang.cindex.CursorKind.STRUCT_DECL)
membersCount = 0
membersSize = 0
for i in child.get_children():
if (i.kind == clang.cindex.CursorKind.VISIBILITY_ATTR or # "default"
i.kind == clang.cindex.CursorKind.CXX_BASE_SPECIFIER): # base class
pass
elif i.kind == clang.cindex.CursorKind.CXX_ACCESS_SPEC_DECL:
isPublic = (i.access_specifier == clang.cindex.AccessSpecifier.PUBLIC)
elif i.kind == clang.cindex.CursorKind.CLASS_DECL:
# This is a subclass
if isPublic:
ExploreClass(i, fqn + [ i.spelling ])
elif (i.kind == clang.cindex.CursorKind.CXX_METHOD or
i.kind == clang.cindex.CursorKind.CONSTRUCTOR or
i.kind == clang.cindex.CursorKind.DESTRUCTOR):
if isPublic:
hasImplementation = False
for j in i.get_children():
if j.kind == clang.cindex.CursorKind.COMPOUND_STMT:
hasImplementation = True
if hasImplementation:
ReportProblem('Exported public method with an implementation', fqn, i)
elif i.kind == clang.cindex.CursorKind.VAR_DECL:
raise Exception('Unsupported: %s, %s' % (i.kind, i.location))
elif i.kind == clang.cindex.CursorKind.FUNCTION_TEMPLATE:
# An inline function template is OK, as it is not added to
# a shared library, but compiled by the client of the library
if isPublic:
print('Detected a template function (this is fine, but avoid it as much as possible): %s' % ('::'.join(fqn + [ i.spelling ])))
hasImplementation = False
for j in i.get_children():
if j.kind == clang.cindex.CursorKind.COMPOUND_STMT:
hasImplementation = True
if not hasImplementation:
ReportProblem('Exported template function without an inline implementation', fqn, i)
elif (i.kind == clang.cindex.CursorKind.TYPEDEF_DECL or # Allow "typedef"
i.kind == clang.cindex.CursorKind.ENUM_DECL): # Allow enums
pass
elif i.kind == clang.cindex.CursorKind.FRIEND_DECL:
children = list(i.get_children())
if (isPublic and
(len(children) != 1 or
not children[0].displayname in [
# This is supported for ABI compatibility with Orthanc <= 1.8.0
'operator<<(std::ostream &, const Orthanc::DicomTag &)',
])):
raise Exception('Unsupported: %s, %s' % (i.kind, i.location))
elif i.kind == clang.cindex.CursorKind.FIELD_DECL:
# TODO
if i.type.get_size() > 0:
membersSize += i.type.get_size()
membersCount += 1
else:
if isPublic:
raise Exception('Unsupported: %s, %s' % (i.kind, i.location))
#print('Size of %s => (%d,%d)' % ('::'.join(fqn), membersCount, membersSize))
def ExploreNamespace(node, namespace):
for child in node.get_children():
fqn = namespace + [ child.spelling ]
if child.kind == clang.cindex.CursorKind.NAMESPACE:
ExploreNamespace(child, fqn)
elif (child.kind == clang.cindex.CursorKind.CLASS_DECL or
child.kind == clang.cindex.CursorKind.STRUCT_DECL):
ExploreClass(child, fqn)
elif child.kind == clang.cindex.CursorKind.FUNCTION_DECL:
visible = False
hasImplementation = False
for i in child.get_children():
if (i.kind == clang.cindex.CursorKind.VISIBILITY_ATTR and
i.spelling == 'default'):
visible = True
elif i.kind == clang.cindex.CursorKind.COMPOUND_STMT:
hasImplementation = True
if visible and hasImplementation:
ReportProblem('Exported public function with an implementation', fqn, i)
print('')
for node in tu.cursor.get_children():
if (node.kind == clang.cindex.CursorKind.NAMESPACE and
node.spelling == 'Orthanc'):
ExploreNamespace(node, [ 'Orthanc' ])
if args.target_cpp_size != '':
with open(args.target_cpp_size, 'w') as f:
for t in sorted(ALL_TYPES):
f.write(' printf("sizeof(::%s) == %%d\\n", static_cast<int>(sizeof(::%s)));\n' % (t, t))
print('\nTotal of possibly problematic methods: %d' % COUNT)
print('\nProblematic files:\n')
for i in sorted(list(set(FILES))):
print(i)
print('')

View File

@ -0,0 +1,51 @@
#!/usr/bin/python
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import json
import os
import re
import sys
if len(sys.argv) != 2:
print('Usage: %s [Path to DCMTK source code]' % sys.argv[0])
exit(-1)
orthancSyntaxes = []
with open(os.path.join(os.path.dirname(__file__), 'DicomTransferSyntaxes.json'), 'r') as f:
for syntax in json.loads(f.read()):
orthancSyntaxes.append(syntax['UID'])
with open(os.path.join(sys.argv[1], 'dcmdata/include/dcmtk/dcmdata/dcuid.h'), 'r') as f:
r = re.compile(r'^#define UID_([A-Za-z0-9_]+)TransferSyntax\s+"([0-9.]+)"$')
for line in f.readlines():
m = r.match(line)
if m != None:
syntax = m.group(2)
if not syntax in orthancSyntaxes:
print('Missing syntax: %s => %s' % (syntax, m.group(1)))

View File

@ -0,0 +1,376 @@
[
{
"UID" : "1.2.840.10008.1.2",
"Name" : "Implicit VR Little Endian",
"Value" : "LittleEndianImplicit",
"Retired" : false,
"DCMTK" : "EXS_LittleEndianImplicit",
"GDCM" : "gdcm::TransferSyntax::ImplicitVRLittleEndian"
},
{
"UID" : "1.2.840.10008.1.2.1",
"Name" : "Explicit VR Little Endian",
"Value" : "LittleEndianExplicit",
"Retired" : false,
"DCMTK" : "EXS_LittleEndianExplicit",
"GDCM" : "gdcm::TransferSyntax::ExplicitVRLittleEndian"
},
{
"UID" : "1.2.840.10008.1.2.1.99",
"Name" : "Deflated Explicit VR Little Endian",
"Value" : "DeflatedLittleEndianExplicit",
"Retired" : false,
"DCMTK" : "EXS_DeflatedLittleEndianExplicit"
},
{
"UID" : "1.2.840.10008.1.2.2",
"Name" : "Explicit VR Big Endian",
"Value" : "BigEndianExplicit",
"Retired" : false,
"DCMTK" : "EXS_BigEndianExplicit"
},
{
"UID" : "1.2.840.10008.1.2.4.50",
"Name" : "JPEG Baseline (process 1, lossy)",
"Value" : "JPEGProcess1",
"Retired" : false,
"Note" : "Default Transfer Syntax for Lossy JPEG 8-bit Image Compression",
"DCMTK" : "EXS_JPEGProcess1",
"DCMTK360" : "EXS_JPEGProcess1TransferSyntax",
"GDCM" : "gdcm::TransferSyntax::JPEGBaselineProcess1"
},
{
"UID" : "1.2.840.10008.1.2.4.51",
"Name" : "JPEG Extended Sequential (processes 2 & 4)",
"Value" : "JPEGProcess2_4",
"Retired" : false,
"Note" : "Default Transfer Syntax for Lossy JPEG (lossy, 8/12 bit), 12-bit Image Compression (Process 4 only)",
"DCMTK" : "EXS_JPEGProcess2_4",
"DCMTK360" : "EXS_JPEGProcess2_4TransferSyntax",
"GDCM" : "gdcm::TransferSyntax::JPEGExtendedProcess2_4"
},
{
"UID" : "1.2.840.10008.1.2.4.52",
"Name" : "JPEG Extended Sequential (lossy, 8/12 bit), arithmetic coding",
"Value" : "JPEGProcess3_5",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess3_5",
"DCMTK360" : "EXS_JPEGProcess3_5TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.53",
"Name" : "JPEG Spectral Selection, Nonhierarchical (lossy, 8/12 bit)",
"Value" : "JPEGProcess6_8",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess6_8",
"DCMTK360" : "EXS_JPEGProcess6_8TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.54",
"Name" : "JPEG Spectral Selection, Nonhierarchical (lossy, 8/12 bit), arithmetic coding",
"Value" : "JPEGProcess7_9",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess7_9",
"DCMTK360" : "EXS_JPEGProcess7_9TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.55",
"Name" : "JPEG Full Progression, Nonhierarchical (lossy, 8/12 bit)",
"Value" : "JPEGProcess10_12",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess10_12",
"DCMTK360" : "EXS_JPEGProcess10_12TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.56",
"Name" : "JPEG Full Progression, Nonhierarchical (lossy, 8/12 bit), arithmetic coding",
"Value" : "JPEGProcess11_13",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess11_13",
"DCMTK360" : "EXS_JPEGProcess11_13TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.57",
"Name" : "JPEG Lossless, Nonhierarchical with any selection value (process 14)",
"Value" : "JPEGProcess14",
"Retired" : false,
"DCMTK" : "EXS_JPEGProcess14",
"DCMTK360" : "EXS_JPEGProcess14TransferSyntax",
"GDCM" : "gdcm::TransferSyntax::JPEGLosslessProcess14"
},
{
"UID" : "1.2.840.10008.1.2.4.58",
"Name" : "JPEG Lossless with any selection value, arithmetic coding",
"Value" : "JPEGProcess15",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess15",
"DCMTK360" : "EXS_JPEGProcess15TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.59",
"Name" : "JPEG Extended Sequential, Hierarchical (lossy, 8/12 bit)",
"Value" : "JPEGProcess16_18",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess16_18",
"DCMTK360" : "EXS_JPEGProcess16_18TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.60",
"Name" : "JPEG Extended Sequential, Hierarchical (lossy, 8/12 bit), arithmetic coding",
"Value" : "JPEGProcess17_19",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess17_19",
"DCMTK360" : "EXS_JPEGProcess17_19TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.61",
"Name" : "JPEG Spectral Selection, Hierarchical (lossy, 8/12 bit)",
"Value" : "JPEGProcess20_22",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess20_22",
"DCMTK360" : "EXS_JPEGProcess20_22TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.62",
"Name" : "JPEG Spectral Selection, Hierarchical (lossy, 8/12 bit), arithmetic coding",
"Value" : "JPEGProcess21_23",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess21_23",
"DCMTK360" : "EXS_JPEGProcess21_23TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.63",
"Name" : "JPEG Full Progression, Hierarchical (lossy, 8/12 bit)",
"Value" : "JPEGProcess24_26",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess24_26",
"DCMTK360" : "EXS_JPEGProcess24_26TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.64",
"Name" : "JPEG Full Progression, Hierarchical (lossy, 8/12 bit), arithmetic coding",
"Value" : "JPEGProcess25_27",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess25_27",
"DCMTK360" : "EXS_JPEGProcess25_27TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.65",
"Name" : "JPEG Lossless, Hierarchical",
"Value" : "JPEGProcess28",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess28",
"DCMTK360" : "EXS_JPEGProcess28TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.66",
"Name" : "JPEG Lossless, Hierarchical, arithmetic coding",
"Value" : "JPEGProcess29",
"Retired" : true,
"DCMTK" : "EXS_JPEGProcess29",
"DCMTK360" : "EXS_JPEGProcess29TransferSyntax"
},
{
"UID" : "1.2.840.10008.1.2.4.70",
"Name" : "JPEG Lossless, Nonhierarchical, First-Order Prediction (Processes 14 [Selection Value 1])",
"Value" : "JPEGProcess14SV1",
"Retired" : false,
"Note" : "Default Transfer Syntax for Lossless JPEG Image Compression",
"DCMTK" : "EXS_JPEGProcess14SV1",
"DCMTK360" : "EXS_JPEGProcess14SV1TransferSyntax",
"GDCM" : "gdcm::TransferSyntax::JPEGLosslessProcess14_1"
},
{
"UID" : "1.2.840.10008.1.2.4.80",
"Name" : "JPEG-LS (lossless)",
"Value" : "JPEGLSLossless",
"Retired" : false,
"DCMTK" : "EXS_JPEGLSLossless",
"GDCM" : "gdcm::TransferSyntax::JPEGLSLossless"
},
{
"UID" : "1.2.840.10008.1.2.4.81",
"Name" : "JPEG-LS (lossy or near-lossless)",
"Value" : "JPEGLSLossy",
"Retired" : false,
"DCMTK" : "EXS_JPEGLSLossy",
"GDCM" : "gdcm::TransferSyntax::JPEGLSNearLossless"
},
{
"UID" : "1.2.840.10008.1.2.4.90",
"Name" : "JPEG 2000 (lossless)",
"Value" : "JPEG2000LosslessOnly",
"Retired" : false,
"DCMTK" : "EXS_JPEG2000LosslessOnly",
"GDCM" : "gdcm::TransferSyntax::JPEG2000Lossless"
},
{
"UID" : "1.2.840.10008.1.2.4.91",
"Name" : "JPEG 2000 (lossless or lossy)",
"Value" : "JPEG2000",
"Retired" : false,
"DCMTK" : "EXS_JPEG2000",
"GDCM" : "gdcm::TransferSyntax::JPEG2000"
},
{
"UID" : "1.2.840.10008.1.2.4.92",
"Name" : "JPEG 2000 part 2 multicomponent extensions (lossless)",
"Value" : "JPEG2000MulticomponentLosslessOnly",
"Retired" : false,
"DCMTK" : "EXS_JPEG2000MulticomponentLosslessOnly",
"GDCM" : "gdcm::TransferSyntax::JPEG2000Part2Lossless"
},
{
"UID" : "1.2.840.10008.1.2.4.93",
"Name" : "JPEG 2000 part 2 multicomponent extensions (lossless or lossy)",
"Value" : "JPEG2000Multicomponent",
"Retired" : false,
"DCMTK" : "EXS_JPEG2000Multicomponent",
"GDCM" : "gdcm::TransferSyntax::JPEG2000Part2"
},
{
"UID" : "1.2.840.10008.1.2.4.94",
"Name" : "JPIP Referenced",
"Value" : "JPIPReferenced",
"Retired" : false,
"DCMTK" : "EXS_JPIPReferenced"
},
{
"UID" : "1.2.840.10008.1.2.4.95",
"Name" : "JPIP Referenced Deflate",
"Value" : "JPIPReferencedDeflate",
"Retired" : false,
"DCMTK" : "EXS_JPIPReferencedDeflate"
},
{
"UID" : "1.2.840.10008.1.2.4.100",
"Name" : "MPEG2 Main Profile / Main Level",
"Value" : "MPEG2MainProfileAtMainLevel",
"Retired" : false,
"DCMTK" : "EXS_MPEG2MainProfileAtMainLevel"
},
{
"UID" : "1.2.840.10008.1.2.4.101",
"Name" : "MPEG2 Main Profile / High Level",
"Value" : "MPEG2MainProfileAtHighLevel",
"Retired" : false,
"DCMTK" : "EXS_MPEG2MainProfileAtHighLevel"
},
{
"UID" : "1.2.840.10008.1.2.4.102",
"Name" : "MPEG4 AVC/H.264 High Profile / Level 4.1",
"Value" : "MPEG4HighProfileLevel4_1",
"Retired" : false,
"DCMTK" : "EXS_MPEG4HighProfileLevel4_1",
"SinceDCMTK" : "361"
},
{
"UID" : "1.2.840.10008.1.2.4.103",
"Name" : "MPEG4 AVC/H.264 BD-compatible High Profile / Level 4.1",
"Value" : "MPEG4BDcompatibleHighProfileLevel4_1",
"Retired" : false,
"DCMTK" : "EXS_MPEG4BDcompatibleHighProfileLevel4_1",
"SinceDCMTK" : "361"
},
{
"UID" : "1.2.840.10008.1.2.4.104",
"Name" : "MPEG4 AVC/H.264 High Profile / Level 4.2 For 2D Video",
"Value" : "MPEG4HighProfileLevel4_2_For2DVideo",
"Retired" : false,
"DCMTK" : "EXS_MPEG4HighProfileLevel4_2_For2DVideo",
"SinceDCMTK" : "361"
},
{
"UID" : "1.2.840.10008.1.2.4.105",
"Name" : "MPEG4 AVC/H.264 High Profile / Level 4.2 For 3D Video",
"Value" : "MPEG4HighProfileLevel4_2_For3DVideo",
"Retired" : false,
"DCMTK" : "EXS_MPEG4HighProfileLevel4_2_For3DVideo",
"SinceDCMTK" : "361"
},
{
"UID" : "1.2.840.10008.1.2.4.106",
"Name" : "MPEG4 AVC/H.264 Stereo High Profile / Level 4.2",
"Value" : "MPEG4StereoHighProfileLevel4_2",
"Retired" : false,
"DCMTK" : "EXS_MPEG4StereoHighProfileLevel4_2",
"SinceDCMTK" : "361"
},
{
"UID" : "1.2.840.10008.1.2.4.107",
"Name" : "HEVC/H.265 Main Profile / Level 5.1",
"Value" : "HEVCMainProfileLevel5_1",
"Retired" : false,
"DCMTK" : "EXS_HEVCMainProfileLevel5_1",
"SinceDCMTK" : "362"
},
{
"UID" : "1.2.840.10008.1.2.4.108",
"Name" : "HEVC/H.265 Main 10 Profile / Level 5.1",
"Value" : "HEVCMain10ProfileLevel5_1",
"Retired" : false,
"DCMTK" : "EXS_HEVCMain10ProfileLevel5_1",
"SinceDCMTK" : "362"
},
{
"UID" : "1.2.840.10008.1.2.5",
"Name" : "RLE - Run Length Encoding (lossless)",
"Value" : "RLELossless",
"Retired" : false,
"DCMTK" : "EXS_RLELossless",
"GDCM" : "gdcm::TransferSyntax::RLELossless"
},
{
"UID" : "1.2.840.10008.1.2.6.1",
"Name" : "RFC 2557 MIME Encapsulation",
"Value" : "RFC2557MimeEncapsulation",
"Retired" : true
},
{
"UID" : "1.2.840.10008.1.2.6.2",
"Name" : "XML Encoding",
"Value" : "XML",
"Retired" : true
}
]

View File

@ -0,0 +1,63 @@
static const unsigned int testEncodingsCount = 18;
static const ::Orthanc::Encoding testEncodings[] = {
::Orthanc::Encoding_Latin5,
::Orthanc::Encoding_Hebrew,
::Orthanc::Encoding_Greek,
::Orthanc::Encoding_Arabic,
::Orthanc::Encoding_Cyrillic,
::Orthanc::Encoding_Latin4,
::Orthanc::Encoding_Latin3,
::Orthanc::Encoding_Latin2,
::Orthanc::Encoding_Latin1,
::Orthanc::Encoding_Utf8,
::Orthanc::Encoding_Thai,
::Orthanc::Encoding_Japanese,
::Orthanc::Encoding_Ascii,
::Orthanc::Encoding_Windows1251,
::Orthanc::Encoding_Chinese,
::Orthanc::Encoding_Windows1251,
::Orthanc::Encoding_Windows1251,
::Orthanc::Encoding_Windows1251
};
static const char *testEncodingsEncoded[18] = {
"\x54\x65\x73\x74\xe9\xe4\xf6\xf2\xdd",
"\x54\x65\x73\x74\xe3",
"\x54\x65\x73\x74\xc8",
"\x54\x65\x73\x74\xd5",
"\x54\x65\x73\x74\xb4\xfb",
"\x54\x65\x73\x74\xe9\xe4\xf6\xf3",
"\x54\x65\x73\x74\xe9\xe4\xf6\xf2\xf8\xa9",
"\x54\x65\x73\x74\xe9\xe4\xf6",
"\x54\x65\x73\x74\xe9\xe4\xf6\xf2",
"\x54\x65\x73\x74\xc3\xa9\xc3\xa4\xc3\xb6\xc3\xb2\xd0\x94\xce\x98\xc4\x9d\xd7\x93\xd8\xb5\xc4\xb7\xd1\x9b\xe0\xb9\x9b\xef\xbe\x88\xc4\xb0",
"\x54\x65\x73\x74\xfb",
"\x54\x65\x73\x74\x84\x44\x83\xa6\xc8",
"\x54\x65\x73\x74",
"\x54\x65\x73\x74\xc4\x9e",
"\x81\x30\x89\x37\x81\x30\x89\x38\xA8\xA4\xA8\xA2\x81\x30\x89\x39\x81\x30\x8A\x30",
"\xd0\xe5\xed\xf2\xe3\xe5\xed\xee\xe3\xf0\xe0\xf4\xe8\xff",
"\xD2\xE0\xE7",
"\xcf\xf0\xff\xec\xe0\xff"
};
static const char *testEncodingsExpected[18] = {
"\x54\x65\x73\x74\xc3\xa9\xc3\xa4\xc3\xb6\xc3\xb2\xc4\xb0",
"\x54\x65\x73\x74\xd7\x93",
"\x54\x65\x73\x74\xce\x98",
"\x54\x65\x73\x74\xd8\xb5",
"\x54\x65\x73\x74\xd0\x94\xd1\x9b",
"\x54\x65\x73\x74\xc3\xa9\xc3\xa4\xc3\xb6\xc4\xb7",
"\x54\x65\x73\x74\xc3\xa9\xc3\xa4\xc3\xb6\xc3\xb2\xc4\x9d\xc4\xb0",
"\x54\x65\x73\x74\xc3\xa9\xc3\xa4\xc3\xb6",
"\x54\x65\x73\x74\xc3\xa9\xc3\xa4\xc3\xb6\xc3\xb2",
"\x54\x65\x73\x74\xc3\xa9\xc3\xa4\xc3\xb6\xc3\xb2\xd0\x94\xce\x98\xc4\x9d\xd7\x93\xd8\xb5\xc4\xb7\xd1\x9b\xe0\xb9\x9b\xef\xbe\x88\xc4\xb0",
"\x54\x65\x73\x74\xe0\xb9\x9b",
"\x54\x65\x73\x74\xd0\x94\xce\x98\xef\xbe\x88",
"\x54\x65\x73\x74",
"\x54\x65\x73\x74\xd0\x94\xd1\x9b",
"\xc3\x9e\xc3\x9f\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3",
"\xd0\xa0\xd0\xb5\xd0\xbd\xd1\x82\xd0\xb3\xd0\xb5\xd0\xbd\xd0\xbe\xd0\xb3\xd1\x80\xd0\xb0\xd1\x84\xd0\xb8\xd1\x8f",
"\xd0\xa2\xd0\xb0\xd0\xb7",
"\xd0\x9f\xd1\x80\xd1\x8f\xd0\xbc\xd0\xb0\xd1\x8f"
};
static const char *toUpperSource = "\x67\x72\xc3\xbc\xc3\x9f\x45\x4e\x20\x53\xc3\xa9\x62\x61\x73\x54\x49\x65\x6e\x20\x54\x65\x73\x74\xc3\xa9\xc3\xa4\xc3\xb6\xc3\xb2\xd0\x94\xce\x98\xc4\x9d\xd7\x93\xd8\xb5\xc4\xb7\xd1\x9b\xe0\xb9\x9b\xef\xbe\x88\xc4\xb0";
static const char *toUpperResult = "\x47\x52\xc3\x9c\xc3\x9f\x45\x4e\x20\x53\xc3\x89\x42\x41\x53\x54\x49\x45\x4e\x20\x54\x45\x53\x54\xc3\x89\xc3\x84\xc3\x96\xc3\x92\xd0\x94\xce\x98\xc4\x9c\xd7\x93\xd8\xb5\xc4\xb6\xd0\x8b\xe0\xb9\x9b\xef\xbe\x88\xc4\xb0";

View File

@ -0,0 +1,80 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
source = u'TestéäöòДΘĝדصķћ๛ネİ'
encodings = {
'UTF-8' : 'Utf8',
'ASCII' : 'Ascii',
'ISO-8859-1' : 'Latin1',
'ISO-8859-2' : 'Latin2',
'ISO-8859-3' : 'Latin3',
'ISO-8859-4' : 'Latin4',
'ISO-8859-9' : 'Latin5',
'ISO-8859-5' : 'Cyrillic',
'WINDOWS-1251' : 'Windows1251',
'ISO-8859-6' : 'Arabic',
'ISO-8859-7' : 'Greek',
'ISO-8859-8' : 'Hebrew',
'TIS-620' : 'Thai',
'SHIFT-JIS' : 'Japanese',
#'GB18030' : 'Chinese', # Done manually below (*)
}
#from encodings.aliases import aliases
#for a, b in aliases.iteritems():
# print '%s : %s' % (a, b)
# "63" corresponds to "?"
l = []
encoded = []
expected = []
def ToArray(source):
result = ''
for byte in bytearray(source):
result += '\\x%02x' % byte
return '"%s"' % result
for encoding, orthancEnumeration in encodings.iteritems():
l.append('::Orthanc::Encoding_%s' % orthancEnumeration)
s = source.encode(encoding, 'ignore')
encoded.append(ToArray(s))
expected.append(ToArray(s.decode(encoding).encode('utf-8')))
# https://en.wikipedia.org/wiki/GB_18030#Technical_details (*)
l.append('::Orthanc::Encoding_Chinese')
expected.append(ToArray('Þßàáâã'))
encoded.append('"\\x81\\x30\\x89\\x37\\x81\\x30\\x89\\x38\\xA8\\xA4\\xA8\\xA2\\x81\\x30\\x89\\x39\\x81\\x30\\x8A\\x30"')
# Issue 32
# "encoded" is the copy/paste from "dcm2xml +Ca cyrillic Issue32.dcm"
l.append('::Orthanc::Encoding_Windows1251')
encoded.append('"\\xd0\\xe5\\xed\\xf2\\xe3\\xe5\\xed\\xee\\xe3\\xf0\\xe0\\xf4\\xe8\\xff"')
expected.append(ToArray('Рентгенография'))
l.append('::Orthanc::Encoding_Windows1251')
encoded.append('"\\xD2\\xE0\\xE7"')
expected.append(ToArray('Таз'))
l.append('::Orthanc::Encoding_Windows1251')
encoded.append('"\\xcf\\xf0\\xff\\xec\\xe0\\xff"')
expected.append(ToArray('Прямая'))
if True:
print 'static const unsigned int testEncodingsCount = %d;' % len(l)
print 'static const ::Orthanc::Encoding testEncodings[] = {\n %s\n};' % (',\n '.join(l))
print 'static const char *testEncodingsEncoded[%d] = {\n %s\n};' % (len(l), ',\n '.join(encoded))
print 'static const char *testEncodingsExpected[%d] = {\n %s\n};' % (len(l), ',\n '.join(expected))
else:
for i in range(len(expected)):
print expected[i]
#print '%s: %s' % (expected[i], l[i])
u = (u'grüßEN SébasTIen %s' % source)
print 'static const char *toUpperSource = %s;' % ToArray(u.encode('utf-8'))
print 'static const char *toUpperResult = %s;' % ToArray(u.upper().encode('utf-8'))

View File

@ -0,0 +1,626 @@
[
/** Generic error codes **/
{
"Code": -1,
"Name": "InternalError",
"Description": "Internal error"
},
{
"Code": 0,
"HttpStatus": 200,
"Name": "Success",
"Description": "Success"
},
{
"Code": 1,
"Name": "Plugin",
"Description": "Error encountered within the plugin engine"
},
{
"Code": 2,
"Name": "NotImplemented",
"Description": "Not implemented yet"
},
{
"Code": 3,
"HttpStatus": 400,
"Name": "ParameterOutOfRange",
"Description": "Parameter out of range",
"SQLite": true
},
{
"Code": 4,
"Name": "NotEnoughMemory",
"Description": "The server hosting Orthanc is running out of memory"
},
{
"Code": 5,
"HttpStatus": 400,
"Name": "BadParameterType",
"Description": "Bad type for a parameter",
"SQLite": true
},
{
"Code": 6,
"Name": "BadSequenceOfCalls",
"Description": "Bad sequence of calls"
},
{
"Code": 7,
"HttpStatus": 404,
"Name": "InexistentItem",
"Description": "Accessing an inexistent item"
},
{
"Code": 8,
"HttpStatus": 400,
"Name": "BadRequest",
"Description": "Bad request"
},
{
"Code": 9,
"Name": "NetworkProtocol",
"Description": "Error in the network protocol"
},
{
"Code": 10,
"Name": "SystemCommand",
"Description": "Error while calling a system command"
},
{
"Code": 11,
"Name": "Database",
"Description": "Error with the database engine"
},
{
"Code": 12,
"HttpStatus": 400,
"Name": "UriSyntax",
"Description": "Badly formatted URI"
},
{
"Code": 13,
"HttpStatus": 404,
"Name": "InexistentFile",
"Description": "Inexistent file"
},
{
"Code": 14,
"Name": "CannotWriteFile",
"Description": "Cannot write to file"
},
{
"Code": 15,
"HttpStatus": 400,
"Name": "BadFileFormat",
"Description": "Bad file format"
},
{
"Code": 16,
"Name": "Timeout",
"Description": "Timeout"
},
{
"Code": 17,
"HttpStatus": 404,
"Name": "UnknownResource",
"Description": "Unknown resource"
},
{
"Code": 18,
"Name": "IncompatibleDatabaseVersion",
"Description": "Incompatible version of the database"
},
{
"Code": 19,
"Name": "FullStorage",
"Description": "The file storage is full"
},
{
"Code": 20,
"Name": "CorruptedFile",
"Description": "Corrupted file (e.g. inconsistent MD5 hash)"
},
{
"Code": 21,
"HttpStatus": 404,
"Name": "InexistentTag",
"Description": "Inexistent tag"
},
{
"Code": 22,
"Name": "ReadOnly",
"Description": "Cannot modify a read-only data structure"
},
{
"Code": 23,
"Name": "IncompatibleImageFormat",
"Description": "Incompatible format of the images"
},
{
"Code": 24,
"Name": "IncompatibleImageSize",
"Description": "Incompatible size of the images"
},
{
"Code": 25,
"Name": "SharedLibrary",
"Description": "Error while using a shared library (plugin)"
},
{
"Code": 26,
"Name": "UnknownPluginService",
"Description": "Plugin invoking an unknown service"
},
{
"Code": 27,
"Name": "UnknownDicomTag",
"Description": "Unknown DICOM tag"
},
{
"Code": 28,
"HttpStatus": 400,
"Name": "BadJson",
"Description": "Cannot parse a JSON document"
},
{
"Code": 29,
"HttpStatus": 401,
"Name": "Unauthorized",
"Description": "Bad credentials were provided to an HTTP request"
},
{
"Code": 30,
"Name": "BadFont",
"Description": "Badly formatted font file"
},
{
"Code": 31,
"Name": "DatabasePlugin",
"Description": "The plugin implementing a custom database back-end does not fulfill the proper interface"
},
{
"Code": 32,
"Name": "StorageAreaPlugin",
"Description": "Error in the plugin implementing a custom storage area"
},
{
"Code": 33,
"Name": "EmptyRequest",
"Description": "The request is empty"
},
{
"Code": 34,
"HttpStatus": 406,
"Name": "NotAcceptable",
"Description": "Cannot send a response which is acceptable according to the Accept HTTP header"
},
{
"Code": 35,
"Name": "NullPointer",
"Description": "Cannot handle a NULL pointer"
},
{
"Code": 36,
"HttpStatus": 503,
"Name": "DatabaseUnavailable",
"Description": "The database is currently not available (probably a transient situation)"
},
{
"Code": 37,
"Name": "CanceledJob",
"Description": "This job was canceled"
},
{
"Code": 38,
"Name": "BadGeometry",
"Description": "Geometry error encountered in Stone"
},
{
"Code": 39,
"Name": "SslInitialization",
"Description": "Cannot initialize SSL encryption, check out your certificates"
},
{
"Code": 40,
"Name": "DiscontinuedAbi",
"Description": "Calling a function that has been removed from the Orthanc Framework"
},
{
"Code": 41,
"HttpStatus" : 416,
"Name": "BadRange",
"Description": "Incorrect range request"
},
{
"Code": 42,
"HttpStatus": 503,
"Name": "DatabaseCannotSerialize",
"Description": "Database could not serialize access due to concurrent update, the transaction should be retried"
},
{
"Code": 43,
"HttpStatus": 409,
"Name": "Revision",
"Description": "A bad revision number was provided, which might indicate conflict between multiple writers"
},
{
"Code": 44,
"Name": "MainDicomTagsMultiplyDefined",
"Description": "A main DICOM Tag has been defined multiple times for the same resource level"
},
{
"Code": 45,
"HttpStatus": 403,
"Name": "ForbiddenAccess",
"Description": "Access to a resource is forbidden"
},
{
"Code": 46,
"HttpStatus": 409,
"Name": "DuplicateResource",
"Description": "Duplicate resource"
},
{
"Code": 47,
"Name": "IncompatibleConfigurations",
"Description": "Your configuration file contains configuration that are mutually incompatible"
},
/** SQLite **/
{
"Code": 1000,
"Name": "SQLiteNotOpened",
"Description": "SQLite: The database is not opened",
"SQLite": true
},
{
"Code": 1001,
"Name": "SQLiteAlreadyOpened",
"Description": "SQLite: Connection is already open",
"SQLite": true
},
{
"Code": 1002,
"Name": "SQLiteCannotOpen",
"Description": "SQLite: Unable to open the database",
"SQLite": true
},
{
"Code": 1003,
"Name": "SQLiteStatementAlreadyUsed",
"Description": "SQLite: This cached statement is already being referred to",
"SQLite": true
},
{
"Code": 1004,
"Name": "SQLiteExecute",
"Description": "SQLite: Cannot execute a command",
"SQLite": true
},
{
"Code": 1005,
"Name": "SQLiteRollbackWithoutTransaction",
"Description": "SQLite: Rolling back a nonexistent transaction (have you called Begin()?)",
"SQLite": true
},
{
"Code": 1006,
"Name": "SQLiteCommitWithoutTransaction",
"Description": "SQLite: Committing a nonexistent transaction",
"SQLite": true
},
{
"Code": 1007,
"Name": "SQLiteRegisterFunction",
"Description": "SQLite: Unable to register a function",
"SQLite": true
},
{
"Code": 1008,
"Name": "SQLiteFlush",
"Description": "SQLite: Unable to flush the database",
"SQLite": true
},
{
"Code": 1009,
"Name": "SQLiteCannotRun",
"Description": "SQLite: Cannot run a cached statement",
"SQLite": true
},
{
"Code": 1010,
"Name": "SQLiteCannotStep",
"Description": "SQLite: Cannot step over a cached statement",
"SQLite": true
},
{
"Code": 1011,
"Name": "SQLiteBindOutOfRange",
"Description": "SQLite: Bind a value while out of range (serious error)",
"SQLite": true
},
{
"Code": 1012,
"Name": "SQLitePrepareStatement",
"Description": "SQLite: Cannot prepare a cached statement",
"SQLite": true
},
{
"Code": 1013,
"Name": "SQLiteTransactionAlreadyStarted",
"Description": "SQLite: Beginning the same transaction twice",
"SQLite": true
},
{
"Code": 1014,
"Name": "SQLiteTransactionCommit",
"Description": "SQLite: Failure when committing the transaction",
"SQLite": true
},
{
"Code": 1015,
"Name": "SQLiteTransactionBegin",
"Description": "SQLite: Cannot start a transaction",
"SQLite": true
},
/** Specific error codes **/
{
"Code": 2000,
"Name": "DirectoryOverFile",
"Description": "The directory to be created is already occupied by a regular file"
},
{
"Code": 2001,
"Name": "FileStorageCannotWrite",
"Description": "Unable to create a subdirectory or a file in the file storage"
},
{
"Code": 2002,
"Name": "DirectoryExpected",
"Description": "The specified path does not point to a directory"
},
{
"Code": 2003,
"Name": "HttpPortInUse",
"Description": "The TCP port of the HTTP server is privileged or already in use"
},
{
"Code": 2004,
"Name": "DicomPortInUse",
"Description": "The TCP port of the DICOM server is privileged or already in use"
},
{
"Code": 2005,
"Name": "BadHttpStatusInRest",
"Description": "This HTTP status is not allowed in a REST API"
},
{
"Code": 2006,
"Name": "RegularFileExpected",
"Description": "The specified path does not point to a regular file"
},
{
"Code": 2007,
"Name": "PathToExecutable",
"Description": "Unable to get the path to the executable"
},
{
"Code": 2008,
"Name": "MakeDirectory",
"Description": "Cannot create a directory"
},
{
"Code": 2009,
"Name": "BadApplicationEntityTitle",
"Description": "An application entity title (AET) cannot be empty or be longer than 16 characters"
},
{
"Code": 2010,
"Name": "NoCFindHandler",
"Description": "No request handler factory for DICOM C-FIND SCP"
},
{
"Code": 2011,
"Name": "NoCMoveHandler",
"Description": "No request handler factory for DICOM C-MOVE SCP"
},
{
"Code": 2012,
"Name": "NoCStoreHandler",
"Description": "No request handler factory for DICOM C-STORE SCP"
},
{
"Code": 2013,
"Name": "NoApplicationEntityFilter",
"Description": "No application entity filter"
},
{
"Code": 2014,
"Name": "NoSopClassOrInstance",
"Description": "DicomUserConnection: Unable to find the SOP class and instance"
},
{
"Code": 2015,
"Name": "NoPresentationContext",
"Description": "DicomUserConnection: No acceptable presentation context for modality"
},
{
"Code": 2016,
"Name": "DicomFindUnavailable",
"Description": "DicomUserConnection: The C-FIND command is not supported by the remote SCP"
},
{
"Code": 2017,
"Name": "DicomMoveUnavailable",
"Description": "DicomUserConnection: The C-MOVE command is not supported by the remote SCP"
},
{
"Code": 2018,
"Name": "CannotStoreInstance",
"Description": "Cannot store an instance"
},
{
"Code": 2019,
"HttpStatus": 400,
"Name": "CreateDicomNotString",
"Description": "Only string values are supported when creating DICOM instances"
},
{
"Code": 2020,
"HttpStatus": 400,
"Name": "CreateDicomOverrideTag",
"Description": "Trying to override a value inherited from a parent module"
},
{
"Code": 2021,
"HttpStatus": 400,
"Name": "CreateDicomUseContent",
"Description": "Use \\\"Content\\\" to inject an image into a new DICOM instance"
},
{
"Code": 2022,
"HttpStatus": 400,
"Name": "CreateDicomNoPayload",
"Description": "No payload is present for one instance in the series"
},
{
"Code": 2023,
"HttpStatus": 400,
"Name": "CreateDicomUseDataUriScheme",
"Description": "The payload of the DICOM instance must be specified according to Data URI scheme"
},
{
"Code": 2024,
"HttpStatus": 400,
"Name": "CreateDicomBadParent",
"Description": "Trying to attach a new DICOM instance to an inexistent resource"
},
{
"Code": 2025,
"HttpStatus": 400,
"Name": "CreateDicomParentIsInstance",
"Description": "Trying to attach a new DICOM instance to an instance (must be a series, study or patient)"
},
{
"Code": 2026,
"Name": "CreateDicomParentEncoding",
"Description": "Unable to get the encoding of the parent resource"
},
{
"Code": 2027,
"Name": "UnknownModality",
"Description": "Unknown modality"
},
{
"Code": 2028,
"Name": "BadJobOrdering",
"Description": "Bad ordering of filters in a job"
},
{
"Code": 2029,
"Name": "JsonToLuaTable",
"Description": "Cannot convert the given JSON object to a Lua table"
},
{
"Code": 2030,
"Name": "CannotCreateLua",
"Description": "Cannot create the Lua context"
},
{
"Code": 2031,
"Name": "CannotExecuteLua",
"Description": "Cannot execute a Lua command"
},
{
"Code": 2032,
"Name": "LuaAlreadyExecuted",
"Description": "Arguments cannot be pushed after the Lua function is executed"
},
{
"Code": 2033,
"Name": "LuaBadOutput",
"Description": "The Lua function does not give the expected number of outputs"
},
{
"Code": 2034,
"Name": "NotLuaPredicate",
"Description": "The Lua function is not a predicate (only true/false outputs allowed)"
},
{
"Code": 2035,
"Name": "LuaReturnsNoString",
"Description": "The Lua function does not return a string"
},
{
"Code": 2036,
"Name": "StorageAreaAlreadyRegistered",
"Description": "Another plugin has already registered a custom storage area"
},
{
"Code": 2037,
"Name": "DatabaseBackendAlreadyRegistered",
"Description": "Another plugin has already registered a custom database back-end"
},
{
"Code": 2038,
"Name": "DatabaseNotInitialized",
"Description": "Plugin trying to call the database during its initialization"
},
{
"Code": 2039,
"Name": "SslDisabled",
"Description": "Orthanc has been built without SSL support"
},
{
"Code": 2040,
"Name": "CannotOrderSlices",
"Description": "Unable to order the slices of the series"
},
{
"Code": 2041,
"Name": "NoWorklistHandler",
"Description": "No request handler factory for DICOM C-Find Modality SCP"
},
{
"Code": 2042,
"Name": "AlreadyExistingTag",
"Description": "Cannot override the value of a tag that already exists"
},
{
"Code": 2043,
"Name": "NoStorageCommitmentHandler",
"Description": "No request handler factory for DICOM N-ACTION SCP (storage commitment)"
},
{
"Code": 2044,
"Name": "NoCGetHandler",
"Description": "No request handler factory for DICOM C-GET SCP"
},
{
"Code": 2045,
"Name": "DicomGetUnavailable",
"Description": "DicomUserConnection: The C-GET command is not supported by the remote SCP"
},
/** HTTP-related error codes **/
{
"Code": 3000,
"HttpStatus": 415,
"Name": "UnsupportedMediaType",
"Description": "Unsupported media type"
}
]

View File

@ -0,0 +1,151 @@
#!/usr/bin/python
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import json
import os
import re
import sys
START_PLUGINS = 1000000
BASE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
##
## Read all the available error codes and HTTP status
##
with open(os.path.join(BASE, 'OrthancFramework', 'Resources', 'CodeGeneration', 'ErrorCodes.json'), 'r') as f:
ERRORS = json.loads(re.sub('/\*.*?\*/', '', f.read()))
for error in ERRORS:
if error['Code'] >= START_PLUGINS:
print('ERROR: Error code must be below %d, but "%s" is set to %d' % (START_PLUGINS, error['Name'], error['Code']))
sys.exit(-1)
with open(os.path.join(BASE, 'OrthancFramework', 'Sources', 'Enumerations.h'), 'r') as f:
a = f.read()
HTTP = {}
for i in re.findall('(HttpStatus_([0-9]+)_\w+)', a):
HTTP[int(i[1])] = i[0]
##
## Generate the "ErrorCode" enumeration in "Enumerations.h"
##
path = os.path.join(BASE, 'OrthancFramework', 'Sources', 'Enumerations.h')
with open(path, 'r') as f:
a = f.read()
s = ',\n'.join(map(lambda x: ' ErrorCode_%s = %d /*!< %s */' % (x['Name'], int(x['Code']), x['Description']), ERRORS))
s += ',\n ErrorCode_START_PLUGINS = %d' % START_PLUGINS
a = re.sub('(enum ErrorCode\s*{)[^}]*?(\s*};)', r'\1\n%s\2' % s, a, re.DOTALL)
with open(path, 'w') as f:
f.write(a)
##
## Generate the "OrthancPluginErrorCode" enumeration in "OrthancCPlugin.h"
##
path = os.path.join(BASE, 'OrthancServer', 'Plugins', 'Include', 'orthanc', 'OrthancCPlugin.h')
with open(path, 'r') as f:
a = f.read()
s = ',\n'.join(map(lambda x: ' OrthancPluginErrorCode_%s = %d /*!< %s */' % (x['Name'], int(x['Code']), x['Description']), ERRORS))
s += ',\n\n _OrthancPluginErrorCode_INTERNAL = 0x7fffffff\n '
a = re.sub('(typedef enum\s*{)[^}]*?(} OrthancPluginErrorCode;)', r'\1\n%s\2' % s, a, re.DOTALL)
with open(path, 'w') as f:
f.write(a)
##
## Generate the "EnumerationToString(ErrorCode)" and
## "ConvertErrorCodeToHttpStatus(ErrorCode)" functions in
## "Enumerations.cpp"
##
path = os.path.join(BASE, 'OrthancFramework', 'Sources', 'Enumerations.cpp')
with open(path, 'r') as f:
a = f.read()
s = '\n\n'.join(map(lambda x: ' case ErrorCode_%s:\n return "%s";' % (x['Name'], x['Description']), ERRORS))
a = re.sub('(EnumerationToString\(ErrorCode.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)',
r'\1\n%s\2' % s, a, re.DOTALL)
def GetHttpStatus(x):
s = HTTP[x['HttpStatus']]
return ' case ErrorCode_%s:\n return %s;' % (x['Name'], s)
s = '\n\n'.join(map(GetHttpStatus, filter(lambda x: 'HttpStatus' in x, ERRORS)))
a = re.sub('(ConvertErrorCodeToHttpStatus\(ErrorCode.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)',
r'\1\n%s\2' % s, a, re.DOTALL)
with open(path, 'w') as f:
f.write(a)
##
## Generate the "ErrorCode" enumeration in "OrthancSQLiteException.h"
##
path = os.path.join(BASE, 'OrthancFramework', 'Sources', 'SQLite', 'OrthancSQLiteException.h')
with open(path, 'r') as f:
a = f.read()
e = list(filter(lambda x: 'SQLite' in x and x['SQLite'], ERRORS))
s = ',\n'.join(map(lambda x: ' ErrorCode_%s' % x['Name'], e))
a = re.sub('(enum ErrorCode\s*{)[^}]*?(\s*};)', r'\1\n%s\2' % s, a, re.DOTALL)
s = '\n\n'.join(map(lambda x: ' case ErrorCode_%s:\n return "%s";' % (x['Name'], x['Description']), e))
a = re.sub('(EnumerationToString\(ErrorCode.*?\)\s*{\s*switch \([^)]*?\)\s*{)[^}]*?(\s*default:)',
r'\1\n%s\2' % s, a, re.DOTALL)
with open(path, 'w') as f:
f.write(a)
##
## Generate the "PrintErrors" function in "main.cpp"
##
path = os.path.join(BASE, 'OrthancServer', 'Sources', 'main.cpp')
with open(path, 'r') as f:
a = f.read()
s = '\n'.join(map(lambda x: ' PrintErrorCode(ErrorCode_%s, "%s");' % (x['Name'], x['Description']), ERRORS))
a = re.sub('(static void PrintErrors[^{}]*?{[^{}]*?{)([^}]*?)}', r'\1\n%s\n }' % s, a, re.DOTALL)
with open(path, 'w') as f:
f.write(a)

View File

@ -0,0 +1,75 @@
#!/usr/bin/python
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import json
import os
import re
import sys
import pystache
BASE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
## https://www.dicomlibrary.com/dicom/transfer-syntax/
## https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=EDICOM_transfer_syntax
with open(os.path.join(BASE, 'Resources', 'CodeGeneration', 'DicomTransferSyntaxes.json'), 'r') as f:
SYNTAXES = json.loads(f.read())
##
## Generate the "DicomTransferSyntax" enumeration in "Enumerations.h"
##
path = os.path.join(BASE, 'Sources', 'Enumerations.h')
with open(path, 'r') as f:
a = f.read()
s = ',\n'.join(map(lambda x: ' DicomTransferSyntax_%s /*!< %s */' % (x['Value'], x['Name']), SYNTAXES))
a = re.sub('(enum DicomTransferSyntax\s*{)[^}]*?(\s*};)', r'\1\n%s\2' % s, a, re.DOTALL)
with open(path, 'w') as f:
f.write(a)
##
## Generate the implementations
##
with open(os.path.join(BASE, 'Sources', 'Enumerations_TransferSyntaxes.impl.h'), 'w') as b:
with open(os.path.join(BASE, 'Resources', 'CodeGeneration', 'GenerateTransferSyntaxesEnumerations.mustache'), 'r') as a:
b.write(pystache.render(a.read(), {
'Syntaxes' : SYNTAXES
}))
with open(os.path.join(BASE, 'Sources', 'DicomParsing', 'FromDcmtkBridge_TransferSyntaxes.impl.h'), 'w') as b:
with open(os.path.join(BASE, 'Resources', 'CodeGeneration', 'GenerateTransferSyntaxesDcmtk.mustache'), 'r') as a:
b.write(pystache.render(a.read(), {
'Syntaxes' : SYNTAXES
}))

View File

@ -0,0 +1,94 @@
/**
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017-2023 Osimis S.A., Belgium
* Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
* Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
*
* This program 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.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
**/
// This file is autogenerated by "../Resources/GenerateTransferSyntaxes.py"
namespace Orthanc
{
bool FromDcmtkBridge::LookupDcmtkTransferSyntax(E_TransferSyntax& target,
DicomTransferSyntax source)
{
switch (source)
{
{{#Syntaxes}}
{{#DCMTK}}
{{#SinceDCMTK}}
#if DCMTK_VERSION_NUMBER >= {{SinceDCMTK}}
{{/SinceDCMTK}}
case DicomTransferSyntax_{{Value}}:
{{#DCMTK360}}
# if DCMTK_VERSION_NUMBER <= 360
target = {{DCMTK360}};
# else
target = {{DCMTK}};
# endif
{{/DCMTK360}}
{{^DCMTK360}}
target = {{DCMTK}};
{{/DCMTK360}}
return true;
{{#SinceDCMTK}}
#endif
{{/SinceDCMTK}}
{{/DCMTK}}
{{/Syntaxes}}
default:
return false;
}
}
bool FromDcmtkBridge::LookupOrthancTransferSyntax(DicomTransferSyntax& target,
E_TransferSyntax source)
{
switch (source)
{
{{#Syntaxes}}
{{#DCMTK}}
{{#SinceDCMTK}}
#if DCMTK_VERSION_NUMBER >= {{SinceDCMTK}}
{{/SinceDCMTK}}
{{#DCMTK360}}
# if DCMTK_VERSION_NUMBER <= 360
case {{DCMTK360}}:
# else
case {{DCMTK}}:
# endif
{{/DCMTK360}}
{{^DCMTK360}}
case {{DCMTK}}:
{{/DCMTK360}}
target = DicomTransferSyntax_{{Value}};
return true;
{{#SinceDCMTK}}
#endif
{{/SinceDCMTK}}
{{/DCMTK}}
{{/Syntaxes}}
default:
return false;
}
}
}

View File

@ -0,0 +1,85 @@
/**
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017-2023 Osimis S.A., Belgium
* Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
* Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
*
* This program 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.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
**/
// This file is autogenerated by "../Resources/GenerateTransferSyntaxes.py"
namespace Orthanc
{
const char* GetTransferSyntaxUid(DicomTransferSyntax syntax)
{
switch (syntax)
{
{{#Syntaxes}}
case DicomTransferSyntax_{{Value}}:
return "{{UID}}";
{{/Syntaxes}}
default:
throw OrthancException(ErrorCode_ParameterOutOfRange);
}
}
bool IsRetiredTransferSyntax(DicomTransferSyntax syntax)
{
switch (syntax)
{
{{#Syntaxes}}
case DicomTransferSyntax_{{Value}}:
{{#Retired}}
return true;
{{/Retired}}
{{^Retired}}
return false;
{{/Retired}}
{{/Syntaxes}}
default:
throw OrthancException(ErrorCode_ParameterOutOfRange);
}
}
bool LookupTransferSyntax(DicomTransferSyntax& target,
const std::string& uid)
{
{{#Syntaxes}}
if (uid == "{{UID}}")
{
target = DicomTransferSyntax_{{Value}};
return true;
}
{{/Syntaxes}}
return false;
}
void GetAllDicomTransferSyntaxes(std::set<DicomTransferSyntax>& target)
{
target.clear();
{{#Syntaxes}}
target.insert(DicomTransferSyntax_{{Value}});
{{/Syntaxes}}
}
}

View File

@ -0,0 +1,52 @@
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
# $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../Resources/Toolchains/LinuxStandardBaseToolchain.cmake -G Ninja
cmake_minimum_required(VERSION 2.8...4.0)
project(DcmtkTools)
include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/Compiler.cmake)
include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/DownloadPackage.cmake)
set(STATIC_BUILD ON CACHE BOOL "")
set(ALLOW_DOWNLOADS ON CACHE BOOL "")
set(DCMTK_STATIC_VERSION "3.6.5" CACHE STRING "")
set(ENABLE_DCMTK_JPEG ON CACHE BOOL "")
set(ENABLE_DCMTK_JPEG_LOSSLESS ON CACHE BOOL "")
set(ENABLE_DCMTK_LOG ON CACHE BOOL "")
set(ENABLE_DCMTK_NETWORKING ON CACHE BOOL "")
set(ENABLE_DCMTK_TRANSCODING ON CACHE BOOL "")
include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/DcmtkConfiguration.cmake)
add_library(dcmtk STATIC
${CMAKE_SOURCE_DIR}/dummy.cpp
${DCMTK_SOURCES}
)
add_executable(getscu
${DCMTK_SOURCES_DIR}/dcmnet/apps/getscu.cc
)
target_link_libraries(getscu dcmtk)

View File

@ -0,0 +1,46 @@
/**
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017-2023 Osimis S.A., Belgium
* Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
* Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
*
* This program 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.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
**/
#include <string>
struct OrthancLinesIterator;
OrthancLinesIterator* OrthancLinesIterator_Create(const std::string& content)
{
return NULL;
}
bool OrthancLinesIterator_GetLine(std::string& target,
const OrthancLinesIterator* iterator)
{
return false;
}
void OrthancLinesIterator_Next(OrthancLinesIterator* iterator)
{
}
void OrthancLinesIterator_Free(OrthancLinesIterator* iterator)
{
}

View File

@ -0,0 +1,446 @@
#!/usr/bin/python
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import sys
import os
import os.path
import pprint
import re
UPCASE_CHECK = True
USE_SYSTEM_EXCEPTION = False
EXCEPTION_CLASS = 'OrthancException'
OUT_OF_RANGE_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_ParameterOutOfRange)'
INEXISTENT_PATH_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_InexistentItem)'
NAMESPACE = 'Orthanc.EmbeddedResources'
FRAMEWORK_PATH = None
ARGS = []
for i in range(len(sys.argv)):
if not sys.argv[i].startswith('--'):
ARGS.append(sys.argv[i])
elif sys.argv[i].lower() == '--no-upcase-check':
UPCASE_CHECK = False
elif sys.argv[i].lower() == '--system-exception':
USE_SYSTEM_EXCEPTION = True
EXCEPTION_CLASS = '::std::runtime_error'
OUT_OF_RANGE_EXCEPTION = '%s("Parameter out of range")' % EXCEPTION_CLASS
INEXISTENT_PATH_EXCEPTION = '%s("Unknown path in a directory resource")' % EXCEPTION_CLASS
elif sys.argv[i].startswith('--namespace='):
NAMESPACE = sys.argv[i][sys.argv[i].find('=') + 1 : ]
elif sys.argv[i].startswith('--framework-path='):
FRAMEWORK_PATH = sys.argv[i][sys.argv[i].find('=') + 1 : ]
if len(ARGS) < 2 or len(ARGS) % 2 != 0:
print ('Usage:')
print ('python %s [--no-upcase-check] [--system-exception] [--namespace=<Namespace>] <TargetBaseFilename> [ <Name> <Source> ]*' % sys.argv[0])
exit(-1)
TARGET_BASE_FILENAME = ARGS[1]
SOURCES = ARGS[2:]
try:
# Make sure the destination directory exists
os.makedirs(os.path.normpath(os.path.join(TARGET_BASE_FILENAME, '..')))
except:
pass
#####################################################################
## Read each resource file
#####################################################################
def CheckNoUpcase(s):
global UPCASE_CHECK
if (UPCASE_CHECK and
re.search('[A-Z]', s) != None):
raise Exception("Path in a directory with an upcase letter: %s" % s)
resources = {}
counter = 0
i = 0
while i < len(SOURCES):
resourceName = SOURCES[i].upper()
pathName = SOURCES[i + 1]
if not os.path.exists(pathName):
raise Exception("Non existing path: %s" % pathName)
if resourceName in resources:
raise Exception("Twice the same resource: " + resourceName)
if os.path.isdir(pathName):
# The resource is a directory: Recursively explore its files
content = {}
for root, dirs, files in os.walk(pathName):
dirs.sort()
files.sort()
base = os.path.relpath(root, pathName)
# Fix issue #24 (Build fails on OSX when directory has .DS_Store files):
# Ignore folders whose name starts with a dot (".")
if base.find('/.') != -1:
print('Ignoring folder: %s' % root)
continue
for f in files:
if f.find('~') == -1: # Ignore Emacs backup files
if base == '.':
r = f
else:
r = os.path.join(base, f)
CheckNoUpcase(r)
r = '/' + r.replace('\\', '/')
if r in content:
raise Exception("Twice the same filename (check case): " + r)
content[r] = {
'Filename' : os.path.join(root, f),
'Index' : counter
}
counter += 1
resources[resourceName] = {
'Type' : 'Directory',
'Files' : content
}
elif os.path.isfile(pathName):
resources[resourceName] = {
'Type' : 'File',
'Index' : counter,
'Filename' : pathName
}
counter += 1
else:
raise Exception("Not a regular file, nor a directory: " + pathName)
i += 2
#pprint.pprint(resources)
#####################################################################
## Write .h header
#####################################################################
header = open(TARGET_BASE_FILENAME + '.h', 'w')
header.write("""
#pragma once
#include <string>
#include <list>
#if defined(_MSC_VER)
# pragma warning(disable: 4065) // "Switch statement contains 'default' but no 'case' labels"
#endif
""")
for ns in NAMESPACE.split('.'):
header.write('namespace %s {\n' % ns)
header.write("""
enum FileResourceId
{
""")
isFirst = True
for name in resources:
if resources[name]['Type'] == 'File':
if isFirst:
isFirst = False
else:
header.write(',\n')
header.write(' %s' % name)
header.write("""
};
enum DirectoryResourceId
{
""")
isFirst = True
for name in resources:
if resources[name]['Type'] == 'Directory':
if isFirst:
isFirst = False
else:
header.write(',\n')
header.write(' %s' % name)
header.write("""
};
const void* GetFileResourceBuffer(FileResourceId id);
size_t GetFileResourceSize(FileResourceId id);
void GetFileResource(std::string& result, FileResourceId id);
const void* GetDirectoryResourceBuffer(DirectoryResourceId id, const char* path);
size_t GetDirectoryResourceSize(DirectoryResourceId id, const char* path);
void GetDirectoryResource(std::string& result, DirectoryResourceId id, const char* path);
void ListResources(std::list<std::string>& result, DirectoryResourceId id);
""")
for ns in NAMESPACE.split('.'):
header.write('}\n')
header.close()
#####################################################################
## Write the resource content in the .cpp source
#####################################################################
PYTHON_MAJOR_VERSION = sys.version_info[0]
def WriteResource(cpp, item):
cpp.write(' static const uint8_t resource%dBuffer[] = {' % item['Index'])
f = open(item['Filename'], "rb")
content = f.read()
f.close()
# http://stackoverflow.com/a/1035360
pos = 0
buffer = [] # instead of appending a few bytes at a time to the cpp file,
# we first append each chunk to a list, join it and write it
# to the file. We've measured that it was 2-3 times faster in python3.
# Note that speed is important since if generation is too slow,
# cmake might try to compile the EmbeddedResources.cpp file while it is
# still being generated !
for b in content:
if PYTHON_MAJOR_VERSION == 2:
c = ord(b[0])
else:
c = b
if pos > 0:
buffer.append(",")
if (pos % 16) == 0:
buffer.append("\n")
if c < 0:
raise Exception("Internal error")
buffer.append("0x%02x" % c)
pos += 1
cpp.write("".join(buffer))
# Zero-size array are disallowed, so we put one single void character in it.
if pos == 0:
cpp.write(' 0')
cpp.write(' };\n')
cpp.write(' static const size_t resource%dSize = %d;\n' % (item['Index'], pos))
cpp = open(TARGET_BASE_FILENAME + '.cpp', 'w')
cpp.write('#include "%s.h"\n' % os.path.basename(TARGET_BASE_FILENAME))
if USE_SYSTEM_EXCEPTION:
cpp.write('#include <stdexcept>')
elif FRAMEWORK_PATH != None:
cpp.write('#include "%s/OrthancException.h"' % FRAMEWORK_PATH)
else:
cpp.write('#include <OrthancException.h>')
cpp.write("""
#include <stdint.h>
#include <string.h>
""")
for ns in NAMESPACE.split('.'):
cpp.write('namespace %s {\n' % ns)
for name in resources:
if resources[name]['Type'] == 'File':
WriteResource(cpp, resources[name])
else:
for f in resources[name]['Files']:
WriteResource(cpp, resources[name]['Files'][f])
#####################################################################
## Write the accessors to the file resources in .cpp
#####################################################################
cpp.write("""
const void* GetFileResourceBuffer(FileResourceId id)
{
switch (id)
{
""")
for name in resources:
if resources[name]['Type'] == 'File':
cpp.write(' case %s:\n' % name)
cpp.write(' return resource%dBuffer;\n' % resources[name]['Index'])
cpp.write("""
default:
throw %s;
}
}
size_t GetFileResourceSize(FileResourceId id)
{
switch (id)
{
""" % OUT_OF_RANGE_EXCEPTION)
for name in resources:
if resources[name]['Type'] == 'File':
cpp.write(' case %s:\n' % name)
cpp.write(' return resource%dSize;\n' % resources[name]['Index'])
cpp.write("""
default:
throw %s;
}
}
""" % OUT_OF_RANGE_EXCEPTION)
#####################################################################
## Write the accessors to the directory resources in .cpp
#####################################################################
cpp.write("""
const void* GetDirectoryResourceBuffer(DirectoryResourceId id, const char* path)
{
switch (id)
{
""")
for name in resources:
if resources[name]['Type'] == 'Directory':
cpp.write(' case %s:\n' % name)
isFirst = True
for path in resources[name]['Files']:
cpp.write(' if (!strcmp(path, "%s"))\n' % path)
cpp.write(' return resource%dBuffer;\n' % resources[name]['Files'][path]['Index'])
cpp.write(' throw %s;\n\n' % INEXISTENT_PATH_EXCEPTION)
cpp.write(""" default:
throw %s;
}
}
size_t GetDirectoryResourceSize(DirectoryResourceId id, const char* path)
{
switch (id)
{
""" % OUT_OF_RANGE_EXCEPTION)
for name in resources:
if resources[name]['Type'] == 'Directory':
cpp.write(' case %s:\n' % name)
isFirst = True
for path in resources[name]['Files']:
cpp.write(' if (!strcmp(path, "%s"))\n' % path)
cpp.write(' return resource%dSize;\n' % resources[name]['Files'][path]['Index'])
cpp.write(' throw %s;\n\n' % INEXISTENT_PATH_EXCEPTION)
cpp.write(""" default:
throw %s;
}
}
""" % OUT_OF_RANGE_EXCEPTION)
#####################################################################
## List the resources in a directory
#####################################################################
cpp.write("""
void ListResources(std::list<std::string>& result, DirectoryResourceId id)
{
result.clear();
switch (id)
{
""")
for name in resources:
if resources[name]['Type'] == 'Directory':
cpp.write(' case %s:\n' % name)
for path in sorted(resources[name]['Files']):
cpp.write(' result.push_back("%s");\n' % path)
cpp.write(' break;\n\n')
cpp.write(""" default:
throw %s;
}
}
""" % OUT_OF_RANGE_EXCEPTION)
#####################################################################
## Write the convenience wrappers in .cpp
#####################################################################
cpp.write("""
void GetFileResource(std::string& result, FileResourceId id)
{
size_t size = GetFileResourceSize(id);
result.resize(size);
if (size > 0)
memcpy(&result[0], GetFileResourceBuffer(id), size);
}
void GetDirectoryResource(std::string& result, DirectoryResourceId id, const char* path)
{
size_t size = GetDirectoryResourceSize(id, path);
result.resize(size);
if (size > 0)
memcpy(&result[0], GetDirectoryResourceBuffer(id, path), size);
}
""")
for ns in NAMESPACE.split('.'):
cpp.write('}\n')
cpp.close()

View File

@ -0,0 +1,166 @@
#!/usr/bin/env python
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import json
import os
import re
import sys
if len(sys.argv) != 2:
raise Exception('Bad number of arguments')
# This emulates "util/perl/OpenSSL/stackhash.pm"
GENERATE_STACK_MACROS = '''
SKM_DEFINE_STACK_OF_INTERNAL(${nametype}, ${realtype}, ${plaintype})
#define sk_${nametype}_num(sk) OPENSSL_sk_num(ossl_check_const_${nametype}_sk_type(sk))
#define sk_${nametype}_value(sk, idx) ((${realtype} *)OPENSSL_sk_value(ossl_check_const_${nametype}_sk_type(sk), (idx)))
#define sk_${nametype}_new(cmp) ((STACK_OF(${nametype}) *)OPENSSL_sk_new(ossl_check_${nametype}_compfunc_type(cmp)))
#define sk_${nametype}_new_null() ((STACK_OF(${nametype}) *)OPENSSL_sk_new_null())
#define sk_${nametype}_new_reserve(cmp, n) ((STACK_OF(${nametype}) *)OPENSSL_sk_new_reserve(ossl_check_${nametype}_compfunc_type(cmp), (n)))
#define sk_${nametype}_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_${nametype}_sk_type(sk), (n))
#define sk_${nametype}_free(sk) OPENSSL_sk_free(ossl_check_${nametype}_sk_type(sk))
#define sk_${nametype}_zero(sk) OPENSSL_sk_zero(ossl_check_${nametype}_sk_type(sk))
#define sk_${nametype}_delete(sk, i) ((${realtype} *)OPENSSL_sk_delete(ossl_check_${nametype}_sk_type(sk), (i)))
#define sk_${nametype}_delete_ptr(sk, ptr) ((${realtype} *)OPENSSL_sk_delete_ptr(ossl_check_${nametype}_sk_type(sk), ossl_check_${nametype}_type(ptr)))
#define sk_${nametype}_push(sk, ptr) OPENSSL_sk_push(ossl_check_${nametype}_sk_type(sk), ossl_check_${nametype}_type(ptr))
#define sk_${nametype}_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_${nametype}_sk_type(sk), ossl_check_${nametype}_type(ptr))
#define sk_${nametype}_pop(sk) ((${realtype} *)OPENSSL_sk_pop(ossl_check_${nametype}_sk_type(sk)))
#define sk_${nametype}_shift(sk) ((${realtype} *)OPENSSL_sk_shift(ossl_check_${nametype}_sk_type(sk)))
#define sk_${nametype}_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_${nametype}_sk_type(sk),ossl_check_${nametype}_freefunc_type(freefunc))
#define sk_${nametype}_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_${nametype}_sk_type(sk), ossl_check_${nametype}_type(ptr), (idx))
#define sk_${nametype}_set(sk, idx, ptr) ((${realtype} *)OPENSSL_sk_set(ossl_check_${nametype}_sk_type(sk), (idx), ossl_check_${nametype}_type(ptr)))
#define sk_${nametype}_find(sk, ptr) OPENSSL_sk_find(ossl_check_${nametype}_sk_type(sk), ossl_check_${nametype}_type(ptr))
#define sk_${nametype}_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_${nametype}_sk_type(sk), ossl_check_${nametype}_type(ptr))
#define sk_${nametype}_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_${nametype}_sk_type(sk), ossl_check_${nametype}_type(ptr), pnum)
#define sk_${nametype}_sort(sk) OPENSSL_sk_sort(ossl_check_${nametype}_sk_type(sk))
#define sk_${nametype}_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_${nametype}_sk_type(sk))
#define sk_${nametype}_dup(sk) ((STACK_OF(${nametype}) *)OPENSSL_sk_dup(ossl_check_const_${nametype}_sk_type(sk)))
#define sk_${nametype}_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(${nametype}) *)OPENSSL_sk_deep_copy(ossl_check_const_${nametype}_sk_type(sk), ossl_check_${nametype}_copyfunc_type(copyfunc), ossl_check_${nametype}_freefunc_type(freefunc)))
#define sk_${nametype}_set_cmp_func(sk, cmp) ((sk_${nametype}_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_${nametype}_sk_type(sk), ossl_check_${nametype}_compfunc_type(cmp)))
'''
GENERATE_LHASH_MACROS = '''
DEFINE_LHASH_OF_INTERNAL(${type});
#define lh_${type}_new(hfn, cmp) ((LHASH_OF(${type}) *)OPENSSL_LH_new(ossl_check_${type}_lh_hashfunc_type(hfn), ossl_check_${type}_lh_compfunc_type(cmp)))
#define lh_${type}_free(lh) OPENSSL_LH_free(ossl_check_${type}_lh_type(lh))
#define lh_${type}_flush(lh) OPENSSL_LH_flush(ossl_check_${type}_lh_type(lh))
#define lh_${type}_insert(lh, ptr) ((${type} *)OPENSSL_LH_insert(ossl_check_${type}_lh_type(lh), ossl_check_${type}_lh_plain_type(ptr)))
#define lh_${type}_delete(lh, ptr) ((${type} *)OPENSSL_LH_delete(ossl_check_${type}_lh_type(lh), ossl_check_const_${type}_lh_plain_type(ptr)))
#define lh_${type}_retrieve(lh, ptr) ((${type} *)OPENSSL_LH_retrieve(ossl_check_${type}_lh_type(lh), ossl_check_const_${type}_lh_plain_type(ptr)))
#define lh_${type}_error(lh) OPENSSL_LH_error(ossl_check_${type}_lh_type(lh))
#define lh_${type}_num_items(lh) OPENSSL_LH_num_items(ossl_check_${type}_lh_type(lh))
#define lh_${type}_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_${type}_lh_type(lh), out)
#define lh_${type}_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_${type}_lh_type(lh), out)
#define lh_${type}_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_${type}_lh_type(lh), out)
#define lh_${type}_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_${type}_lh_type(lh))
#define lh_${type}_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_${type}_lh_type(lh), dl)
#define lh_${type}_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_${type}_lh_type(lh), ossl_check_${type}_lh_doallfunc_type(dfn))
'''
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)),
'OpenSSL-ExtractProvidersOIDs.json'), 'r') as f:
OIDS = json.loads(f.read())
CURRENT_HEADER = ''
def Parse(match):
s = ''
for t in re.findall('generate_stack_macros\("(.+?)"\)', match.group(1)):
s += (GENERATE_STACK_MACROS
.replace('${nametype}', t)
.replace('${realtype}', t)
.replace('${plaintype}', t))
for t in re.findall('generate_const_stack_macros\("(.+?)"\)', match.group(1)):
s += (GENERATE_STACK_MACROS
.replace('${nametype}', t)
.replace('${realtype}', 'const %s' % t)
.replace('${plaintype}', t))
for t in re.findall('generate_stack_string_macros\(\)', match.group(1)):
s += (GENERATE_STACK_MACROS
.replace('${nametype}', 'OPENSSL_STRING')
.replace('${realtype}', 'char')
.replace('${plaintype}', 'char'))
for t in re.findall('generate_stack_const_string_macros\(\)', match.group(1)):
s += (GENERATE_STACK_MACROS
.replace('${nametype}', 'OPENSSL_CSTRING')
.replace('${realtype}', 'const char')
.replace('${plaintype}', 'char'))
for t in re.findall('generate_stack_block_macros\(\)', match.group(1)):
s += (GENERATE_STACK_MACROS
.replace('${nametype}', 'OPENSSL_BLOCK')
.replace('${realtype}', 'void')
.replace('${plaintype}', 'void'))
for t in re.findall('generate_lhash_macros\("(.+?)"\)', match.group(1)):
s += GENERATE_LHASH_MACROS.replace('${type}', t)
for t in re.findall('\$config{rc4_int}', match.group(1)):
s += 'unsigned int'
for t in re.findall('oids_to_c::process_leaves\(.+?\)', match.group(1), re.MULTILINE | re.DOTALL):
if not CURRENT_HEADER in OIDS:
raise Exception('Unknown header: %s' % CURRENT_HEADER)
for (name, definition) in OIDS[CURRENT_HEADER].items():
s += '#define DER_OID_V_%s %s\n' % (name, ', '.join(definition))
s += '#define DER_OID_SZ_%s %d\n' % (name, len(definition))
s += 'extern const unsigned char ossl_der_oid_%s[DER_OID_SZ_%s];\n\n' % (name, name)
return s
for base in [ 'include/openssl',
'providers/common/include/prov' ]:
directory = os.path.join(sys.argv[1], base)
for source in os.listdir(directory):
if source.endswith('.h.in'):
target = re.sub('\.h\.in$', '.h', source)
with open(os.path.join(directory, source), 'r') as f:
with open(os.path.join(directory, target), 'w') as g:
CURRENT_HEADER = source
g.write(re.sub('{-(.*?)-}.*?$', Parse, f.read(),
flags = re.MULTILINE | re.DOTALL))
with open(os.path.join(sys.argv[1], 'providers/common/der/orthanc_oids_gen.c'), 'w') as f:
for (header, content) in OIDS.items():
f.write('#include "prov/%s"\n' % re.sub('\.h\.in$', '.h', header))
f.write('\n')
for (header, content) in OIDS.items():
for (name, definition) in content.items():
f.write('const unsigned char ossl_der_oid_%s[DER_OID_SZ_%s] = { DER_OID_V_%s };\n' % (
name, name, name))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,73 @@
#!/usr/bin/env python
# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2024-2025 Orthanc Team SRL, Belgium
# Copyright (C) 2021-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
#
# This program 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.
#
# 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
##
## This is a maintenance script to automatically extract the OIDs
## generated from the ".asn1" files by the OpenSSL configuration
## script "./Configure". This script generates the file
## "OpenSSL-ExtractProvidersOIDs.json". The output JSON is then used
## by "OpenSSL-ConfigureHeaders.py".
##
import json
import os
import re
import sys
if len(sys.argv) != 2:
raise Exception('Provide the path to your configured OpenSSL 3.x build directory')
BASE = os.path.join(sys.argv[1], 'providers/common/include/prov')
TARGET = 'OpenSSL-ExtractProvidersOIDs.json'
RESULT = {}
for source in os.listdir(BASE):
if source.endswith('.h.in'):
path = os.path.join(BASE, re.sub('.in$', '', source))
content = {}
with open(path, 'r') as f:
for definition in re.findall('#define (DER_OID_V_.+?)#define (DER_OID_SZ_.+?)extern const(.+?)$', f.read(), re.MULTILINE | re.DOTALL):
oid = definition[0].strip().split(' ')
name = oid[0].replace('DER_OID_V_', '')
oid = oid[1:]
sizes = definition[1].strip().split(' ')
if (name in content or
len(sizes) != 2 or
sizes[0] != 'DER_OID_SZ_%s' % name or
int(sizes[1]) != len(oid)):
raise Exception('Cannot parse %s, for OID %s' % (path, name))
content[name] = list(map(lambda x: x.replace(',', ''), oid))
RESULT[source] = content
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), TARGET), 'w') as f:
f.write(json.dumps(RESULT, sort_keys = True, indent = 4))

View File

@ -0,0 +1,136 @@
diff -urEb boost_1_69_0.orig/boost/move/adl_move_swap.hpp boost_1_69_0/boost/move/adl_move_swap.hpp
--- boost_1_69_0.orig/boost/move/adl_move_swap.hpp 2019-02-22 15:05:32.682359994 +0100
+++ boost_1_69_0/boost/move/adl_move_swap.hpp 2019-02-22 15:05:48.426358034 +0100
@@ -28,6 +28,8 @@
//Try to avoid including <algorithm>, as it's quite big
#if defined(_MSC_VER) && defined(BOOST_DINKUMWARE_STDLIB)
#include <utility> //Dinkum libraries define std::swap in utility which is lighter than algorithm
+#elif defined(__LSB_VERSION__)
+# include <utility>
#elif defined(BOOST_GNU_STDLIB)
//For non-GCC compilers, where GNUC version is not very reliable, or old GCC versions
//use the good old stl_algobase header, which is quite lightweight
diff -urEb boost_1_69_0.orig/boost/system/detail/system_category_win32.hpp boost_1_69_0/boost/system/detail/system_category_win32.hpp
--- boost_1_69_0.orig/boost/system/detail/system_category_win32.hpp 2019-02-22 15:05:32.722359989 +0100
+++ boost_1_69_0/boost/system/detail/system_category_win32.hpp 2019-02-22 15:06:31.922352713 +0100
@@ -26,7 +26,7 @@
namespace detail
{
-#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) )
+#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) || 1 /* std::snprintf() does not seem to exist on Visual Studio 2015 */
inline char const * unknown_message_win32( int ev, char * buffer, std::size_t len )
{
diff -urEb boost_1_69_0.orig/boost/thread/detail/config.hpp boost_1_69_0/boost/thread/detail/config.hpp
--- boost_1_69_0.orig/boost/thread/detail/config.hpp 2019-02-22 15:05:32.598360004 +0100
+++ boost_1_69_0/boost/thread/detail/config.hpp 2019-02-22 15:05:48.426358034 +0100
@@ -418,7 +418,7 @@
#define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
#elif defined(BOOST_THREAD_CHRONO_MAC_API)
#define BOOST_THREAD_HAS_MONO_CLOCK
-#elif defined(__ANDROID__)
+#elif defined(__ANDROID__) || defined(__LSB_VERSION__)
#define BOOST_THREAD_HAS_MONO_CLOCK
#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
#define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
diff -urEb boost_1_69_0.orig/boost/type_traits/detail/has_postfix_operator.hpp boost_1_69_0/boost/type_traits/detail/has_postfix_operator.hpp
--- boost_1_69_0.orig/boost/type_traits/detail/has_postfix_operator.hpp 2019-02-22 15:05:32.650359998 +0100
+++ boost_1_69_0/boost/type_traits/detail/has_postfix_operator.hpp 2019-02-22 15:05:48.426358034 +0100
@@ -85,8 +85,11 @@
namespace boost {
namespace detail {
+// https://stackoverflow.com/a/15474269
+#ifndef Q_MOC_RUN
// This namespace ensures that argument-dependent name lookup does not mess things up.
namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) {
+#endif
// 1. a function to have an instance of type T without requiring T to be default
// constructible
@@ -234,7 +237,9 @@
BOOST_STATIC_CONSTANT(bool, value = (trait_impl1 < Lhs_noref, Ret, BOOST_TT_FORBIDDEN_IF >::value));
};
+#ifndef Q_MOC_RUN
} // namespace impl
+#endif
} // namespace detail
// this is the accessible definition of the trait to end user
diff -urEb boost_1_69_0.orig/boost/type_traits/detail/has_prefix_operator.hpp boost_1_69_0/boost/type_traits/detail/has_prefix_operator.hpp
--- boost_1_69_0.orig/boost/type_traits/detail/has_prefix_operator.hpp 2019-02-22 15:05:32.650359998 +0100
+++ boost_1_69_0/boost/type_traits/detail/has_prefix_operator.hpp 2019-02-22 15:05:48.426358034 +0100
@@ -114,8 +114,11 @@
namespace boost {
namespace detail {
+// https://stackoverflow.com/a/15474269
+#ifndef Q_MOC_RUN
// This namespace ensures that argument-dependent name lookup does not mess things up.
namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) {
+#endif
// 1. a function to have an instance of type T without requiring T to be default
// constructible
@@ -263,7 +266,9 @@
BOOST_STATIC_CONSTANT(bool, value = (trait_impl1 < Rhs_noref, Ret, BOOST_TT_FORBIDDEN_IF >::value));
};
+#ifndef Q_MOC_RUN
} // namespace impl
+#endif
} // namespace detail
// this is the accessible definition of the trait to end user
diff -urEb boost_1_69_0.orig/libs/filesystem/src/operations.cpp boost_1_69_0/libs/filesystem/src/operations.cpp
--- boost_1_69_0.orig/libs/filesystem/src/operations.cpp 2019-02-22 15:05:32.566360008 +0100
+++ boost_1_69_0/libs/filesystem/src/operations.cpp 2019-02-22 18:04:17.346573047 +0100
@@ -2111,9 +2111,16 @@
std::size_t path_size (0); // initialization quiets gcc warning (ticket #3509)
error_code ec = path_max(path_size);
if (ec)return ec;
- dirent de;
- buffer = std::malloc((sizeof(dirent) - sizeof(de.d_name))
- + path_size + 1); // + 1 for "/0"
+
+ // Fixed possible use of uninitialized dirent::d_type in dir_iterator
+ // https://github.com/boostorg/filesystem/commit/bbe9d1771e5d679b3f10c42a58fc81f7e8c024a9
+ const std::size_t buffer_size = (sizeof(dirent) - sizeof(dirent().d_name))
+ + path_size + 1; // + 1 for "\0"
+ buffer = std::malloc(buffer_size);
+ if (BOOST_UNLIKELY(!buffer))
+ return make_error_code(boost::system::errc::not_enough_memory);
+ std::memset(buffer, 0, buffer_size);
+
return ok;
}
@@ -2142,6 +2149,13 @@
*result = 0;
if ((p = ::readdir(dirp))== 0)
return errno;
+
+ // Fixed possible use of uninitialized dirent::d_type in dir_iterator
+ // https://github.com/boostorg/filesystem/commit/bbe9d1771e5d679b3f10c42a58fc81f7e8c024a9
+# ifdef BOOST_FILESYSTEM_STATUS_CACHE
+ entry->d_type = p->d_type;
+# endif
+
std::strcpy(entry->d_name, p->d_name);
*result = entry;
return 0;
diff -urEb boost_1_69_0.orig/boost/thread/pthread/thread_data.hpp boost_1_69_0/boost/thread/pthread/thread_data.hpp
--- boost_1_69_0.orig/boost/thread/pthread/thread_data.hpp 2022-08-11 07:26:14.343376000 +0000
+++ boost_1_69_0/boost/thread/pthread/thread_data.hpp 2022-08-11 07:27:21.009862000 +0000
@@ -57,7 +57,7 @@
#else
std::size_t page_size = ::sysconf( _SC_PAGESIZE);
#endif
-#if PTHREAD_STACK_MIN > 0
+#ifdef PTHREAD_STACK_MIN
if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN;
#endif
size = ((size+page_size-1)/page_size)*page_size;

View File

@ -0,0 +1,125 @@
diff -urEb boost_1_85_0.orig/libs/locale/src/boost/locale/shared/date_time.cpp boost_1_85_0/libs/locale/src/boost/locale/shared/date_time.cpp
--- boost_1_85_0.orig/libs/locale/src/boost/locale/shared/date_time.cpp 2024-05-16 20:54:25.516816710 +0200
+++ boost_1_85_0/libs/locale/src/boost/locale/shared/date_time.cpp 2024-05-16 20:55:09.144319528 +0200
@@ -12,8 +12,10 @@
#include <boost/locale/date_time.hpp>
#include <boost/locale/formatting.hpp>
#include <boost/core/exchange.hpp>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/mutex.hpp>
+#if !defined(__EMSCRIPTEN__)
+# include <boost/thread/locks.hpp>
+# include <boost/thread/mutex.hpp>
+#endif
#include <cmath>
namespace boost { namespace locale {
@@ -400,6 +402,7 @@
return impl_->get_option(abstract_calendar::is_dst) != 0;
}
+#if !defined(__EMSCRIPTEN__)
namespace time_zone {
boost::mutex& tz_mutex()
{
@@ -422,6 +425,7 @@
return boost::exchange(tz_id(), new_id);
}
} // namespace time_zone
+#endif
}} // namespace boost::locale
diff -urEb boost_1_85_0.orig/libs/locale/src/boost/locale/shared/generator.cpp boost_1_85_0/libs/locale/src/boost/locale/shared/generator.cpp
--- boost_1_85_0.orig/libs/locale/src/boost/locale/shared/generator.cpp 2024-05-16 20:54:25.516816710 +0200
+++ boost_1_85_0/libs/locale/src/boost/locale/shared/generator.cpp 2024-05-16 20:56:20.231509636 +0200
@@ -7,8 +7,10 @@
#include <boost/locale/encoding.hpp>
#include <boost/locale/generator.hpp>
#include <boost/locale/localization_backend.hpp>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/mutex.hpp>
+#if !defined(__EMSCRIPTEN__)
+# include <boost/thread/locks.hpp>
+# include <boost/thread/mutex.hpp>
+#endif
#include <algorithm>
#include <map>
#include <vector>
@@ -21,7 +23,9 @@
{}
mutable std::map<std::string, std::locale> cached;
+#if !defined(__EMSCRIPTEN__)
mutable boost::mutex cached_lock;
+#endif
category_t cats;
char_facet_t chars;
@@ -101,7 +105,9 @@
std::locale generator::generate(const std::locale& base, const std::string& id) const
{
if(d->caching_enabled) {
+#if !defined(__EMSCRIPTEN__)
boost::unique_lock<boost::mutex> guard(d->cached_lock);
+#endif
const auto p = d->cached.find(id);
if(p != d->cached.end())
return p->second;
@@ -126,7 +132,9 @@
result = backend->install(result, facet, char_facet_t::nochar);
}
if(d->caching_enabled) {
+#if !defined(__EMSCRIPTEN__)
boost::unique_lock<boost::mutex> guard(d->cached_lock);
+#endif
const auto p = d->cached.find(id);
if(p == d->cached.end())
d->cached[id] = result;
diff -urEb boost_1_85_0.orig/libs/locale/src/boost/locale/shared/localization_backend.cpp boost_1_85_0/libs/locale/src/boost/locale/shared/localization_backend.cpp
--- boost_1_85_0.orig/libs/locale/src/boost/locale/shared/localization_backend.cpp 2024-05-16 20:54:25.516816710 +0200
+++ boost_1_85_0/libs/locale/src/boost/locale/shared/localization_backend.cpp 2024-05-16 20:56:58.823070064 +0200
@@ -5,8 +5,10 @@
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/locale/localization_backend.hpp>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/mutex.hpp>
+#if !defined(__EMSCRIPTEN__)
+# include <boost/thread/locks.hpp>
+# include <boost/thread/mutex.hpp>
+#endif
#include <functional>
#include <memory>
#include <vector>
@@ -211,11 +213,13 @@
return mgr;
}
+#if !defined(__EMSCRIPTEN__)
boost::mutex& localization_backend_manager_mutex()
{
static boost::mutex the_mutex;
return the_mutex;
}
+#endif
localization_backend_manager& localization_backend_manager_global()
{
static localization_backend_manager the_manager = make_default_backend_mgr();
@@ -225,12 +229,16 @@
localization_backend_manager localization_backend_manager::global()
{
+#if !defined(__EMSCRIPTEN__)
boost::unique_lock<boost::mutex> lock(localization_backend_manager_mutex());
+#endif
return localization_backend_manager_global();
}
localization_backend_manager localization_backend_manager::global(const localization_backend_manager& in)
{
+#if !defined(__EMSCRIPTEN__)
boost::unique_lock<boost::mutex> lock(localization_backend_manager_mutex());
+#endif
return exchange(localization_backend_manager_global(), in);
}

View File

@ -0,0 +1,127 @@
diff -urEb boost_1_86_0.orig/libs/locale/src/boost/locale/shared/date_time.cpp boost_1_86_0/libs/locale/src/boost/locale/shared/date_time.cpp
--- boost_1_86_0.orig/libs/locale/src/boost/locale/shared/date_time.cpp 2024-09-25 15:46:01.000000000 +0200
+++ boost_1_86_0/libs/locale/src/boost/locale/shared/date_time.cpp 2024-09-25 15:58:51.306131987 +0200
@@ -12,8 +12,10 @@
#include <boost/locale/date_time.hpp>
#include <boost/locale/formatting.hpp>
#include <boost/core/exchange.hpp>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/mutex.hpp>
+#if !defined(__EMSCRIPTEN__)
+# include <boost/thread/locks.hpp>
+# include <boost/thread/mutex.hpp>
+#endif
#include <cmath>
namespace boost { namespace locale {
@@ -400,6 +402,7 @@
return impl_->get_option(abstract_calendar::is_dst) != 0;
}
+#if !defined(__EMSCRIPTEN__)
namespace time_zone {
boost::mutex& tz_mutex()
{
@@ -422,7 +425,7 @@
return boost::exchange(tz_id(), new_id);
}
} // namespace time_zone
-
+#endif
}} // namespace boost::locale
// boostinspect:nominmax
diff -urEb boost_1_86_0.orig/libs/locale/src/boost/locale/shared/generator.cpp boost_1_86_0/libs/locale/src/boost/locale/shared/generator.cpp
--- boost_1_86_0.orig/libs/locale/src/boost/locale/shared/generator.cpp 2024-09-25 15:46:01.000000000 +0200
+++ boost_1_86_0/libs/locale/src/boost/locale/shared/generator.cpp 2024-09-25 16:00:07.756233916 +0200
@@ -7,8 +7,10 @@
#include <boost/locale/encoding.hpp>
#include <boost/locale/generator.hpp>
#include <boost/locale/localization_backend.hpp>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/mutex.hpp>
+#if !defined(__EMSCRIPTEN__)
+# include <boost/thread/locks.hpp>
+# include <boost/thread/mutex.hpp>
+#endif
#include <algorithm>
#include <map>
#include <vector>
@@ -21,8 +23,9 @@
{}
mutable std::map<std::string, std::locale> cached;
+#if !defined(__EMSCRIPTEN__)
mutable boost::mutex cached_lock;
-
+#endif
category_t cats;
char_facet_t chars;
@@ -101,7 +104,9 @@
std::locale generator::generate(const std::locale& base, const std::string& id) const
{
if(d->caching_enabled) {
+#if !defined(__EMSCRIPTEN__)
boost::unique_lock<boost::mutex> guard(d->cached_lock);
+#endif
const auto p = d->cached.find(id);
if(p != d->cached.end())
return p->second;
@@ -126,7 +131,9 @@
result = backend->install(result, facet, char_facet_t::nochar);
}
if(d->caching_enabled) {
+#if !defined(__EMSCRIPTEN__)
boost::unique_lock<boost::mutex> guard(d->cached_lock);
+#endif
const auto p = d->cached.find(id);
if(p == d->cached.end())
d->cached[id] = result;
diff -urEb boost_1_86_0.orig/libs/locale/src/boost/locale/shared/localization_backend.cpp boost_1_86_0/libs/locale/src/boost/locale/shared/localization_backend.cpp
--- boost_1_86_0.orig/libs/locale/src/boost/locale/shared/localization_backend.cpp 2024-09-25 15:46:01.000000000 +0200
+++ boost_1_86_0/libs/locale/src/boost/locale/shared/localization_backend.cpp 2024-09-25 16:01:09.196820495 +0200
@@ -5,8 +5,10 @@
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/locale/localization_backend.hpp>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/mutex.hpp>
+#if !defined(__EMSCRIPTEN__)
+# include <boost/thread/locks.hpp>
+# include <boost/thread/mutex.hpp>
+#endif
#include <functional>
#include <memory>
#include <vector>
@@ -211,11 +213,13 @@
return mgr;
}
+#if !defined(__EMSCRIPTEN__)
boost::mutex& localization_backend_manager_mutex()
{
static boost::mutex the_mutex;
return the_mutex;
}
+#endif
localization_backend_manager& localization_backend_manager_global()
{
static localization_backend_manager the_manager = make_default_backend_mgr();
@@ -225,12 +229,16 @@
localization_backend_manager localization_backend_manager::global()
{
+#if !defined(__EMSCRIPTEN__)
boost::unique_lock<boost::mutex> lock(localization_backend_manager_mutex());
+#endif
return localization_backend_manager_global();
}
localization_backend_manager localization_backend_manager::global(const localization_backend_manager& in)
{
+#if !defined(__EMSCRIPTEN__)
boost::unique_lock<boost::mutex> lock(localization_backend_manager_mutex());
+#endif
return exchange(localization_backend_manager_global(), in);
}

View File

@ -0,0 +1,41 @@
diff -urEb civetweb-1.13.orig/include/civetweb.h civetweb-1.13/include/civetweb.h
--- civetweb-1.13.orig/include/civetweb.h 2020-10-27 13:11:13.870113645 +0100
+++ civetweb-1.13/include/civetweb.h 2020-10-27 13:12:33.997986337 +0100
@@ -1695,6 +1695,9 @@
struct mg_error_data *error);
#endif
+// Added by SJ
+CIVETWEB_API void mg_disable_keep_alive(struct mg_connection *conn);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff -urEb civetweb-1.13.orig/src/civetweb.c civetweb-1.13/src/civetweb.c
--- civetweb-1.13.orig/src/civetweb.c 2020-10-27 13:11:13.870113645 +0100
+++ civetweb-1.13/src/civetweb.c 2020-10-27 13:12:14.534017414 +0100
@@ -10876,6 +10876,11 @@
/* + MicroSoft extensions
* https://msdn.microsoft.com/en-us/library/aa142917.aspx */
+ /* Added by SJ, for write access to WebDAV on Windows >= 7 */
+ {"LOCK", 1, 1, 0, 0, 0},
+ {"UNLOCK", 1, 0, 0, 0, 0},
+ {"PROPPATCH", 1, 1, 0, 0, 0},
+
/* REPORT method (RFC 3253) */
{"REPORT", 1, 1, 1, 1, 1},
/* REPORT method only allowed for CGI/Lua/LSP and callbacks. */
@@ -21287,4 +21292,12 @@
}
+// Added by SJ
+void mg_disable_keep_alive(struct mg_connection *conn)
+{
+ if (conn != NULL) {
+ conn->must_close = 1;
+ }
+}
+
/* End of civetweb.c */

View File

@ -0,0 +1,43 @@
diff -urEb civetweb-1.14.orig/src/civetweb.c civetweb-1.14/src/civetweb.c
--- civetweb-1.14.orig/src/civetweb.c 2023-07-06 15:48:01.163703913 +0200
+++ civetweb-1.14/src/civetweb.c 2023-07-06 15:48:51.207843938 +0200
@@ -567,7 +567,7 @@
#if (_MSC_VER < 1300)
#define STRX(x) #x
#define STR(x) STRX(x)
-#define __func__ __FILE__ ":" STR(__LINE__)
+#define __func__ __ORTHANC_FILE__ ":" STR(__LINE__)
#define strtoull(x, y, z) ((unsigned __int64)_atoi64(x))
#define strtoll(x, y, z) (_atoi64(x))
#else
@@ -1450,14 +1450,14 @@
}
-#define mg_malloc(a) mg_malloc_ex(a, NULL, __FILE__, __LINE__)
-#define mg_calloc(a, b) mg_calloc_ex(a, b, NULL, __FILE__, __LINE__)
-#define mg_realloc(a, b) mg_realloc_ex(a, b, NULL, __FILE__, __LINE__)
-#define mg_free(a) mg_free_ex(a, __FILE__, __LINE__)
-
-#define mg_malloc_ctx(a, c) mg_malloc_ex(a, c, __FILE__, __LINE__)
-#define mg_calloc_ctx(a, b, c) mg_calloc_ex(a, b, c, __FILE__, __LINE__)
-#define mg_realloc_ctx(a, b, c) mg_realloc_ex(a, b, c, __FILE__, __LINE__)
+#define mg_malloc(a) mg_malloc_ex(a, NULL, __ORTHANC_FILE__, __LINE__)
+#define mg_calloc(a, b) mg_calloc_ex(a, b, NULL, __ORTHANC_FILE__, __LINE__)
+#define mg_realloc(a, b) mg_realloc_ex(a, b, NULL, __ORTHANC_FILE__, __LINE__)
+#define mg_free(a) mg_free_ex(a, __ORTHANC_FILE__, __LINE__)
+
+#define mg_malloc_ctx(a, c) mg_malloc_ex(a, c, __ORTHANC_FILE__, __LINE__)
+#define mg_calloc_ctx(a, b, c) mg_calloc_ex(a, b, c, __ORTHANC_FILE__, __LINE__)
+#define mg_realloc_ctx(a, b, c) mg_realloc_ex(a, b, c, __ORTHANC_FILE__, __LINE__)
#else /* USE_SERVER_STATS */
@@ -1774,6 +1774,7 @@
#if !defined(OPENSSL_API_3_0)
#define OPENSSL_API_3_0
#endif
+#define OPENSSL_REMOVE_THREAD_STATE()
#else
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
#if !defined(OPENSSL_API_1_1)

View File

@ -0,0 +1,12 @@
diff -urEb curl-8.12.1-orig/CMake/Macros.cmake curl-8.12.1/CMake/Macros.cmake
--- curl-8.12.1-orig/CMake/Macros.cmake 2025-02-13 08:15:00.000000000 +0100
+++ curl-8.12.1/CMake/Macros.cmake 2025-03-27 10:25:42.119275658 +0100
@@ -50,7 +50,7 @@
message(STATUS "Performing Test ${_curl_test}")
try_compile(${_curl_test}
${PROJECT_BINARY_DIR}
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c"
+ "${CURL_SOURCES_DIR}/CMake/CurlTests.c"
CMAKE_FLAGS
"-DCOMPILE_DEFINITIONS:STRING=-D${_curl_test} ${CURL_TEST_DEFINES} ${_cmake_required_definitions}"
"${_curl_test_add_libraries}"

View File

@ -0,0 +1,24 @@
diff -urEb curl-8.9.0.orig/CMake/Macros.cmake curl-8.9.0/CMake/Macros.cmake
--- curl-8.9.0.orig/CMake/Macros.cmake 2025-02-18 16:04:59.818585107 +0100
+++ curl-8.9.0/CMake/Macros.cmake 2025-02-18 16:05:16.867458366 +0100
@@ -48,7 +48,7 @@
message(STATUS "Performing Test ${CURL_TEST}")
try_compile(${CURL_TEST}
${CMAKE_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c
+ ${CURL_SOURCES_DIR}/CMake/CurlTests.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${CURL_TEST_ADD_LIBRARIES}"
OUTPUT_VARIABLE OUTPUT)
diff -urEb curl-8.9.0.orig/lib/system_win32.c curl-8.9.0/lib/system_win32.c
--- curl-8.9.0.orig/lib/system_win32.c 2025-02-18 16:04:59.834584988 +0100
+++ curl-8.9.0/lib/system_win32.c 2025-02-18 16:06:26.448941452 +0100
@@ -273,7 +273,7 @@
bool Curl_win32_impersonating(void)
{
-#ifndef CURL_WINDOWS_APP
+#if !defined(CURL_WINDOWS_APP) && !defined(__MINGW32__)
HANDLE token = NULL;
if(OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE, &token)) {
CloseHandle(token);

View File

@ -0,0 +1,29 @@
diff -urEb dcmtk-3.6.0.orig/dcmnet/libsrc/dulparse.cc dcmtk-3.6.0/dcmnet/libsrc/dulparse.cc
--- dcmtk-3.6.0.orig/dcmnet/libsrc/dulparse.cc 2010-12-01 09:26:36.000000000 +0100
+++ dcmtk-3.6.0/dcmnet/libsrc/dulparse.cc 2016-12-02 15:58:49.930540033 +0100
@@ -393,6 +393,8 @@
return cond;
buf += length;
+ if (presentationLength < length)
+ return EC_MemoryExhausted;
presentationLength -= length;
DCMNET_TRACE("Successfully parsed Abstract Syntax");
break;
@@ -404,12 +406,16 @@
cond = LST_Enqueue(&context->transferSyntaxList, (LST_NODE*)subItem);
if (cond.bad()) return cond;
buf += length;
+ if (presentationLength < length)
+ return EC_MemoryExhausted;
presentationLength -= length;
DCMNET_TRACE("Successfully parsed Transfer Syntax");
break;
default:
cond = parseDummy(buf, &length, presentationLength);
buf += length;
+ if (presentationLength < length)
+ return EC_MemoryExhausted;
presentationLength -= length;
break;
}

View File

@ -0,0 +1,21 @@
diff -urEb dcmtk-3.6.0.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.0/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-3.6.0.orig/ofstd/include/dcmtk/ofstd/offile.h 2010-12-17 11:50:30.000000000 +0100
+++ dcmtk-3.6.0/ofstd/include/dcmtk/ofstd/offile.h 2013-07-19 15:56:25.688996134 +0200
@@ -196,7 +196,7 @@
OFBool popen(const char *command, const char *modes)
{
if (file_) fclose();
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__MINGW64_VERSION_MAJOR)
file_ = _popen(command, modes);
#else
file_ = :: popen(command, modes);
@@ -258,7 +258,7 @@
{
if (popened_)
{
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__MINGW64_VERSION_MAJOR)
result = _pclose(file_);
#else
result = :: pclose(file_);

View File

@ -0,0 +1,54 @@
diff -urEb dcmtk-3.6.0.orig/dcmnet/libsrc/dul.cc dcmtk-3.6.0/dcmnet/libsrc/dul.cc
--- dcmtk-3.6.0.orig/dcmnet/libsrc/dul.cc 2017-03-17 15:49:23.043061969 +0100
+++ dcmtk-3.6.0/dcmnet/libsrc/dul.cc 2017-03-17 15:50:44.075359547 +0100
@@ -630,7 +630,10 @@
if (cond.bad())
return cond;
- cond = PRV_NextPDUType(association, block, timeout, &pduType);
+ /* This is the first time we read from this new connection, so in case it
+ * doesn't speak DICOM, we shouldn't wait forever (= DUL_NOBLOCK).
+ */
+ cond = PRV_NextPDUType(association, DUL_NOBLOCK, PRV_DEFAULTTIMEOUT, &pduType);
if (cond == DUL_NETWORKCLOSED)
event = TRANS_CONN_CLOSED;
@@ -1770,7 +1773,7 @@
// send number of socket handle in child process over anonymous pipe
DWORD bytesWritten;
char buf[20];
- sprintf(buf, "%i", OFreinterpret_cast(int, childSocketHandle));
+ sprintf(buf, "%i", OFstatic_cast(int, OFreinterpret_cast(size_t, childSocketHandle)));
if (!WriteFile(hChildStdInWriteDup, buf, strlen(buf) + 1, &bytesWritten, NULL))
{
CloseHandle(hChildStdInWriteDup);
@@ -1780,7 +1783,7 @@
// return OF_ok status code DULC_FORKEDCHILD with descriptive text
OFOStringStream stream;
stream << "New child process started with pid " << OFstatic_cast(int, pi.dwProcessId)
- << ", socketHandle " << OFreinterpret_cast(int, childSocketHandle) << OFStringStream_ends;
+ << ", socketHandle " << OFstatic_cast(int, OFreinterpret_cast(size_t, childSocketHandle)) << OFStringStream_ends;
OFSTRINGSTREAM_GETOFSTRING(stream, msg)
return makeDcmnetCondition(DULC_FORKEDCHILD, OF_ok, msg.c_str());
}
@@ -1840,7 +1843,7 @@
}
#endif
#endif
- setTCPBufferLength(sock);
+ //setTCPBufferLength(sock);
#ifndef DONT_DISABLE_NAGLE_ALGORITHM
/*
diff -urEb dcmtk-3.6.0.orig/dcmnet/libsrc/dulfsm.cc dcmtk-3.6.0/dcmnet/libsrc/dulfsm.cc
--- dcmtk-3.6.0.orig/dcmnet/libsrc/dulfsm.cc 2017-03-17 15:49:23.043061969 +0100
+++ dcmtk-3.6.0/dcmnet/libsrc/dulfsm.cc 2017-03-17 15:49:48.467144792 +0100
@@ -2417,7 +2417,7 @@
return makeDcmnetCondition(DULC_TCPINITERROR, OF_error, msg.c_str());
}
#endif
- setTCPBufferLength(s);
+ //setTCPBufferLength(s);
#ifndef DONT_DISABLE_NAGLE_ALGORITHM
/*

View File

@ -0,0 +1,12 @@
diff -urEb dcmtk-3.6.2.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.2/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-3.6.2.orig/ofstd/include/dcmtk/ofstd/offile.h 2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-3.6.2/ofstd/include/dcmtk/ofstd/offile.h 2018-01-02 13:56:04.075293459 +0100
@@ -551,7 +551,7 @@
*/
void setlinebuf()
{
-#if defined(_WIN32) || defined(__hpux)
+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
this->setvbuf(NULL, _IOLBF, 0);
#else
:: setlinebuf(file_);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
diff -urEb dcmtk-3.6.2.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.2/CMake/GenerateDCMTKConfigure.cmake
--- dcmtk-3.6.2.orig/CMake/GenerateDCMTKConfigure.cmake 2020-01-06 17:42:52.299540389 +0100
+++ dcmtk-3.6.2/CMake/GenerateDCMTKConfigure.cmake 2020-01-06 17:43:56.707520036 +0100
@@ -568,12 +568,12 @@
ENDIF(HAVE_CSTDDEF)
CHECK_FUNCTIONWITHHEADER_EXISTS(feenableexcept "${HEADERS}" HAVE_PROTOTYPE_FEENABLEEXCEPT)
- CHECK_FUNCTIONWITHHEADER_EXISTS(isinf "${HEADERS}" HAVE_PROTOTYPE_ISINF)
- CHECK_FUNCTIONWITHHEADER_EXISTS(isnan "${HEADERS}" HAVE_PROTOTYPE_ISNAN)
- CHECK_FUNCTIONWITHHEADER_EXISTS(finite "${HEADERS}" HAVE_PROTOTYPE_FINITE)
- CHECK_FUNCTIONWITHHEADER_EXISTS(std::isinf "${HEADERS}" HAVE_PROTOTYPE_STD__ISINF)
- CHECK_FUNCTIONWITHHEADER_EXISTS(std::isnan "${HEADERS}" HAVE_PROTOTYPE_STD__ISNAN)
- CHECK_FUNCTIONWITHHEADER_EXISTS(std::finite "${HEADERS}" HAVE_PROTOTYPE_STD__FINITE)
+ CHECK_FUNCTIONWITHHEADER_EXISTS("isinf(0.)" "${HEADERS}" HAVE_PROTOTYPE_ISINF)
+ CHECK_FUNCTIONWITHHEADER_EXISTS("isnan(0.)" "${HEADERS}" HAVE_PROTOTYPE_ISNAN)
+ CHECK_FUNCTIONWITHHEADER_EXISTS("finite(0.)" "${HEADERS}" HAVE_PROTOTYPE_FINITE)
+ CHECK_FUNCTIONWITHHEADER_EXISTS("std::isinf(0.)" "${HEADERS}" HAVE_PROTOTYPE_STD__ISINF)
+ CHECK_FUNCTIONWITHHEADER_EXISTS("std::isnan(0.)" "${HEADERS}" HAVE_PROTOTYPE_STD__ISNAN)
+ CHECK_FUNCTIONWITHHEADER_EXISTS("std::finite(0.)" "${HEADERS}" HAVE_PROTOTYPE_STD__FINITE)
CHECK_FUNCTIONWITHHEADER_EXISTS(flock "${HEADERS}" HAVE_PROTOTYPE_FLOCK)
CHECK_FUNCTIONWITHHEADER_EXISTS(gethostbyname "${HEADERS}" HAVE_PROTOTYPE_GETHOSTBYNAME)
CHECK_FUNCTIONWITHHEADER_EXISTS(gethostbyname_r "${HEADERS}" HAVE_PROTOTYPE_GETHOSTBYNAME_R)
diff -urEb dcmtk-3.6.2.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.2/dcmdata/include/dcmtk/dcmdata/dcdict.h
--- dcmtk-3.6.2.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-01-06 17:42:52.283540394 +0100
+++ dcmtk-3.6.2/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-01-06 17:46:21.711473976 +0100
@@ -152,6 +152,12 @@
/// returns an iterator to the end of the repeating tag dictionary
DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
+ // Function by the Orthanc project to load a dictionary from a
+ // memory buffer, which is necessary in sandboxed
+ // environments. This is an adapted version of
+ // DcmDataDictionary::loadDictionary().
+ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
+
private:
/** private undefined assignment operator
diff -urEb dcmtk-3.6.2.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.2/dcmdata/libsrc/dcdict.cc
--- dcmtk-3.6.2.orig/dcmdata/libsrc/dcdict.cc 2020-01-06 17:42:52.287540392 +0100
+++ dcmtk-3.6.2/dcmdata/libsrc/dcdict.cc 2020-01-06 17:47:18.335299472 +0100
@@ -876,3 +876,6 @@
wrlock().clear();
unlock();
}
+
+
+#include "dcdict_orthanc.cc"

View File

@ -0,0 +1,99 @@
diff -urEb dcmtk-3.6.4.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.4/dcmdata/include/dcmtk/dcmdata/dcdict.h
--- dcmtk-3.6.4.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-01-06 19:55:12.887153062 +0100
+++ dcmtk-3.6.4/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-01-06 19:55:28.156447233 +0100
@@ -152,6 +152,12 @@
/// returns an iterator to the end of the repeating tag dictionary
DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
+ // Function by the Orthanc project to load a dictionary from a
+ // memory buffer, which is necessary in sandboxed
+ // environments. This is an adapted version of
+ // DcmDataDictionary::loadDictionary().
+ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
+
private:
/** private undefined assignment operator
diff -urEb dcmtk-3.6.4.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.4/dcmdata/libsrc/dcdict.cc
--- dcmtk-3.6.4.orig/dcmdata/libsrc/dcdict.cc 2020-01-06 19:55:12.899154075 +0100
+++ dcmtk-3.6.4/dcmdata/libsrc/dcdict.cc 2020-01-06 19:55:28.156447233 +0100
@@ -899,3 +899,6 @@
wrlock().clear();
wrunlock();
}
+
+
+#include "dcdict_orthanc.cc"
diff -urEb dcmtk-3.6.4.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.4/dcmdata/libsrc/dcpxitem.cc
--- dcmtk-3.6.4.orig/dcmdata/libsrc/dcpxitem.cc 2020-01-06 19:55:12.899154075 +0100
+++ dcmtk-3.6.4/dcmdata/libsrc/dcpxitem.cc 2020-01-06 19:55:28.156447233 +0100
@@ -36,6 +36,9 @@
#include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */
#include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */
+#undef max
+#include "dcmtk/ofstd/oflimits.h"
+
// ********************************
diff -urEb dcmtk-3.6.4.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.4/oflog/include/dcmtk/oflog/thread/syncpub.h
--- dcmtk-3.6.4.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-01-06 19:55:12.911155088 +0100
+++ dcmtk-3.6.4/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-01-06 19:56:26.991372656 +0100
@@ -63,7 +63,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Mutex::Mutex (Mutex::Type t)
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)) + 0)
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)))
{ }
@@ -106,7 +106,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max),
unsigned DCMTK_LOG4CPLUS_THREADED (initial))
- : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)) + 0)
+ : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)))
{ }
@@ -148,7 +148,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
FairMutex::FairMutex ()
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex) + 0)
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex))
{ }
@@ -190,7 +190,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig))
- : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)) + 0)
+ : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)))
{ }
@@ -252,7 +252,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
SharedMutex::SharedMutex ()
- : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex) + 0)
+ : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex))
{ }
diff -urEb dcmtk-3.6.4.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.4/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-3.6.4.orig/ofstd/include/dcmtk/ofstd/offile.h 2020-01-06 19:55:12.951158464 +0100
+++ dcmtk-3.6.4/ofstd/include/dcmtk/ofstd/offile.h 2020-01-06 19:55:28.156447233 +0100
@@ -575,7 +575,7 @@
*/
void setlinebuf()
{
-#if defined(_WIN32) || defined(__hpux)
+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
this->setvbuf(NULL, _IOLBF, 0);
#else
:: setlinebuf(file_);

View File

@ -0,0 +1,152 @@
diff -urEb dcmtk-3.6.5.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.5/CMake/GenerateDCMTKConfigure.cmake
--- dcmtk-3.6.5.orig/CMake/GenerateDCMTKConfigure.cmake 2020-11-04 18:27:08.984662119 +0100
+++ dcmtk-3.6.5/CMake/GenerateDCMTKConfigure.cmake 2020-11-04 18:27:48.232609773 +0100
@@ -169,6 +169,8 @@
endif()
# Check the sizes of various types
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ # This doesn't work for wasm, Orthanc defines the macros manually
include (CheckTypeSize)
CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
@@ -177,6 +179,7 @@
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P)
+endif()
# Check for include files, libraries, and functions
include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake")
diff -urEb dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h
--- dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-11-04 18:27:08.972662135 +0100
+++ dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-11-04 18:27:48.232609773 +0100
@@ -152,6 +152,12 @@
/// returns an iterator to the end of the repeating tag dictionary
DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
+ // Function by the Orthanc project to load a dictionary from a
+ // memory buffer, which is necessary in sandboxed
+ // environments. This is an adapted version of
+ // DcmDataDictionary::loadDictionary().
+ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
+
private:
/** private undefined assignment operator
diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc
--- dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc 2020-11-04 18:27:08.976662131 +0100
+++ dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc 2020-11-04 18:27:48.232609773 +0100
@@ -900,3 +900,6 @@
wrlock().clear();
wrunlock();
}
+
+
+#include "dcdict_orthanc.cc"
diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc
--- dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc 2020-11-04 18:27:08.976662131 +0100
+++ dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc 2020-11-04 18:27:48.232609773 +0100
@@ -36,6 +36,9 @@
#include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */
#include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */
+#undef max
+#include "dcmtk/ofstd/oflimits.h"
+
// ********************************
diff -urEb dcmtk-3.6.5.orig/dcmnet/libsrc/dulparse.cc dcmtk-3.6.5/dcmnet/libsrc/dulparse.cc
--- dcmtk-3.6.5.orig/dcmnet/libsrc/dulparse.cc 2020-11-04 18:27:09.004662093 +0100
+++ dcmtk-3.6.5/dcmnet/libsrc/dulparse.cc 2020-11-04 18:29:41.832458294 +0100
@@ -736,7 +736,14 @@
<< " is larger than maximum allowed UID length " << DICOM_UI_LENGTH << " (will use 64 bytes max)");
UIDLength = DICOM_UI_LENGTH;
}
- OFStandard::strlcpy(role->SOPClassUID, (char*)buf, UIDLength+1 /* +1 for 0-byte */);
+
+ // Patch from: https://github.com/DCMTK/dcmtk/commit/10428a74e74c003b3ff31c992f658d528b626fab
+ // The UID in the source buffer is not necessarily null terminated. Copy with memcpy
+ // and add a zero byte. We have already checked that there is enough data available
+ // in the source source buffer and enough space in the target buffer.
+ (void) memcpy(role->SOPClassUID, buf, UIDLength);
+ role->SOPClassUID[UIDLength] = '\0';
+
buf += UIDLength;
role->SCURole = *buf++;
role->SCPRole = *buf++;
diff -urEb dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h
--- dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-11-04 18:27:08.980662125 +0100
+++ dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-11-04 18:27:48.232609773 +0100
@@ -63,7 +63,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Mutex::Mutex (Mutex::Type t)
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)) + 0)
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)))
{ }
@@ -106,7 +106,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max),
unsigned DCMTK_LOG4CPLUS_THREADED (initial))
- : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)) + 0)
+ : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)))
{ }
@@ -148,7 +148,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
FairMutex::FairMutex ()
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex) + 0)
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex))
{ }
@@ -190,7 +190,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig))
- : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)) + 0)
+ : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)))
{ }
@@ -252,7 +252,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
SharedMutex::SharedMutex ()
- : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex) + 0)
+ : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex))
{ }
diff -urEb dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc dcmtk-3.6.5/oflog/libsrc/oflog.cc
--- dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc 2020-11-04 18:27:08.984662119 +0100
+++ dcmtk-3.6.5/oflog/libsrc/oflog.cc 2020-11-04 18:27:48.232609773 +0100
@@ -19,6 +19,10 @@
*
*/
+#if defined(_WIN32)
+# include <winsock2.h>
+#endif
+
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/oflog/oflog.h"
diff -urEb dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h 2020-11-04 18:27:09.008662088 +0100
+++ dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h 2020-11-04 18:27:48.232609773 +0100
@@ -575,7 +575,7 @@
*/
void setlinebuf()
{
-#if defined(_WIN32) || defined(__hpux)
+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
this->setvbuf(NULL, _IOLBF, 0);
#else
:: setlinebuf(file_);

View File

@ -0,0 +1,183 @@
diff -urEb dcmtk-3.6.6.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.6/CMake/GenerateDCMTKConfigure.cmake
--- dcmtk-3.6.6.orig/CMake/GenerateDCMTKConfigure.cmake 2021-01-26 08:51:48.815071681 +0100
+++ dcmtk-3.6.6/CMake/GenerateDCMTKConfigure.cmake 2021-01-26 08:52:06.331135995 +0100
@@ -169,6 +169,8 @@
endif()
# Check the sizes of various types
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ # This doesn't work for wasm, Orthanc defines the macros manually
include (CheckTypeSize)
CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
@@ -177,6 +179,7 @@
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P)
+endif()
# Check for include files, libraries, and functions
include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake")
diff -urEb dcmtk-3.6.6.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.6/dcmdata/include/dcmtk/dcmdata/dcdict.h
--- dcmtk-3.6.6.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2021-01-26 08:51:48.859071844 +0100
+++ dcmtk-3.6.6/dcmdata/include/dcmtk/dcmdata/dcdict.h 2021-01-26 08:52:06.331135995 +0100
@@ -152,6 +152,12 @@
/// returns an iterator to the end of the repeating tag dictionary
DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
+ // Function by the Orthanc project to load a dictionary from a
+ // memory buffer, which is necessary in sandboxed
+ // environments. This is an adapted version of
+ // DcmDataDictionary::loadDictionary().
+ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
+
private:
/** private undefined assignment operator
diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcdicdir.cc dcmtk-3.6.6/dcmdata/libsrc/dcdicdir.cc
--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcdicdir.cc 2021-01-26 08:51:48.863071859 +0100
+++ dcmtk-3.6.6/dcmdata/libsrc/dcdicdir.cc 2021-01-26 08:56:03.519887982 +0100
@@ -1032,7 +1032,14 @@
// insert Media Stored SOP Class UID
insertMediaSOPUID(metainfo);
- getDirFileFormat().validateMetaInfo(outxfer);
+ /**
+ * Patch for Orthanc: In DCMTK 3.6.6, the default value for the
+ * second argument changed from "EWM_fileformat" to
+ * "EWM_createNewMeta". This sets "MediaStorageSOPClassUID"
+ * (0002,0002) in meta-header to "1.2.276.0.7230010.3.1.0.1"
+ * instead of expected "1.2.840.10008.1.3.10".
+ **/
+ getDirFileFormat().validateMetaInfo(outxfer, EWM_fileformat);
{
// it is important that the cache object is destroyed before the file is renamed!
diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.6/dcmdata/libsrc/dcdict.cc
--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcdict.cc 2021-01-26 08:51:48.863071859 +0100
+++ dcmtk-3.6.6/dcmdata/libsrc/dcdict.cc 2021-01-26 08:52:06.331135995 +0100
@@ -900,3 +900,6 @@
wrlock().clear();
wrunlock();
}
+
+
+#include "dcdict_orthanc.cc"
diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.6/dcmdata/libsrc/dcpxitem.cc
--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcpxitem.cc 2021-01-26 08:51:48.863071859 +0100
+++ dcmtk-3.6.6/dcmdata/libsrc/dcpxitem.cc 2021-01-26 08:52:06.335136010 +0100
@@ -36,6 +36,9 @@
#include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */
#include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */
+#undef max
+#include "dcmtk/ofstd/oflimits.h"
+
// ********************************
diff -urEb dcmtk-3.6.6.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.6/oflog/include/dcmtk/oflog/thread/syncpub.h
--- dcmtk-3.6.6.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2021-01-26 08:51:48.847071800 +0100
+++ dcmtk-3.6.6/oflog/include/dcmtk/oflog/thread/syncpub.h 2021-01-26 08:52:06.335136010 +0100
@@ -63,7 +63,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Mutex::Mutex (Mutex::Type t)
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)) + 0)
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)))
{ }
@@ -106,7 +106,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max),
unsigned DCMTK_LOG4CPLUS_THREADED (initial))
- : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)) + 0)
+ : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)))
{ }
@@ -148,7 +148,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
FairMutex::FairMutex ()
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex) + 0)
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex))
{ }
@@ -190,7 +190,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig))
- : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)) + 0)
+ : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)))
{ }
@@ -252,7 +252,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
SharedMutex::SharedMutex ()
- : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex) + 0)
+ : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex))
{ }
diff -urEb dcmtk-3.6.6.orig/oflog/libsrc/oflog.cc dcmtk-3.6.6/oflog/libsrc/oflog.cc
--- dcmtk-3.6.6.orig/oflog/libsrc/oflog.cc 2021-01-26 08:51:48.847071800 +0100
+++ dcmtk-3.6.6/oflog/libsrc/oflog.cc 2021-01-26 08:52:06.335136010 +0100
@@ -19,6 +19,10 @@
*
*/
+#if defined(_WIN32)
+# include <winsock2.h>
+#endif
+
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/oflog/oflog.h"
diff -urEb dcmtk-3.6.6.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.6/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-3.6.6.orig/ofstd/include/dcmtk/ofstd/offile.h 2021-01-26 08:51:48.863071859 +0100
+++ dcmtk-3.6.6/ofstd/include/dcmtk/ofstd/offile.h 2021-01-26 08:52:06.335136010 +0100
@@ -586,7 +586,7 @@
*/
void setlinebuf()
{
-#if defined(_WIN32) || defined(__hpux)
+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
this->setvbuf(NULL, _IOLBF, 0);
#else
:: setlinebuf(file_);
diff -urEb dcmtk-3.6.6.orig/config/tests/arith.cc dcmtk-3.6.6/config/tests/arith.cc
--- dcmtk-3.6.6.orig/config/tests/arith.cc 2022-03-28 19:17:03.000000000 +0000
+++ dcmtk-3.6.6/config/tests/arith.cc 2022-03-28 19:18:12.000000000 +0000
@@ -40,7 +40,7 @@
#include <ieeefp.h>
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(__aarch64__)
// For controlling floating point exceptions on OS X.
#include <xmmintrin.h>
#endif
@@ -340,7 +340,7 @@
#ifdef HAVE_WINDOWS_H
_clearfp();
_controlfp( _controlfp(0,0) & ~_EM_INVALID, _MCW_EM );
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) && !defined(__aarch64__)
_MM_SET_EXCEPTION_MASK( _MM_GET_EXCEPTION_MASK() & ~_MM_MASK_INVALID );
#elif defined(HAVE_FENV_H) && defined(HAVE_PROTOTYPE_FEENABLEEXCEPT)
feenableexcept( FE_INVALID );
@@ -382,7 +382,7 @@
_controlfp( _controlfp(0,0) | _EM_INVALID, _MCW_EM );
#elif defined(HAVE_FENV_H)
feclearexcept( FE_INVALID );
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(__aarch64__)
_MM_SET_EXCEPTION_MASK( _MM_GET_EXCEPTION_MASK() | _MM_MASK_INVALID );
#elif defined(HAVE_FENV_H) && defined(HAVE_PROTOTYPE_FEENABLEEXCEPT)
fedisableexcept( FE_INVALID );

View File

@ -0,0 +1,821 @@
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jccoefct.c dcmtk-3.6.7/dcmjpeg/libijg12/jccoefct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jccoefct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jccoefct.c 2022-08-16 12:21:34.000000000 +0200
@@ -343,7 +343,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jcdiffct.c dcmtk-3.6.7/dcmjpeg/libijg12/jcdiffct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jcdiffct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jcdiffct.c 2022-08-16 12:21:20.000000000 +0200
@@ -302,7 +302,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private;
/* JDIMENSION MCU_col_num; */ /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jcpred.c dcmtk-3.6.7/dcmjpeg/libijg12/jcpred.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jcpred.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jcpred.c 2022-08-16 12:21:04.000000000 +0200
@@ -213,7 +213,7 @@
const JSAMPROW input_buf, JSAMPROW prev_row,
JDIFFROW diff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
DIFFERENCE_1D(INITIAL_PREDICTORx);
/*
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jctrans.c dcmtk-3.6.7/dcmjpeg/libijg12/jctrans.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jctrans.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jctrans.c 2022-08-16 12:20:36.000000000 +0200
@@ -267,7 +267,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdmerge.c dcmtk-3.6.7/dcmjpeg/libijg12/jdmerge.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdmerge.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jdmerge.c 2022-08-16 12:20:14.000000000 +0200
@@ -148,7 +148,7 @@
JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
- (void) in_row_groups_avail;
+ //(void) in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
JSAMPROW work_ptrs[2];
JDIMENSION num_rows; /* number of rows returned to caller */
@@ -198,8 +198,8 @@
JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */
{
- (void) in_row_groups_avail;
- (void) out_rows_avail;
+ //(void) in_row_groups_avail;
+ //(void) out_rows_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
/* Just do the upsampling. */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdpostct.c dcmtk-3.6.7/dcmjpeg/libijg12/jdpostct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdpostct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jdpostct.c 2022-08-16 12:19:54.000000000 +0200
@@ -161,8 +161,8 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) output_buf;
- (void) out_rows_avail;
+ //(void) output_buf;
+ //(void) out_rows_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION old_next_row, num_rows;
@@ -207,9 +207,9 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) input_buf;
- (void) in_row_group_ctr;
- (void) in_row_groups_avail;
+ //(void) input_buf;
+ //(void) in_row_group_ctr;
+ //(void) in_row_groups_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION num_rows, max_rows;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdpred.c dcmtk-3.6.7/dcmjpeg/libijg12/jdpred.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdpred.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jdpred.c 2022-08-16 12:19:22.000000000 +0200
@@ -101,8 +101,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
}
@@ -111,8 +111,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR2);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -123,8 +123,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR3);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -135,8 +135,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR4);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -147,8 +147,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR5);
JPEG_UNUSED(Rc);
@@ -160,8 +160,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR6);
JPEG_UNUSED(Rc);
@@ -173,8 +173,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR7);
JPEG_UNUSED(Rc);
@@ -195,7 +195,7 @@
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
UNDIFFERENCE_1D(INITIAL_PREDICTORx);
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdsample.c dcmtk-3.6.7/dcmjpeg/libijg12/jdsample.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdsample.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jdsample.c 2022-08-16 12:18:32.000000000 +0200
@@ -92,7 +92,7 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void)in_row_groups_avail;
+ //(void)in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int ci;
jpeg_component_info * compptr;
@@ -239,7 +239,7 @@
h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
@@ -268,7 +268,7 @@
h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdscale.c dcmtk-3.6.7/dcmjpeg/libijg12/jdscale.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jdscale.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jdscale.c 2022-08-16 12:18:02.000000000 +0200
@@ -67,7 +67,7 @@
const JDIFFROW diff_buf, JSAMPROW output_buf,
JDIMENSION width)
{
- (void)cinfo;
+ //(void)cinfo;
unsigned int xindex;
for (xindex = 0; xindex < width; xindex++)
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jquant1.c dcmtk-3.6.7/dcmjpeg/libijg12/jquant1.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jquant1.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jquant1.c 2022-08-16 12:17:44.000000000 +0200
@@ -744,7 +744,7 @@
METHODDEF(void)
start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
{
- (void) is_pre_scan;
+ //(void) is_pre_scan;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
size_t arraysize;
int i;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg12/jquant2.c dcmtk-3.6.7/dcmjpeg/libijg12/jquant2.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg12/jquant2.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg12/jquant2.c 2022-08-16 12:17:30.000000000 +0200
@@ -224,7 +224,7 @@
prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows)
{
- (void) output_buf;
+ //(void) output_buf;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
register JSAMPROW ptr;
register histptr histp;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jccoefct.c dcmtk-3.6.7/dcmjpeg/libijg16/jccoefct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jccoefct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jccoefct.c 2022-08-16 12:17:02.000000000 +0200
@@ -343,7 +343,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jcdiffct.c dcmtk-3.6.7/dcmjpeg/libijg16/jcdiffct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jcdiffct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jcdiffct.c 2022-08-16 12:14:16.000000000 +0200
@@ -302,7 +302,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private;
/* JDIMENSION MCU_col_num; */ /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jcpred.c dcmtk-3.6.7/dcmjpeg/libijg16/jcpred.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jcpred.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jcpred.c 2022-08-16 12:14:00.000000000 +0200
@@ -213,7 +213,7 @@
const JSAMPROW input_buf, JSAMPROW prev_row,
JDIFFROW diff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
DIFFERENCE_1D(INITIAL_PREDICTORx);
/*
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jctrans.c dcmtk-3.6.7/dcmjpeg/libijg16/jctrans.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jctrans.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jctrans.c 2022-08-16 12:13:42.000000000 +0200
@@ -267,7 +267,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdmerge.c dcmtk-3.6.7/dcmjpeg/libijg16/jdmerge.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdmerge.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jdmerge.c 2022-08-16 12:13:18.000000000 +0200
@@ -171,7 +171,7 @@
JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
- (void) in_row_groups_avail;
+ //(void) in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
JSAMPROW work_ptrs[2];
JDIMENSION num_rows; /* number of rows returned to caller */
@@ -221,8 +221,8 @@
JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */
{
- (void) in_row_groups_avail;
- (void) out_rows_avail;
+ //(void) in_row_groups_avail;
+ //(void) out_rows_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
/* Just do the upsampling. */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdpostct.c dcmtk-3.6.7/dcmjpeg/libijg16/jdpostct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdpostct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jdpostct.c 2022-08-16 12:12:54.000000000 +0200
@@ -161,8 +161,8 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) output_buf;
- (void) out_rows_avail;
+ //(void) output_buf;
+ //(void) out_rows_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION old_next_row, num_rows;
@@ -207,9 +207,9 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) input_buf;
- (void) in_row_group_ctr;
- (void) in_row_groups_avail;
+ //(void) input_buf;
+ //(void) in_row_group_ctr;
+ //(void) in_row_groups_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION num_rows, max_rows;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdpred.c dcmtk-3.6.7/dcmjpeg/libijg16/jdpred.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdpred.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jdpred.c 2022-08-16 12:12:26.000000000 +0200
@@ -101,8 +101,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
}
@@ -111,8 +111,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR2);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -123,8 +123,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR3);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -135,8 +135,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR4A);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -147,8 +147,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR4);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -159,8 +159,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR5);
JPEG_UNUSED(Rc);
@@ -172,8 +172,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR5A);
JPEG_UNUSED(Rc);
@@ -185,8 +185,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR6);
JPEG_UNUSED(Rc);
@@ -198,8 +198,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR6A);
JPEG_UNUSED(Rc);
@@ -211,8 +211,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR7);
JPEG_UNUSED(Rc);
@@ -224,8 +224,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR7A);
JPEG_UNUSED(Rc);
@@ -245,7 +245,7 @@
const JDIFFROW diff_buf, JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
UNDIFFERENCE_1D(INITIAL_PREDICTORx);
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdsample.c dcmtk-3.6.7/dcmjpeg/libijg16/jdsample.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdsample.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jdsample.c 2022-08-16 12:10:32.000000000 +0200
@@ -92,7 +92,7 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void)in_row_groups_avail;
+ //(void)in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int ci;
jpeg_component_info * compptr;
@@ -239,7 +239,7 @@
h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
@@ -268,7 +268,7 @@
h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdscale.c dcmtk-3.6.7/dcmjpeg/libijg16/jdscale.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jdscale.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jdscale.c 2022-08-16 12:04:18.000000000 +0200
@@ -67,8 +67,8 @@
const JDIFFROW diff_buf, JSAMPROW output_buf,
JDIMENSION width)
{
- (void)cinfo;
unsigned int xindex;
+ (void)cinfo;
for (xindex = 0; xindex < width; xindex++)
output_buf[xindex] = (JSAMPLE) diff_buf[xindex];
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jquant1.c dcmtk-3.6.7/dcmjpeg/libijg16/jquant1.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jquant1.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jquant1.c 2022-08-16 12:03:56.000000000 +0200
@@ -744,10 +744,10 @@
METHODDEF(void)
start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
{
- (void) is_pre_scan;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
size_t arraysize;
int i;
+ (void) is_pre_scan;
/* Install my colormap. */
cinfo->colormap = cquantize->sv_colormap;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg16/jquant2.c dcmtk-3.6.7/dcmjpeg/libijg16/jquant2.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg16/jquant2.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg16/jquant2.c 2022-08-16 12:03:14.000000000 +0200
@@ -224,7 +224,6 @@
prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows)
{
- (void) output_buf;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
register JSAMPROW ptr;
register histptr histp;
@@ -232,6 +231,7 @@
int row;
JDIMENSION col;
JDIMENSION width = cinfo->output_width;
+ (void) output_buf;
for (row = 0; row < num_rows; row++) {
ptr = input_buf[row];
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jccoefct.c dcmtk-3.6.7/dcmjpeg/libijg8/jccoefct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jccoefct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jccoefct.c 2022-08-16 12:27:04.000000000 +0200
@@ -343,7 +343,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jcdiffct.c dcmtk-3.6.7/dcmjpeg/libijg8/jcdiffct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jcdiffct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jcdiffct.c 2022-08-16 12:26:48.000000000 +0200
@@ -302,7 +302,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private;
/* JDIMENSION MCU_col_num; */ /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jcpred.c dcmtk-3.6.7/dcmjpeg/libijg8/jcpred.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jcpred.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jcpred.c 2022-08-16 12:26:32.000000000 +0200
@@ -213,7 +213,7 @@
const JSAMPROW input_buf, JSAMPROW prev_row,
JDIFFROW diff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
DIFFERENCE_1D(INITIAL_PREDICTORx);
/*
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jctrans.c dcmtk-3.6.7/dcmjpeg/libijg8/jctrans.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jctrans.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jctrans.c 2022-08-16 12:25:56.000000000 +0200
@@ -267,7 +267,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdmerge.c dcmtk-3.6.7/dcmjpeg/libijg8/jdmerge.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdmerge.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jdmerge.c 2022-08-16 12:25:36.000000000 +0200
@@ -148,7 +148,7 @@
JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
- (void) in_row_groups_avail;
+ //(void) in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
JSAMPROW work_ptrs[2];
JDIMENSION num_rows; /* number of rows returned to caller */
@@ -198,8 +198,8 @@
JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */
{
- (void) in_row_groups_avail;
- (void) out_rows_avail;
+ //(void) in_row_groups_avail;
+ //(void) out_rows_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
/* Just do the upsampling. */
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdpostct.c dcmtk-3.6.7/dcmjpeg/libijg8/jdpostct.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdpostct.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jdpostct.c 2022-08-16 12:25:12.000000000 +0200
@@ -161,8 +161,8 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) output_buf;
- (void) out_rows_avail;
+ //(void) output_buf;
+ //(void) out_rows_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION old_next_row, num_rows;
@@ -207,9 +207,9 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) input_buf;
- (void) in_row_group_ctr;
- (void) in_row_groups_avail;
+ //(void) input_buf;
+ //(void) in_row_group_ctr;
+ //(void) in_row_groups_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION num_rows, max_rows;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdpred.c dcmtk-3.6.7/dcmjpeg/libijg8/jdpred.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdpred.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jdpred.c 2022-08-16 12:23:34.000000000 +0200
@@ -101,8 +101,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
}
@@ -111,8 +111,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR2);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -123,8 +123,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR3);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -135,8 +135,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR4);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -147,8 +147,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR5);
JPEG_UNUSED(Rc);
@@ -160,8 +160,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR6);
JPEG_UNUSED(Rc);
@@ -173,8 +173,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR7);
JPEG_UNUSED(Rc);
@@ -194,7 +194,7 @@
const JDIFFROW diff_buf, JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
UNDIFFERENCE_1D(INITIAL_PREDICTORx);
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdsample.c dcmtk-3.6.7/dcmjpeg/libijg8/jdsample.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdsample.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jdsample.c 2022-08-16 12:22:36.000000000 +0200
@@ -92,7 +92,7 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void)in_row_groups_avail;
+ //(void)in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int ci;
jpeg_component_info * compptr;
@@ -239,7 +239,7 @@
h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
@@ -268,7 +268,7 @@
h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdscale.c dcmtk-3.6.7/dcmjpeg/libijg8/jdscale.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jdscale.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jdscale.c 2022-08-16 12:22:06.000000000 +0200
@@ -67,7 +67,7 @@
const JDIFFROW diff_buf, JSAMPROW output_buf,
JDIMENSION width)
{
- (void)cinfo;
+ //(void)cinfo;
unsigned int xindex;
for (xindex = 0; xindex < width; xindex++)
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jquant1.c dcmtk-3.6.7/dcmjpeg/libijg8/jquant1.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jquant1.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jquant1.c 2022-08-16 12:21:50.000000000 +0200
@@ -744,7 +744,7 @@
METHODDEF(void)
start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
{
- (void) is_pre_scan;
+ //(void) is_pre_scan;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
size_t arraysize;
int i;
diff -urEb dcmtk-3.6.7.orig/dcmjpeg/libijg8/jquant2.c dcmtk-3.6.7/dcmjpeg/libijg8/jquant2.c
--- dcmtk-3.6.7.orig/dcmjpeg/libijg8/jquant2.c 2022-04-28 15:47:25.000000000 +0200
+++ dcmtk-3.6.7/dcmjpeg/libijg8/jquant2.c 2022-08-16 12:03:36.000000000 +0200
@@ -224,7 +224,6 @@
prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows)
{
- (void) output_buf;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
register JSAMPROW ptr;
register histptr histp;
@@ -232,6 +231,7 @@
int row;
JDIMENSION col;
JDIMENSION width = cinfo->output_width;
+ (void) output_buf;
for (row = 0; row < num_rows; row++) {
ptr = input_buf[row];

View File

@ -0,0 +1,123 @@
diff -urEb dcmtk-3.6.7.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.7/CMake/GenerateDCMTKConfigure.cmake
--- dcmtk-3.6.7.orig/CMake/GenerateDCMTKConfigure.cmake 2022-08-15 14:28:32.373922631 +0200
+++ dcmtk-3.6.7/CMake/GenerateDCMTKConfigure.cmake 2022-08-15 14:29:43.341136298 +0200
@@ -183,6 +183,8 @@
# Check the sizes of various types
include (CheckTypeSize)
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ # This doesn't work for wasm, Orthanc defines the macros manually
CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
CHECK_TYPE_SIZE("float" SIZEOF_FLOAT)
@@ -190,6 +192,7 @@
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P)
+endif()
# Check for include files, libraries, and functions
include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake")
diff -urEb dcmtk-3.6.7.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.7/dcmdata/include/dcmtk/dcmdata/dcdict.h
--- dcmtk-3.6.7.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2022-08-15 14:28:32.421922100 +0200
+++ dcmtk-3.6.7/dcmdata/include/dcmtk/dcmdata/dcdict.h 2022-08-15 14:30:16.224771418 +0200
@@ -162,6 +162,12 @@
/// returns an iterator to the end of the repeating tag dictionary
DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
+ // Function by the Orthanc project to load a dictionary from a
+ // memory buffer, which is necessary in sandboxed
+ // environments. This is an adapted version of
+ // DcmDataDictionary::loadDictionary().
+ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
+
private:
/** private undefined assignment operator
diff -urEb dcmtk-3.6.7.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.7/dcmdata/libsrc/dcdict.cc
--- dcmtk-3.6.7.orig/dcmdata/libsrc/dcdict.cc 2022-08-15 14:28:32.421922100 +0200
+++ dcmtk-3.6.7/dcmdata/libsrc/dcdict.cc 2022-08-15 14:31:15.220116058 +0200
@@ -892,3 +892,5 @@
wrlock().clear();
wrunlock();
}
+
+#include "dcdict_orthanc.cc"
diff -urEb dcmtk-3.6.7.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.7/dcmdata/libsrc/dcpxitem.cc
--- dcmtk-3.6.7.orig/dcmdata/libsrc/dcpxitem.cc 2022-08-15 14:28:32.425922056 +0200
+++ dcmtk-3.6.7/dcmdata/libsrc/dcpxitem.cc 2022-08-15 14:31:28.887964099 +0200
@@ -31,6 +31,9 @@
#include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */
#include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */
+#undef max
+#include "dcmtk/ofstd/oflimits.h"
+
// ********************************
diff -urEb dcmtk-3.6.7.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.7/oflog/include/dcmtk/oflog/thread/syncpub.h
--- dcmtk-3.6.7.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2022-08-15 14:28:32.401922322 +0200
+++ dcmtk-3.6.7/oflog/include/dcmtk/oflog/thread/syncpub.h 2022-08-15 14:31:52.415702413 +0200
@@ -63,7 +63,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Mutex::Mutex (Mutex::Type t)
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t) + 0))
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)))
{ }
@@ -106,7 +106,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max),
unsigned DCMTK_LOG4CPLUS_THREADED (initial))
- : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial) + 0))
+ : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)))
{ }
@@ -190,7 +190,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig))
- : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig) + 0))
+ : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)))
{ }
@@ -252,7 +252,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
SharedMutex::SharedMutex ()
- : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex + 0))
+ : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex))
{ }
diff -urEb dcmtk-3.6.7.orig/oflog/libsrc/oflog.cc dcmtk-3.6.7/oflog/libsrc/oflog.cc
--- dcmtk-3.6.7.orig/oflog/libsrc/oflog.cc 2022-08-15 14:28:32.405922278 +0200
+++ dcmtk-3.6.7/oflog/libsrc/oflog.cc 2022-08-15 14:32:16.815430896 +0200
@@ -19,6 +19,10 @@
*
*/
+#if defined(_WIN32)
+# include <winsock2.h>
+#endif
+
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/oflog/oflog.h"
diff -urEb dcmtk-3.6.7.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.7/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-3.6.7.orig/ofstd/include/dcmtk/ofstd/offile.h 2022-08-15 14:28:32.425922056 +0200
+++ dcmtk-3.6.7/ofstd/include/dcmtk/ofstd/offile.h 2022-08-15 14:32:41.471156396 +0200
@@ -570,7 +570,7 @@
*/
void setlinebuf()
{
-#if defined(_WIN32) || defined(__hpux)
+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
this->setvbuf(NULL, _IOLBF, 0);
#else
:: setlinebuf(file_);

View File

@ -0,0 +1,995 @@
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jccoefct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jccoefct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jccoefct.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jccoefct.c 2024-01-09 17:48:28.974677157 +0100
@@ -343,7 +343,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jcdiffct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jcdiffct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jcdiffct.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jcdiffct.c 2024-01-09 17:48:36.414609533 +0100
@@ -302,7 +302,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private;
/* JDIMENSION MCU_col_num; */ /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jcpred.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jcpred.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jcpred.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jcpred.c 2024-01-09 17:48:49.766488124 +0100
@@ -213,7 +213,7 @@
const JSAMPROW input_buf, JSAMPROW prev_row,
JDIFFROW diff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
DIFFERENCE_1D(INITIAL_PREDICTORx);
/*
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jctrans.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jctrans.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jctrans.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jctrans.c 2024-01-09 17:49:00.070394388 +0100
@@ -267,7 +267,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdmerge.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdmerge.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdmerge.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdmerge.c 2024-01-09 17:49:11.910286634 +0100
@@ -148,7 +148,7 @@
JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
- (void) in_row_groups_avail;
+ //(void) in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
JSAMPROW work_ptrs[2];
JDIMENSION num_rows; /* number of rows returned to caller */
@@ -198,8 +198,8 @@
JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */
{
- (void) in_row_groups_avail;
- (void) out_rows_avail;
+ //(void) in_row_groups_avail;
+ //(void) out_rows_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
/* Just do the upsampling. */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdpostct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdpostct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdpostct.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdpostct.c 2024-01-09 17:49:24.910168268 +0100
@@ -161,8 +161,8 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) output_buf;
- (void) out_rows_avail;
+ //(void) output_buf;
+ //(void) out_rows_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION old_next_row, num_rows;
@@ -207,9 +207,9 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) input_buf;
- (void) in_row_group_ctr;
- (void) in_row_groups_avail;
+ //(void) input_buf;
+ //(void) in_row_group_ctr;
+ //(void) in_row_groups_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION num_rows, max_rows;
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdpred.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdpred.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdpred.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdpred.c 2024-01-09 17:50:00.513843814 +0100
@@ -101,8 +101,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
}
@@ -111,8 +111,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR2);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -123,8 +123,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR3);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -135,8 +135,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR4);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -147,8 +147,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR5);
JPEG_UNUSED(Rc);
@@ -160,8 +160,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR6);
JPEG_UNUSED(Rc);
@@ -173,8 +173,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR7);
JPEG_UNUSED(Rc);
@@ -195,7 +195,7 @@
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
UNDIFFERENCE_1D(INITIAL_PREDICTORx);
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdsample.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdsample.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdsample.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdsample.c 2024-01-09 17:50:36.545515066 +0100
@@ -92,7 +92,7 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void)in_row_groups_avail;
+ //(void)in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int ci;
jpeg_component_info * compptr;
@@ -158,8 +158,8 @@
fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)cinfo;
- (void)compptr;
+ //(void)cinfo;
+ //(void)compptr;
*output_data_ptr = input_data;
}
@@ -173,9 +173,9 @@
noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)cinfo;
- (void)compptr;
- (void)input_data;
+ //(void)cinfo;
+ //(void)compptr;
+ //(void)input_data;
*output_data_ptr = NULL; /* safety check */
}
@@ -239,7 +239,7 @@
h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
@@ -268,7 +268,7 @@
h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdscale.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdscale.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jdscale.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jdscale.c 2024-01-09 17:50:42.833457657 +0100
@@ -67,7 +67,7 @@
const JDIFFROW diff_buf, JSAMPROW output_buf,
JDIMENSION width)
{
- (void)cinfo;
+ //(void)cinfo;
unsigned int xindex;
for (xindex = 0; xindex < width; xindex++)
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jquant1.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jquant1.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jquant1.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jquant1.c 2024-01-09 17:51:03.049273013 +0100
@@ -251,8 +251,8 @@
* (Forcing the upper and lower values to the limits ensures that
* dithering can't produce a color outside the selected gamut.)
*/
- (void) cinfo;
- (void) ci;
+ //(void) cinfo;
+ //(void) ci;
return (int) (((IJG_INT32) j * MAXJSAMPLE + maxj/2) / maxj);
}
@@ -262,8 +262,8 @@
/* Return largest input value that should map to j'th output value */
/* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */
{
- (void) cinfo;
- (void) ci;
+ //(void) cinfo;
+ //(void) ci;
/* Breakpoints are halfway between values returned by output_value */
return (int) (((IJG_INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj));
}
@@ -744,7 +744,7 @@
METHODDEF(void)
start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
{
- (void) is_pre_scan;
+ //(void) is_pre_scan;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
size_t arraysize;
int i;
@@ -802,7 +802,7 @@
METHODDEF(void)
finish_pass_1_quant (j_decompress_ptr cinfo)
{
- (void) cinfo;
+ //(void) cinfo;
/* no work in 1-pass case */
}
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jquant2.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jquant2.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg12/jquant2.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg12/jquant2.c 2024-01-09 17:51:16.685148405 +0100
@@ -224,7 +224,7 @@
prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows)
{
- (void) output_buf;
+ //(void) output_buf;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
register JSAMPROW ptr;
register histptr histp;
@@ -1156,7 +1156,7 @@
METHODDEF(void)
finish_pass2 (j_decompress_ptr cinfo)
{
- (void) cinfo;
+ //(void) cinfo;
/* no work */
}
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jccoefct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jccoefct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jccoefct.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jccoefct.c 2024-01-09 17:51:24.997072424 +0100
@@ -343,7 +343,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jcdiffct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jcdiffct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jcdiffct.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jcdiffct.c 2024-01-09 17:51:31.549012520 +0100
@@ -302,7 +302,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private;
/* JDIMENSION MCU_col_num; */ /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jcpred.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jcpred.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jcpred.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jcpred.c 2024-01-09 17:51:40.740928459 +0100
@@ -213,7 +213,7 @@
const JSAMPROW input_buf, JSAMPROW prev_row,
JDIFFROW diff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
DIFFERENCE_1D(INITIAL_PREDICTORx);
/*
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jctrans.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jctrans.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jctrans.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jctrans.c 2024-01-09 17:51:49.244850672 +0100
@@ -267,7 +267,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdmerge.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdmerge.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdmerge.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdmerge.c 2024-01-09 17:51:59.852753613 +0100
@@ -171,7 +171,7 @@
JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
- (void) in_row_groups_avail;
+ //(void) in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
JSAMPROW work_ptrs[2];
JDIMENSION num_rows; /* number of rows returned to caller */
@@ -221,8 +221,8 @@
JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */
{
- (void) in_row_groups_avail;
- (void) out_rows_avail;
+ //(void) in_row_groups_avail;
+ //(void) out_rows_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
/* Just do the upsampling. */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdpostct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdpostct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdpostct.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdpostct.c 2024-01-09 17:52:12.796635145 +0100
@@ -161,8 +161,8 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) output_buf;
- (void) out_rows_avail;
+ //(void) output_buf;
+ //(void) out_rows_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION old_next_row, num_rows;
@@ -207,9 +207,9 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) input_buf;
- (void) in_row_group_ctr;
- (void) in_row_groups_avail;
+ //(void) input_buf;
+ //(void) in_row_group_ctr;
+ //(void) in_row_groups_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION num_rows, max_rows;
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdpred.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdpred.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdpred.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdpred.c 2024-01-09 17:53:08.884121363 +0100
@@ -101,8 +101,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
}
@@ -111,8 +111,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR2);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -123,8 +123,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR3);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -135,8 +135,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR4A);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -147,8 +147,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR4);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -159,8 +159,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR5);
JPEG_UNUSED(Rc);
@@ -172,8 +172,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR5A);
JPEG_UNUSED(Rc);
@@ -185,8 +185,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR6);
JPEG_UNUSED(Rc);
@@ -198,8 +198,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR6A);
JPEG_UNUSED(Rc);
@@ -211,8 +211,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR7);
JPEG_UNUSED(Rc);
@@ -224,8 +224,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR7A);
JPEG_UNUSED(Rc);
@@ -245,7 +245,7 @@
const JDIFFROW diff_buf, JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
UNDIFFERENCE_1D(INITIAL_PREDICTORx);
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdsample.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdsample.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdsample.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdsample.c 2024-01-09 17:53:28.779938946 +0100
@@ -92,7 +92,7 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void)in_row_groups_avail;
+ //(void)in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int ci;
jpeg_component_info * compptr;
@@ -158,8 +158,8 @@
fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)cinfo;
- (void)compptr;
+ //(void)cinfo;
+ //(void)compptr;
*output_data_ptr = input_data;
}
@@ -173,9 +173,9 @@
noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)cinfo;
- (void)compptr;
- (void)input_data;
+ //(void)cinfo;
+ //(void)compptr;
+ //(void)input_data;
*output_data_ptr = NULL; /* safety check */
}
@@ -239,7 +239,7 @@
h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
@@ -268,7 +268,7 @@
h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdscale.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdscale.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jdscale.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jdscale.c 2024-01-09 17:53:34.795883773 +0100
@@ -67,7 +67,7 @@
const JDIFFROW diff_buf, JSAMPROW output_buf,
JDIMENSION width)
{
- (void)cinfo;
+ //(void)cinfo;
unsigned int xindex;
for (xindex = 0; xindex < width; xindex++)
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jquant1.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jquant1.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jquant1.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jquant1.c 2024-01-09 17:53:53.891708593 +0100
@@ -251,8 +251,8 @@
* (Forcing the upper and lower values to the limits ensures that
* dithering can't produce a color outside the selected gamut.)
*/
- (void) cinfo;
- (void) ci;
+ //(void) cinfo;
+ //(void) ci;
return (int) (((IJG_INT32) j * MAXJSAMPLE + maxj/2) / maxj);
}
@@ -262,8 +262,8 @@
/* Return largest input value that should map to j'th output value */
/* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */
{
- (void) cinfo;
- (void) ci;
+ //(void) cinfo;
+ //(void) ci;
/* Breakpoints are halfway between values returned by output_value */
return (int) (((IJG_INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj));
}
@@ -744,7 +744,7 @@
METHODDEF(void)
start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
{
- (void) is_pre_scan;
+ //(void) is_pre_scan;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
size_t arraysize;
int i;
@@ -802,7 +802,7 @@
METHODDEF(void)
finish_pass_1_quant (j_decompress_ptr cinfo)
{
- (void) cinfo;
+ //(void) cinfo;
/* no work in 1-pass case */
}
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jquant2.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jquant2.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg16/jquant2.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg16/jquant2.c 2024-01-09 17:54:05.051606183 +0100
@@ -224,7 +224,7 @@
prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows)
{
- (void) output_buf;
+ //(void) output_buf;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
register JSAMPROW ptr;
register histptr histp;
@@ -1156,7 +1156,7 @@
METHODDEF(void)
finish_pass2 (j_decompress_ptr cinfo)
{
- (void) cinfo;
+ //(void) cinfo;
/* no work */
}
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jccoefct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jccoefct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jccoefct.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jccoefct.c 2024-01-09 17:54:11.635545753 +0100
@@ -343,7 +343,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jcdiffct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jcdiffct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jcdiffct.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jcdiffct.c 2024-01-09 17:54:16.815498204 +0100
@@ -302,7 +302,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private;
/* JDIMENSION MCU_col_num; */ /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jcpred.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jcpred.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jcpred.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jcpred.c 2024-01-09 17:54:25.827415468 +0100
@@ -213,7 +213,7 @@
const JSAMPROW input_buf, JSAMPROW prev_row,
JDIFFROW diff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
DIFFERENCE_1D(INITIAL_PREDICTORx);
/*
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jctrans.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jctrans.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jctrans.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jctrans.c 2024-01-09 17:54:33.939340981 +0100
@@ -267,7 +267,7 @@
METHODDEF(boolean)
compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- (void)input_buf;
+ //(void)input_buf;
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
c_coef_ptr coef = (c_coef_ptr) lossyc->coef_private;
JDIMENSION MCU_col_num; /* index of current MCU within row */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdmerge.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdmerge.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdmerge.c 2024-01-09 17:13:10.345673450 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdmerge.c 2024-01-09 17:54:41.019275962 +0100
@@ -148,7 +148,7 @@
JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
- (void) in_row_groups_avail;
+ //(void) in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
JSAMPROW work_ptrs[2];
JDIMENSION num_rows; /* number of rows returned to caller */
@@ -198,8 +198,8 @@
JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */
{
- (void) in_row_groups_avail;
- (void) out_rows_avail;
+ //(void) in_row_groups_avail;
+ //(void) out_rows_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
/* Just do the upsampling. */
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdpostct.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdpostct.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdpostct.c 2024-01-09 17:13:10.349673411 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdpostct.c 2024-01-09 17:54:48.891203659 +0100
@@ -161,8 +161,8 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) output_buf;
- (void) out_rows_avail;
+ //(void) output_buf;
+ //(void) out_rows_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION old_next_row, num_rows;
@@ -207,9 +207,9 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void) input_buf;
- (void) in_row_group_ctr;
- (void) in_row_groups_avail;
+ //(void) input_buf;
+ //(void) in_row_group_ctr;
+ //(void) in_row_groups_avail;
my_post_ptr post = (my_post_ptr) cinfo->post;
JDIMENSION num_rows, max_rows;
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdpred.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdpred.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdpred.c 2024-01-09 17:13:10.349673411 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdpred.c 2024-01-09 17:55:02.179081586 +0100
@@ -101,8 +101,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
}
@@ -111,8 +111,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR2);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -123,8 +123,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR3);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -135,8 +135,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
UNDIFFERENCE_2D(PREDICTOR4);
JPEG_UNUSED(Rc);
JPEG_UNUSED(Rb);
@@ -147,8 +147,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR5);
JPEG_UNUSED(Rc);
@@ -160,8 +160,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR6);
JPEG_UNUSED(Rc);
@@ -173,8 +173,8 @@
const JDIFFROW diff_buf, const JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)cinfo;
- (void)comp_index;
+ //(void)cinfo;
+ //(void)comp_index;
SHIFT_TEMPS
UNDIFFERENCE_2D(PREDICTOR7);
JPEG_UNUSED(Rc);
@@ -194,7 +194,7 @@
const JDIFFROW diff_buf, JDIFFROW prev_row,
JDIFFROW undiff_buf, JDIMENSION width)
{
- (void)prev_row;
+ //(void)prev_row;
j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
UNDIFFERENCE_1D(INITIAL_PREDICTORx);
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdsample.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdsample.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdsample.c 2024-01-09 17:13:10.349673411 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdsample.c 2024-01-09 17:55:13.234979994 +0100
@@ -92,7 +92,7 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- (void)in_row_groups_avail;
+ //(void)in_row_groups_avail;
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int ci;
jpeg_component_info * compptr;
@@ -158,8 +158,8 @@
fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)cinfo;
- (void)compptr;
+ //(void)cinfo;
+ //(void)compptr;
*output_data_ptr = input_data;
}
@@ -173,9 +173,9 @@
noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)cinfo;
- (void)compptr;
- (void)input_data;
+ //(void)cinfo;
+ //(void)compptr;
+ //(void)input_data;
*output_data_ptr = NULL; /* safety check */
}
@@ -239,7 +239,7 @@
h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
@@ -268,7 +268,7 @@
h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
{
- (void)compptr;
+ //(void)compptr;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdscale.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdscale.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jdscale.c 2024-01-09 17:13:10.349673411 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jdscale.c 2024-01-09 17:55:21.722901985 +0100
@@ -67,7 +67,7 @@
const JDIFFROW diff_buf, JSAMPROW output_buf,
JDIMENSION width)
{
- (void)cinfo;
+ //(void)cinfo;
unsigned int xindex;
for (xindex = 0; xindex < width; xindex++)
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jquant1.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jquant1.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jquant1.c 2024-01-09 17:13:10.349673411 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jquant1.c 2024-01-09 17:48:22.270738074 +0100
@@ -251,8 +251,8 @@
* (Forcing the upper and lower values to the limits ensures that
* dithering can't produce a color outside the selected gamut.)
*/
- (void) cinfo;
- (void) ci;
+ //(void) cinfo;
+ //(void) ci;
return (int) (((IJG_INT32) j * MAXJSAMPLE + maxj/2) / maxj);
}
@@ -262,8 +262,8 @@
/* Return largest input value that should map to j'th output value */
/* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */
{
- (void) cinfo;
- (void) ci;
+ //(void) cinfo;
+ //(void) ci;
/* Breakpoints are halfway between values returned by output_value */
return (int) (((IJG_INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj));
}
@@ -744,7 +744,7 @@
METHODDEF(void)
start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
{
- (void) is_pre_scan;
+ //(void) is_pre_scan;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
size_t arraysize;
int i;
@@ -802,7 +802,7 @@
METHODDEF(void)
finish_pass_1_quant (j_decompress_ptr cinfo)
{
- (void) cinfo;
+ //(void) cinfo;
/* no work in 1-pass case */
}
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jquant2.c dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jquant2.c
--- dcmtk-DCMTK-3.6.8.orig/dcmjpeg/libijg8/jquant2.c 2024-01-09 17:13:10.349673411 +0100
+++ dcmtk-DCMTK-3.6.8/dcmjpeg/libijg8/jquant2.c 2024-01-09 17:47:42.343100533 +0100
@@ -224,7 +224,7 @@
prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows)
{
- (void) output_buf;
+ //(void) output_buf;
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
register JSAMPROW ptr;
register histptr histp;
@@ -1156,7 +1156,7 @@
METHODDEF(void)
finish_pass2 (j_decompress_ptr cinfo)
{
- (void) cinfo;
+ //(void) cinfo;
/* no work */
}

View File

@ -0,0 +1,157 @@
diff -urEb dcmtk-DCMTK-3.6.8.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-DCMTK-3.6.8/CMake/GenerateDCMTKConfigure.cmake
--- dcmtk-DCMTK-3.6.8.orig/CMake/GenerateDCMTKConfigure.cmake 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/CMake/GenerateDCMTKConfigure.cmake 2024-11-25 16:54:59.036009112 +0100
@@ -224,6 +224,8 @@
# Check the sizes of various types
include (CheckTypeSize)
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ # This doesn't work for wasm, Orthanc defines the macros manually
CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
CHECK_TYPE_SIZE("float" SIZEOF_FLOAT)
@@ -231,6 +233,7 @@
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P)
+endif()
# Check for include files, libraries, and functions
include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake")
Only in dcmtk-DCMTK-3.6.8/config/include/dcmtk/config: arith.h
Only in dcmtk-DCMTK-3.6.8/config/include/dcmtk/config: osconfig.h
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-DCMTK-3.6.8/dcmdata/include/dcmtk/dcmdata/dcdict.h
--- dcmtk-DCMTK-3.6.8.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/dcmdata/include/dcmtk/dcmdata/dcdict.h 2024-11-25 16:54:59.036009112 +0100
@@ -162,6 +162,12 @@
/// returns an iterator to the end of the repeating tag dictionary
DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
+ // Function by the Orthanc project to load a dictionary from a
+ // memory buffer, which is necessary in sandboxed
+ // environments. This is an adapted version of
+ // DcmDataDictionary::loadDictionary().
+ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
+
private:
/** private undefined assignment operator
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmdata/libsrc/dcdict.cc dcmtk-DCMTK-3.6.8/dcmdata/libsrc/dcdict.cc
--- dcmtk-DCMTK-3.6.8.orig/dcmdata/libsrc/dcdict.cc 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/dcmdata/libsrc/dcdict.cc 2024-11-25 16:54:59.036009112 +0100
@@ -914,3 +914,5 @@
wrlock().clear();
wrunlock();
}
+
+#include "dcdict_orthanc.cc"
Only in dcmtk-DCMTK-3.6.8/dcmdata/libsrc: dcdict_orthanc.cc
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-DCMTK-3.6.8/dcmdata/libsrc/dcpxitem.cc
--- dcmtk-DCMTK-3.6.8.orig/dcmdata/libsrc/dcpxitem.cc 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/dcmdata/libsrc/dcpxitem.cc 2024-11-25 16:54:59.036009112 +0100
@@ -31,6 +31,9 @@
#include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */
#include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */
+#undef max
+#include "dcmtk/ofstd/oflimits.h"
+
// ********************************
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmnet/libsrc/scu.cc dcmtk-DCMTK-3.6.8/dcmnet/libsrc/scu.cc
--- dcmtk-DCMTK-3.6.8.orig/dcmnet/libsrc/scu.cc 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/dcmnet/libsrc/scu.cc 2024-11-25 16:54:59.036009112 +0100
@@ -19,6 +19,11 @@
*
*/
+#if defined(_WIN32)
+# define __STDC_LIMIT_MACROS // Get access to UINT16_MAX
+# include <stdint.h>
+#endif
+
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmdata/dcostrmf.h" /* for class DcmOutputFileStream */
diff -urEb dcmtk-DCMTK-3.6.8.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-DCMTK-3.6.8/oflog/include/dcmtk/oflog/thread/syncpub.h
--- dcmtk-DCMTK-3.6.8.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/oflog/include/dcmtk/oflog/thread/syncpub.h 2024-11-25 16:54:59.037009100 +0100
@@ -63,7 +63,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Mutex::Mutex (Mutex::Type t)
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t) + 0))
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)))
{ }
@@ -106,7 +106,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max),
unsigned DCMTK_LOG4CPLUS_THREADED (initial))
- : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial) + 0))
+ : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)))
{ }
@@ -190,7 +190,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig))
- : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig) + 0))
+ : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)))
{ }
@@ -252,7 +252,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
SharedMutex::SharedMutex ()
- : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex + 0))
+ : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex))
{ }
diff -urEb dcmtk-DCMTK-3.6.8.orig/oflog/libsrc/oflog.cc dcmtk-DCMTK-3.6.8/oflog/libsrc/oflog.cc
--- dcmtk-DCMTK-3.6.8.orig/oflog/libsrc/oflog.cc 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/oflog/libsrc/oflog.cc 2024-11-25 16:54:59.037009100 +0100
@@ -19,6 +19,11 @@
*
*/
+
+#if defined(_WIN32)
+# include <winsock2.h>
+#endif
+
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/oflog/oflog.h"
diff -urEb dcmtk-DCMTK-3.6.8.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-DCMTK-3.6.8/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-DCMTK-3.6.8.orig/ofstd/include/dcmtk/ofstd/offile.h 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/ofstd/include/dcmtk/ofstd/offile.h 2024-11-25 16:54:59.037009100 +0100
@@ -570,7 +570,7 @@
*/
void setlinebuf()
{
-#if defined(_WIN32) || defined(__hpux)
+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
this->setvbuf(NULL, _IOLBF, 0);
#else
:: setlinebuf(file_);
diff -urEb dcmtk-DCMTK-3.6.8.orig/ofstd/include/dcmtk/ofstd/ofutil.h dcmtk-DCMTK-3.6.8/ofstd/include/dcmtk/ofstd/ofutil.h
--- dcmtk-DCMTK-3.6.8.orig/ofstd/include/dcmtk/ofstd/ofutil.h 2023-12-19 11:12:57.000000000 +0100
+++ dcmtk-DCMTK-3.6.8/ofstd/include/dcmtk/ofstd/ofutil.h 2024-11-25 17:00:27.525244000 +0100
@@ -75,8 +75,8 @@
// copy constructor should be fine for primitive types.
inline type(const T& pt)
: t( pt ) {}
- inline type(const OFrvalue_storage& rhs)
- : t( rhs.pt ) {}
+ inline type(const type& rhs)
+ : t( rhs.t ) {}
// automatic conversion to the underlying type
inline operator T&() const { return OFconst_cast( T&, t ); }
Only in dcmtk-DCMTK-3.6.8/ofstd/include/dcmtk/ofstd: ofutil.h~

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,296 @@
diff -urEb dcmtk-3.6.9.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.9/CMake/GenerateDCMTKConfigure.cmake
--- dcmtk-3.6.9.orig/CMake/GenerateDCMTKConfigure.cmake 2025-02-18 18:03:13.505405952 +0100
+++ dcmtk-3.6.9/CMake/GenerateDCMTKConfigure.cmake 2025-02-18 18:06:53.925278621 +0100
@@ -227,12 +227,15 @@
# Check the sizes of various types
include (CheckTypeSize)
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ # This doesn't work for wasm, Orthanc defines the macros manually
CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
CHECK_TYPE_SIZE("float" SIZEOF_FLOAT)
CHECK_TYPE_SIZE("int" SIZEOF_INT)
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P)
+endif()
# Check for include files, libraries, and functions
include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake")
diff -urEb dcmtk-3.6.9.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.9/dcmdata/include/dcmtk/dcmdata/dcdict.h
--- dcmtk-3.6.9.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2025-02-18 18:03:13.497406077 +0100
+++ dcmtk-3.6.9/dcmdata/include/dcmtk/dcmdata/dcdict.h 2025-02-18 18:06:53.925278621 +0100
@@ -163,6 +163,12 @@
/// returns an iterator to the end of the repeating groups data dictionary
DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
+ // Function by the Orthanc project to load a dictionary from a
+ // memory buffer, which is necessary in sandboxed
+ // environments. This is an adapted version of
+ // DcmDataDictionary::loadDictionary().
+ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
+
private:
/** private undefined assignment operator
diff -urEb dcmtk-3.6.9.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.9/dcmdata/libsrc/dcdict.cc
--- dcmtk-3.6.9.orig/dcmdata/libsrc/dcdict.cc 2025-02-18 18:03:13.499406046 +0100
+++ dcmtk-3.6.9/dcmdata/libsrc/dcdict.cc 2025-02-18 18:06:53.926278608 +0100
@@ -904,3 +904,5 @@
wrlock().clear();
wrunlock();
}
+
+#include "dcdict_orthanc.cc"
diff -urEb dcmtk-3.6.9.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.9/dcmdata/libsrc/dcpxitem.cc
--- dcmtk-3.6.9.orig/dcmdata/libsrc/dcpxitem.cc 2025-02-18 18:03:13.497406077 +0100
+++ dcmtk-3.6.9/dcmdata/libsrc/dcpxitem.cc 2025-02-18 18:06:53.926278608 +0100
@@ -31,6 +31,8 @@
#include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */
#include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */
+#undef max
+#include "dcmtk/ofstd/oflimits.h"
// ********************************
diff -urEb dcmtk-3.6.9.orig/dcmnet/libsrc/scu.cc dcmtk-3.6.9/dcmnet/libsrc/scu.cc
--- dcmtk-3.6.9.orig/dcmnet/libsrc/scu.cc 2025-02-18 18:03:13.525405640 +0100
+++ dcmtk-3.6.9/dcmnet/libsrc/scu.cc 2025-02-18 18:06:53.927278595 +0100
@@ -19,6 +19,11 @@
*
*/
+#if defined(_WIN32)
+# define __STDC_LIMIT_MACROS // Get access to UINT16_MAX
+# include <stdint.h>
+#endif
+
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmdata/dcostrmf.h" /* for class DcmOutputFileStream */
diff -urEb dcmtk-3.6.9.orig/oficonv/include/dcmtk/oficonv/iconv.h dcmtk-3.6.9/oficonv/include/dcmtk/oficonv/iconv.h
--- dcmtk-3.6.9.orig/oficonv/include/dcmtk/oficonv/iconv.h 2025-02-18 18:03:13.510405874 +0100
+++ dcmtk-3.6.9/oficonv/include/dcmtk/oficonv/iconv.h 2025-02-18 18:06:53.927278595 +0100
@@ -55,7 +55,12 @@
#endif
struct __tag_iconv_t;
+
+#if defined(__LSB_VERSION__)
+typedef void *iconv_t;
+#else
typedef struct __tag_iconv_t *iconv_t;
+#endif
#ifndef OFICONV_CITRUS_WC_T_DEFINED
#define OFICONV_CITRUS_WC_T_DEFINED
diff -urEb dcmtk-3.6.9.orig/oficonv/libsrc/citrus_csmapper.c dcmtk-3.6.9/oficonv/libsrc/citrus_csmapper.c
--- dcmtk-3.6.9.orig/oficonv/libsrc/citrus_csmapper.c 2025-02-18 18:03:13.510405874 +0100
+++ dcmtk-3.6.9/oficonv/libsrc/citrus_csmapper.c 2025-02-18 18:06:53.927278595 +0100
@@ -63,7 +63,8 @@
#ifdef WITH_THREADS
#ifdef HAVE_WINDOWS_H
-static SRWLOCK ma_lock = SRWLOCK_INIT;
+static int ma_lock_initialized = 0;
+static CRITICAL_SECTION ma_lock;
#elif defined(HAVE_PTHREAD_H)
static pthread_rwlock_t ma_lock = PTHREAD_RWLOCK_INITIALIZER;
#endif
@@ -382,6 +383,14 @@
char mapper_path[OFICONV_PATH_MAX];
unsigned long norm;
int ret;
+
+#if defined(WITH_THREADS) && defined(HAVE_WINDOWS_H)
+ if (ma_lock_initialized == 0) { /* Very minor risk of race condition here */
+ InitializeCriticalSection(&ma_lock);
+ ma_lock_initialized = 1;
+ }
+#endif
+
norm = 0;
getCSMapperPath(mapper_path, sizeof(mapper_path), NULL);
diff -urEb dcmtk-3.6.9.orig/oficonv/libsrc/citrus_iconv.c dcmtk-3.6.9/oficonv/libsrc/citrus_iconv.c
--- dcmtk-3.6.9.orig/oficonv/libsrc/citrus_iconv.c 2025-02-18 18:03:13.520405718 +0100
+++ dcmtk-3.6.9/oficonv/libsrc/citrus_iconv.c 2025-02-18 18:10:35.928614598 +0100
@@ -49,7 +49,15 @@
#endif
#include <limits.h>
+
+#if (_MSC_VER >= 1900)
#include <stdbool.h>
+#else
+#define bool int
+#define false 0
+#define true 1
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -80,7 +88,8 @@
#ifdef WITH_THREADS
#ifdef HAVE_WINDOWS_H
-static SRWLOCK ci_lock = SRWLOCK_INIT;
+static int ci_lock_initialized = 0;
+static CRITICAL_SECTION ci_lock;
#elif defined(HAVE_PTHREAD_H)
static pthread_rwlock_t ci_lock = PTHREAD_RWLOCK_INITIALIZER;
#endif
@@ -299,14 +308,24 @@
_citrus_iconv_open(struct _citrus_iconv * * rcv,
const char * src, const char * dst)
{
-struct _citrus_iconv *cv = NULL;
+#ifdef HAVE_WINDOWS_H
+ char current_codepage[20];
+#endif
+
+ struct _citrus_iconv *cv = NULL;
struct _citrus_iconv_shared *ci = NULL;
char realdst[OFICONV_PATH_MAX], realsrc[OFICONV_PATH_MAX];
int ret;
+#if defined(WITH_THREADS) && defined(HAVE_WINDOWS_H)
+ if (ci_lock_initialized == 0) { /* Very minor risk of race condition here */
+ InitializeCriticalSection(&ci_lock);
+ ci_lock_initialized = 1;
+ }
+#endif
+
init_cache();
#ifdef HAVE_WINDOWS_H
- char current_codepage[20];
snprintf(current_codepage, sizeof(current_codepage), "%lu", (unsigned long) GetConsoleOutputCP());
#endif
diff -urEb dcmtk-3.6.9.orig/oficonv/libsrc/citrus_lock.h dcmtk-3.6.9/oficonv/libsrc/citrus_lock.h
--- dcmtk-3.6.9.orig/oficonv/libsrc/citrus_lock.h 2025-02-18 18:03:13.518405749 +0100
+++ dcmtk-3.6.9/oficonv/libsrc/citrus_lock.h 2025-02-18 18:06:53.927278595 +0100
@@ -31,11 +31,11 @@
#ifdef WITH_THREADS
-#ifdef HAVE_WINDOWS_H
+#if defined(HAVE_WINDOWS_H)
#include <windows.h>
-#define WLOCK(lock) AcquireSRWLockExclusive(lock);
-#define UNLOCK(lock) ReleaseSRWLockExclusive(lock);
+#define WLOCK(lock) EnterCriticalSection(lock);
+#define UNLOCK(lock) LeaveCriticalSection(lock);
#else /* HAVE_WINDOWS_H */
diff -urEb dcmtk-3.6.9.orig/oficonv/libsrc/citrus_mapper.c dcmtk-3.6.9/oficonv/libsrc/citrus_mapper.c
--- dcmtk-3.6.9.orig/oficonv/libsrc/citrus_mapper.c 2025-02-18 18:03:13.516405780 +0100
+++ dcmtk-3.6.9/oficonv/libsrc/citrus_mapper.c 2025-02-18 18:06:53.928278582 +0100
@@ -64,7 +64,8 @@
#ifdef WITH_THREADS
#ifdef HAVE_WINDOWS_H
-static SRWLOCK cm_lock = SRWLOCK_INIT;
+static int cm_lock_initialized = 0;
+static CRITICAL_SECTION cm_lock;
#elif defined(HAVE_PTHREAD_H)
static pthread_rwlock_t cm_lock = PTHREAD_RWLOCK_INITIALIZER;
#endif
@@ -355,6 +356,13 @@
const char *module, *variable;
int hashval, ret;
+#if defined(WITH_THREADS) && defined(HAVE_WINDOWS_H)
+ if (cm_lock_initialized == 0) { /* Very minor risk of race condition here */
+ InitializeCriticalSection(&cm_lock);
+ cm_lock_initialized = 1;
+ }
+#endif
+
variable = NULL;
WLOCK(&cm_lock);
diff -urEb dcmtk-3.6.9.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.9/oflog/include/dcmtk/oflog/thread/syncpub.h
--- dcmtk-3.6.9.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2025-02-18 18:03:13.473406452 +0100
+++ dcmtk-3.6.9/oflog/include/dcmtk/oflog/thread/syncpub.h 2025-02-18 18:06:53.928278582 +0100
@@ -63,7 +63,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Mutex::Mutex (Mutex::Type t)
- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t) + 0))
+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)))
{ }
@@ -106,7 +106,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max),
unsigned DCMTK_LOG4CPLUS_THREADED (initial))
- : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial) + 0))
+ : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)))
{ }
@@ -190,7 +190,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig))
- : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig) + 0))
+ : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)))
{ }
@@ -252,7 +252,7 @@
DCMTK_LOG4CPLUS_INLINE_EXPORT
SharedMutex::SharedMutex ()
- : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex + 0))
+ : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex))
{ }
diff -urEb dcmtk-3.6.9.orig/oflog/libsrc/oflog.cc dcmtk-3.6.9/oflog/libsrc/oflog.cc
--- dcmtk-3.6.9.orig/oflog/libsrc/oflog.cc 2025-02-18 18:03:13.475406421 +0100
+++ dcmtk-3.6.9/oflog/libsrc/oflog.cc 2025-02-18 18:06:53.928278582 +0100
@@ -19,6 +19,11 @@
*
*/
+
+#if defined(_WIN32)
+# include <winsock2.h>
+#endif
+
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/oflog/oflog.h"
diff -urEb dcmtk-3.6.9.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.9/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-3.6.9.orig/ofstd/include/dcmtk/ofstd/offile.h 2025-02-18 18:03:13.523405671 +0100
+++ dcmtk-3.6.9/ofstd/include/dcmtk/ofstd/offile.h 2025-02-18 18:06:53.929278570 +0100
@@ -569,7 +569,7 @@
*/
void setlinebuf()
{
-#if defined(_WIN32) || defined(__hpux)
+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
this->setvbuf(NULL, _IOLBF, 0);
#else
:: setlinebuf(file_);
diff -urEb dcmtk-3.6.9.orig/ofstd/libsrc/ofstub.cc dcmtk-3.6.9/ofstd/libsrc/ofstub.cc
--- dcmtk-3.6.9.orig/ofstd/libsrc/ofstub.cc 2025-02-18 18:03:13.523405671 +0100
+++ dcmtk-3.6.9/ofstd/libsrc/ofstub.cc 2025-02-18 18:06:53.929278570 +0100
@@ -35,6 +35,10 @@
#include <windows.h>
#endif /* HAVE_WINDOWS_H */
+#if defined(__LSB_VERSION__)
+#include <errno.h>
+#endif
+
#define EXITCODE_CANNOT_DETERMINE_DIR 90
#define EXITCODE_EXEC_FAILED 91
#define EXITCODE_ILLEGAL_PARAMS 92

View File

@ -0,0 +1,205 @@
// Function by the Orthanc project to load a dictionary from a memory
// buffer, which is necessary in sandboxed environments. This is an
// adapted version of DcmDataDictionary::loadDictionary().
#include <string>
#include <boost/noncopyable.hpp>
struct OrthancLinesIterator;
// This plain old C class is implemented in "../../Core/Toolbox.h"
OrthancLinesIterator* OrthancLinesIterator_Create(const std::string& content);
bool OrthancLinesIterator_GetLine(std::string& target,
const OrthancLinesIterator* iterator);
void OrthancLinesIterator_Next(OrthancLinesIterator* iterator);
void OrthancLinesIterator_Free(OrthancLinesIterator* iterator);
class LinesIterator : public boost::noncopyable
{
private:
OrthancLinesIterator* iterator_;
public:
LinesIterator(const std::string& content) :
iterator_(NULL)
{
iterator_ = OrthancLinesIterator_Create(content);
}
~LinesIterator()
{
if (iterator_ != NULL)
{
OrthancLinesIterator_Free(iterator_);
iterator_ = NULL;
}
}
bool GetLine(std::string& target) const
{
if (iterator_ != NULL)
{
return OrthancLinesIterator_GetLine(target, iterator_);
}
else
{
return false;
}
}
void Next()
{
if (iterator_ != NULL)
{
OrthancLinesIterator_Next(iterator_);
}
}
};
OFBool
DcmDataDictionary::loadFromMemory(const std::string& content, OFBool errorIfAbsent)
{
int lineNumber = 0;
char* lineFields[DCM_MAXDICTFIELDS + 1];
int fieldsPresent;
DcmDictEntry* e;
int errorsEncountered = 0;
OFBool errorOnThisLine = OFFalse;
int i;
DcmTagKey key, upperKey;
DcmDictRangeRestriction groupRestriction = DcmDictRange_Unspecified;
DcmDictRangeRestriction elementRestriction = DcmDictRange_Unspecified;
DcmVR vr;
char* vrName;
char* tagName;
char* privCreator;
int vmMin, vmMax = 1;
const char* standardVersion;
LinesIterator iterator(content);
std::string line;
while (iterator.GetLine(line)) {
iterator.Next();
if (line.size() >= DCM_MAXDICTLINESIZE) {
DCMDATA_ERROR("DcmDataDictionary: Too long line: " << line);
continue;
}
lineNumber++;
if (onlyWhitespace(line.c_str())) {
continue; /* ignore this line */
}
if (isaCommentLine(line.c_str())) {
continue; /* ignore this line */
}
errorOnThisLine = OFFalse;
/* fields are tab separated */
fieldsPresent = splitFields(line.c_str(), lineFields,
DCM_MAXDICTFIELDS,
DCM_DICT_FIELD_SEPARATOR_CHAR);
/* initialize dict entry fields */
vrName = NULL;
tagName = NULL;
privCreator = NULL;
vmMin = vmMax = 1;
standardVersion = "DICOM";
switch (fieldsPresent) {
case 0:
case 1:
case 2:
DCMDATA_ERROR("DcmDataDictionary: "
<< "too few fields (line " << lineNumber << ")");
errorOnThisLine = OFTrue;
break;
default:
DCMDATA_ERROR("DcmDataDictionary: "
<< "too many fields (line " << lineNumber << "): ");
errorOnThisLine = OFTrue;
break;
case 5:
stripWhitespace(lineFields[4]);
standardVersion = lineFields[4];
/* drop through to next case label */
case 4:
/* the VM field is present */
if (!parseVMField(lineFields[3], vmMin, vmMax)) {
DCMDATA_ERROR("DcmDataDictionary: "
<< "bad VM field (line " << lineNumber << "): " << lineFields[3]);
errorOnThisLine = OFTrue;
}
/* drop through to next case label */
case 3:
if (!parseWholeTagField(lineFields[0], key, upperKey,
groupRestriction, elementRestriction, privCreator))
{
DCMDATA_ERROR("DcmDataDictionary: "
<< "bad Tag field (line " << lineNumber << "): " << lineFields[0]);
errorOnThisLine = OFTrue;
} else {
/* all is OK */
vrName = lineFields[1];
stripWhitespace(vrName);
tagName = lineFields[2];
stripWhitespace(tagName);
}
}
if (!errorOnThisLine) {
/* check the VR Field */
vr.setVR(vrName);
if (vr.getEVR() == EVR_UNKNOWN) {
DCMDATA_ERROR("DcmDataDictionary: "
<< "bad VR field (line " << lineNumber << "): " << vrName);
errorOnThisLine = OFTrue;
}
}
if (!errorOnThisLine) {
e = new DcmDictEntry(
key.getGroup(), key.getElement(),
upperKey.getGroup(), upperKey.getElement(),
vr, tagName, vmMin, vmMax, standardVersion, OFTrue,
privCreator);
e->setGroupRangeRestriction(groupRestriction);
e->setElementRangeRestriction(elementRestriction);
addEntry(e);
}
for (i = 0; i < fieldsPresent; i++) {
free(lineFields[i]);
lineFields[i] = NULL;
}
delete[] privCreator;
if (errorOnThisLine) {
errorsEncountered++;
}
}
/* return OFFalse in case of errors and set internal state accordingly */
if (errorsEncountered == 0) {
dictionaryLoaded = OFTrue;
return OFTrue;
}
else {
dictionaryLoaded = OFFalse;
return OFFalse;
}
}

View File

@ -0,0 +1,15 @@
Generate some patch
===================
diff -urEb dcmtk-3.6.0.orig/ dcmtk-3.6.0
diff -urEb dcmtk-3.6.2.orig/ dcmtk-3.6.2
diff -urEb dcmtk-3.6.4.orig/ dcmtk-3.6.4
diff -urEb dcmtk-3.6.5.orig/ dcmtk-3.6.5
diff -urEb dcmtk-3.6.6.orig/ dcmtk-3.6.6
diff -urEb dcmtk-3.6.7.orig/ dcmtk-3.6.7
For "dcmtk-3.6.2-private.dic" (only used with DCMTK 3.6.0)
=============================
# cp ../../ThirdPartyDownloads/dcmtk-3.6.2/dcmdata/data/private.dic dcmtk-3.6.2-private.dic

Some files were not shown because too many files have changed in this diff Show More