Skip to content

Commit

Permalink
Avoid recompiling sources for the bindings.
Browse files Browse the repository at this point in the history
Signed-off-by: Franco Cipollone <[email protected]>
  • Loading branch information
francocipollone committed Aug 16, 2021
1 parent e26eeb4 commit 0ce31c6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ if (RUBY_FOUND)

set(CMAKE_SWIG_OUTDIR "${CMAKE_BINARY_DIR}/lib/ruby")
if(CMAKE_VERSION VERSION_GREATER 3.8.0)
SWIG_ADD_LIBRARY(math LANGUAGE ruby SOURCES ruby/ruby.i ${swig_i_files} ${sources})
SWIG_ADD_LIBRARY(math LANGUAGE ruby SOURCES ruby/ruby.i ${swig_i_files})
else()
SWIG_ADD_MODULE(math ruby ruby/ruby.i ${swig_i_files} ${sources})
SWIG_ADD_MODULE(math ruby ruby/ruby.i ${swig_i_files})
endif()

# Suppress warnings on SWIG-generated files
Expand All @@ -72,7 +72,10 @@ if (RUBY_FOUND)
)
target_include_directories(math SYSTEM PUBLIC ${RUBY_INCLUDE_DIRS})

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

Expand All @@ -97,12 +100,15 @@ if (PYTHONLIBS_FOUND)

set(CMAKE_SWIG_OUTDIR "${CMAKE_BINARY_DIR}/lib/python")
if(CMAKE_VERSION VERSION_GREATER 3.8.0)
SWIG_ADD_LIBRARY(${SWIG_PY_LIB} LANGUAGE python SOURCES python/python.i ${sources})
SWIG_ADD_LIBRARY(${SWIG_PY_LIB} LANGUAGE python SOURCES python/python.i)
else()
SWIG_ADD_MODULE(${SWIG_PY_LIB} python python/python.i ${sources})
SWIG_ADD_MODULE(${SWIG_PY_LIB} python python/python.i)
endif()

SWIG_LINK_LIBRARIES(${SWIG_PY_LIB} ${PYTHON_LIBRARIES})
SWIG_LINK_LIBRARIES(${SWIG_PY_LIB}
${PYTHON_LIBRARIES}
ignition-math${PROJECT_VERSION_MAJOR}
)

# When using SWIG 3 to build a python interface there is an extra underscore between the name of
# the library given to swig_add_library macro and the generated .so
Expand Down

0 comments on commit 0ce31c6

Please sign in to comment.