Skip to content

Commit 24b6153

Browse files
authored
Merge pull request #1339 from gazebosim/voldivh/win_install_cmd
Install ruby commands on Windows
2 parents f425694 + fa91043 commit 24b6153

File tree

6 files changed

+21
-11
lines changed

6 files changed

+21
-11
lines changed

conf/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Used only for internal testing.
2-
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${PROJECT_NAME}")
2+
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$<CONFIG>/ruby/gz/cmd${PROJECT_NAME}")
33

44
# Generate a configuration file for internal testing.
55
# Note that the major version of the library is included in the name.
66
# Ex: sdformat0.yaml
77
configure_file(
88
"${PROJECT_NAME_NO_VERSION_LOWER}.yaml.in"
9-
"${CMAKE_BINARY_DIR}/test/conf/${PROJECT_NAME}.yaml" @ONLY)
9+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.yaml.configured" @ONLY)
10+
11+
file(GENERATE
12+
OUTPUT "${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>/${PROJECT_NAME}.yaml"
13+
INPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.yaml.configured")
1014

1115
# Used for the installed version.
1216
set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmd${PROJECT_NAME}")

sdf/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if (GZ_PROGRAM)
5050
add_custom_command(
5151
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/full_${desc_ver_dash}.sdf
5252
COMMAND
53-
${CMAKE_COMMAND} -E env GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf
53+
${CMAKE_COMMAND} -E env GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>
5454
${GZ_PROGRAM}
5555
ARGS sdf -d ${desc_ver} > ${CMAKE_CURRENT_BINARY_DIR}/full_${desc_ver_dash}.sdf
5656
COMMENT "Generating full description for spec ${desc_ver}"

src/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ if (BUILD_TESTING)
6161
XmlUtils.cc)
6262
endif()
6363

64+
if(TARGET UNIT_gz_TEST)
65+
target_compile_definitions(UNIT_gz_TEST PUBLIC "-DDETAIL_GZ_CONFIG_PATH=\"${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>\"")
66+
endif()
67+
6468
if (TARGET UNIT_FrameSemantics_TEST)
6569
target_sources(UNIT_FrameSemantics_TEST PRIVATE FrameSemantics.cc Utils.cc)
6670
target_link_libraries(UNIT_FrameSemantics_TEST TINYXML2::TINYXML2)
@@ -126,6 +130,4 @@ target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
126130
${CMAKE_CURRENT_SOURCE_DIR}
127131
)
128132

129-
if(NOT WIN32)
130-
add_subdirectory(cmd)
131-
endif()
133+
add_subdirectory(cmd)

src/cmd/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
# Generate the ruby script for internal testing.
33
# Note that the major version of the library is included in the name.
44
# Ex: cmdsdformat0.rb
5-
set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${PROJECT_NAME}.rb")
6-
set(cmd_script_configured_test "${cmd_script_generated_test}.configured")
5+
set(cmd_script_generated_test
6+
"${CMAKE_BINARY_DIR}/test/lib/$<CONFIG>/ruby/gz/cmd${PROJECT_NAME}.rb")
7+
set(cmd_script_configured_test
8+
"${CMAKE_CURRENT_BINARY_DIR}/test_cmd${PROJECT_NAME}.rb.configured")
79

810
# Set the library_location variable to the full path of the library file within
911
# the build directory.
@@ -24,8 +26,8 @@ file(GENERATE
2426
# Generate the ruby script that gets installed.
2527
# Note that the major version of the library is included in the name.
2628
# Ex: cmdsdformat0.rb
27-
set(cmd_script_generated "${CMAKE_CURRENT_BINARY_DIR}/cmd${PROJECT_NAME}.rb")
28-
set(cmd_script_configured "${cmd_script_generated}.configured")
29+
set(cmd_script_generated "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/cmd${PROJECT_NAME}.rb")
30+
set(cmd_script_configured "${CMAKE_CURRENT_BINARY_DIR}/cmd${PROJECT_NAME}.rb.configured")
2931

3032
# Set the library_location variable to the relative path to the library file
3133
# within the install directory structure.

src/gz_TEST.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
#define pclose _pclose
3737
#endif
3838

39+
// DETAIL_GZ_CONFIG_PATH is compiler definition set in CMake.
40+
#define GZ_CONFIG_PATH DETAIL_GZ_CONFIG_PATH
41+
3942
static std::string SdfVersion()
4043
{
4144
return " --force-version " + std::string(SDF_VERSION_FULL);

test/test_config.hh.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#ifndef SDF_TEST_CONFIG_HH_
1919
#define SDF_TEST_CONFIG_HH_
2020

21-
#define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf"
2221
#define GZ_PATH "@GZ_PROGRAM@"
2322
#define GZ_TEST_LIBRARY_PATH "${PROJECT_BINARY_DIR}/src:"\
2423
"@GZ-MSGS_LIBRARY_DIRS@:"

0 commit comments

Comments
 (0)