1#-------------------------------------------------------------------------------
2# Copyright (c) 2021-2022 Cypress Semiconductor Corporation (an Infineon company)
3# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7#-------------------------------------------------------------------------------
8
9fetch_remote_library(
10    LIB_NAME                p64_utils
11    LIB_SOURCE_PATH_VAR     CY_P64_UTILS_LIB_PATH
12    LIB_PATCH_DIR           ${CMAKE_CURRENT_LIST_DIR}
13    LIB_FORCE_PATCH         CY_P64_UTILS_FORCE_PATCH
14    FETCH_CONTENT_ARGS
15        GIT_REPOSITORY      https://github.com/Infineon/p64_utils.git
16        GIT_TAG             ${CY_P64_UTILS_LIB_VERSION}
17        GIT_SHALLOW         TRUE
18        GIT_PROGRESS        TRUE
19        GIT_SUBMODULES      ""
20)
21
22#-------------------------------------------------------------------------------
23
24cmake_minimum_required(VERSION 3.13)
25
26project("Cypress PSoC64 Utils Library" LANGUAGES C ASM)
27
28cmake_policy(SET CMP0076 NEW)
29cmake_policy(SET CMP0079 NEW)
30
31if (NOT DEFINED P64_UTILS_LIB_TARGET)
32    set(P64_UTILS_LIB_TARGET p64_utils_lib)
33endif()
34
35add_compile_definitions(CY_P64_FREE_WIPED)
36
37add_library(${P64_UTILS_LIB_TARGET} STATIC)
38
39target_sources(${P64_UTILS_LIB_TARGET}
40    PRIVATE
41        ${CY_P64_UTILS_LIB_PATH}/cy_p64_base64.c
42        ${CY_P64_UTILS_LIB_PATH}/cy_p64_cJSON.c
43        ${CY_P64_UTILS_LIB_PATH}/cy_p64_jwt_policy.c
44        ${CY_P64_UTILS_LIB_PATH}/cy_p64_malloc.c
45        ${CY_P64_UTILS_LIB_PATH}/cy_p64_syscalls.c
46        ${CY_P64_UTILS_LIB_PATH}/cy_p64_syscall.c
47        ${CY_P64_UTILS_LIB_PATH}/cy_p64_watchdog.c
48        ${CY_P64_UTILS_LIB_PATH}/cy_p64_image.c
49        ${CY_P64_UTILS_LIB_PATH}/cy_p64_psacrypto.c
50)
51
52target_include_directories(${P64_UTILS_LIB_TARGET}
53    PUBLIC
54        ${CY_P64_UTILS_LIB_PATH}
55    PRIVATE
56        ${CY_PSOC64_DIR}/Device/Include
57        ${CY_CORE_LIB_PATH}/include
58        ${CY_MTB_PDL_CAT1_LIB_PATH}/cmsis/include
59        ${CY_MTB_PDL_CAT1_LIB_PATH}/devices/COMPONENT_CAT1A/include
60        ${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/include
61)
62
63