-
Notifications
You must be signed in to change notification settings - Fork 39
/
CMakeLists.txt
71 lines (59 loc) · 1.91 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
## ./CMakeLists.txt
cmake_minimum_required(VERSION 3.11)
if (NOT DEFINED IS_BARE_METAL)
set(IS_BARE_METAL FALSE)
endif()
if (${IS_BARE_METAL})
set(PROJECT_NAME_CUSTOM "BareMetal")
else()
set(PROJECT_NAME_CUSTOM "MikroSDK")
endif()
if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
project(${PROJECT_NAME_CUSTOM} VERSION ${MIKROSDK_CURRENT_VERSION} LANGUAGES MikroC)
else()
project(${PROJECT_NAME_CUSTOM} VERSION ${MIKROSDK_CURRENT_VERSION} LANGUAGES C ASM)
if(NOT ${TOOLCHAIN_ID} STREQUAL "mchp_xc8")
add_compile_options("-fms-extensions")
endif()
endif()
# Link MikroC.Core for all toolchains
find_package(MikroC.Core)
set(CMAKE_STATIC_LIBRARY_PREFIX "")
list(APPEND CMAKE_MODULE_PATH "${${PROJECT_NAME_CUSTOM}_SOURCE_DIR}/cmake")
# Build Tft modules by default if not specified differently
if (NOT DEFINED MSDK_BUILD_TFT_MODULES)
set(MSDK_BUILD_TFT_MODULES TRUE)
endif()
include(utils)
include(mikroeUtils)
include(GNUInstallDirs)
add_subdirectory(platform)
if (NOT ${IS_BARE_METAL})
add_subdirectory(api)
add_subdirectory(bsp)
add_subdirectory(components)
add_subdirectory(drv)
add_subdirectory(hal)
add_subdirectory(middleware)
add_subdirectory(targets)
add_subdirectory(thirdparty)
endif()
if(${MSDK_TEST_EXAMPLES} MATCHES "true")
add_subdirectory(tests)
endif()
## Deploy build is used for testing compiler specific issues.
if (NOT ${IS_BARE_METAL})
if($ENV{IS_DOCKER_CONTAINER} MATCHES "true")
add_subdirectory(deploy)
endif()
endif()
if(COMPILER_REVISION)
if(${COMPILER_REVISION} VERSION_GREATER_EQUAL "1.0")
if(${TOOLCHAIN_LANGUAGE} STREQUAL "GNU")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.meproject)
fetch_linker_name(${CMAKE_CURRENT_SOURCE_DIR}/.meproject linkerName)
add_ld_all_targets(. ${CMAKE_CURRENT_SOURCE_DIR} ${linkerName})
endif()
endif()
endif()
endif()