From c63dbd7ab7839b3a48556a6e0dd01c0613634fc7 Mon Sep 17 00:00:00 2001 From: Voldivh Date: Mon, 16 Oct 2023 15:46:56 -0500 Subject: [PATCH 1/3] Enables ruby commands on Windows Signed-off-by: Voldivh --- conf/CMakeLists.txt | 8 ++++++-- src/CMakeLists.txt | 4 +--- src/cmd/CMakeLists.txt | 10 ++++++---- test/CMakeLists.txt | 7 ++++++- test/test_config.hh.in | 2 +- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index e42216a9f..7ac7c9e15 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -1,12 +1,16 @@ # Used only for internal testing. -set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${PROJECT_NAME}") +set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$/ruby/gz/cmd${PROJECT_NAME}") # Generate a configuration file for internal testing. # Note that the major version of the library is included in the name. # Ex: sdformat0.yaml configure_file( "${PROJECT_NAME_NO_VERSION_LOWER}.yaml.in" - "${CMAKE_BINARY_DIR}/test/conf/${PROJECT_NAME}.yaml" @ONLY) + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.yaml.configured" @ONLY) + +file(GENERATE + OUTPUT "${CMAKE_BINARY_DIR}/test/conf/$/${PROJECT_NAME}.yaml" + INPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.yaml.configured") # Used for the installed version. set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmd${PROJECT_NAME}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index feab8e716..ad3eb9682 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -126,6 +126,4 @@ target_include_directories(${PROJECT_LIBRARY_TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR} ) -if(NOT WIN32) - add_subdirectory(cmd) -endif() +add_subdirectory(cmd) diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 0c4c1a2f0..a869d5fca 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -2,8 +2,10 @@ # Generate the ruby script for internal testing. # Note that the major version of the library is included in the name. # Ex: cmdsdformat0.rb -set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${PROJECT_NAME}.rb") -set(cmd_script_configured_test "${cmd_script_generated_test}.configured") +set(cmd_script_generated_test + "${CMAKE_BINARY_DIR}/test/lib/$/ruby/gz/cmd${PROJECT_NAME}.rb") +set(cmd_script_configured_test + "${CMAKE_CURRENT_BINARY_DIR}/test_cmd${PROJECT_NAME}.rb.configured") # Set the library_location variable to the full path of the library file within # the build directory. @@ -24,8 +26,8 @@ file(GENERATE # Generate the ruby script that gets installed. # Note that the major version of the library is included in the name. # Ex: cmdsdformat0.rb -set(cmd_script_generated "${CMAKE_CURRENT_BINARY_DIR}/cmd${PROJECT_NAME}.rb") -set(cmd_script_configured "${cmd_script_generated}.configured") +set(cmd_script_generated "${CMAKE_CURRENT_BINARY_DIR}/$/cmd${PROJECT_NAME}.rb") +set(cmd_script_configured "${CMAKE_CURRENT_BINARY_DIR}/cmd${PROJECT_NAME}.rb.configured") # Set the library_location variable to the relative path to the library file # within the install directory structure. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a93dcf814..1afd56f23 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,9 @@ -configure_file(test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh) +configure_file(test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh.configured) + +file(GENERATE +OUTPUT ${PROJECT_BINARY_DIR}/include/test_config.hh +INPUT ${PROJECT_BINARY_DIR}/include/test_config.hh.configured) + include_directories( ${PROJECT_BINARY_DIR}/include ) diff --git a/test/test_config.hh.in b/test/test_config.hh.in index a84d1cddd..89a908f4b 100644 --- a/test/test_config.hh.in +++ b/test/test_config.hh.in @@ -18,7 +18,7 @@ #ifndef SDF_TEST_CONFIG_HH_ #define SDF_TEST_CONFIG_HH_ -#define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf" +#define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf/$" #define GZ_PATH "@GZ_PROGRAM@" #define GZ_TEST_LIBRARY_PATH "${PROJECT_BINARY_DIR}/src:"\ "@GZ-MSGS_LIBRARY_DIRS@:" From 0d34a61fb88666a511448fdf2a1747968afa1f98 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 17 Oct 2023 10:50:58 -0500 Subject: [PATCH 2/3] Use a compile definition for setting `GZ_CONFIG_PATH` Signed-off-by: Addisu Z. Taddese --- src/CMakeLists.txt | 4 ++++ src/gz_TEST.cc | 3 +++ test/CMakeLists.txt | 7 +------ test/test_config.hh.in | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ad3eb9682..0757017d2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,6 +61,10 @@ if (BUILD_TESTING) XmlUtils.cc) endif() + if(TARGET UNIT_gz_TEST) + target_compile_definitions(UNIT_gz_TEST PUBLIC "-DDETAIL_GZ_CONFIG_PATH=\"${CMAKE_BINARY_DIR}/test/conf/$\"") + endif() + if (TARGET UNIT_FrameSemantics_TEST) target_sources(UNIT_FrameSemantics_TEST PRIVATE FrameSemantics.cc Utils.cc) target_link_libraries(UNIT_FrameSemantics_TEST TINYXML2::TINYXML2) diff --git a/src/gz_TEST.cc b/src/gz_TEST.cc index a7c5cacdd..72ff7e5cb 100644 --- a/src/gz_TEST.cc +++ b/src/gz_TEST.cc @@ -36,6 +36,9 @@ #define pclose _pclose #endif +// DETAIL_GZ_CONFIG_PATH is compiler definition set in CMake. +#define GZ_CONFIG_PATH DETAIL_GZ_CONFIG_PATH + static std::string SdfVersion() { return " --force-version " + std::string(SDF_VERSION_FULL); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1afd56f23..a93dcf814 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,9 +1,4 @@ -configure_file(test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh.configured) - -file(GENERATE -OUTPUT ${PROJECT_BINARY_DIR}/include/test_config.hh -INPUT ${PROJECT_BINARY_DIR}/include/test_config.hh.configured) - +configure_file(test_config.hh.in ${PROJECT_BINARY_DIR}/include/test_config.hh) include_directories( ${PROJECT_BINARY_DIR}/include ) diff --git a/test/test_config.hh.in b/test/test_config.hh.in index 89a908f4b..8e025d922 100644 --- a/test/test_config.hh.in +++ b/test/test_config.hh.in @@ -18,7 +18,6 @@ #ifndef SDF_TEST_CONFIG_HH_ #define SDF_TEST_CONFIG_HH_ -#define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf/$" #define GZ_PATH "@GZ_PROGRAM@" #define GZ_TEST_LIBRARY_PATH "${PROJECT_BINARY_DIR}/src:"\ "@GZ-MSGS_LIBRARY_DIRS@:" From fa910435eb98e59871ca28a5ab1742da1c930df4 Mon Sep 17 00:00:00 2001 From: Voldivh Date: Tue, 17 Oct 2023 14:34:48 -0500 Subject: [PATCH 3/3] Modifies path for sdf_description generation Signed-off-by: Voldivh --- sdf/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdf/CMakeLists.txt b/sdf/CMakeLists.txt index 983e7804b..d243b028b 100644 --- a/sdf/CMakeLists.txt +++ b/sdf/CMakeLists.txt @@ -50,7 +50,7 @@ if (GZ_PROGRAM) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/full_${desc_ver_dash}.sdf COMMAND - ${CMAKE_COMMAND} -E env GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf + ${CMAKE_COMMAND} -E env GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$ ${GZ_PROGRAM} ARGS sdf -d ${desc_ver} > ${CMAKE_CURRENT_BINARY_DIR}/full_${desc_ver_dash}.sdf COMMENT "Generating full description for spec ${desc_ver}"