forked from nasa/fprime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment-CMakeLists.txt.template
106 lines (103 loc) · 3.63 KB
/
deployment-CMakeLists.txt.template
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
103
104
105
106
####
# Deployment 'CMakeLists.txt':
#
# fprime deployments setup the most basic CMake settings, include the F prime build system, and
# list deployment specific modules. In one or more of these deployment modules, executables should
# be registered using `register_fprime_executable`. This is usually done in a `Top` module, but not
# strictly required.
#
# To create a deployment, create a `CMakeLists.txt` file following this template structure in a
# directory. This `CMakeLists.txt` is buildable as part of CMake. Thus, the user can build the
# deployment using the following commands. Unless building unit tests, these commands are the
# recommended way of building F prime projects.
#
# **Build Commands**
# ```
# mkdir build_dir
# cd build_dir
# cmake <path to deployment CMakeLists.txt>
# ```
#
# This file can be constructed in three sections.
#
# ### Section 1: Setup the Basic CMake Infrastructure ###
#
# Section 1 sets up the basic CMake infrastructure. This infrastructure configures CMake by setting
# the minimum setup for a CMake project. This requires calling several CMake functions, and setting
# a CMake variable.
#
# First, the user must call `project` to setup the project and default deployment executable name.
# Also the project languages "C" and "CXX" (C++) must be supplied.
#
# Next, call `cmake_minimum_required` and set VERSION to 3.16 or greater.
#
# **Example:**
# ```
# project(Ref C CXX)
# cmake_minimum_required(VERSION 3.16)
# ```
#
# ### Section 2: Include F prime Core Build System
#
# This section includes the `cmake/FPrime.cmake` file from the root of the F prime library.
#
# **Example:**
# ```
# include("${CMAKE_CURRENT_LIST_DIR}/../cmake/FPrime.cmake")
# include("${CMAKE_CURRENT_LIST_DIR}/../cmake/FPrime-Code.cmake")
# ```
# **Note:** if custom targets are desired, then they should be registered between the two includes.
#
# ### Section 3: Include Modules and Topologies
#
# The last section is to include all the modules that are specific to this deployment. This uses
# the `add_fprime_subdirectory` function to help with adding F prime deployment modules and
# keeping the F prime import structure correct.
#
# **Note:** Topology directories are included here.
#
# **Example:**
# ```
# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PingReceiver/")
# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RecvBuffApp/")
# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SendBuffApp/")
# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SignalGen/")
# # Add Topology subdirectory
# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Top/")
# ```
####
##
# Section 1: Basic Project Setup
#
# This contains the basic project information. Specifically, a cmake version and
# project definition.
# Step 1: set <OPTIONAL>
##
project(<OPTIONAL> C CXX)
cmake_minimum_required(VERSION 3.16)
# Optional: set CMake build type
##
# Section 2: F prime Core
#
# This includes all of the F prime core components, and imports the make-system. F prime core
# components will be placed in the 'F-Prime' binary subdirectory to keep them from
# colliding with deployment specific items.
#
# Step 2: set `<PATH-TO>`. Usually this is `${CMAKE_CURRENT_LIST_DIR}`
##
include("<PATH-TO>/cmake/FPrime.cmake")
#NOTE: add custom targets here
include("<PATH-TO>/cmake/FPrime-Code.cmake")
##
# Section 3: Components and Topology
#
# This section includes deployment specific directories. This allows use of non-
# core components in the topology, which is also added here.
#
# Step 4: include all the subdirectories.
##
# Add component subdirectories
add_fprime_subdirectory("<PATH-TO-MODULE>")
add_fprime_subdirectory("<PATH-TO-MODULE>")
...
add_fprime_subdirectory("<PATH-TO-TOP>")