Skip to content

Commit

Permalink
Replace Java based compiler with a Bison based one
Browse files Browse the repository at this point in the history
Add support for a large part of the IDL4 language specification, including
support for (builtin) annotations, correct evaluation of constant expressions
and compiler directives.

 * Compiler written as a framework from the get-go. Components can be
   linked and used independently.
   * Preprocessing is taken care off by idlpp (fork of the excellent mcpp), a
     portable C preprocessor that implements all of C90, C99 and
     C++98 specifications. (not exported as a target)
   * Parsing the interface definition language and compiler directives is
     taken care off by libidl, a library that is consumed by the compiler and
     exported as a target itself. libidl provides a platform and locale
     agnostic, thread-safe parser and utilities to consume the resulting
     syntax tree.
   * Compilation is deferred to generators by the compiler. Generators receive
     the syntax tree from the compiler and transform it into type support and
     serialization code. Generators are plugins (dynamic libraries), that can
     register custom command line options and builtin annotations as desired,
     so they can reside in the repositor of the target language.
 * Removes build-time dependencies on Java and Maven.
 * Removes runtime dependencies on Java, ANTLR3 and ANTLR4.

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
  • Loading branch information
k0ekk0ek committed Mar 23, 2021
1 parent 92e652b commit 697c985
Show file tree
Hide file tree
Showing 179 changed files with 16,986 additions and 17,764 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Expand Up @@ -177,17 +177,13 @@ windows1809_vs2017: &windows1809_vs2017
else
eval "export GENERATOR='Visual Studio 15 2017'"
fi
- JAVA_HOME=$(find "/c/Program Files/Android/jdk/" -name "*openjdk*" | sort | head -n 1)
- export JAVA_HOME
- export PATH="${PATH}:${JAVA_HOME}/bin"
# Windows targets in Travis are still very much in beta and Python is not yet
# available and installation of Python through Chocolaty does not work well.
# The real fix is to wait until Python and pip are both available on the
# target. Until then download Conan from the official website and simply add
# the extracted folder to the path.
install:
- choco install innoextract
- choco install maven --ignore-dependencies
- choco install winflexbison3
- wget -q https://dl.bintray.com/conan/installers/conan-win-64_1_34_0.exe
- innoextract conan-win-64_1_34_0.exe
Expand Down
7 changes: 0 additions & 7 deletions CMakeLists.txt
Expand Up @@ -49,14 +49,7 @@ string(REPLACE " " "-" PROJECT_NAME_DASHED "${PROJECT_NAME_FULL}")
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_CAPS)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_SMALL)

# By default the Java-based components get built, but make it possible to disable that: if only the
# core library is required, there's no need to build them, and that in turn eliminates the Maven and
# JDK dependency.
option(BUILD_IDLC "Build IDL preprocessor" ON)
if(BUILD_IDLC STREQUAL "AUTO")
find_package(Maven 3.0 QUIET)
set(BUILD_IDLC ${Maven_FOUND})
endif()

set(CMAKE_C_STANDARD 99)
if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
Expand Down
18 changes: 5 additions & 13 deletions README.md
Expand Up @@ -25,19 +25,11 @@ In order to build Cyclone DDS you need a Linux, Mac or Windows 10 machine (or, w
* [OpenSSL](https://www.openssl.org/), preferably version 1.1 or later if you want to use TLS over
TCP. You can explicitly disable it by setting ``ENABLE_SSL=NO``, which is very useful for
reducing the footprint or when the FindOpenSSL CMake script gives you trouble;
* Java JDK, version 8 or later, e.g., [OpenJDK](https://jdk.java.net/);
* [Apache Maven](https://maven.apache.org/download.cgi), version 3.5 or later.

On Ubuntu ``apt install maven default-jdk`` should do the trick for getting Java and Maven
installed, and the rest should already be there. On Windows, installing chocolatey and ``choco
install git cmake openjdk maven`` should get you a long way. On macOS, ``brew install maven cmake``
and downloading and installing the JDK is easiest.

The only Java-based component is the IDL preprocessor. The run-time
libraries are pure C code, so there is no need to have Java available on "target"
machines. If desired, it is possible to do a build without Java or Maven installed by
defining ``BUILD_IDLC=NO``, but that effectively only gets you the core library. For the
current [ROS 2 RMW layer](https://github.com/ros2/rmw_cyclonedds), that is sufficient.
* [Bison](https://www.gnu.org/software/bison/) parser generator.

On Ubuntu ``apt install bison`` should do the trick for getting Bison installed, and the rest should
already be there. On Windows, installing chocolatey and ``choco install winflexbison3`` should get
you a long way. On macOS, ``brew install bison`` is easiest.

To obtain Eclipse Cyclone DDS, do

Expand Down
83 changes: 0 additions & 83 deletions cmake/Modules/FindMaven.cmake

This file was deleted.

37 changes: 0 additions & 37 deletions cmake/Modules/ListJoin.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/Modules/Packaging/PackageConfig.cmake.in
Expand Up @@ -16,7 +16,7 @@ option("@PROJECT_NAME@_IDLC_ALWAYS" "Should we include idlc even if the user did

set("@PROJECT_NAME@_idlc_FOUND" FALSE)
if ("idlc" IN_LIST "@PROJECT_NAME@_FIND_COMPONENTS" OR "@PROJECT_NAME@_IDLC_ALWAYS")
include("${CMAKE_CURRENT_LIST_DIR}/idlc/IdlcGenerate.cmake" OPTIONAL RESULT_VARIABLE _IdlcGenerate)
include("${CMAKE_CURRENT_LIST_DIR}/idlc/Generate.cmake" OPTIONAL RESULT_VARIABLE _IdlcGenerate)
if(NOT _IdlcGenerate STREQUAL "NOTFOUND")
set("@PROJECT_NAME@_idlc_FOUND" TRUE)
endif()
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/debugging.md
Expand Up @@ -44,7 +44,7 @@ $ add-apt-repository ppa:ubuntu-toolchain-r/test
$ echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main" >> /etc/apt/sources.list.d/llvm-toolchain-6.0.list
$ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
$ apt-get update
$ apt-get install gcc-8 g++-8 clang-6.0 oracle-java8-set-default maven
$ apt-get install gcc-8 g++-8 clang-6.0 bison
```

4. Switch to the *travis* user.
Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/CMakeLists.export
Expand Up @@ -9,7 +9,7 @@ find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_D
# that will supply a library target related the the given idl file.
# In short, it takes the idl file, generates the source files with
# the proper data types and compiles them into a library.
idlc_generate(HelloWorldData_lib "HelloWorldData.idl")
idlc_generate(TARGET HelloWorldData_lib FILES "HelloWorldData.idl")

# Both executables have only one related source file.
add_executable(HelloworldPublisher publisher.c)
Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/CMakeLists.txt
Expand Up @@ -9,7 +9,7 @@
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
idlc_generate(HelloWorldData_lib "HelloWorldData.idl")
idlc_generate(TARGET HelloWorldData_lib FILES "HelloWorldData.idl")

add_executable(HelloworldPublisher publisher.c)
add_executable(HelloworldSubscriber subscriber.c)
Expand Down
2 changes: 1 addition & 1 deletion examples/roundtrip/CMakeLists.export
Expand Up @@ -20,7 +20,7 @@ find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_D
# that will supply a library target related the the given idl file.
# In short, it takes the idl file, generates the source files with
# the proper data types and compiles them into a library.
idlc_generate(RoundTrip_lib RoundTrip.idl)
idlc_generate(TARGET RoundTrip_lib FILES RoundTrip.idl)

# Both executables have only one related source file.
add_executable(RoundtripPing ping.c)
Expand Down
2 changes: 1 addition & 1 deletion examples/roundtrip/CMakeLists.txt
Expand Up @@ -9,7 +9,7 @@
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
idlc_generate(RoundTrip_lib RoundTrip.idl)
idlc_generate(TARGET RoundTrip_lib FILES RoundTrip.idl)

add_executable(RoundtripPing ping.c)
add_executable(RoundtripPong pong.c)
Expand Down
2 changes: 1 addition & 1 deletion examples/throughput/CMakeLists.txt
Expand Up @@ -9,7 +9,7 @@
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
idlc_generate(Throughput_lib Throughput.idl)
idlc_generate(TARGET Throughput_lib FILES Throughput.idl)

add_executable(ThroughputPublisher publisher.c)
add_executable(ThroughputSubscriber subscriber.c)
Expand Down
3 changes: 1 addition & 2 deletions scripts/docker/Dockerfile
Expand Up @@ -13,7 +13,6 @@ FROM ubuntu:bionic
# Dependencies required to build cyclonedds
RUN apt update && apt install -y \
cmake \
default-jdk \
maven \
bison \
g++

10 changes: 2 additions & 8 deletions src/CMakeLists.txt
Expand Up @@ -82,14 +82,8 @@ endif()

configure_file(features.h.in "${CMAKE_CURRENT_BINARY_DIR}/core/include/dds/features.h")

add_subdirectory(tools)
add_subdirectory(ddsrt)

# some of the tests in the core rely on preprocessing IDL, so idlc has to
# come first
if(BUILD_IDLC)
add_subdirectory(idlc)
endif()
add_subdirectory(idl)
add_subdirectory(security)
add_subdirectory(core)
add_subdirectory(tools)
add_subdirectory(ddsts)
1 change: 1 addition & 0 deletions src/core/ddsc/CMakeLists.txt
Expand Up @@ -53,6 +53,7 @@ PREPEND(hdrs_public_ddsc "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/dd
ddsc/dds_statistics.h
ddsc/dds_rhc.h
ddsc/dds_internal_api.h
ddsc/dds_opcodes.h
)

PREPEND(hdrs_private_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
Expand Down

0 comments on commit 697c985

Please sign in to comment.