Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install ruby commands on Windows #1339

Merged
merged 4 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions conf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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/$<CONFIG>/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/$<CONFIG>/${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}")
Expand Down
2 changes: 1 addition & 1 deletion sdf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/$<CONFIG>
${GZ_PROGRAM}
ARGS sdf -d ${desc_ver} > ${CMAKE_CURRENT_BINARY_DIR}/full_${desc_ver_dash}.sdf
COMMENT "Generating full description for spec ${desc_ver}"
Expand Down
8 changes: 5 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/$<CONFIG>\"")
endif()

if (TARGET UNIT_FrameSemantics_TEST)
target_sources(UNIT_FrameSemantics_TEST PRIVATE FrameSemantics.cc Utils.cc)
target_link_libraries(UNIT_FrameSemantics_TEST TINYXML2::TINYXML2)
Expand Down Expand Up @@ -126,6 +130,4 @@ target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
)

if(NOT WIN32)
add_subdirectory(cmd)
endif()
add_subdirectory(cmd)
10 changes: 6 additions & 4 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/$<CONFIG>/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.
Expand All @@ -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}/$<CONFIG>/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.
Expand Down
3 changes: 3 additions & 0 deletions src/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion test/test_config.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@:"
Expand Down