PropWare
2.1.2
C++ objects and CMake build system for Parallax Propeller
|
Click here for docs on the
develop
branch.
Be sure to check out CMake's official documentation at cmake.org. Remember that PropWare requires CMake 3.3+.
project(HelloWorld)
. This name can be anything you'd like so long as there is no whitespace.create_simple_executable(${PROJECT_NAME} main.cpp)
. The first parameter (${PROJECT_NAME}
) is the name of your executable. Generally, I use the project name (${PROJECT_NAME}
is an automatically-created CMake variable which, in this case, would resolve to HelloWorld
), but it can be what you'd like, so long as there is no whitespace. Next, simply list off each of your source files (separated by whitespace).Let's take the example of a phony project for a Quadcopter. We're using Parallax's Quickstart development board, the compressed-memory-model, and our code must be compiled with size optimizations. Our project consists of the following files:
Our CMakeLists.txt file might look something like this:
BOARD
variable can be used to identify your physical hardware. PropGCC uses this to determine how many bytes of EEPROM, default baud rate for RS232, and other functions. Any board available in SimpleIDE is available here as well - they are reading from the same configuration pool (<PropGCC root>/propeller-load
).lmm
] This option should be one of cog
, cmm
, lmm
, xmm-single
, xmm-split
, or xmmc
. Read more about PropGCC's memory models here.COMMON_FLAGS
variable will be applied to assembly, C and C++ files. This includes cogc
, ecogc
, cogcpp
, and ecogcpp
but not Spin
.CMake will default to enabling only C and C++ in your project. If your project uses more than these two languages, you must add them with either the project or enable_language function.
create_simple_executable
function. It is a wrapper around add_executable that sets various configuration options for the Propeller and PropGCC build system. The parameters to this function match those of add_executable.Flags applied to all PropGCC languages
Flags applied to COGC, ECOGC, COGCXX, and ECOGXX
Compilation flags used for a specific language.
[default: lmm
]
This option should be one of cog
, cmm
, lmm
, xmm-single
, xmm-split
, or xmmc
. Read more about PropGCC's memory models here.
Used to identify your physical hardware. PropGCC uses this to determine how many bytes of EEPROM, default baud rate for RS232, and other functions. Any board available in SimpleIDE is available here as well - they are reading from the same configuration pool (<PropGCC root>/propeller-load
).
CMake options allow you to have fine-grain control over what compilation flags are used by default. Most users will want to leave all options set to their default values, but those doing special projects or using conflicting libraries can change the options to suit their needs.
[default: ON]
Sets the optimization level for size. Equivalent to adding "-Os" to COMMON_FLAGS
.
[default: ON]
Turns on all warnings from the compiler. Aids in writing clean, error-free code. Equivalent to adding "-Wall" to COMMON_FLAGS
.
[default: ON]
Sets all variables of type double
to use IEEE 32-bit floating point instead of 64. Equivalent to adding "-m32bit-doubles" to COMMON_FLAGS
. Required for compatibility with numerous functions in the Simple library.
[default: ON]
Sets the C standard to C99. Equivalent to adding "-std=c99" to C_FLAGS
[default: ON]
Sets the C++ standard to the latest available for the compiler. This is gnu++0x
in GCC 4.6.1 (current PropGCC) and gnu++14
in GCC5 version of PropGCC. Equivalent to adding "-std=<standard>" to CXX_FLAGS
.
With all options left at their defaults, the following flags will be used. There is currently no option to disable -fno-threadsafe-statics -fno-rtti
. If such an option is required, let the author know and an option will be added. It is believed that these flags will always be desired by Propeller users.
-Wall -Os -m32bit-doubles -std=c99
-Wall -Os -m32bit-doubles -std=c99 -mcog -xc -r
-Wall -Os -m32bit-doubles -std=c99 -mcog -xc -r
-Wall -Os -m32bit-doubles -std=gnu++0x -fno-threadsafe-statics -fno-rtti
-Wall -Os -m32bit-doubles -std=gnu++0x -fno-threadsafe-statics -fno-rtti -mcog -xc++ -r
-Wall -Os -m32bit-doubles -std=gnu++0x -fno-threadsafe-statics -fno-rtti -mcog -xc++ -r
cr