Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ign -> gz CMake, Config, and Example Files migration : gz-cmake #274

Merged
merged 3 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ list(APPEND CMAKE_MODULE_PATH "${IGNITION_CMAKE_DIR}")

#--------------------------------------
# include the master IgnCMake module
include(IgnCMake)
include(GzCMake)

#--------------------------------------
# Set up the project
Expand Down Expand Up @@ -54,11 +54,11 @@ install(DIRECTORY tools/

#--------------------------------------
# Create configuration and installation variables
set(gz_config_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake-config.cmake.in")
set(gz_config_input "${CMAKE_CURRENT_SOURCE_DIR}/config/gz-cmake-config.cmake.in")
set(gz_config_output "${PROJECT_NAME_LOWER}-config.cmake")
set(gz_version_output "${PROJECT_NAME_LOWER}-config-version.cmake")
set(gz_config_install_dir "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME_LOWER}")
set(ign_pkgconfig_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake.pc.in")
set(ign_pkgconfig_input "${CMAKE_CURRENT_SOURCE_DIR}/config/gz-cmake.pc.in")
set(ign_pkgconfig_output "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc")
set(ign_pkgconfig_install_dir "${IGN_LIB_INSTALL_DIR}/pkgconfig")
set(ign_utilities_target ${PROJECT_EXPORT_NAME}-utilities)
Expand Down Expand Up @@ -141,25 +141,53 @@ install(
#============================================================================
# Install the files for this package
#============================================================================
set(ign_modules_install_dir "${gz_config_install_dir}/cmake${PROJECT_VERSION_MAJOR}")
set(gz_modules_install_dir "${gz_config_install_dir}/cmake${PROJECT_VERSION_MAJOR}")

file(GLOB modules "cmake/*.cmake")
file(GLOB templates "cmake/*.in")

install(
FILES ${modules} ${templates}
DESTINATION ${ign_modules_install_dir}
DESTINATION ${gz_modules_install_dir}
COMPONENT modules)

file(GLOB pkgconfig_templates "cmake/pkgconfig/*.in")

install(
FILES ${pkgconfig_templates}
DESTINATION ${ign_modules_install_dir}/pkgconfig
DESTINATION ${gz_modules_install_dir}/pkgconfig
COMPONENT modules)

message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")

# TODO(CH3): Deprecated. Remove on tock.
# Install symlinks for IgnPython and IgnBenchmark
set(tick_tocked_cmake_files
"GzPython.cmake"
"GzBenchmark.cmake")

# TODO(CH3): Deprecated. Remove on tock.
# Install symlinks for IgnPython and IgnBenchmark
foreach(cmake_file ${tick_tocked_cmake_files})
string(REGEX REPLACE "^Gz" "Ign" ign_cmake_file ${cmake_file})
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/cmake")

if (WIN32) # Windows requires copy instead of symlink
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy \
${CMAKE_INSTALL_PREFIX}\/${gz_modules_install_dir}\/${cmake_file} \
${PROJECT_BINARY_DIR}\/cmake/${ign_cmake_file})")
else()
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_INSTALL_PREFIX}\/${gz_modules_install_dir}\/${cmake_file} \
${PROJECT_BINARY_DIR}\/cmake/${ign_cmake_file})")
endif()

install(
FILES ${PROJECT_BINARY_DIR}/cmake/${ign_cmake_file}
DESTINATION ${gz_modules_install_dir}
COMPONENT modules)
endforeach()

include(CTest)
if (BUILD_TESTING)
add_subdirectory(test)
Expand Down Expand Up @@ -203,7 +231,7 @@ set(CPPCHECK_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/examples
)
set(IGNITION_CMAKE_CODECHECK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/codecheck")
include(IgnCodeCheck)
include(GzCodeCheck)
_gz_setup_target_for_codecheck()

# Docs
Expand Down
4 changes: 2 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
1. doxygen allow all .cc, .hh, and CMakeLists.txt, not just in examples/ dir
* [Pull request #198](https://github.com/gazebosim/gz-cmake/pull/198)

1. Add `LEGACY_PROJECT_PREFIX` parameter to `ign_create_core_library`
1. Add `LEGACY_PROJECT_PREFIX` parameter to `gz_create_core_library`
* [Pull request #199](https://github.com/gazebosim/gz-cmake/pull/199)

1. Add `HIDE_SYMBOLS_BY_DEFAULT` parameter to `ign_configure_build`
1. Add `HIDE_SYMBOLS_BY_DEFAULT` parameter to `gz_configure_build`
* [Pull request #196](https://github.com/gazebosim/gz-cmake/pull/196)

1. Add Ubuntu Jammy CI
Expand Down
2 changes: 1 addition & 1 deletion MigrationFromClassic.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ writing a good quality find-module.

In many cases, a package that we depend on will be distributed with a pkgconfig
(`*.pc`) file. In such a case, `gz-cmake` provides a macro that can easily
find the package and create an imported target for it. Simply use `include(IgnPkgConfig)`
find the package and create an imported target for it. Simply use `include(GzPkgConfig)`
and then `gz_pkg_check_modules(~)` in your find-module, and you are done. An
example of a simple case of this can be found in `gz-cmake/cmake/FindGTS.cmake`.

Expand Down
4 changes: 2 additions & 2 deletions cmake/FindAVCODEC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#
########################################
# Find avcodec
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_check_modules_quiet(AVCODEC libavcodec)

if(NOT AVCODEC_FOUND)
include(IgnManualSearch)
include(GzManualSearch)
gz_manual_search(AVCODEC
HEADER_NAMES "libavcodec/avcodec.h"
LIBRARY_NAMES "avcodec")
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindAVDEVICE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ set(av_major ${AVDEVICE_FIND_VERSION_MAJOR})
set(av_minor ${AVDEVICE_FIND_VERSION_MINOR})
set(av_patch ${AVDEVICE_FIND_VERSION_PATCH})

include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_check_modules_quiet(AVDEVICE "libavdevice >= ${av_major}.${av_minor}.${av_patch}")

if(NOT AVDEVICE_FOUND)
include(IgnManualSearch)
include(GzManualSearch)
gz_manual_search(AVDEVICE
HEADER_NAMES "libavdevice/avdevice.h"
LIBRARY_NAMES "avdevice")
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindAVFORMAT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#
########################################
# Find AV format
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_check_modules_quiet(AVFORMAT libavformat)

if(NOT AVFORMAT_FOUND)
include(IgnManualSearch)
include(GzManualSearch)
gz_manual_search(AVFORMAT
HEADER_NAMES "libavformat/avformat.h"
LIBRARY_NAMES "avformat")
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindAVUTIL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#
########################################
# Find avutil
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_check_modules_quiet(AVUTIL libavutil)

if(NOT AVUTIL_FOUND)
include(IgnManualSearch)
include(GzManualSearch)
gz_manual_search(AVUTIL
HEADER_NAMES "libavutil/avutil.h"
LIBRARY_NAMES "avutil")
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindCPPZMQ.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ endif()

if(CPPZMQ_FOUND)

include(IgnImportTarget)
include(GzImportTarget)

# Since this is a header-only library, we should import it as an INTERFACE
# target.
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindDL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ else()
mark_as_advanced(DL_LIBRARIES)

if(DL_FOUND)
include(IgnImportTarget)
include(GzImportTarget)
gz_import_target(DL)
set(DL_TARGET DL::DL)
endif()
Expand All @@ -94,7 +94,7 @@ endif()

# We need to manually specify the pkgconfig entry (and type of entry) for dl,
# because gz_pkg_check_modules does not work for it.
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_config_library_entry(DL dl)

include(FindPackageHandleStandardArgs)
Expand Down
8 changes: 4 additions & 4 deletions cmake/FindFreeImage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set(minor_version ${FreeImage_FIND_VERSION_MINOR})
set(full_version ${major_version}.${minor_version})

if (NOT WIN32)
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_config_library_entry(FreeImage freeimage)

# If we don't have PkgConfig, or if PkgConfig failed, then do a manual search
Expand Down Expand Up @@ -87,7 +87,7 @@ if (NOT WIN32)

if(FreeImage_FOUND)
# Create the imported target for FreeImage if we found it
include(IgnImportTarget)
include(GzImportTarget)
gz_import_target(FreeImage)
endif()

Expand Down Expand Up @@ -140,9 +140,9 @@ else()
endif()

if (FreeImage_FOUND)
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_config_library_entry(FreeImage "FreeImage")
include(IgnImportTarget)
include(GzImportTarget)
gz_import_target(FreeImage)
endif()

Expand Down
6 changes: 3 additions & 3 deletions cmake/FindGTS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

if (NOT WIN32)
# Configuration using pkg-config modules
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_check_modules(GTS gts)
else()
# true by default, change to false when a failure appears
Expand Down Expand Up @@ -92,9 +92,9 @@ else()
if (GTS_FOUND)
# We need to manually specify the pkgconfig entry (and type of entry),
# because gz_pkg_check_modules does not work for it.
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_config_library_entry(GTS gts)
include(IgnImportTarget)
include(GzImportTarget)
gz_import_target(GTS)
endif()
endif()
4 changes: 2 additions & 2 deletions cmake/FindGzCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ if(${GzCURL_FOUND})
INTERFACE_LINK_LIBRARIES CURL::libcurl)
endif()

include(IgnImportTarget)
include(GzImportTarget)

if(NOT TARGET curl::curl)
gz_import_target(curl
LIB_VAR CURL_LIBRARIES
INCLUDE_VAR CURL_INCLUDE_DIRS)
endif()

include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_config_entry(GzCURL "libcurl >= ${GzCURL_FIND_VERSION}")

endif()
2 changes: 1 addition & 1 deletion cmake/FindGzOGRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ if(OGRE_FOUND)
list(APPEND OGRE_INCLUDE_DIRS ${dir_include})
endforeach()

include(IgnImportTarget)
include(GzImportTarget)
gz_import_target(GzOGRE
TARGET_NAME GzOGRE::GzOGRE
LIB_VAR OGRE_LIBRARIES
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindGzOGRE2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ if (NOT WIN32)
set(OGRE2_VERSION "${OGRE2_VERSION_MAJOR}.${OGRE2_VERSION_MINOR}.${OGRE2_VERSION_PATCH}")

# find ogre components
include(IgnImportTarget)
include(GzImportTarget)
foreach(component ${GzOGRE2_FIND_COMPONENTS})
find_library(OGRE2-${component}
NAMES
Expand Down Expand Up @@ -339,7 +339,7 @@ if (NOT WIN32)

# We need to manually specify the pkgconfig entry (and type of entry),
# because gz_pkg_check_modules does not work for it.
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_config_library_entry(GzOGRE2 OgreMain)
else() #WIN32

Expand Down
4 changes: 2 additions & 2 deletions cmake/FindGzProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# correctly imported. This is especially important on Windows in order to
# support shared library versions of Protobuf.

include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_config_entry(GzProtobuf "protobuf >= ${GzProtobuf_FIND_VERSION}")

find_package(Protobuf ${GzProtobuf_FIND_VERSION} QUIET CONFIG)
Expand Down Expand Up @@ -82,7 +82,7 @@ if(${Protobuf_FOUND})

# Older versions of protobuf don't create imported targets, so we will create
# them here if they have not been provided.
include(IgnImportTarget)
include(GzImportTarget)

if(NOT TARGET protobuf::libprotobuf)
gz_import_target(protobuf
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindGzURDFDOM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Prefer pkg-config over cmake if possible since version checking is not working
# on urdfdom series from 1.x to 3.0.0 (at least)
include(IgnPkgConfig)
include(GzPkgConfig)
if(PKG_CONFIG_FOUND)
if (GzURDFDOM_FIND_VERSION)
set(signature "urdfdom >= ${GzURDFDOM_FIND_VERSION}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindIFADDRS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ endif()

if(IFADDRS_FOUND)

include(IgnImportTarget)
include(GzImportTarget)

# Since this is a header-only library, we should import it as an INTERFACE
# target.
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindJSONCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(JSONCPP_FIND_VERSION)
else()
find_package(jsoncpp CONFIG QUIET)
set(JSONCPP_TARGET jsoncpp_lib)
include(IgnPkgConfig)
include(GzPkgConfig)

if(JSONCPP_FOUND)
gz_pkg_config_entry(JSONCPP jsoncpp)
Expand Down Expand Up @@ -67,7 +67,7 @@ else()
endif()

if(JSONCPP_FOUND)
include(IgnImportTarget)
include(GzImportTarget)
gz_import_target(JSONCPP)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindODE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if(ODE_FOUND)
message(STATUS "Looking for Open Dynamics Engine - found")
endif()

include(IgnImportTarget)
include(GzImportTarget)
gz_import_target(ODE)

if(NOT ODE_FIND_QUIETLY)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindOptiX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,6 @@ find_package_handle_standard_args(
OptiX
REQUIRED_VARS OptiX_FOUND)

include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_config_library_entry(OptiX OptiX)

4 changes: 2 additions & 2 deletions cmake/FindSWSCALE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#
########################################
# Find libswscale format
include(IgnPkgConfig)
include(GzPkgConfig)
gz_pkg_check_modules_quiet(SWSCALE libswscale)

if(NOT SWSCALE_FOUND)
include(IgnManualSearch)
include(GzManualSearch)
gz_manual_search(SWSCALE
HEADER_NAMES "libswscale/swscale.h"
LIBRARY_NAMES "swscale")
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindTINYXML2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
########################################
# Find tinyxml2. Only debian distributions package tinyxml with a pkg-config.

include(IgnPkgConfig)
include(GzPkgConfig)

# Use pkg_check_modules to start
gz_pkg_check_modules_quiet(TINYXML2 tinyxml2)
Expand Down Expand Up @@ -53,7 +53,7 @@ if(NOT TINYXML2_FOUND)
endif()

if(TINYXML2_FOUND)
include(IgnImportTarget)
include(GzImportTarget)
gz_import_target(TINYXML2)
endif()

Expand Down
Loading