Skip to content

Commit df7bd4f

Browse files
plexil-bhFry, Charles R. {Chuck} (ARC-TI)[KBR Wyle Services, LLC]
authored andcommitted
Pull request #41: Bring CMake to top-level directory
Merge in PLEXIL/plexil from feature/PLEXIL-102 to main * commit '6a683c3ced0494de7064662efb69b8da70f4013c': Clarified cmake vs GNU make builds a bit Modified ReadMe as the source dir is now PLEXIL_HOME Bring CMake to top-level directory
2 parents cde7d07 + 6a683c3 commit df7bd4f

5 files changed

Lines changed: 95 additions & 49 deletions

File tree

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.sh -crlf
2+
*.ac -crlf
3+
*.am -crlf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
bin
22
include
3+
plexil-build
34
# Emacs backup file names
45
*~
56
\#*#

CMakeLists.txt

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
## Copyright (c) 2006-2022, Universities Space Research Association (USRA).
2+
## All rights reserved.
3+
##
4+
## Redistribution and use in source and binary forms, with or without
5+
## modification, are permitted provided that the following conditions are met:
6+
## * Redistributions of source code must retain the above copyright
7+
## notice, this list of conditions and the following disclaimer.
8+
## * Redistributions in binary form must reproduce the above copyright
9+
## notice, this list of conditions and the following disclaimer in the
10+
## documentation and/or other materials provided with the distribution.
11+
## * Neither the name of the Universities Space Research Association nor the
12+
## names of its contributors may be used to endorse or promote products
13+
## derived from this software without specific prior written permission.
14+
##
15+
## THIS SOFTWARE IS PROVIDED BY USRA ``AS IS'' AND ANY EXPRESS OR IMPLIED
16+
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17+
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
## DISCLAIMED. IN NO EVENT SHALL USRA BE LIABLE FOR ANY DIRECT, INDIRECT,
19+
## INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20+
## BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
21+
## OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
23+
## TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
24+
## USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
26+
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
27+
28+
# explicitly set certain policies
29+
cmake_policy(VERSION 3.6)
30+
31+
project(Plexil
32+
DESCRIPTION "An executive for the PLEXIL language"
33+
LANGUAGES CXX C)
34+
35+
# cmake modules
36+
include(CMakeDependentOption)
37+
include(ExternalProject)
38+
include(GNUInstallDirs)
39+
40+
#
41+
# Options
42+
#
43+
44+
#
45+
# How to build it
46+
option(BUILD_SHARED_LIBS "Build shared instead of static libraries" ON)
47+
#
48+
# What to build
49+
option(UNIVERSAL_EXEC "Build the universalExec application" ON)
50+
option(TEST_EXEC "Build the TestExec application" ON)
51+
option(UDP_ADAPTER "Build adapter for interfacing via UDP" OFF)
52+
option(PLAN_DEBUG_LISTENER "Build the PlanDebugListener module" ON)
53+
option(VIEWER_LISTENER "Build interface for Plexil Viewer" ON)
54+
option(GANTT_LISTENER "Build interface for GANTT chart generator (deprecated)" OFF)
55+
#
56+
# Not strictly exec code
57+
option(STANDALONE_SIMULATOR "Build the StandAloneSimulator application" OFF)
58+
option(MODULE_TESTS "Build unit test executables for submodules" OFF)
59+
60+
#
61+
# Implementation choices
62+
option(POSIX_TIME "Use standard POSIX time functions" ON)
63+
option(JAVA_NATIVE_INTERFACE "Support for calling PlexilExec from Java" OFF)
64+
option(DEBUG_MESSAGES "Support for tracing internals at runtime" ON)
65+
66+
# Dependent options
67+
CMAKE_DEPENDENT_OPTION(IPC_ADAPTER "Build TCA-IPC and adapter for interapp comms" ON
68+
"NOT STANDALONE_SIMULATOR" ON)
69+
CMAKE_DEPENDENT_OPTION(POSIX_THREADS "Include POSIX threading support" ON
70+
"NOT IPC_ADAPTER; NOT UNIVERSAL_EXEC" ON)
71+
72+
# set PlexilExec_SOURCE_DIR to the src subdirectory
73+
set(PlexilExec_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
74+
add_subdirectory(src)

README

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ software:
2828
* gcc/g++, clang/clang++, or other C99 and C++03 compliant compilers
2929
* Java 8 or newer JDK (e.g. openjdk-11-jdk)
3030
* Apache ant, including the antlr module
31+
* cmake 3.6 or newer (only for cmake build)
3132

3233
If you downloaded a tarball, the GNU autotools and gperf are not
3334
needed.
@@ -39,6 +40,12 @@ libxi, libxmu and their header files.
3940
How to build PLEXIL - Simple version
4041
------------------------------------
4142

43+
The entire PLEXIL software suite can be built using GNU Make and
44+
related tools, and these instructions use this approach.
45+
46+
Parts of the PLEXIL suite can be build with cmake, instructions for
47+
which are further below.
48+
4249
To build the PLEXIL distribution:
4350

4451
1. To build everything, including the robosim and sample-app examples,
@@ -152,16 +159,20 @@ not recommended.
152159
mkdir plexil-build
153160
cd plexil-build
154161

155-
2. Configure the build using CMake.
162+
2. Configure the build using CMake. Since you changed to the build directory,
163+
the source (top-level) directory can be indicated with two dots
164+
after setting up the options. You can set the install directory to the
165+
current directory using one dot, as shown in the following command.
156166

157-
cmake "path/to/plexil/src" -DCMAKE_INSTALL_PREFIX="/install/here" ... options ...
167+
cmake -DCMAKE_INSTALL_PREFIX=. other_options ..
158168

159169
The example below includes all the optional PLEXIL components as built
160170
in the previous section, with binaries and libraries installed in the
161-
PLEXIL installation directory. You can omit or change options as
162-
desired.
171+
PLEXIL installation directory. You can omit or change options as
172+
desired. You can use -S to specify the path to the source (top-level
173+
or PLEXIL_HOME) directory.
163174

164-
cmake path/to/plexil/src -DCMAKE_INSTALL_PREFIX="$PLEXIL_HOME" \
175+
cmake -S "$PLEXIL_HOME" -DCMAKE_INSTALL_PREFIX="$PLEXIL_HOME" \
165176
-DGANTT_LISTENER=ON -DSTANDALONE_SIMULATOR=ON -DTEST_EXEC=ON -DUDP_ADAPTER=ON
166177

167178
Please see the CAVEATS file in this directory for advice on CMake options.

src/CMakeLists.txt

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Copyright (c) 2006-2020, Universities Space Research Association (USRA).
1+
## Copyright (c) 2006-2022, Universities Space Research Association (USRA).
22
## All rights reserved.
33
##
44
## Redistribution and use in source and binary forms, with or without
@@ -23,49 +23,6 @@
2323
## TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2424
## USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

26-
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
27-
28-
project(PlexilExec
29-
DESCRIPTION "An executive for the PLEXIL language"
30-
LANGUAGES CXX C)
31-
32-
# cmake modules
33-
include(CMakeDependentOption)
34-
include(ExternalProject)
35-
include(GNUInstallDirs)
36-
37-
#
38-
# Options
39-
#
40-
41-
#
42-
# How to build it
43-
option(BUILD_SHARED_LIBS "Build shared instead of static libraries" ON)
44-
#
45-
# What to build
46-
option(UNIVERSAL_EXEC "Build the universalExec application" ON)
47-
option(TEST_EXEC "Build the TestExec application" ON)
48-
option(UDP_ADAPTER "Build adapter for interfacing via UDP" OFF)
49-
option(PLAN_DEBUG_LISTENER "Build the PlanDebugListener module" ON)
50-
option(VIEWER_LISTENER "Build interface for Plexil Viewer" ON)
51-
option(GANTT_LISTENER "Build interface for GANTT chart generator (deprecated)" OFF)
52-
#
53-
# Not strictly exec code
54-
option(STANDALONE_SIMULATOR "Build the StandAloneSimulator application" OFF)
55-
option(MODULE_TESTS "Build unit test executables for submodules" OFF)
56-
57-
#
58-
# Implementation choices
59-
option(POSIX_TIME "Use standard POSIX time functions" ON)
60-
option(JAVA_NATIVE_INTERFACE "Support for calling PlexilExec from Java" OFF)
61-
option(DEBUG_MESSAGES "Support for tracing internals at runtime" ON)
62-
63-
# Dependent options
64-
CMAKE_DEPENDENT_OPTION(IPC_ADAPTER "Build TCA-IPC and adapter for interapp comms" ON
65-
"NOT STANDALONE_SIMULATOR" ON)
66-
CMAKE_DEPENDENT_OPTION(POSIX_THREADS "Include POSIX threading support" ON
67-
"NOT IPC_ADAPTER; NOT UNIVERSAL_EXEC" ON)
68-
6926
#
7027
# Create plexil-config.h from platform characteristics and options
7128
#

0 commit comments

Comments
 (0)