2020-03-26 01:16:03 +08:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
|
|
|
|
project(SOF_RIMAGE C)
|
|
|
|
|
2020-06-16 12:59:30 +08:00
|
|
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
message(STATUS "No CMAKE_BUILD_TYPE, defaulting to Debug")
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE)
|
|
|
|
endif()
|
|
|
|
|
2020-03-26 01:16:03 +08:00
|
|
|
add_executable(rimage
|
|
|
|
src/file_simple.c
|
|
|
|
src/cse.c
|
|
|
|
src/css.c
|
|
|
|
src/plat_auth.c
|
|
|
|
src/hash.c
|
|
|
|
src/pkcs1_5.c
|
|
|
|
src/manifest.c
|
2020-04-07 18:40:06 +08:00
|
|
|
src/ext_manifest.c
|
2020-03-26 01:16:03 +08:00
|
|
|
src/elf.c
|
|
|
|
src/rimage.c
|
2020-09-07 23:20:08 +08:00
|
|
|
src/adsp_config.c
|
|
|
|
tomlc99/toml.c
|
2020-03-26 01:16:03 +08:00
|
|
|
)
|
|
|
|
|
2022-01-20 22:24:06 +08:00
|
|
|
set_property(TARGET rimage PROPERTY C_STANDARD 99)
|
|
|
|
|
2020-03-26 01:16:03 +08:00
|
|
|
target_compile_options(rimage PRIVATE
|
2021-10-24 16:08:08 +08:00
|
|
|
-Wall -Werror -Wmissing-prototypes -Wimplicit-fallthrough
|
2020-03-26 01:16:03 +08:00
|
|
|
)
|
|
|
|
|
2022-01-20 22:24:06 +08:00
|
|
|
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 9.1)
|
|
|
|
target_compile_options(rimage PRIVATE -Wno-char-subscripts)
|
|
|
|
endif()
|
|
|
|
|
2022-01-26 17:52:36 +08:00
|
|
|
# Windows builds use MSYS2 https://www.msys2.org/ to get linux tools and headers.
|
|
|
|
# MSYS_INSTALL_DIR variable points to MSYS2 installation directory.
|
|
|
|
# You may pass it as environmental or cmake configure variable.
|
|
|
|
if(${CMAKE_HOST_WIN32})
|
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
if(DEFINED ENV{MSYS_INSTALL_DIR} AND NOT MSYS_INSTALL_DIR)
|
|
|
|
set(MSYS_INSTALL_DIR $ENV{MSYS_INSTALL_DIR})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSYS_INSTALL_DIR)
|
|
|
|
cmake_path(IS_ABSOLUTE MSYS_INSTALL_DIR IS_MSYS_INSTALL_DIR_ABSOLUTE)
|
|
|
|
if(NOT IS_MSYS_INSTALL_DIR_ABSOLUTE)
|
|
|
|
message(FATAL_ERROR "Please provide absolute path to MSYS2 installation
|
|
|
|
setting MSYS_INSTALL_DIR env variable")
|
|
|
|
endif()
|
|
|
|
# Include standard posix headers. Requires pacman openssl-devel package.
|
|
|
|
cmake_path(APPEND MSYS_INSTALL_DIR "usr" "include" OUTPUT_VARIABLE MSYS_SYSTEM_INCLUDE_PATH)
|
|
|
|
target_include_directories(rimage PRIVATE "${MSYS_SYSTEM_INCLUDE_PATH}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-01-20 22:24:06 +08:00
|
|
|
target_link_libraries(rimage PRIVATE crypto)
|
2020-03-26 01:16:03 +08:00
|
|
|
|
|
|
|
target_include_directories(rimage PRIVATE
|
2020-05-13 22:03:34 +08:00
|
|
|
src/include/
|
2020-09-07 23:20:08 +08:00
|
|
|
tomlc99/
|
2020-03-26 01:16:03 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
install(TARGETS rimage DESTINATION bin)
|