You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

75 lines
1.9 KiB

cmake_minimum_required(VERSION 3.13)
cmake_policy(SET CMP0054 NEW)
if (NOT C6416_SDK_PATH)
set(C6416_SDK_PATH ${CMAKE_CURRENT_LIST_DIR})
endif()
get_filename_component(C6416_SDK_PATH "${C6416_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
set(C6416_SDK_PATH ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Path to C6416 SDK" FORCE)
# set a default build type if none was specified
if (NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if (DEFINED PLAT)
set(PLATFORMS ${PLAT})
elseif (DEFINED ENV{PLAT})
set(PLATFORMS $ENV{PLAT})
else()
set(PLATFORMS "dsk")
endif()
# add cmake to module path
set(C6416_SDK_PATH ${CMAKE_CURRENT_LIST_DIR})
list(APPEND CMAKE_MODULE_PATH ${C6416_SDK_PATH}/cmake)
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE ${C6416_SDK_PATH}/cmake/c6400-toolchain.cmake)
endif()
project(c6416_sdk C ASM)
set(CMAKE_EXECUTABLE_SUFFIX .elf)
set(CMAKE_STATIC_LIBRARY_SUFFIX .lib)
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_C_STANDARD 11)
set(tgt_name "c6416_sdk")
add_library(${tgt_name} STATIC)
target_include_directories(${tgt_name} PUBLIC
${C6416_SDK_PATH}/include
)
add_subdirectory(${C6416_SDK_PATH}/csl)
add_subdirectory(${C6416_SDK_PATH}/dsplib)
add_subdirectory(${C6416_SDK_PATH}/imglib)
add_subdirectory(${C6416_SDK_PATH}/src)
foreach (_plt IN LISTS PLATFORMS)
if (x${_plt} STREQUAL x"")
message(FATAL_ERROR "platform: please specify PLAT.")
endif()
message(STATUS "platform: ${_plt}")
get_filename_component(plt_dir ${C6416_SDK_PATH}/platforms/${_plt} REALPATH)
if (NOT EXISTS ${plt_dir})
message(FATAL_ERROR "platform: ${_plt} isn't exist.")
endif()
add_subdirectory(${plt_dir})
endforeach()
add_custom_command(TARGET ${tgt_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${C6416_SDK_PATH}/lib
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${tgt_name}.lib ${C6416_SDK_PATH}/lib
COMMENT "Copy ${tgt_name}.lib to ${C6416_SDK_PATH}/lib")