|
| 1 | +# @internal |
| 2 | +# @copyright |
| 3 | +# Copyright (c) 2018, Intel Corporation All Rights Reserved. |
| 4 | +# |
| 5 | +# INTEL CONFIDENTIAL |
| 6 | +# |
| 7 | +# The source code contained or described herein and all documents related to the |
| 8 | +# source code ("Material") are owned by Intel Corporation or its suppliers or |
| 9 | +# licensors. Title to the Material remains with Intel Corporation or its |
| 10 | +# suppliers and licensors. The Material may contain trade secrets and proprietary |
| 11 | +# and confidential information of Intel Corporation and its suppliers and licensors, |
| 12 | +# and is protected by worldwide copyright and trade secret laws and treaty |
| 13 | +# provisions. No part of the Material may be used, copied, reproduced, modified, |
| 14 | +# published, uploaded, posted, transmitted, distributed, or disclosed in any way |
| 15 | +# without Intel's prior express written permission. |
| 16 | + |
| 17 | +# No license under any patent, copyright, trade secret or other intellectual |
| 18 | +# property right is granted to or conferred upon you by disclosure or delivery |
| 19 | +# of the Materials, either expressly, by implication, inducement, estoppel or |
| 20 | +# otherwise. Any license under such intellectual property rights must be express |
| 21 | +# and approved by Intel in writing. |
| 22 | + |
| 23 | +# Unless otherwise agreed by Intel in writing, you may not remove or alter this |
| 24 | +# notice or any other notice embedded in Materials by Intel or Intel's suppliers |
| 25 | +# or licensors in any way. |
| 26 | +# @endinternal |
| 27 | + |
| 28 | +#---------------------------------------------------------------------------------------------------- |
| 29 | +# Project wide defines and flags |
| 30 | +#---------------------------------------------------------------------------------------------------- |
| 31 | + |
| 32 | + |
| 33 | +#---------------------------------------------------------------------------------------------------- |
| 34 | +# Create Safe String Library |
| 35 | +#---------------------------------------------------------------------------------------------------- |
| 36 | + # safe c library requires the compiler path with double quotes. Also, doesn't accept few of the C compiler flags |
| 37 | + set(CMAKE_C_FLAGS_SAFEC "-DNO_MSABI_VA_FUNCS -fPIC") |
| 38 | + |
| 39 | + include(ExternalProject) |
| 40 | + find_package(Git REQUIRED) |
| 41 | + |
| 42 | + ExternalProject_Add(safeclib_proj |
| 43 | + PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/safeclib |
| 44 | + DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/safeclib |
| 45 | + GIT_REPOSITORY https://github.com/rurban/safeclib |
| 46 | + GIT_TAG 59eba324c20c07f7ca8190238dd415525f4925dc |
| 47 | + UPDATE_COMMAND "" |
| 48 | + CONFIGURE_COMMAND ./build-tools/autogen.sh && ./configure CFLAGS=${CMAKE_C_FLAGS_SAFEC} --enable-strmax=0x8000 --enable-shared=no --disable-doc |
| 49 | + BUILD_COMMAND make |
| 50 | + BUILD_IN_SOURCE ON |
| 51 | + STEP_TARGETS build |
| 52 | + BUILD_ALWAYS OFF |
| 53 | + BUILD_BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/safeclib/src/safeclib_proj/src/.libs/libsafec-3.3.a |
| 54 | + INSTALL_COMMAND "" |
| 55 | + LOG_DOWNLOAD ON |
| 56 | + LOG_UPDATE ON |
| 57 | + LOG_BUILD ON |
| 58 | + ) |
| 59 | + |
| 60 | + ExternalProject_Get_property(safeclib_proj SOURCE_DIR) |
| 61 | + add_library(safeclib STATIC IMPORTED) |
| 62 | + set_property(TARGET safeclib PROPERTY IMPORTED_LOCATION ${SOURCE_DIR}/src/.libs/libsafec-3.3.a) |
| 63 | + add_dependencies(safeclib safeclib_proj) |
| 64 | + set(SAFECLIB_COMPILE_FLAGS "-DHAVE_C99") |
| 65 | + |
| 66 | +#---------------------------------------------------------------------------------------------------- |
| 67 | +# OS driver interface library |
| 68 | +#---------------------------------------------------------------------------------------------------- |
| 69 | + |
| 70 | +target_link_libraries(ipmctl_os_interface |
| 71 | + safeclib |
| 72 | + ) |
| 73 | +target_include_directories(ipmctl_os_interface |
| 74 | + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/safeclib/src/safeclib_proj/include) |
| 75 | + |
| 76 | +set_source_files_properties(${OS_INTERFACE_SOURCE_FILES} |
| 77 | + PROPERTIES COMPILE_FLAGS ${SAFECLIB_COMPILE_FLAGS}) |
| 78 | + |
| 79 | +#---------------------------------------------------------------------------------------------------- |
| 80 | +# libipmctl |
| 81 | +#---------------------------------------------------------------------------------------------------- |
| 82 | +target_link_libraries(ipmctl |
| 83 | + safeclib |
| 84 | + ) |
| 85 | + |
| 86 | +target_include_directories(ipmctl |
| 87 | + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/safeclib/src/safeclib_proj/include) |
| 88 | + |
| 89 | +set_source_files_properties(${LIBIPMCTL_SOURCE_FILES} |
| 90 | + PROPERTIES COMPILE_FLAGS ${SAFECLIB_COMPILE_FLAGS}) |
| 91 | + |
| 92 | +#--------------------------------------------------------------------------------------------------- |
| 93 | +# ipmctl executable |
| 94 | +#--------------------------------------------------------------------------------------------------- |
| 95 | +set_source_files_properties(${IPMCTL_SOURCE_FILES} |
| 96 | + PROPERTIES COMPILE_FLAGS ${SAFECLIB_COMPILE_FLAGS}) |
| 97 | + |
| 98 | +#--------------------------------------------------------------------------------------------------- |
| 99 | +# Monitor service executable |
| 100 | +#--------------------------------------------------------------------------------------------------- |
| 101 | +set_source_files_properties(${IPMCTL_MONITOR_SOURCE_FILES} |
| 102 | + PROPERTIES COMPILE_FLAGS ${SAFECLIB_COMPILE_FLAGS}) |
0 commit comments