annotate OrthancFramework/Resources/CMake/LibP11Configuration.cmake @ 4066:3a59a021b5de framework

build instructions for the library
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Jun 2020 18:43:14 +0200
parents 9fa06bddaabe
children 304842a0d152
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
1 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBP11)
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
2 if (NOT STATIC_BUILD AND USE_SYSTEM_OPENSSL)
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
3 message(FATAL_ERROR "If statically linking against libp11, one must also statically link against OpenSSL")
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
4 endif()
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
5
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
6 SET(LIBP11_SOURCES_DIR ${CMAKE_BINARY_DIR}/libp11-0.4.0)
3133
0c2a8d5e0097 moving third-party dependencies to another server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2384
diff changeset
7 SET(LIBP11_URL "http://orthanc.osimis.io/ThirdPartyDownloads/libp11-0.4.0.tar.gz")
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
8 SET(LIBP11_MD5 "00b3e41db5be840d822bda12f3ab2ca7")
2026
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
9
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
10 if (IS_DIRECTORY "${LIBP11_SOURCES_DIR}")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
11 set(FirstRun OFF)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
12 else()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
13 set(FirstRun ON)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
14 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
15
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
16 DownloadPackage(${LIBP11_MD5} ${LIBP11_URL} "${LIBP11_SOURCES_DIR}")
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
2027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
18 # Apply the patches
2026
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
19 execute_process(
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${CMAKE_CURRENT_LIST_DIR}/../Patches/libp11-0.4.0.patch
2026
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
21 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
22 RESULT_VARIABLE Failure
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
23 )
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
24
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
25 if (Failure AND FirstRun)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
26 message(FATAL_ERROR "Error while patching libp11")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
27 endif()
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
2027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
29 # This command MUST be after applying the patch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
30 file(COPY
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
31 ${LIBP11_SOURCES_DIR}/src/engine.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
32 ${LIBP11_SOURCES_DIR}/src/libp11.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
33 DESTINATION ${AUTOGENERATED_DIR}/libp11)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
34
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
35 file(WRITE ${AUTOGENERATED_DIR}/libp11/config.h "")
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
36
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 set(LIBP11_SOURCES
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
38 #${LIBP11_SOURCES_DIR}/src/eng_front.c
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 ${LIBP11_SOURCES_DIR}/src/eng_back.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 ${LIBP11_SOURCES_DIR}/src/eng_parse.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 ${LIBP11_SOURCES_DIR}/src/libpkcs11.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 ${LIBP11_SOURCES_DIR}/src/p11_attr.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 ${LIBP11_SOURCES_DIR}/src/p11_cert.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 ${LIBP11_SOURCES_DIR}/src/p11_ec.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 ${LIBP11_SOURCES_DIR}/src/p11_err.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 ${LIBP11_SOURCES_DIR}/src/p11_front.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 ${LIBP11_SOURCES_DIR}/src/p11_key.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 ${LIBP11_SOURCES_DIR}/src/p11_load.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 ${LIBP11_SOURCES_DIR}/src/p11_misc.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 ${LIBP11_SOURCES_DIR}/src/p11_rsa.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 ${LIBP11_SOURCES_DIR}/src/p11_slot.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 )
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
2364
ae50eccd41b7 compilation succeeds on OpenBSD
jodogne
parents: 2187
diff changeset
57 ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 list(APPEND LIBP11_SOURCES
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 ${LIBP11_SOURCES_DIR}/src/atfork.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 )
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
2113
0108ac01fc8e added source_group directives for MSVC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2027
diff changeset
64 source_group(ThirdParty\\libp11 REGULAR_EXPRESSION ${LIBP11_SOURCES_DIR}/.*)
0108ac01fc8e added source_group directives for MSVC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2027
diff changeset
65
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 else()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 check_include_file_cxx(libp11.h HAVE_LIBP11_H)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 if (NOT HAVE_LIBP11_H)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 message(FATAL_ERROR "Please install the libp11-dev package")
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 check_library_exists(p11 PKCS11_login "" HAVE_LIBP11_LIB)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 if (NOT HAVE_LIBP11_LIB)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 message(FATAL_ERROR "Please install the libp11-dev package")
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 link_libraries(p11)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 endif()