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

dartsim-plugin windows build fixes #148

Merged
merged 3 commits into from
Nov 3, 2020
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
16 changes: 12 additions & 4 deletions dartsim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ ign_add_component(dartsim INTERFACE

target_link_libraries(${features} INTERFACE ${DART_LIBRARIES})
target_include_directories(${features} SYSTEM INTERFACE ${DART_INCLUDE_DIRS})
if (MSVC)
# needed by DART, see https://github.com/dartsim/dart/issues/753
target_compile_options(${features} INTERFACE "/permissive-")
endif()

install(
DIRECTORY include/
Expand Down Expand Up @@ -42,11 +46,15 @@ install(TARGETS ${dartsim_plugin} DESTINATION ${IGNITION_PHYSICS_ENGINE_INSTALL_
set(versioned ${CMAKE_SHARED_LIBRARY_PREFIX}${dartsim_plugin}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(unversioned ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME_NO_VERSION_LOWER}-${engine_name}${CMAKE_SHARED_LIBRARY_SUFFIX})
if (WIN32)
# create_symlink requires cmake 3.13 on windows
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
# disable MSVC inherit via dominance warning
target_compile_options(${dartsim_plugin} PUBLIC "/wd4250")
INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy
${IGNITION_PHYSICS_ENGINE_INSTALL_DIR}\/${versioned}
${IGNITION_PHYSICS_ENGINE_INSTALL_DIR}\/${unversioned})")
else()
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unversioned})
INSTALL(FILES ${PROJECT_BINARY_DIR}/${unversioned} DESTINATION ${IGNITION_PHYSICS_ENGINE_INSTALL_DIR})
endif()
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unversioned})
INSTALL(FILES ${PROJECT_BINARY_DIR}/${unversioned} DESTINATION ${IGNITION_PHYSICS_ENGINE_INSTALL_DIR})

# Testing
ign_build_tests(
Expand Down
6 changes: 6 additions & 0 deletions test/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ if (DART_FOUND)
target_link_libraries(MockDoublePendulum PUBLIC ${DART_LIBRARIES})
target_compile_definitions(MockDoublePendulum PRIVATE
"IGNITION_PHYSICS_RESOURCE_DIR=\"${IGNITION_PHYSICS_RESOURCE_DIR}\"")
if (MSVC)
# needed by DART, see https://github.com/dartsim/dart/issues/753
target_compile_options(MockDoublePendulum PUBLIC "/permissive-")
# disable MSVC inherit via dominance warning
target_compile_options(MockDoublePendulum PUBLIC "/wd4250")
endif()
endif()
32 changes: 0 additions & 32 deletions tools/check_test_ran.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

import os
import sys
import subprocess

def usage():
print("""Usage:
Expand All @@ -53,29 +52,6 @@ def usage():
print(sys.argv)
sys.exit(getattr(os, 'EX_USAGE', 1))

def run_grep(filename, arg):
process = subprocess.Popen(['grep', arg, filename], stdout=subprocess.PIPE)
stdout, stderr = process.communicate()
return stdout, stderr

def run_xsltproc(stylesheet, document):
try:
process = subprocess.Popen(['xsltproc', stylesheet, document], stdout=subprocess.PIPE)
stdout, stderr = process.communicate()
# Overwrite same document
open(document, 'w').write(stdout)
except OSError as err:
test_name = os.path.basename(document)
f = open(document, 'w')
d = {'test': test_name, 'test_file': document, 'test_no_xml': test_name.replace('.xml', '')}
f.write("""<?xml version="1.0" encoding="UTF-8"?>
<testsuite tests="1" failures="1" time="1" errors="0" name="%(test)s">
<testcase name="test_ran" status="run" time="1" classname="%(test_no_xml)s">
<failure message="Unable to find xsltproc. Can not parse output test for QTest suite." type=""/>
</testcase>
</testsuite>"""%d)
sys.exit(getattr(os, 'EX_USAGE', 1))

def check_main():
if len(sys.argv) < 2:
usage()
Expand All @@ -98,14 +74,6 @@ def check_main():
<failure message="Unable to find test results for %(test)s, test did not run.\nExpected results in %(test_file)s" type=""/>
</testcase>
</testsuite>"""%d)
sys.exit(getattr(os, 'EX_USAGE', 1))

# Checking if test is a QTest file
stdout, stderr = run_grep(test_file, "QtVersion")
if (stdout):
print("Detect QTest xml file. Converting to JUNIT ...")
stylesheet = os.path.dirname(os.path.abspath(__file__)) + "/qtest_to_junit.xslt"
run_xsltproc(stylesheet, test_file)

if __name__ == '__main__':
check_main()
2 changes: 1 addition & 1 deletion tpe/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (WIN32)
# disable MSVC inherit via dominance warning
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250")
INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy
${IGNITION_PHYSICS_ENGINE_INSTALL_DIR}\/${versioned}
${IGNITION_PHYSICS_ENGINE_INSTALL_DIR}\/${versioned}
${IGNITION_PHYSICS_ENGINE_INSTALL_DIR}\/${unversioned})")
else()
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unversioned})
Expand Down