-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jake Hageman
committed
May 3, 2019
1 parent
19e84d3
commit 2661d19
Showing
260 changed files
with
217,941 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
########################################################################## | ||
# | ||
# Core Flight Software Mission top-level CMake build script | ||
# This will build cFS for all target machine(s) defined by the mission | ||
# | ||
# Note that the target CPUs may use different architectures, therefore each | ||
# architecture must be done as a separate sub-build since none of the binaries | ||
# can be shared. | ||
# | ||
# This is actually two build scripts in one: | ||
# - A "top-level" script which divides the overall build by architecture | ||
# (This is run when TARGETSYSTEM is unset) | ||
# - An architecture-specific build that generates the binaries | ||
# (This is run when TARGETSYSTEM is set) | ||
# | ||
# This file implements the common operation sequence between the mission build | ||
# and the architecture-specific sub build. It relies on several functions | ||
# that are implemented in a separate include files: | ||
# | ||
# initialize_globals: | ||
# This function sets up the basic global variables such as MISSION_SOURCE_DIR, | ||
# MISSIONCONFIG, ENABLE_UNIT_TESTS, SIMULATION and others. These are the | ||
# basic variables that must exist _before_ the mission configuration is read. | ||
# | ||
# read_targetconfig: | ||
# Parse the information from targets.cmake and create the build lists. Note | ||
# this function is common to both mission and arch-specific builds. | ||
# | ||
# prepare: | ||
# Use the information in the target config to set up additional variables | ||
# and satisfy any preequisites for targets. Most importantly this stage | ||
# is reposible for finding the actual location of all source files for apps | ||
# listed in the mission configuration, along with collecting any supplemental | ||
# sources, such as EDS files or additional compiler flags. | ||
# | ||
# process_arch: | ||
# This is called multiple times, once for each CPU architecture specfied in | ||
# the main targets.cmake file. At the mission level, this creates a sub | ||
# project target using the correct toolchain for cross compile. In the arch | ||
# specific level (inside the sub-project) it generates the actual library and | ||
# executable targets. | ||
# | ||
# | ||
########################################################################## | ||
|
||
# Squelch a warning when building on Win32/Cygwin | ||
set(CMAKE_LEGACY_CYGWIN_WIN32 0) | ||
|
||
# The minimum CMake version is chosen because 2.6.4 is what is | ||
# included by default with RHEL/Centos 5.x | ||
cmake_minimum_required(VERSION 2.6.4) | ||
|
||
# This top-level file does not define ANY targets directly but we know | ||
# that the subdirectories will at least use the "C" language, so | ||
# indicate that now. Doing this early initializes the CFLAGS | ||
# so they won't change later. | ||
project(CFETOP C) | ||
|
||
# Allow unit tests to be added by any recipe | ||
enable_testing() | ||
|
||
# Include the global routines | ||
include("cmake/global_functions.cmake") | ||
|
||
# Load a sub-script that defines the other functions, | ||
# depending on whether TARGETSYSTEM is defined or not | ||
if (TARGETSYSTEM) | ||
# Arch-specific/CPU build mode -- use the "arch_build" implementation | ||
include("cmake/arch_build.cmake") | ||
else (TARGETSYSTEM) | ||
# Host System/Top Level build mode -- use the "mission_build" implementation | ||
include("cmake/mission_build.cmake") | ||
endif (TARGETSYSTEM) | ||
|
||
# Call the initialization function defined by the sub-script | ||
# This is implemented differently depending on whether this is a | ||
# top-level or arch-specific build | ||
initialize_globals() | ||
|
||
# Load the target configuration information (used by all builds) | ||
# This is at the top level so all vars set in here will become globals. | ||
include(${MISSION_DEFS}/targets.cmake) | ||
|
||
# Scan the list of targets and organize by target system type. | ||
read_targetconfig() | ||
|
||
# Define preprocessor directive(s) which can be used to | ||
# gate conditionally compiled code when using these CMake scripts. | ||
# Macro defined here at the topmost level will be defined in all targets | ||
# on all processors. These macros can preserve compatibility with the old makefiles | ||
# such that the code can still be built using the old method without the new features. | ||
add_definitions("-D_ENHANCED_BUILD_") | ||
|
||
# Call the prepare function defined by the sub-script | ||
# This is implemented differently depending on whether this is a | ||
# top-level or arch-specific build | ||
prepare() | ||
|
||
# Call the process_arch macro for each architecture | ||
foreach(SYSVAR ${TGTSYS_LIST}) | ||
process_arch(${SYSVAR}) | ||
endforeach(SYSVAR IN LISTS TGTSYS_LIST) | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# | ||
# Core Flight Software CMake / GNU make wrapper | ||
# | ||
# ABOUT THIS MAKEFILE: | ||
# This is actually part of the CMake alternative build system. | ||
# It is a GNU-make wrapper that calls the CMake tools appropriately | ||
# so that setting up a new build is fast and easy with no need to | ||
# learn the CMake commands. It also makes it easier to integrate | ||
# the build with IDE tools such as Eclipse by providing a default | ||
# makefile that has the common targets such as all/clean/etc. | ||
# | ||
# Use of this file is optional. | ||
# | ||
# This file is intended to be placed at the TOP-MOST level of the mission | ||
# source tree, i.e. a level above "cfe". Note this is outside the cfe | ||
# repository which is why it cannot be delivered directly in place. | ||
# To use it, simply copy it to the top directory. As this just contains | ||
# wrappers for the CMake targets, it is unlikely to change. Projects | ||
# are also free to customize this file and add their own targets after | ||
# copying it to the top of the source tree. | ||
# | ||
# For _ALL_ targets defined in this file the build tree location may | ||
# be specified via the "O" variable (i.e. make O=<my-build-dir> all). | ||
# If not specified then the "build" subdirectory will be assumed. | ||
# | ||
# This wrapper defines the following major targets: | ||
# prep -- Runs CMake to create a new or re-configure an existing build tree | ||
# Note that multiple build trees can exist from a single source | ||
# Other control options (such as "SIMULATION") may be passed to CMake via | ||
# make variables depending on the mission build scripts. These will be | ||
# cached in the build tree so they do not need to be set again thereafter. | ||
# | ||
# all -- Build all targets in the CMake build tree | ||
# | ||
# install -- Copy all files to the installation tree and run packaging scripts | ||
# The "DESTDIR" environment variable controls where the files are copied | ||
# | ||
# clean -- Clean all targets in the CMake build tree, but not the build tree itself. | ||
# | ||
# distclean -- Entirely remove the build directory specified by "O" | ||
# Note that after this the "prep" step must be run again in order to build. | ||
# Use caution with this as it does an rm -rf - don't set O to your home dir! | ||
# | ||
# doc -- Build all doxygen source documentation. The HTML documentation will be | ||
# generated under the build tree specified by "O". | ||
# | ||
# test -- Run all unit tests defined in the build. Unit tests will typically only | ||
# be executable when building with the "SIMULATION=native" option. Otherwise | ||
# it is up to the user to copy the executables to the target and run them. | ||
# | ||
# lcov -- Runs the "lcov" tool on the build tree to collect all code coverage | ||
# analysis data and build the reports. Code coverage data may be output by | ||
# the "make test" target above. | ||
# | ||
|
||
# Establish default values for critical variables. Any of these may be overridden | ||
# on the command line or via the make environment configuration in an IDE | ||
O ?= build | ||
ARCH ?= native | ||
BUILDTYPE ?= debug | ||
INSTALLPREFIX ?= /exe | ||
DESTDIR ?= $(O) | ||
|
||
# The "DESTDIR" variable is a bit more complicated because it should be an absolute | ||
# path for CMake, but we want to accept either absolute or relative paths. So if | ||
# the path does NOT start with "/", prepend it with the current directory. | ||
ifeq ($(filter /%, $(DESTDIR)),) | ||
DESTDIR := $(CURDIR)/$(DESTDIR) | ||
endif | ||
|
||
# The "LOCALTGTS" defines the top-level targets that are implemented in this makefile | ||
# Any other target may also be given, in that case it will simply be passed through. | ||
LOCALTGTS := doc prep all clean install distclean test lcov | ||
OTHERTGTS := $(filter-out $(LOCALTGTS),$(MAKECMDGOALS)) | ||
|
||
# As this makefile does not build any real files, treat everything as a PHONY target | ||
# This ensures that the rule gets executed even if a file by that name does exist | ||
.PHONY: $(LOCALTGTS) $(OTHERTGTS) | ||
|
||
# If the target name appears to be a directory (ends in /), do a make all in that directory | ||
DIRTGTS := $(filter %/,$(OTHERTGTS)) | ||
ifneq ($(DIRTGTS),) | ||
$(DIRTGTS): | ||
$(MAKE) -C $(O)/$(patsubst $(O)/%,%,$(@)) all | ||
endif | ||
|
||
# For any other goal that is not one of the known local targets, pass it to the arch build | ||
# as there might be a target by that name. For example, this is useful for rebuilding | ||
# single unit test executable files while debugging from the IDE | ||
FILETGTS := $(filter-out $(DIRTGTS),$(OTHERTGTS)) | ||
ifneq ($(FILETGTS),) | ||
$(FILETGTS): | ||
$(MAKE) -C $(O)/$(ARCH) $(@) | ||
endif | ||
|
||
# The "prep" step requires extra options that are specified via enviroment variables. | ||
# Certain special ones should be passed via cache (-D) options to CMake. | ||
# These are only needed for the "prep" target but they are computed globally anyway. | ||
PREP_OPTS := | ||
|
||
ifneq ($(INSTALLPREFIX),) | ||
PREP_OPTS += -DCMAKE_INSTALL_PREFIX=$(INSTALLPREFIX) | ||
endif | ||
|
||
ifneq ($(VERBOSE),) | ||
PREP_OPTS += --trace | ||
endif | ||
|
||
ifneq ($(BUILDTYPE),) | ||
PREP_OPTS += -DCMAKE_BUILD_TYPE=$(BUILDTYPE) | ||
endif | ||
|
||
all: | ||
$(MAKE) --no-print-directory -C "$(O)" mission-all | ||
|
||
install: | ||
$(MAKE) --no-print-directory -C "$(O)" DESTDIR="$(DESTDIR)" mission-install | ||
|
||
prep $(O)/.prep: | ||
mkdir -p "$(O)" | ||
(cd "$(O)/$(BUILDDIR)" && cmake $(PREP_OPTS) "$(CURDIR)/cfe") | ||
echo "$(PREP_OPTS)" > "$(O)/.prep" | ||
|
||
clean: | ||
$(MAKE) --no-print-directory -C "$(O)" mission-clean | ||
|
||
distclean: | ||
rm -rf "$(O)" | ||
|
||
test: | ||
(cd $(O)/$(ARCH) && ctest -O ctest.log) | ||
|
||
lcov: | ||
lcov --capture --directory $(O)/$(ARCH) --output-file $(O)/$(ARCH)/coverage.info | ||
genhtml $(O)/$(ARCH)/coverage.info --output-directory $(O)/$(ARCH)/lcov | ||
@/bin/echo -e "\n\nCoverage Report Link: file:$(CURDIR)/$(O)/$(ARCH)/lcov/index.html\n" | ||
|
||
doc: | ||
$(MAKE) --no-print-directory -C "$(O)" mission-doc | ||
@/bin/echo -e "\n\nDetail Design: \nfile:https://$(CURDIR)/$(O)/doc/detaildesign/html/index.html\n" | ||
|
||
usersguide: | ||
$(MAKE) --no-print-directory -C "$(O)" cfe-usersguide | ||
@/bin/echo -e "\n\ncFE Users Guide: \nfile:https://$(CURDIR)/$(O)/doc/users_guide/html/index.html\n" | ||
|
||
# Make all the commands that use the build tree depend on a flag file | ||
# that is used to indicate the prep step has been done. This way | ||
# the prep step does not need to be done explicitly by the user | ||
# as long as the default options are sufficient. | ||
$(filter-out prep distclean,$(LOCALTGTS)): $(O)/.prep | ||
|
Oops, something went wrong.