From b2abb2f860106808c9b60218221740d3a8f4c1d2 Mon Sep 17 00:00:00 2001 From: plexil-bh Date: Thu, 23 Jun 2022 13:57:52 -0700 Subject: [PATCH 1/3] Bring CMake to top-level directory --- .gitattributes | 3 ++ .gitignore | 1 + CMakeLists.txt | 74 ++++++++++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 45 +--------------------------- 4 files changed, 79 insertions(+), 44 deletions(-) create mode 100644 .gitattributes create mode 100644 CMakeLists.txt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..e940cf0a8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.sh -crlf +*.ac -crlf +*.am -crlf \ No newline at end of file diff --git a/.gitignore b/.gitignore index f25705f18..d15a013fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ bin include +plexil-build # Emacs backup file names *~ \#*# diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..03bef77df --- /dev/null +++ b/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f2d5483c0..a32f00f56 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 @@ -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 # From 8e02a7211436415a634cdd2879e1ba7921d8c786 Mon Sep 17 00:00:00 2001 From: plexil-bh Date: Wed, 29 Jun 2022 12:26:38 -0700 Subject: [PATCH 2/3] Modified ReadMe as the source dir is now PLEXIL_HOME --- README | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README b/README index 01a2cad84..c90237cb4 100644 --- a/README +++ b/README @@ -152,16 +152,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. From 6a683c3ced0494de7064662efb69b8da70f4013c Mon Sep 17 00:00:00 2001 From: Michael Dalal Date: Wed, 6 Jul 2022 16:31:58 -0700 Subject: [PATCH 3/3] Clarified cmake vs GNU make builds a bit --- README | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README b/README index c90237cb4..8d2bb7fbe 100644 --- a/README +++ b/README @@ -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. @@ -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,