Skip to content

Commit

Permalink
Merge branch 'ign-math6' into chapulina/6/-0
Browse files Browse the repository at this point in the history
  • Loading branch information
chapulina authored Apr 27, 2021
2 parents d79b7d7 + 6534dab commit 3e6bd7c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ add_subdirectory(graph)
#################################################
# Setup swig
if (SWIG_FOUND)
if (POLICY CMP0078)
cmake_policy(SET CMP0078 NEW)
endif()
if (POLICY CMP0086)
cmake_policy(SET CMP0086 NEW)
endif()

include(${SWIG_USE_FILE})
set(CMAKE_SWIG_FLAGS "")

Expand All @@ -36,18 +43,12 @@ endif()
# $ export RUBYLIB=/usr/local/lib/ruby
# $ ruby -e "require 'ignition/math'; a = Ignition::Math::Angle.new(20); puts a.Degree()"
if (RUBY_FOUND)
include_directories(${RUBY_INCLUDE_DIRS})

foreach (swig_file ${swig_files})
# Assuming that each swig file has a test
list(APPEND ruby_tests ${swig_file}_TEST)

# Generate the list if .i files
list(APPEND swig_i_files ${swig_file}.i)

# Removing warning from auto-generated files.
set_source_files_properties(${swig_file}RUBY_wrap.cxx
PROPERTIES COMPILE_FLAGS "-w")
endforeach()

# Turn on c++
Expand All @@ -61,6 +62,14 @@ if (RUBY_FOUND)
SWIG_ADD_MODULE(math ruby ruby.i ${swig_i_files} ${sources})
endif()

# Suppress warnings on SWIG-generated files
target_compile_options(math PRIVATE
$<$<CXX_COMPILER_ID:GNU>:-Wno-pedantic -Wno-shadow -Wno-maybe-uninitialized -Wno-unused-parameter>
$<$<CXX_COMPILER_ID:Clang>:-Wno-shadow -Wno-maybe-uninitialized -Wno-unused-parameter>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-shadow -Wno-maybe-uninitialized -Wno-unused-parameter>
)
target_include_directories(math SYSTEM PUBLIC ${RUBY_INCLUDE_DIRS})

SWIG_LINK_LIBRARIES(math ${RUBY_LIBRARY})
target_compile_features(math PUBLIC ${IGN_CXX_${c++standard}_FEATURES})
install(TARGETS math DESTINATION ${IGN_LIB_INSTALL_DIR}/ruby/ignition)
Expand Down

0 comments on commit 3e6bd7c

Please sign in to comment.