Skip to content

Commit

Permalink
Pull request #41: Bring CMake to top-level directory
Browse files Browse the repository at this point in the history
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
  • Loading branch information
plexil-bh authored and Fry, Charles R. {Chuck} (ARC-TI)[KBR Wyle Services, LLC] committed Jul 12, 2022
2 parents cde7d07 + 6a683c3 commit df7bd4f
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 49 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.sh -crlf
*.ac -crlf
*.am -crlf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin
include
plexil-build
# Emacs backup file names
*~
\#*#
Expand Down
74 changes: 74 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
## Copyright (c) 2006-2022, Universities Space Research Association (USRA).
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are met:
## * Redistributions of source code must retain the above copyright
## notice, this list of conditions and the following disclaimer.
## * Redistributions in binary form must reproduce the above copyright
## notice, this list of conditions and the following disclaimer in the
## documentation and/or other materials provided with the distribution.
## * Neither the name of the Universities Space Research Association nor the
## names of its contributors may be used to endorse or promote products
## derived from this software without specific prior written permission.
##
## THIS SOFTWARE IS PROVIDED BY USRA ``AS IS'' AND ANY EXPRESS OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
## DISCLAIMED. IN NO EVENT SHALL USRA BE LIABLE FOR ANY DIRECT, INDIRECT,
## INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
## BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
## OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
## TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
## USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cmake_minimum_required(VERSION 3.6 FATAL_ERROR)

# explicitly set certain policies
cmake_policy(VERSION 3.6)

project(Plexil
DESCRIPTION "An executive for the PLEXIL language"
LANGUAGES CXX C)

# cmake modules
include(CMakeDependentOption)
include(ExternalProject)
include(GNUInstallDirs)

#
# Options
#

#
# How to build it
option(BUILD_SHARED_LIBS "Build shared instead of static libraries" ON)
#
# What to build
option(UNIVERSAL_EXEC "Build the universalExec application" ON)
option(TEST_EXEC "Build the TestExec application" ON)
option(UDP_ADAPTER "Build adapter for interfacing via UDP" OFF)
option(PLAN_DEBUG_LISTENER "Build the PlanDebugListener module" ON)
option(VIEWER_LISTENER "Build interface for Plexil Viewer" ON)
option(GANTT_LISTENER "Build interface for GANTT chart generator (deprecated)" OFF)
#
# Not strictly exec code
option(STANDALONE_SIMULATOR "Build the StandAloneSimulator application" OFF)
option(MODULE_TESTS "Build unit test executables for submodules" OFF)

#
# Implementation choices
option(POSIX_TIME "Use standard POSIX time functions" ON)
option(JAVA_NATIVE_INTERFACE "Support for calling PlexilExec from Java" OFF)
option(DEBUG_MESSAGES "Support for tracing internals at runtime" ON)

# Dependent options
CMAKE_DEPENDENT_OPTION(IPC_ADAPTER "Build TCA-IPC and adapter for interapp comms" ON
"NOT STANDALONE_SIMULATOR" ON)
CMAKE_DEPENDENT_OPTION(POSIX_THREADS "Include POSIX threading support" ON
"NOT IPC_ADAPTER; NOT UNIVERSAL_EXEC" ON)

# set PlexilExec_SOURCE_DIR to the src subdirectory
set(PlexilExec_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
add_subdirectory(src)
21 changes: 16 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ software:
* gcc/g++, clang/clang++, or other C99 and C++03 compliant compilers
* Java 8 or newer JDK (e.g. openjdk-11-jdk)
* Apache ant, including the antlr module
* cmake 3.6 or newer (only for cmake build)

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

The entire PLEXIL software suite can be built using GNU Make and
related tools, and these instructions use this approach.

Parts of the PLEXIL suite can be build with cmake, instructions for
which are further below.

To build the PLEXIL distribution:

1. To build everything, including the robosim and sample-app examples,
Expand Down Expand Up @@ -152,16 +159,20 @@ not recommended.
mkdir plexil-build
cd plexil-build

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

cmake "path/to/plexil/src" -DCMAKE_INSTALL_PREFIX="/install/here" ... options ...
cmake -DCMAKE_INSTALL_PREFIX=. other_options ..

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

cmake path/to/plexil/src -DCMAKE_INSTALL_PREFIX="$PLEXIL_HOME" \
cmake -S "$PLEXIL_HOME" -DCMAKE_INSTALL_PREFIX="$PLEXIL_HOME" \
-DGANTT_LISTENER=ON -DSTANDALONE_SIMULATOR=ON -DTEST_EXEC=ON -DUDP_ADAPTER=ON

Please see the CAVEATS file in this directory for advice on CMake options.
Expand Down
45 changes: 1 addition & 44 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Copyright (c) 2006-2020, Universities Space Research Association (USRA).
## Copyright (c) 2006-2022, Universities Space Research Association (USRA).
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
Expand All @@ -23,49 +23,6 @@
## TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
## USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cmake_minimum_required(VERSION 3.6 FATAL_ERROR)

project(PlexilExec
DESCRIPTION "An executive for the PLEXIL language"
LANGUAGES CXX C)

# cmake modules
include(CMakeDependentOption)
include(ExternalProject)
include(GNUInstallDirs)

#
# Options
#

#
# How to build it
option(BUILD_SHARED_LIBS "Build shared instead of static libraries" ON)
#
# What to build
option(UNIVERSAL_EXEC "Build the universalExec application" ON)
option(TEST_EXEC "Build the TestExec application" ON)
option(UDP_ADAPTER "Build adapter for interfacing via UDP" OFF)
option(PLAN_DEBUG_LISTENER "Build the PlanDebugListener module" ON)
option(VIEWER_LISTENER "Build interface for Plexil Viewer" ON)
option(GANTT_LISTENER "Build interface for GANTT chart generator (deprecated)" OFF)
#
# Not strictly exec code
option(STANDALONE_SIMULATOR "Build the StandAloneSimulator application" OFF)
option(MODULE_TESTS "Build unit test executables for submodules" OFF)

#
# Implementation choices
option(POSIX_TIME "Use standard POSIX time functions" ON)
option(JAVA_NATIVE_INTERFACE "Support for calling PlexilExec from Java" OFF)
option(DEBUG_MESSAGES "Support for tracing internals at runtime" ON)

# Dependent options
CMAKE_DEPENDENT_OPTION(IPC_ADAPTER "Build TCA-IPC and adapter for interapp comms" ON
"NOT STANDALONE_SIMULATOR" ON)
CMAKE_DEPENDENT_OPTION(POSIX_THREADS "Include POSIX threading support" ON
"NOT IPC_ADAPTER; NOT UNIVERSAL_EXEC" ON)

#
# Create plexil-config.h from platform characteristics and options
#
Expand Down

0 comments on commit df7bd4f

Please sign in to comment.