Skip to content

Commit 159d8b8

Browse files
committed
Release v3.2.0 (20200610)
1 parent 9da231a commit 159d8b8

File tree

364 files changed

+64296
-41718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

364 files changed

+64296
-41718
lines changed

CMakeLists.txt

+92-27
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,92 @@
1-
cmake_minimum_required(VERSION 2.6.4)
2-
project (cryptoauthlib)
3-
4-
# Set the current release version
5-
set(VERSION "3.1.0")
6-
set(VERSION_MAJOR 3)
7-
set(VERSION_MINOR 1)
8-
set(VERSION_PATCH 0)
9-
10-
# Build Options
11-
option(BUILD_TESTS "Create Test Application with library" OFF)
12-
#set(ATCA_PKCS11 ON CACHE INTERNAL "")
13-
14-
message(STATUS "Building Configuration: ${CMAKE_BUILD_TYPE}")
15-
16-
17-
if(BUILD_TESTS)
18-
set(ATCA_BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
19-
endif(BUILD_TESTS)
20-
21-
add_subdirectory(lib)
22-
23-
# Tests
24-
if(BUILD_TESTS)
25-
add_subdirectory(test)
26-
endif(BUILD_TESTS)
27-
1+
cmake_minimum_required(VERSION 2.6.4)
2+
project (cryptoauthlib)
3+
4+
# Set the current release version
5+
set(VERSION "3.2.0")
6+
set(VERSION_MAJOR 3)
7+
set(VERSION_MINOR 2)
8+
set(VERSION_PATCH 0)
9+
10+
# Build Options
11+
option(BUILD_TESTS "Create Test Application with library" OFF)
12+
#set(ATCA_PKCS11 ON CACHE INTERNAL "")
13+
14+
# Default install root which is normally /usr/local/
15+
set(CMAKE_INSTALL_PREFIX "/" CACHE INTERNAL "")
16+
17+
# If including certificate definitions into the library then include them as ATCACERT_DEF_SRC
18+
#file(GLOB ATCACERT_DEF_SRC ABSOLUTE "app/*.c")
19+
20+
if(WIN32)
21+
string(REPLACE "\\" "/" LOCAL_APP_DATA "$ENV{LOCALAPPDATA}/Microchip")
22+
set(DEFAULT_LIB_PATH "${LOCAL_APP_DATA}" CACHE
23+
STRING "The default absolute library path")
24+
set(DEFAULT_CONF_PATH "${LOCAL_APP_DATA}" CACHE
25+
STRING "The default location of ${PROJECT_NAME}.conf")
26+
set(DEFAULT_STORE_PATH "${LOCAL_APP_DATA}/${PROJECT_NAME}" CACHE
27+
STRING "The default location of the filestore directory")
28+
else()
29+
include(GNUInstallDirs)
30+
set(DEFAULT_LIB_PATH "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE
31+
STRING "The default absolute library path")
32+
set(DEFAULT_CONF_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${PROJECT_NAME}" CACHE
33+
STRING "The default location of ${PROJECT_NAME}.conf")
34+
set(DEFAULT_STORE_PATH "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/${PROJECT_NAME}" CACHE
35+
STRING "The default location of the filestore directory")
36+
endif()
37+
38+
set(DEFAULT_CONF_FILE_NAME "${PROJECT_NAME}.conf" CACHE
39+
STRING "The default file for library configuration")
40+
41+
if(NOT CMAKE_BUILD_TYPE)
42+
if(WIN32)
43+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Default build type" FORCE)
44+
else()
45+
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Default build type" FORCE)
46+
endif()
47+
endif()
48+
49+
# Set up a default configuration file to install
50+
configure_file(${PROJECT_SOURCE_DIR}/app/pkcs11/cryptoauthlib.conf.in ${PROJECT_BINARY_DIR}/${DEFAULT_CONF_FILE_NAME})
51+
52+
# Packaging
53+
set(CPACK_PACKAGE_VENDOR "Microchip Technology Inc")
54+
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
55+
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
56+
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
57+
set(CPACK_GENERATOR "TGZ")
58+
set(CPACK_SOURCE_GENERATOR "TGZ")
59+
set(CPACK_SOURCE_IGNORE_FILES "build/*;\\.git/*")
60+
61+
include(CPack)
62+
63+
# Make sure when testing that everything goes where it should
64+
if(BUILD_TESTS)
65+
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
66+
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
67+
endif()
68+
69+
add_subdirectory(lib)
70+
71+
# Tests
72+
if(BUILD_TESTS)
73+
add_subdirectory(test)
74+
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT cryptoauth_test)
75+
endif(BUILD_TESTS)
76+
77+
# Installation
78+
install(DIRECTORY DESTINATION ${DEFAULT_CONF_PATH})
79+
install(CODE "
80+
if(NOT EXISTS ${DEFAULT_CONF_PATH}/${DEFAULT_CONF_FILE_NAME})
81+
file(INSTALL ${PROJECT_BINARY_DIR}/${DEFAULT_CONF_FILE_NAME}
82+
DESTINATION ${DEFAULT_CONF_PATH})
83+
endif()
84+
")
85+
install(DIRECTORY DESTINATION ${DEFAULT_STORE_PATH})
86+
install(CODE "execute_process(COMMAND chmod 1777 ${DEFAULT_STORE_PATH})")
87+
install(CODE "
88+
if(NOT EXISTS ${DEFAULT_STORE_PATH}/slot.conf.tmpl)
89+
file(INSTALL ${PROJECT_SOURCE_DIR}/app/pkcs11/slot.conf.tmpl
90+
DESTINATION ${DEFAULT_STORE_PATH})
91+
endif()
92+
")

0 commit comments

Comments
 (0)