Skip to content

Commit

Permalink
Partial source and cmake migrations (#270)
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jul 13, 2022
1 parent 5d83d9e commit fdd59dc
Show file tree
Hide file tree
Showing 20 changed files with 79 additions and 81 deletions.
6 changes: 3 additions & 3 deletions .github/ci/packages.apt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
libignition-cmake3-dev
libignition-math7-dev
libignition-tools2-dev
libgz-cmake3-dev
libgz-math7-dev
libgz-tools2-dev
libprotobuf-dev
libprotoc-dev
libtinyxml2-dev
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: actions/checkout@v2
- name: Compile and test
id: ci
uses: ignition-tooling/action-ignition-ci@focal
uses: gazebo-tooling/action-gz-ci@focal
with:
codecov-enabled: true
cppcheck-enabled: true
Expand All @@ -25,4 +25,4 @@ jobs:
uses: actions/checkout@v2
- name: Compile and test
id: ci
uses: ignition-tooling/action-ignition-ci@jammy
uses: gazebo-tooling/action-gz-ci@jammy
2 changes: 1 addition & 1 deletion .github/workflows/pr-collection-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
steps:
- name: Add collection labels
if: github.event.action == 'opened'
uses: ignition-tooling/pr-collection-labeler@v1
uses: gazebo-tooling/pr-collection-labeler@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
24 changes: 12 additions & 12 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load(
"//gz_bazel:build_defs.bzl",
"IGNITION_ROOT",
"IGNITION_VISIBILITY",
"GZ_ROOT",
"GZ_VISIBILITY",
"cmake_configure_file",
"generate_include_header",
"generate_yaml",
Expand All @@ -15,7 +15,7 @@ load(
)

package(
default_visibility = IGNITION_VISIBILITY,
default_visibility = GZ_VISIBILITY,
features = [
"-parse_headers",
"-layering_check",
Expand Down Expand Up @@ -45,8 +45,8 @@ gz_config_header(

gz_export_header(
name = "include/gz/msgs/Export.hh",
export_base = "IGNITION_MSGS",
lib_name = "ignition-msgs",
export_base = "GZ_MSGS",
lib_name = "gz-msgs",
visibility = ["//visibility:private"],
)

Expand Down Expand Up @@ -127,15 +127,15 @@ cc_library(
includes = ["include"],
deps = [
":gzmsgs_proto_cc",
IGNITION_ROOT + "gz_math",
GZ_ROOT + "gz_math",
"@com_google_protobuf//:protobuf",
"@tinyxml2",
],
)

# use shared library only when absolutely needd
cc_binary(
name = "libignition-msgs.so",
name = "libgz-msgs.so",
srcs = [
"src/gz.cc",
"src/gz.hh",
Expand All @@ -151,11 +151,11 @@ cc_binary(
[cc_test(
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
srcs = [src],
data = [IGNITION_ROOT + "gz_msgs/test:desc/stringmsg.desc"],
data = [GZ_ROOT + "gz_msgs/test:desc/stringmsg.desc"],
deps = [
":gz_msgs",
IGNITION_ROOT + "gz_math",
IGNITION_ROOT + "gz_msgs/test:test_utils",
GZ_ROOT + "gz_math",
GZ_ROOT + "gz_msgs/test:test_utils",
"@gtest",
"@gtest//:gtest_main",
],
Expand All @@ -171,9 +171,9 @@ cmake_configure_file(
out = "cmdmsgs.rb",
cmakelists = ["CMakeLists.txt"],
defines = [
"library_location=libignition-msgs.so",
"library_location=libgz-msgs.so",
"PROJECT_VERSION_FULL=%d.%d.%d" % (PROJECT_MAJOR, PROJECT_MINOR, PROJECT_PATCH), # noqa
"IGN_LIBRARY_NAME=%s" % [PROJECT_NAME],
"GZ_LIBRARY_NAME=%s" % [PROJECT_NAME],
],
)

Expand Down
16 changes: 7 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ find_package(gz-cmake3 REQUIRED)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

gz_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/msgs
VERSION_SUFFIX pre1)
gz_configure_project(VERSION_SUFFIX pre1)

#============================================================================
# Set project-specific options
Expand All @@ -30,12 +28,12 @@ gz_configure_project(
# generator compiled for the target machine cannot be used to generate
# the C++ code corresponding to the .proto definition. For this scenario,
# the following two options can be used as follows.
# First of all, ign-msgs is compiled targeting the host machine, and in the
# First of all, gz-msgs is compiled targeting the host machine, and in the
# build targeting the host, the INSTALL_GZ_MSGS_GEN_EXECUTABLE option is
# enabled:
# > cmake -DINSTALL_GZ_MSGS_GEN_EXECUTABLE:BOOL=ON ..
# ensuring that the gz_msgs_gen is installed in
# <host_install_prefix>/bin/gz_msgs_gen . Then, the same version of ign-msgs
# <host_install_prefix>/bin/gz_msgs_gen . Then, the same version of gz-msgs
# can be cross-compiled, and in the cross-compilation build the location of the
# host gz_msgs_gen is specified via the GZ_MSGS_GEN_EXECUTABLE
# CMake cache variable:
Expand All @@ -44,13 +42,13 @@ gz_configure_project(
# TODO(CH3): Deprecated. Remove IGN_MSGS CMake variables on tick-tock.
if(INSTALL_IGN_MSGS_GEN_EXECUTABLE)
message(WARNING "INSTALL_IGN_MSGS_GEN_EXECUTABLE is deprecated, use INSTALL_GZ_MSGS_GEN_EXECUTABLE instead")
set(INSTALL_GZ_MSGS_GEN_EXECUTABLE INSTALL_IGN_MSGS_GEN_EXECUTABLE)
set(INSTALL_GZ_MSGS_GEN_EXECUTABLE ${INSTALL_IGN_MSGS_GEN_EXECUTABLE})
else()
option(
INSTALL_GZ_MSGS_GEN_EXECUTABLE
"Install the gz_msgs_gen executable."
OFF)
set(INSTALL_IGN_MSGS_GEN_EXECUTABLE INSTALL_GZ_MSGS_GEN_EXECUTABLE)
set(INSTALL_IGN_MSGS_GEN_EXECUTABLE ${INSTALL_GZ_MSGS_GEN_EXECUTABLE})
endif()

mark_as_advanced(INSTALL_IGN_MSGS_GEN_EXECUTABLE)
Expand Down Expand Up @@ -79,7 +77,7 @@ message(STATUS "\n\n-- ====== Finding Dependencies ======")
#--------------------------------------
# Find Protobuf
set(REQ_PROTOBUF_VER 3)
gz_find_package(IgnProtobuf
gz_find_package(GzProtobuf
VERSION ${REQ_PROTOBUF_VER}
REQUIRED
COMPONENTS all
Expand Down Expand Up @@ -118,7 +116,7 @@ add_subdirectory(tools)
#============================================================================
# TODO: Consider tweaking gz_configure_build() to call add_subdirectory(proto)
# whenever a proto subdirectory exists. This could be used alongside
# gz_msgs_protoc to get uniform support for proto messages across all ignition
# gz_msgs_protoc to get uniform support for proto messages across all Gazebo
# projects.
add_subdirectory(proto)

Expand Down
10 changes: 5 additions & 5 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
1. Support 'has' functionality in particle Emitter.
* [Pull request 137](https:/gazebosim/gz-msgs/pull/137)

1. Add ignition version of nav_msgs/OccupancyGrid.
1. Add gz version of nav_msgs/OccupancyGrid.
* [Pull request 138](https:/gazebosim/gz-msgs/pull/138)

### Gazebo Msgs 6.3.0 (2021-02-17)
Expand Down Expand Up @@ -288,7 +288,7 @@

### Gazebo Msgs 5.7.0 (2021-03-17)

1. Add ignition version of nav\_msgs/OccupancyGrid (backport #138)
1. Add gz version of nav\_msgs/OccupancyGrid (backport #138)
* [Pull request 143](https:/gazebosim/gz-msgs/pull/143)
* [Pull request 143](https:/gazebosim/gz-msgs/pull/138)

Expand Down Expand Up @@ -317,12 +317,12 @@
1. Add Focal CI.
* [Pull request 73](https:/gazebosim/gz-msgs/pull/73)

1. Include autogenerated code for the ign\_create\_docs function.
1. Include autogenerated code for the gz\_create\_docs function.
* [Pull request 76](https:/gazebosim/gz-msgs/pull/76)
* [Pull request 78](https:/gazebosim/gz-msgs/pull/78)
* [Pull request 79](https:/gazebosim/gz-msgs/pull/79)

1. Use modern CMake targets when including ignition-math.
1. Use modern CMake targets when including gz-math.
* [Pull request 82](https:/gazebosim/gz-msgs/pull/82)

1. Bump versions in readme.
Expand All @@ -342,7 +342,7 @@

### Gazebo Msgs 5.3.0 (2020-05-20)

1. Use modern CMake targets when including ignition-math.
1. Use modern CMake targets when including gz-math.
* [Pull request 82](https:/gazebosim/gz-msgs/pull/82)

1. Included autogenerated code to the ign_create_docs function.
Expand Down
4 changes: 2 additions & 2 deletions api.md.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Gazebo @IGN_DESIGNATION_CAP@
## Gazebo @GZ_DESIGNATION_CAP@

Gazebo @IGN_DESIGNATION_CAP@ is a component in Gazebo, a set of libraries
Gazebo @GZ_DESIGNATION_CAP@ is a component in Gazebo, a set of libraries
designed to rapidly develop robot and simulation applications.

## License
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ environment:
install:
- vcpkg install protobuf
- vcpkg install tinyxml2
# ign-cmake
# gz-cmake
- git clone https:/gazebosim/gz-cmake -b main
- cd gz-cmake
- md build
- cd build
- cmake .. -DBUILD_TESTING=Off
- cmake --build . --target INSTALL
- cd ../..
# ign-math
# gz-math
- git clone https:/gazebosim/gz-math -b main
- cd gz-math
- md build
Expand Down
16 changes: 8 additions & 8 deletions conf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Used only for internal testing.
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}")
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}")

# Generate a configuration file for internal testing.
# Note that the major version of the library is included in the name.
# Ex: transport0.yaml
configure_file(
"${IGN_DESIGNATION}.yaml.in"
"${CMAKE_BINARY_DIR}/test/conf/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" @ONLY)
"${GZ_DESIGNATION}.yaml.in"
"${CMAKE_BINARY_DIR}/test/conf/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" @ONLY)

# Used for the installed version.
set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}")
set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}")

# Generate the configuration file that is installed.
# Note that the major version of the library is included in the name.
# Ex: transport0.yaml
configure_file(
"${IGN_DESIGNATION}.yaml.in"
"${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" @ONLY)
"${GZ_DESIGNATION}.yaml.in"
"${CMAKE_CURRENT_BINARY_DIR}/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" @ONLY)

# Install the yaml configuration files in an unversioned location.
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/ignition/)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/)
2 changes: 1 addition & 1 deletion include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
add_subdirectory(gz)
install(DIRECTORY ignition DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL})
install(DIRECTORY ignition DESTINATION ${GZ_INCLUDE_INSTALL_DIR_FULL})
2 changes: 1 addition & 1 deletion proto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
install(
DIRECTORY gz
DESTINATION "${IGN_INCLUDE_INSTALL_DIR_FULL}"
DESTINATION "${GZ_INCLUDE_INSTALL_DIR_FULL}"
COMPONENT proto
FILES_MATCHING PATTERN "*.proto")
20 changes: 10 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ target_link_libraries(gz_msgs_gen
protobuf::libprotoc
protobuf::libprotobuf)
target_include_directories(gz_msgs_gen PRIVATE ${PROTOBUF_INCLUDE_DIR})
target_compile_features(gz_msgs_gen PRIVATE ${IGN_CXX_11_FEATURES})
target_compile_features(gz_msgs_gen PRIVATE ${GZ_CXX_11_FEATURES})

if (UNIX)
target_link_libraries(gz_msgs_gen pthread)
endif()

if(INSTALL_GZ_MSGS_GEN_EXECUTABLE)
set_target_properties(gz_msgs_gen PROPERTIES VERSION ${PROJECT_VERSION_FULL})
install(TARGETS gz_msgs_gen DESTINATION ${IGN_BIN_INSTALL_DIR})
install(TARGETS gz_msgs_gen DESTINATION ${GZ_BIN_INSTALL_DIR})

# TODO(chapulina) Deprecated. Remove on v10.
install(FILES $<TARGET_FILE:gz_msgs_gen> DESTINATION ${IGN_BIN_INSTALL_DIR} RENAME ign_msgs_gen PERMISSIONS OWNER_EXECUTE)
install(FILES $<TARGET_FILE:gz_msgs_gen> DESTINATION ${GZ_BIN_INSTALL_DIR} RENAME ign_msgs_gen PERMISSIONS OWNER_EXECUTE)
endif()

##################################################
Expand Down Expand Up @@ -148,14 +148,14 @@ endif()
set_source_files_properties(${gen_headers} ${gen_sources} ${gen_ruby_scripts}
PROPERTIES GENERATED TRUE)

message(STATUS "Installing Ruby messages to ${CMAKE_INSTALL_PREFIX}/${IGN_LIB_INSTALL_DIR}/ruby/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}")
install(FILES ${gen_ruby_scripts} DESTINATION ${CMAKE_INSTALL_PREFIX}/${IGN_LIB_INSTALL_DIR}/ruby/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR})
message(STATUS "Installing Ruby messages to ${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/ruby/ignition/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}")
install(FILES ${gen_ruby_scripts} DESTINATION ${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/ruby/ignition/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR})

message(STATUS "Installing Ruby messages to ${CMAKE_INSTALL_PREFIX}/${IGN_LIB_INSTALL_DIR}/ruby/gz/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}")
install(FILES ${gen_ruby_scripts} DESTINATION ${CMAKE_INSTALL_PREFIX}/${IGN_LIB_INSTALL_DIR}/ruby/gz/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR})
message(STATUS "Installing Ruby messages to ${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/ruby/gz/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}")
install(FILES ${gen_ruby_scripts} DESTINATION ${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/ruby/gz/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR})

gz_install_includes(
"${IGN_INCLUDE_INSTALL_DIR_POSTFIX}/gz/${IGN_DESIGNATION}"
"${GZ_INCLUDE_INSTALL_DIR_POSTFIX}/gz/${GZ_DESIGNATION}"
${gen_headers})

##################################################
Expand All @@ -169,8 +169,8 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/MessageTypes.hh.in
${PROJECT_BINARY_DIR}/include/gz/msgs/MessageTypes.hh)

gz_install_includes(
"${IGN_INCLUDE_INSTALL_DIR_POSTFIX}/gz/${IGN_DESIGNATION}"
"${PROJECT_BINARY_DIR}/include/gz/${IGN_DESIGNATION}/MessageTypes.hh")
"${GZ_INCLUDE_INSTALL_DIR_POSTFIX}/gz/${GZ_DESIGNATION}"
"${PROJECT_BINARY_DIR}/include/gz/${GZ_DESIGNATION}/MessageTypes.hh")

##################################################
# Build the main library
Expand Down
2 changes: 1 addition & 1 deletion src/Generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ bool Generator::Generate(const FileDescriptor *_file,
_generatorContext->OpenForInsert(sourceFilename, "includes"));
io::Printer printer(output.get(), '$');

// Add the ign-msgs Factory header
// Add the gz-msgs Factory header
printer.Print("#include \"gz/msgs/Factory.hh\"\n", "name",
"includes");

Expand Down
8 changes: 4 additions & 4 deletions src/Utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ namespace gz
// Inline bracket to help doxygen filtering.
inline namespace GZ_MSGS_VERSION_NAMESPACE {
/// \brief Left and right trim a string. This was copied from Gazebo
/// common, ign-common/Util.hh, to avoid adding another dependency.
/// Remove this function if ign-common ever becomes a dependency.
/// common, gz-common/Util.hh, to avoid adding another dependency.
/// Remove this function if gz-common ever becomes a dependency.
/// \param[in] _s String to trim
/// \return Trimmed string
std::string trimmed(std::string _s)
Expand All @@ -54,8 +54,8 @@ namespace gz
}

/// \brief Splits a string into tokens. This was copied from Gazebo
/// common, ign-common/Util.hh, to avoid adding another dependency.
/// Remove this function if ign-common every becomes a dependency.
/// common, gz-common/Util.hh, to avoid adding another dependency.
/// Remove this function if gz-common every becomes a dependency.
/// \param[in] _str Input string.
/// \param[in] _delim Token delimiter.
/// \return Vector of tokens.
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# Generate the ruby script for internal testing.
# Note that the major version of the library is included in the name.
# Ex: cmdtransport0.rb
set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb")
set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb")
set(cmd_script_configured_test "${cmd_script_generated_test}.configured")

# Set the library_location variable to the full path of the library file within
# the build directory.
set(library_location "$<TARGET_FILE:${PROJECT_LIBRARY_TARGET_NAME}>")

configure_file(
"cmd${IGN_DESIGNATION}.rb.in"
"cmd${GZ_DESIGNATION}.rb.in"
"${cmd_script_configured_test}"
@ONLY)

Expand All @@ -24,15 +24,15 @@ file(GENERATE
# Generate the ruby script that gets installed.
# Note that the major version of the library is included in the name.
# Ex: cmdtransport0.rb
set(cmd_script_generated "${CMAKE_CURRENT_BINARY_DIR}/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb")
set(cmd_script_generated "${CMAKE_CURRENT_BINARY_DIR}/cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb")
set(cmd_script_configured "${cmd_script_generated}.configured")

# Set the library_location variable to the relative path to the library file
# within the install directory structure.
set(library_location "../../../${CMAKE_INSTALL_LIBDIR}/$<TARGET_FILE_NAME:${PROJECT_LIBRARY_TARGET_NAME}>")

configure_file(
"cmd${IGN_DESIGNATION}.rb.in"
"cmd${GZ_DESIGNATION}.rb.in"
"${cmd_script_configured}"
@ONLY)

Expand Down
Loading

0 comments on commit fdd59dc

Please sign in to comment.