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 authored Nov 25, 2024
1 parent e08595c commit 5f98f61
Show file tree
Hide file tree
Showing 62 changed files with 163 additions and 146 deletions.
107 changes: 62 additions & 45 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,87 @@ 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)
endif()

set(example_directories
ign_conf
no_ignition_prefix
no_ign_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
)
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()

foreach(example ${example_directories})
set(run_codecheck false)
if (${example} STREQUAL "ign_conf")
set(example_tarball_name ignition-minimal-0.1.0.tar.bz2)
elseif (${example} STREQUAL "no_ignition_prefix")
set(example_tarball_name no_ignition_prefix-0.1.0.tar.bz2)
elseif (${example} STREQUAL "no_ign_prefix")
set(example_tarball_name no_ign_prefix-0.1.0.tar.bz2)
elseif (${example} STREQUAL "prerelease")
set(example_tarball_name ignition-minimal-1.0.0~pre1.tar.bz2)
elseif (${example} STREQUAL "core_nodep")
set(example_tarball_name ignition-core_no_deps-0.1.0.tar.bz2)
elseif (${example} STREQUAL "c_nodep")
set(example_tarball_name ignition-c_no_deps-0.1.0.tar.bz2)
set(run_codecheck true)
elseif (${example} STREQUAL "core_nodep_static")
set(example_tarball_name ignition-core_no_deps_static-0.1.0.tar.bz2)
elseif (${example} STREQUAL "c_nodep_static")
set(example_tarball_name ignition-c_no_deps_static-0.1.0.tar.bz2)
set(run_codecheck true)
elseif (${example} STREQUAL "core_child")
set(example_tarball_name ignition-core_child-0.1.0.tar.bz2)
elseif (${example} STREQUAL "c_child")
set(example_tarball_name ignition-c_child-0.1.0.tar.bz2)
set(run_codecheck true)
elseif (${example} STREQUAL "core_child_private")
set(example_tarball_name ignition-core_child_private-0.1.0.tar.bz2)
elseif (${example} STREQUAL "c_child_private")
set(example_tarball_name ignition-c_child_private-0.1.0.tar.bz2)
set(run_codecheck true)
elseif (${example} STREQUAL "core_static_child")
set(example_tarball_name ignition-core_static_child-0.1.0.tar.bz2)
elseif (${example} STREQUAL "c_static_child")
set(example_tarball_name ignition-c_static_child-0.1.0.tar.bz2)
set(run_codecheck true)
elseif (${example} STREQUAL "comp_deps")
set(example_tarball_name ignition-component_deps-0.1.0.tar.bz2)
elseif (${example} STREQUAL "use_component_depsA")
set(example_tarball_name ignition-use_component_depsa-0.1.0.tar.bz2)
elseif (${example} STREQUAL "use_component_depsB")
set(example_tarball_name ignition-use_component_depsb-0.1.0.tar.bz2)
elseif (${example} STREQUAL "use_component_depsC")
set(example_tarball_name ignition-use_component_depsc-0.1.0.tar.bz2)
elseif (${example} STREQUAL "use_config_ifp")
set(example_tarball_name ignition-comp_deps-0.1.0.tar.bz2)
elseif (${example} STREQUAL "comp_depsA")
set(example_tarball_name ignition-comp_depsa-0.1.0.tar.bz2)
elseif (${example} STREQUAL "comp_depsB")
set(example_tarball_name ignition-comp_depsb-0.1.0.tar.bz2)
elseif (${example} STREQUAL "comp_depsC")
set(example_tarball_name ignition-comp_depsc-0.1.0.tar.bz2)
elseif (${example} STREQUAL "config_ifp")
set(example_tarball_name ignition-find_config-0.1.0.tar.bz2)

else()
set(example_tarball_name)
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 @@ -77,7 +93,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 Down Expand Up @@ -163,24 +179,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 @@ -202,7 +219,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.10.2 FATAL_ERROR)
project(ignition-core_child VERSION 0.1.0)
project(ignition-c_child VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
ign_find_package(ignition-core_no_deps REQUIRED)
ign_find_package(ignition-c_no_deps REQUIRED)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${IGNITION-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 @@ ign_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-core_no_deps::ignition-core_no_deps)
ignition-c_no_deps::ignition-c_no_deps)
ign_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.10.2 FATAL_ERROR)
project(ignition-core_child_private VERSION 0.1.0)
project(ignition-c_child_private VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
ign_find_package(ignition-core_no_deps PRIVATE REQUIRED)
ign_find_package(ignition-c_no_deps PRIVATE REQUIRED)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${IGNITION-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 @@ ign_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PRIVATE
ignition-core_no_deps::ignition-core_no_deps)
ignition-c_no_deps::ignition-c_no_deps)
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(ignition-core_no_deps VERSION 0.1.0)
project(ignition-c_no_deps VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
ign_configure_build(QUIT_IF_BUILD_ERRORS)
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 <ignition/core_no_deps/Export.hh>
#include <ignition/c_no_deps/Export.hh>

namespace gz
{
namespace core_no_deps
namespace c_no_deps
{
class IGNITION_CORE_NO_DEPS_VISIBLE AlmostEmpty
class IGNITION_C_NO_DEPS_VISIBLE AlmostEmpty
{
};
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(ignition-core_no_deps_static VERSION 0.1.0)
project(ignition-c_no_deps_static VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
OPTION(BUILD_SHARED_LIBS OFF)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*
*/

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

namespace gz
{
namespace core_no_deps
namespace c_no_deps
{
class IGNITION_CORE_NO_DEPS_STATIC_VISIBLE AlmostEmpty
class IGNITION_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.10.2 FATAL_ERROR)
project(ignition-core_static_child VERSION 0.1.0)
project(ignition-c_static_child VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
ign_find_package(ignition-core_no_deps_static REQUIRED)
ign_find_package(ignition-c_no_deps_static REQUIRED)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_STATIC_DOXYGEN_TAGFILE} = ${IGNITION-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 @@ ign_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-component_deps::ignition-component_deps-child)
ignition-c_no_deps_static::ignition-c_no_deps_static)
ign_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
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(ignition-component_deps VERSION 0.1.0)
project(ignition-comp_deps VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
ign_configure_build(QUIT_IF_BUILD_ERRORS
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 <ignition/component_deps/Export.hh>
#include <ignition/comp_deps/Export.hh>

namespace gz
{
namespace component_deps
namespace comp_deps
{
class IGNITION_COMPONENT_DEPS_VISIBLE AlmostEmpty
class IGNITION_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.10.2 FATAL_ERROR)
project(ignition-use_component_depsC VERSION 0.1.0)
project(comp_depsA VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
ign_find_package(ignition-component_deps REQUIRED COMPONENTS child)
ign_find_package(ignition-comp_deps REQUIRED COMPONENTS parent child)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
ign_create_docs()
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ ign_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-component_deps::ignition-component_deps-child)
ignition-comp_deps::ignition-comp_deps-child)
ign_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.10.2 FATAL_ERROR)
project(ignition-use_component_depsB VERSION 0.1.0)
project(comp_depsB VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
ign_find_package(ignition-component_deps REQUIRED COMPONENTS child parent)
ign_find_package(ignition-comp_deps REQUIRED COMPONENTS child parent)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
ign_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 `ign_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 @@ ign_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-component_deps::ignition-component_deps-child)
ignition-comp_deps::ignition-comp_deps-child)
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
File renamed without changes.
8 changes: 8 additions & 0 deletions examples/comp_depsC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(comp_depsC VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project()
ign_find_package(ignition-comp_deps REQUIRED COMPONENTS child)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
ign_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 @@
ign_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-comp_deps::ignition-comp_deps-child)
ign_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.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(no_ignition_prefix VERSION 0.1.0)
project(no_ign_prefix VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project(
NO_IGNITION_PREFIX
Expand Down
File renamed without changes.
Loading

0 comments on commit 5f98f61

Please sign in to comment.