-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
102 lines (85 loc) · 3.5 KB
/
CMakeLists.txt
File metadata and controls
102 lines (85 loc) · 3.5 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# =====================================================================
# DMOD Flash File System Module
# =====================================================================
cmake_minimum_required(VERSION 3.18)
# ======================================================================
# DMOD FFS
# ======================================================================
# Allow version to be passed as a parameter, default to 0.1
if(NOT DEFINED DMOD_MODULE_VERSION)
set(DMOD_MODULE_VERSION "0.1" CACHE STRING "DMOD module version")
endif()
# ======================================================================
# Fetch DMOD repository
# ======================================================================
include(FetchContent)
FetchContent_Declare(
dmod
GIT_REPOSITORY https://github.com/choco-technologies/dmod.git
GIT_TAG develop
)
# ======================================================================
# DMOD Configuration
# ======================================================================
set(DMOD_MODE "DMOD_MODULE" CACHE STRING "DMOD build mode")
set(DMOD_BUILD_TESTS OFF CACHE BOOL "Build tests")
set(DMOD_BUILD_EXAMPLES OFF CACHE BOOL "Build examples")
set(DMOD_BUILD_TOOLS OFF CACHE BOOL "Build tools")
set(DMOD_BUILD_TEMPLATES OFF CACHE BOOL "Build templates")
FetchContent_MakeAvailable(dmod)
project(dmffs
VERSION ${DMOD_MODULE_VERSION}
DESCRIPTION "DMOD Flash File System"
LANGUAGES C CXX)
# ======================================================================
# Import dmod functions and macros
# ======================================================================
set(DMOD_DIR ${dmod_SOURCE_DIR} CACHE PATH "DMOD source directory")
include(${DMOD_DIR}/paths.cmake)
dmod_setup_external_module()
# ======================================================================
# Fetch DMOD File System Interface
# ======================================================================
FetchContent_Declare(
dmfsi
GIT_REPOSITORY
https://github.com/choco-technologies/dmfsi.git
GIT_TAG master
)
FetchContent_MakeAvailable(dmfsi)
# ======================================================================
# DMFFS Module Configuration
# ======================================================================
# Name of the module
set(DMOD_MODULE_NAME dmffs)
# Version is already set above and used in project()
# No need to set it again here
# Author (should be string)
set(DMOD_AUTHOR_NAME Patryk Kubiak)
# Stack size for the module (should be integer)
set(DMOD_STACK_SIZE 1024)
#
# dmod_add_library - create a library module
# it has the same signature as add_library
# and can be used in the same way after the creation
# (for example, to link libraries)
#
dmod_add_library(${DMOD_MODULE_NAME} ${DMOD_MODULE_VERSION}
# List of source files - can include C and C++ files
src/dmffs.c
)
target_include_directories(${DMOD_MODULE_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
# Link to DMFSI interface
target_link_libraries(${DMOD_MODULE_NAME} dmfsi_if)
# ======================================================================
# make_dmffs Application
# ======================================================================
# Add make_dmffs application
dmod_add_executable(make_dmffs ${DMOD_MODULE_VERSION}
apps/make_dmffs/make_dmffs.c
)
target_include_directories(make_dmffs PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)