Skip to content

Commit

Permalink
Reduce example names to be able to run Conda CI on Windows (gz-cmake2) (
Browse files Browse the repository at this point in the history
#463)

* Finish with the massive renaming

---------
Signed-off-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
j-rivero committed Jan 29, 2025
1 parent ceee291 commit 9498b62
Show file tree
Hide file tree
Showing 56 changed files with 137 additions and 149 deletions.
69 changes: 43 additions & 26 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ include(GNUInstallDirs)

# test multiple build types
set(build_types Release RelWithDebInfo Debug)
function(short_build_type build_type output_var)
if (${build_type} STREQUAL "Release")
set(bt_str "R")
elseif (${build_type} STREQUAL "RelWithDebInfo")
set(bt_str "RWD")
elseif (${build_type} STREQUAL "Debug")
set(bt_str "D")
elseif (${build_type} STREQUAL "Coverage")
set(bt_str "C")
else()
message(FATAL_ERROR "Unknown build_type ${build_type}")
endif()
set (${output_var} ${bt_str} PARENT_SCOPE)
endfunction()

find_program(EXAMPLE_LCOV_PATH lcov)
if (NOT WIN32 AND EXAMPLE_LCOV_PATH)
list(APPEND build_types Coverage)
Expand All @@ -12,20 +27,20 @@ set(example_directories
gz_conf
no_gz_prefix
prerelease
core_nodep
core_nodep_static
core_child
core_child_private
core_static_child
c_nodep
c_nodep_static
c_child
c_child_private
c_static_child
comp_deps
use_config_ifp
config_ifp
version_from_package_xml
)
if (NOT CMAKE_GENERATOR MATCHES "Visual Studio")
list(APPEND example_directories
use_component_depsA
use_component_depsB
use_component_depsC
comp_depsA
comp_depsB
comp_depsC
)
endif()

Expand Down Expand Up @@ -70,7 +85,8 @@ foreach(example ${example_directories})
endif()

foreach (build_type ${build_types})
set(TEST_NAME ${example}_${build_type})
short_build_type("${build_type}" bt_str)
set(TEST_NAME ${example}_${bt_str})
string(TIMESTAMP TEST_TIME)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/junit_pass.xml.in"
Expand All @@ -80,7 +96,7 @@ foreach(example ${example_directories})
"${CMAKE_CURRENT_SOURCE_DIR}/junit_fail.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/test_results/${TEST_NAME}.xml"
@ONLY)
set(example_INSTALL_DIR ${CMAKE_BINARY_DIR}/install/${build_type})
set(example_INSTALL_DIR ${CMAKE_BINARY_DIR}/install/${b_str})
ExternalProject_Add(
${TEST_NAME}

Expand All @@ -91,7 +107,7 @@ foreach(example ${example_directories})
# See alternate approach in a2113e0997c9 if this becomes too slow
BUILD_ALWAYS 1
CMAKE_ARGS
"-DCMAKE_PREFIX_PATH=${FAKE_INSTALL_PREFIX}"
"-DCMAKE_PREFIX_PATH=${FAKE_INSTALL_PREFIX};${example_INSTALL_DIR}"
"-DCMAKE_BUILD_TYPE=${build_type}"
"-DCMAKE_INSTALL_PREFIX=${example_INSTALL_DIR}"
TEST_COMMAND
Expand Down Expand Up @@ -166,24 +182,25 @@ endforeach()
# hard to use DEPENDS in ExternalProject_Add because targets
# need to exist before they can be used there
foreach (build_type ${build_types})
add_dependencies(core_child_${build_type} core_nodep_${build_type})
add_dependencies(core_child_private_${build_type} core_nodep_${build_type})
add_dependencies(core_static_child_${build_type} core_nodep_static_${build_type})
if (TARGET use_component_depsA_${build_type})
add_dependencies(use_component_depsA_${build_type} comp_deps_${build_type})
short_build_type(${build_type} bt_str)
add_dependencies(c_child_${bt_str} c_nodep_${bt_str})
add_dependencies(c_child_private_${bt_str} c_nodep_${bt_str})
add_dependencies(c_static_child_${bt_str} c_nodep_static_${bt_str})
if (TARGET comp_depsA_${bt_str})
add_dependencies(comp_depsA_${bt_str} comp_deps_${bt_str})
endif()
if (TARGET use_component_depsB_${build_type})
add_dependencies(use_component_depsB_${build_type} comp_deps_${build_type})
if (TARGET comp_depsB_${bt_str})
add_dependencies(comp_depsB_${bt_str} comp_deps_${bt_str})
endif()
if (TARGET use_component_depsC_${build_type})
add_dependencies(use_component_depsC_${build_type} comp_deps_${build_type})
if (TARGET comp_depsC_${bt_str})
add_dependencies(comp_depsC_${bt_str} comp_deps_${bt_str})
endif()
endforeach()

# test that core_child pkg-config file requires core_nodep
# and that core_child_private pkg-config file requires core_nodep privately
# test that c_child pkg-config file requires c_nodep
# and that c_child_private pkg-config file requires c_nodep privately
if (UNIX)
set(TEST_NAME core_child_requires_core_nodep)
set(TEST_NAME c_child_requires_c_nodep)
string(TIMESTAMP TEST_TIME)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/junit_pass.xml.in"
Expand All @@ -195,7 +212,7 @@ if (UNIX)
@ONLY)
set(_env_vars)
# On Debian and if the install prefix is /usr, the default CMAKE_INSTALL_LIBDIR of this project
# as set by GNUInstallDirs will be different from the one of the example project,
# as set by GNUInstallDirs will be different from the one of the example project,
# so let's hardcode it in that case
if(EXISTS "/etc/debian_version" AND "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
set(example_PKGCONFIG_INSTALL_LIBDIR "lib/pkgconfig")
Expand All @@ -205,7 +222,7 @@ if (UNIX)

list(APPEND _env_vars "PKG_CONFIG_PATH=${example_INSTALL_DIR}/${example_PKGCONFIG_INSTALL_LIBDIR}:${FAKE_INSTALL_PREFIX}/${example_PKGCONFIG_INSTALL_LIBDIR}:$PKG_CONFIG_PATH")
add_test(${TEST_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/test_core_child_requires_core_no_deps.bash
${CMAKE_CURRENT_SOURCE_DIR}/test_c_child_requires_c_no_deps.bash
)
set_tests_properties(${TEST_NAME} PROPERTIES
ENVIRONMENT "${_env_vars}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-core_child VERSION 0.1.0)
project(gz-c_child VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project()
gz_find_package(gz-core_no_deps REQUIRED EXTRA_ARGS NAMES gz-core_no_deps)
gz_find_package(gz-c_no_deps REQUIRED EXTRA_ARGS NAMES gz-c_no_deps)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
gz_create_docs(TAGFILES "${GZ-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${GZ-CORE_NO_DEPS_API_URL}")
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ gz_get_libsources_and_unittests(sources gtest_sources)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
gz-core_no_deps::gz-core_no_deps)
gz-c_no_deps::gz-c_no_deps)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-core_child_private VERSION 0.1.0)
project(gz-c_child_private VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project()
gz_find_package(gz-core_no_deps PRIVATE REQUIRED)
gz_find_package(gz-c_no_deps PRIVATE REQUIRED)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
gz_create_docs(TAGFILES "${GZ-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${GZ-CORE_NO_DEPS_API_URL}")
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ gz_get_libsources_and_unittests(sources gtest_sources)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PRIVATE
gz-core_no_deps::gz-core_no_deps)
gz-core_no_deps::gz-c_no_deps)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-core_no_deps VERSION 0.1.0)
project(gz-c_no_deps VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project(
REPLACE_INCLUDE_PATH gz/core_no_deps
REPLACE_INCLUDE_PATH gz/c_no_deps
)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*
*/

#include <gz/core_no_deps/Export.hh>
#include <gz/c_no_deps/Export.hh>

namespace gz
{
namespace core_no_deps
namespace c_no_deps
{
class GZ_CORE_NO_DEPS_VISIBLE AlmostEmpty
class GZ_C_NO_DEPS_VISIBLE AlmostEmpty
{
};
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-core_no_deps_static VERSION 0.1.0)
project(gz-c_no_deps_static VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project(
REPLACE_INCLUDE_PATH gz/core_no_deps_static
REPLACE_INCLUDE_PATH gz/c_no_deps_static
)
OPTION(BUILD_SHARED_LIBS OFF)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*
*/

#include <gz/core_no_deps_static/Export.hh>
#include <gz/c_no_deps_static/Export.hh>

namespace gz
{
namespace core_no_deps
namespace c_no_deps
{
class GZ_CORE_NO_DEPS_STATIC_VISIBLE AlmostEmpty
class GZ_C_NO_DEPS_STATIC_VISIBLE AlmostEmpty
{
public: AlmostEmpty() = default;
};
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-core_static_child VERSION 0.1.0)
project(gz-c_static_child VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project()
gz_find_package(gz-core_no_deps_static REQUIRED)
gz_find_package(gz-c_no_deps_static REQUIRED)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
gz_create_docs(TAGFILES "${GZ-CORE_NO_DEPS_STATIC_DOXYGEN_TAGFILE} = ${GZ-CORE_NO_DEPS_STATIC_API_URL}")
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# core\_static\_child example

This package links against that static library provided by
the `core_no_deps_static` package.
the `c_no_deps_static` package.

To build, ensure that `core_no_deps_static` has been installed somewhere
To build, ensure that `c_no_deps_static` has been installed somewhere
in your `CMAKE_PREFIX_PATH` and then run:

~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ gz_get_libsources_and_unittests(sources gtest_sources)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
gz-component_deps::gz-component_deps-child)
gz-c_no_deps_static::gz-c_no_deps_static)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/comp_deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-component_deps VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project(
REPLACE_INCLUDE_PATH gz/component_deps
REPLACE_INCLUDE_PATH gz/comp_deps
)
gz_configure_build(QUIT_IF_BUILD_ERRORS
COMPONENTS child parent)
Expand Down
6 changes: 3 additions & 3 deletions examples/comp_deps/src/AlmostEmpty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*
*/

#include <gz/component_deps/Export.hh>
#include <gz/comp_deps/Export.hh>

namespace gz
{
namespace component_deps
namespace comp_deps
{
class GZ_COMPONENT_DEPS_VISIBLE AlmostEmpty
class GZ_COMP_DEPS_VISIBLE AlmostEmpty
{
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-use_component_depsC VERSION 0.1.0)
project(gz-use_comp_depsA VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project()
gz_find_package(gz-component_deps REQUIRED COMPONENTS child)
gz_find_package(gz-comp_deps REQUIRED COMPONENTS child)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
gz_create_docs()
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ gz_get_libsources_and_unittests(sources gtest_sources)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
gz-component_deps::gz-component_deps-child)
gz-comp_deps::gz-comp_deps-child)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-use_component_depsA VERSION 0.1.0)
project(comp_depsA VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project()
gz_find_package(gz-component_deps REQUIRED COMPONENTS parent child)
gz_find_package(gz-comp_deps REQUIRED COMPONENTS parent child)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
gz_create_docs()
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This package uses the `child` and `parent` components of `component\_deps`
and calls `gz_find_package` with the components specified
in the order `child parent`.
Aside from the order in which the components are specified,
this package is identical to `use_component_depsA`.
this package is identical to `use_comp_depsA`.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ gz_get_libsources_and_unittests(sources gtest_sources)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
gz-component_deps::gz-component_deps-child)
gz-comp_deps::gz-comp_deps-child)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-use_component_depsB VERSION 0.1.0)
project(comp_depsB VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project()
gz_find_package(gz-component_deps REQUIRED COMPONENTS child parent)
gz_find_package(gz-comp_deps REQUIRED COMPONENTS child parent)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
gz_create_docs()
File renamed without changes.
6 changes: 6 additions & 0 deletions examples/comp_depsC/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gz_get_libsources_and_unittests(sources gtest_sources)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
gz-comp_deps::gz-comp_deps-child)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions examples/core_static_child/src/CMakeLists.txt

This file was deleted.

27 changes: 0 additions & 27 deletions examples/no_gz_prefix/src/AlmostEmpty.cc

This file was deleted.

Empty file.
File renamed without changes.
Empty file.
Loading

0 comments on commit 9498b62

Please sign in to comment.