Skip to content

Commit

Permalink
Merge pull request OpenDDS#4346 from iguessthislldo/igtd/cmake-build
Browse files Browse the repository at this point in the history
Add More Options for Getting ACE/TAO to CMake
  • Loading branch information
jrw972 authored Nov 13, 2023
2 parents fcfe7ea + 5e40713 commit 569ce6c
Show file tree
Hide file tree
Showing 9 changed files with 247 additions and 51 deletions.
4 changes: 4 additions & 0 deletions acetao.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

[ace6tao2]
version=6.5.20
repo=https://github.com/DOCGroup/ACE_TAO.git
branch=ace6tao2
url=https://github.com/DOCGroup/ACE_TAO/releases/tag/ACE%2BTAO-6_5_20
zip-filename=ACE+TAO-src-6.5.20.zip
zip-url=https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-6_5_20/ACE%2BTAO-src-6.5.20.zip
Expand All @@ -17,6 +19,8 @@ tar.bz2-md5=2551d7d445456bcb316fe5e9a4b514ea

[ace7tao3]
version=7.1.2
repo=https://github.com/DOCGroup/ACE_TAO.git
branch=master
url=https://github.com/DOCGroup/ACE_TAO/releases/tag/ACE%2BTAO-7_1_2
zip-filename=ACE+TAO-src-7.1.2.zip
zip-url=https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-7_1_2/ACE%2BTAO-src-7.1.2.zip
Expand Down
110 changes: 81 additions & 29 deletions cmake/get_ace_tao.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,8 @@ if(NOT DEFINED _OPENDDS_MPC_TYPE OR NOT DEFINED _OPENDDS_ACE_CONFIG_FILE)
"(${CMAKE_SYSTEM_NAME}/${CMAKE_GENERATOR})")
endif()

if(DEFINED OPENDDS_ACE_TAO_SRC)
if(NOT DEFINED OPENDDS_MPC)
message(FATAL_ERROR "OPENDDS_ACE_TAO_SRC requires OPENDDS_MPC to be set")
endif()
if(EXISTS "${OPENDDS_ACE_TAO_SRC}/ace/Version.h")
set(OPENDDS_ACE "${OPENDDS_ACE_TAO_SRC}" CACHE INTERNAL "")
elseif(EXISTS "${OPENDDS_ACE_TAO_SRC}/ACE/ace/Version.h")
set(OPENDDS_ACE "${OPENDDS_ACE_TAO_SRC}/ACE" CACHE INTERNAL "")
if(_OPENDDS_MPC_TYPE STREQUAL gnuace)
set(_OPENDDS_ACE_MPC_NAME_IS_ACE_TARGET TRUE CACHE INTERNAL "")
endif()
else()
message(FATAL_ERROR "Can't find ace/Version.h in OPENDDS_ACE_TAO_SRC")
endif()
if(EXISTS "${OPENDDS_ACE_TAO_SRC}/TAO/tao/Version.h")
set(OPENDDS_TAO "${OPENDDS_ACE_TAO_SRC}/TAO" CACHE INTERNAL "")
else()
message(FATAL_ERROR "Can't find tao/Version.h in OPENDDS_ACE_TAO_SRC")
endif()
message(STATUS "Using ACE/TAO at ${OPENDDS_ACE}")
else()
if(NOT DEFINED OPENDDS_ACE_TAO_SRC)
set(OPENDDS_ACE_TAO_SRC "${OPENDDS_BUILD_DIR}/ace_tao")
set(OPENDDS_ACE "${OPENDDS_ACE_TAO_SRC}" CACHE INTERNAL "")
set(OPENDDS_MPC "${OPENDDS_ACE}/MPC" CACHE INTERNAL "")
set(OPENDDS_TAO "${OPENDDS_ACE}/TAO" CACHE INTERNAL "")

file(STRINGS "${OPENDDS_SOURCE_DIR}/acetao.ini" ace_tao_ini)
unset(section)
Expand All @@ -108,15 +85,90 @@ else()
set("${section}-${name}" "${value}")
endif()
endforeach()
set(url "${ace7tao3-${ext}-url}")
set(md5 "${ace7tao3-${ext}-md5}")

message(STATUS "Getting ACE/TAO from ${url}")
if(NOT DEFINED OPENDDS_ACE_TAO_KIND)
set(OPENDDS_ACE_TAO_KIND ace7tao3)
endif()
set(url "${${OPENDDS_ACE_TAO_KIND}-${ext}-url}")
set(md5 "${${OPENDDS_ACE_TAO_KIND}-${ext}-md5}")
set(repo "${${OPENDDS_ACE_TAO_KIND}-repo}")
set(branch "${${OPENDDS_ACE_TAO_KIND}-branch}")

if(OPENDDS_ACE_TAO_GIT OR DEFINED OPENDDS_ACE_TAO_GIT_REPO OR DEFINED OPENDDS_ACE_TAO_GIT_TAG)
if(NOT DEFINED OPENDDS_MPC)
set(OPENDDS_MPC_GIT TRUE)
endif()

if(NOT DEFINED OPENDDS_ACE_TAO_GIT_REPO)
set(OPENDDS_ACE_TAO_GIT_REPO "${repo}")
endif()
if(NOT DEFINED OPENDDS_ACE_TAO_GIT_TAG)
set(OPENDDS_ACE_TAO_GIT_TAG "${branch}")
endif()
message(STATUS "Getting ACE/TAO from ${OPENDDS_ACE_TAO_GIT_REPO} ${OPENDDS_ACE_TAO_GIT_TAG}")
set(fetch_args
GIT_REPOSITORY "${OPENDDS_ACE_TAO_GIT_REPO}"
GIT_TAG "${OPENDDS_ACE_TAO_GIT_TAG}"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
USES_TERMINAL_DOWNLOAD TRUE
)
else()
message(STATUS "Getting ACE/TAO from ${url}")
set(fetch_args
URL "${url}"
URL_MD5 "${md5}"
)
endif()

FetchContent_Declare(ace_tao_dl
PREFIX "${OPENDDS_BUILD_DIR}/ace_tao_tmp"
SOURCE_DIR "${OPENDDS_ACE_TAO_SRC}"
URL "${url}"
URL_MD5 "${md5}"
${fetch_args}
)
FetchContent_Populate(ace_tao_dl)
endif()

if(EXISTS "${OPENDDS_ACE_TAO_SRC}/ace/Version.h")
set(OPENDDS_ACE "${OPENDDS_ACE_TAO_SRC}" CACHE INTERNAL "")
elseif(EXISTS "${OPENDDS_ACE_TAO_SRC}/ACE/ace/Version.h")
set(OPENDDS_ACE "${OPENDDS_ACE_TAO_SRC}/ACE" CACHE INTERNAL "")
if(_OPENDDS_MPC_TYPE STREQUAL gnuace)
set(_OPENDDS_ACE_MPC_NAME_IS_ACE_TARGET TRUE CACHE INTERNAL "")
endif()
else()
message(FATAL_ERROR "Can't find ace/Version.h in ${OPENDDS_ACE}")
endif()

if(EXISTS "${OPENDDS_ACE_TAO_SRC}/TAO/tao/Version.h")
set(OPENDDS_TAO "${OPENDDS_ACE_TAO_SRC}/TAO" CACHE INTERNAL "")
else()
message(FATAL_ERROR "Can't find tao/Version.h in ${OPENDDS_TAO}")
endif()

if(NOT DEFINED OPENDDS_MPC)
if(EXISTS "${OPENDDS_ACE}/MPC/mpc.pl")
set(OPENDDS_MPC "${OPENDDS_ACE}/MPC" CACHE INTERNAL "")
elseif(OPENDDS_MPC_GIT OR DEFINED OPENDDS_MPC_GIT_REPO OR DEFINED OPENDDS_MPC_GIT_TAG)
set(OPENDDS_MPC "${OPENDDS_BUILD_DIR}/MPC" CACHE INTERNAL "")
if(NOT DEFINED OPENDDS_MPC_GIT_REPO)
set(OPENDDS_MPC_GIT_REPO "https://github.com/DOCGroup/MPC")
endif()
if(NOT DEFINED OPENDDS_MPC_GIT_TAG)
set(OPENDDS_MPC_GIT_TAG "master")
endif()
message(STATUS "Getting MPC from ${OPENDDS_MPC_GIT_REPO} ${OPENDDS_MPC_GIT_TAG}")
FetchContent_Declare(mpc_dl
PREFIX "${OPENDDS_BUILD_DIR}/mpc_tmp"
SOURCE_DIR "${OPENDDS_MPC}"
GIT_REPOSITORY "${OPENDDS_MPC_GIT_REPO}"
GIT_TAG "${OPENDDS_MPC_GIT_TAG}"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
USES_TERMINAL_DOWNLOAD TRUE
)
FetchContent_Populate(mpc_dl)
else()
message(FATAL_ERROR "Can't find MPC in ${OPENDDS_ACE}, set OPENDDS_MPC or OPENDDS_MPC_GIT")
endif()
endif()
11 changes: 10 additions & 1 deletion cmake/init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,14 @@ if(NOT DEFINED ACE_ROOT)
set(ACE_LIB_DIR "${_OPENDDS_ROOT}/${OPENDDS_INSTALL_LIB}")

elseif(OPENDDS_ACE)
set(ACE_ROOT ${OPENDDS_ACE})
set(ACE_ROOT "${OPENDDS_ACE}")
set(ACE_INCLUDE_DIRS "${ACE_ROOT}")
set(ACE_LIB_DIR "${ACE_ROOT}/lib")
endif()

set(ACE_BIN_DIR "${ACE_ROOT}/bin")
endif()
_opendds_get_version(OPENDDS_ACE_VERSION ACE "${ACE_ROOT}")

if(NOT DEFINED TAO_ROOT)
if(OPENDDS_USE_PREFIX_PATH)
Expand All @@ -296,6 +297,14 @@ if(NOT DEFINED TAO_ROOT)
"${TAO_INCLUDE_DIR}/orbsvcs"
)
endif()
_opendds_get_version(OPENDDS_TAO_VERSION TAO "${TAO_ROOT}")

message(STATUS "Using OpenDDS ${OPENDDS_VERSION} at ${DDS_ROOT}")
if(DEFINED OPENDDS_MPC)
message(STATUS "Using MPC at ${OPENDDS_MPC}")
endif()
message(STATUS "Using ACE ${OPENDDS_ACE_VERSION} at ${ACE_ROOT}")
message(STATUS "Using TAO ${OPENDDS_TAO_VERSION} at ${TAO_ROOT}")

if(OPENDDS_STATIC)
set(OPENDDS_LIBRARY_TYPE STATIC)
Expand Down
38 changes: 26 additions & 12 deletions cmake/opendds_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,31 @@ if(NOT "${_OPENDDS_CMAKE_DIR}" IN_LIST CMAKE_MODULE_PATH)
endif()

if(NOT DEFINED OPENDDS_VERSION)
set(_version_file "${_OPENDDS_CMAKE_DIR}/../VERSION.txt")
if(NOT EXISTS "${_version_file}")
set(_version_file "${_OPENDDS_CMAKE_DIR}/../../dds/VERSION.txt")
if(NOT EXISTS "${_version_file}")
message(FATAL_ERROR "Can't find OpenDDS VERSION.txt file")
function(_opendds_get_version var name)
if(DEFINED "${var}")
return()
endif()
endif()
file(READ "${_version_file}" _version_file_contents)
string(REGEX MATCH "OpenDDS version ([0-9]+.[0-9]+.[0-9]+)" _ "${_version_file_contents}")
set(OPENDDS_VERSION "${CMAKE_MATCH_1}")
if(NOT OPENDDS_VERSION)
message(FATAL_ERROR "Couldn't get OpenDDS version from ${_version_file}")
endif()

foreach(dir IN LISTS ARGN)
set(file "${dir}/VERSION.txt")
if(EXISTS "${file}")
break()
endif()
endforeach()
if(NOT EXISTS "${file}")
message(FATAL_ERROR "Could't find ${name} VERSION.txt file")
endif()

file(READ "${file}" contents)
string(REGEX MATCH "${name} version ([0-9]+\.[0-9]+\.[0-9]+)" _ "${contents}")
if(NOT CMAKE_MATCH_1)
message(FATAL_ERROR "Couldn't get ${name} version from ${file}")
endif()
set("${var}" "${CMAKE_MATCH_1}" PARENT_SCOPE)
endfunction()

_opendds_get_version(OPENDDS_VERSION OpenDDS
"${_OPENDDS_CMAKE_DIR}/../../dds"
"${_OPENDDS_CMAKE_DIR}/.."
)
endif()
18 changes: 18 additions & 0 deletions docs/devguide/building/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,10 @@ Config Variables
These variables are set by the ``configure`` script in an MPC-built OpenDDS and normally shouldn't be changed.
They can be changed when configuring a :ref:`CMake-built OpenDDS <cmake-building>` using ``-D``, but should not be changed after that.

.. seealso::

:ref:`cmake-building-vars`

Dependencies
^^^^^^^^^^^^

Expand All @@ -748,11 +752,25 @@ Dependencies

Path to :ref:`deps-ace`, usually :envvar:`ACE_ROOT`

.. cmake:var:: OPENDDS_ACE_VERSION
:nocontentsentry:

The version of ACE being used.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_TAO
:nocontentsentry:

Path to :ref:`deps-tao`, usually :envvar:`TAO_ROOT`

.. cmake:var:: OPENDDS_TAO_VERSION
:nocontentsentry:

The version of TAO being used.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_OPENSSL
:nocontentsentry:

Expand Down
9 changes: 8 additions & 1 deletion docs/devguide/building/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,27 @@ The DOC Group repository for ACE/TAO is hosted on Github at `DOCGroup/ACE_TAO <h

There are two versions of ACE/TAO that are officially supported by OpenDDS in this release (|release|):

.. _ace6tao2:

DOC Group :acetaorel:`ace6tao2`
The configure script will download this version by default.
:ref:`CMake <cmake-building>` will download this version if :cmake:var:`OPENDDS_ACE_TAO_KIND` is set to ``ace6tao``.

Pass ``--ace-github-latest`` to the configure script to clone the ``ace6tao2`` branch of ACE/TAO as is.
This also clones the ``master`` branch of MPC as is.
:ref:`CMake <cmake-building>` will do the same if :cmake:var:`OPENDDS_ACE_TAO_KIND` is set to ``ace6tao`` and :cmake:var:`OPENDDS_ACE_TAO_GIT` is set to ``TRUE``.

.. _ace7tao3:

DOC Group :acetaorel:`ace7tao3`
:ref:`CMake <cmake-building>` will download this version by default.
Pass ``--doc-group3`` to the configure script to download this version.
:ref:`CMake <cmake-building>` will download this version by default.

This version requires a C++14-capable compiler.

Pass ``--ace-github-latest`` to the configure script to clone the ``master`` branch of ACE/TAO as is.
This also clones the ``master`` branch of MPC as is.
:ref:`CMake <cmake-building>` will do the same if :cmake:var:`OPENDDS_ACE_TAO_GIT` is set to ``TRUE``.

.. _deps-ace:

Expand Down
79 changes: 77 additions & 2 deletions docs/devguide/building/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,24 @@ Variables
---------

Unless otherwise noted, the build features and behavior can be controlled by the OpenDDS Config Package :ref:`cmake-config-vars`.

.. _cmake-building-ace-tao:

ACE/TAO
^^^^^^^

A prebuilt ACE/TAO can be passed using :cmake:var:`OPENDDS_ACE`.
In that case :ref:`cmake-feature-vars` will be automatically derived from ACE's ``default.features`` file.
If :cmake:var:`OPENDDS_ACE` is not passed, then ACE/TAO will be built.
When building ACE/TAO a release is downloaded by default, but source can also be provided using :cmake:var:`OPENDDS_ACE_TAO_SRC` or cloned using :cmake:var:`OPENDDS_ACE_TAO_GIT`.
:cmake:var:`OPENDDS_ACE_TAO_KIND` controls what version of ACE/TAO is downloaded for both releases and :cmake:var:`OPENDDS_ACE_TAO_GIT`.

These are the variables that are exclusive to building OpenDDS with CMake:
.. _cmake-building-vars:

Build-Exclusive CMake Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

These are all the variables that are exclusive to building OpenDDS with CMake:

.. cmake:var:: OPENDDS_JUST_BUILD_HOST_TOOLS
Expand All @@ -583,7 +597,68 @@ These are the variables that are exclusive to building OpenDDS with CMake:
.. cmake:var:: OPENDDS_ACE_TAO_SRC
If defined, sets the ACE/TAO to build and use.
By default, a hardcoded release is downloaded.
A prebuilt ACE/TAO can be provided using :cmake:var:`OPENDDS_ACE`.
By default, a hardcoded release depending on :cmake:var:`OPENDDS_ACE_TAO_KIND` is downloaded.

.. cmake:var:: OPENDDS_ACE_TAO_KIND
The default is ``ace7tao3`` for :ref:`ACE 7/TAO 3 <ace7tao3>`.
Use ``ace6tao2`` to get :ref:`ACE 6/TAO 2 <ace6tao2>`.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_ACE_TAO_GIT
Implies :cmake:var:`OPENDDS_MPC_GIT`.
If true clone ACE/TAO from :cmake:var:`OPENDDS_ACE_TAO_GIT_TAG` at :cmake:var:`OPENDDS_ACE_TAO_GIT_REPO`.
By default, a hardcoded release depending on :cmake:var:`OPENDDS_ACE_TAO_KIND` is downloaded.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_ACE_TAO_GIT_REPO
Implies :cmake:var:`OPENDDS_ACE_TAO_GIT`.
The Git repository to clone ACE/TAO from.
The default is ``https://github.com/DOCGroup/ACE_TAO``.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_ACE_TAO_GIT_TAG
Implies :cmake:var:`OPENDDS_ACE_TAO_GIT`.
The Git tag to clone ACE/TAO from.
The default depends on :cmake:var:`OPENDDS_ACE_TAO_KIND`.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_MPC
Path to :ref:`deps-mpc`.
In most cases this will be provided and automatically detected, unless ACE/TAO was cloned manually and provided using :cmake:var:`OPENDDS_ACE_TAO_SRC`.

.. versionadded:: 3.26, but documented in 3.27

.. cmake:var:: OPENDDS_MPC_GIT
If true clone MPC from :cmake:var:`OPENDDS_MPC_GIT_TAG` at :cmake:var:`OPENDDS_MPC_GIT_REPO`.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_MPC_GIT_REPO
Implies :cmake:var:`OPENDDS_MPC_GIT`.
The Git repository to clone MPC from.
The default is ``https://github.com/DOCGroup/MPC``.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_MPC_GIT_TAG
Implies :cmake:var:`OPENDDS_MPC_GIT`.
This is the Git tag to clone MPC from.
The default is ``master``.

.. versionadded:: 3.27

.. cmake:var:: OPENDDS_BUILD_TESTS
Expand Down
11 changes: 11 additions & 0 deletions docs/news.d/cmake-ace-tao.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. news-prs: 4346
.. news-start-section: Additions
.. news-start-section: Building with CMake
- Added new options for :ref:`how to get ACE/TAO <cmake-building-ace-tao>`.
.. news-end-section
.. news-start-section: CMake Config Package
- Added :cmake:var:`OPENDDS_ACE_VERSION` and :cmake:var:`OPENDDS_TAO_VERSION`.
.. news-end-section
.. news-end-section
Loading

0 comments on commit 569ce6c

Please sign in to comment.