Skip to content

Commit

Permalink
Enables cmd commands on Windows (#402)
Browse files Browse the repository at this point in the history
Signed-off-by: Voldivh <[email protected]>
  • Loading branch information
Voldivh authored Oct 23, 2023
1 parent edd9632 commit 3d7793f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
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${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}")
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$<CONFIG>/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/$<CONFIG>/${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}")
Expand Down
4 changes: 1 addition & 3 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 6 additions & 4 deletions core/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: 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/$<CONFIG>/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.
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: 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}/$<CONFIG>/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.
Expand Down
5 changes: 5 additions & 0 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/$<CONFIG>\"")
endif()
3 changes: 3 additions & 0 deletions test/integration/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));

/////////////////////////////////////////////////
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 @@ -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
Expand Down

0 comments on commit 3d7793f

Please sign in to comment.