From 3d92998a5ee4f48afa2b53018d24c4be3c79db03 Mon Sep 17 00:00:00 2001 From: Voldivh Date: Fri, 20 Oct 2023 12:22:35 -0500 Subject: [PATCH] Enables cmd commands on Windows Signed-off-by: Voldivh --- conf/CMakeLists.txt | 8 ++++++-- core/CMakeLists.txt | 4 +--- core/src/cmd/CMakeLists.txt | 10 ++++++---- test/integration/CMakeLists.txt | 5 +++++ test/integration/gz_TEST.cc | 3 +++ test/test_config.hh.in | 1 - 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index bb60e426..5bae2b3c 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${GZ_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( "${GZ_DESIGNATION}.yaml.in" - "${CMAKE_BINARY_DIR}/test/conf/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" @ONLY) + "${CMAKE_CURRENT_BINARY_DIR}/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml.configured" @ONLY) + +file(GENERATE + OUTPUT "${CMAKE_BINARY_DIR}/test/conf/$/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" + INPUT "${CMAKE_CURRENT_BINARY_DIR}/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml.configured") # Used for the installed version. set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}") diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 3cc7fad8..64f75c81 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -143,6 +143,4 @@ gz_build_tests(TYPE UNIT ) add_subdirectory(include/gz/msgs) -if(NOT WIN32) - add_subdirectory(src/cmd) -endif() +add_subdirectory(src/cmd) diff --git a/core/src/cmd/CMakeLists.txt b/core/src/cmd/CMakeLists.txt index 3a746eb0..4d5f415c 100644 --- a/core/src/cmd/CMakeLists.txt +++ b/core/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: cmdtransport0.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(cmd_script_generated_test + "${CMAKE_BINARY_DIR}/test/lib/$/ruby/gz/cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb") +set(cmd_script_configured_test + "${CMAKE_CURRENT_BINARY_DIR}/test_cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.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: cmdtransport0.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(cmd_script_generated "${CMAKE_CURRENT_BINARY_DIR}/$/cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb") +set(cmd_script_configured "${CMAKE_CURRENT_BINARY_DIR}/cmd${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb.configured") # Set the library_location variable to the relative path to the library file # within the install directory structure. diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 817c9a2a..86a3955e 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -14,3 +14,8 @@ if(TARGET INTEGRATION_Factory_TEST) target_compile_definitions(INTEGRATION_Factory_TEST PRIVATE "-DGZ_MSGS_TEST_PATH=\"${PROJECT_SOURCE_DIR}/test\"") endif() + +if(TARGET INTEGRATION_gz_TEST) + target_compile_definitions(INTEGRATION_gz_TEST PUBLIC + "-DDETAIL_GZ_CONFIG_PATH=\"${CMAKE_BINARY_DIR}/test/conf/$\"") +endif() diff --git a/test/integration/gz_TEST.cc b/test/integration/gz_TEST.cc index 0d7af541..993ff562 100644 --- a/test/integration/gz_TEST.cc +++ b/test/integration/gz_TEST.cc @@ -27,6 +27,9 @@ # define pclose _pclose #endif +// DETAIL_GZ_CONFIG_PATH is compiler definition set in CMake. +#define GZ_CONFIG_PATH DETAIL_GZ_CONFIG_PATH + static const std::string g_version(std::string(GZ_MSGS_VERSION_FULL)); ///////////////////////////////////////////////// diff --git a/test/test_config.hh.in b/test/test_config.hh.in index 073b407a..429d6cc8 100644 --- a/test/test_config.hh.in +++ b/test/test_config.hh.in @@ -19,7 +19,6 @@ #define GZ_MSGS_TEST_CONFIG_HH_ #define PROJECT_SOURCE_PATH "${PROJECT_SOURCE_DIR}" -#define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf" #define GZ_TEST_LIBRARY_PATH "${PROJECT_BINARY_DIR}/src" #if (_MSC_VER >= 1400) // Visual Studio 2005