PROTON-1533: Fix swig deprecation warnings
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/bdac005a Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/bdac005a Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/bdac005a Branch: refs/heads/go1 Commit: bdac005a999ffded075eafc61877515edf236b38 Parents: 1b8dae7 Author: Justin Ross <[email protected]> Authored: Wed Aug 9 09:28:35 2017 -0700 Committer: Justin Ross <[email protected]> Committed: Wed Aug 9 09:28:35 2017 -0700 ---------------------------------------------------------------------- proton-c/bindings/node/CMakeLists.txt | 2 +- proton-c/bindings/perl/CMakeLists.txt | 2 +- proton-c/bindings/php/CMakeLists.txt | 2 +- proton-c/bindings/python/CMakeLists.txt | 2 +- proton-c/bindings/ruby/CMakeLists.txt | 2 +- tools/cmake/Modules/FindSWIG.cmake | 43 ++++++++++++++++++++++++++++ 6 files changed, 48 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bdac005a/proton-c/bindings/node/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/node/CMakeLists.txt b/proton-c/bindings/node/CMakeLists.txt index 3bea9f7..333cfd7 100644 --- a/proton-c/bindings/node/CMakeLists.txt +++ b/proton-c/bindings/node/CMakeLists.txt @@ -57,7 +57,7 @@ include_directories("${NODE_ROOT_DIR}/deps/uv/include") set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) set(CMAKE_SWIG_FLAGS "-node;-I${CMAKE_CURRENT_SOURCE_DIR}/../../include") set_source_files_properties(javascript.i PROPERTIES CPLUSPLUS ON) -swig_add_module(cproton javascript javascript.i) +swig_add_library(cproton LANGUAGE javascript SOURCES javascript.i) set_target_properties (cproton PROPERTIES LINKER_LANGUAGE CXX) list(APPEND SWIG_MODULE_cproton_javascript_EXTRA_DEPS ${CMAKE_CURRENT_SOURCE_DIR}/../../proton-c/include/proton/cproton.i http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bdac005a/proton-c/bindings/perl/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/perl/CMakeLists.txt b/proton-c/bindings/perl/CMakeLists.txt index 744e812..28f07bf 100644 --- a/proton-c/bindings/perl/CMakeLists.txt +++ b/proton-c/bindings/perl/CMakeLists.txt @@ -53,7 +53,7 @@ list(APPEND SWIG_MODULE_cproton_perl_EXTRA_DEPS ${CMAKE_SOURCE_DIR}/proton-c/include/proton/cproton.i ${PROTON_HEADERS} ) -swig_add_module(cproton_perl perl perl.i) +swig_add_library(cproton_perl LANGUAGE perl SOURCES perl.i) set_target_properties(cproton_perl PROPERTIES PREFIX "") swig_link_libraries(cproton_perl ${BINDING_DEPS} ${PERL_LIBRARY}) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bdac005a/proton-c/bindings/php/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/php/CMakeLists.txt b/proton-c/bindings/php/CMakeLists.txt index 558269d..696dc38 100644 --- a/proton-c/bindings/php/CMakeLists.txt +++ b/proton-c/bindings/php/CMakeLists.txt @@ -34,7 +34,7 @@ list(APPEND SWIG_MODULE_cproton_EXTRA_DEPS ${CMAKE_SOURCE_DIR}/proton-c/include/proton/cproton.i ${PROTON_HEADERS} ) -swig_add_module(cproton php ${CMAKE_CURRENT_SOURCE_DIR}/php.i) +swig_add_library(cproton LANGUAGE php SOURCES php.i) set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "${PHP_INCLUDES}") swig_link_libraries(cproton ${BINDING_DEPS}) # PHP modules must be linked with unresolved symbols as they are presumably satisfied only when loaded by php itself http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bdac005a/proton-c/bindings/python/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/CMakeLists.txt b/proton-c/bindings/python/CMakeLists.txt index f8c9241..05c2426 100644 --- a/proton-c/bindings/python/CMakeLists.txt +++ b/proton-c/bindings/python/CMakeLists.txt @@ -40,7 +40,7 @@ list(APPEND SWIG_MODULE_cproton_EXTRA_DEPS ${PROTON_HEADERS} ) -swig_add_module(cproton python cproton.i) +swig_add_library(cproton LANGUAGE python SOURCES cproton.i) swig_link_libraries(cproton ${BINDING_DEPS} ${PYTHON_LIBRARIES}) set_target_properties(${SWIG_MODULE_cproton_REAL_NAME} PROPERTIES http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bdac005a/proton-c/bindings/ruby/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/CMakeLists.txt b/proton-c/bindings/ruby/CMakeLists.txt index 05c2a72..c14e4f4 100644 --- a/proton-c/bindings/ruby/CMakeLists.txt +++ b/proton-c/bindings/ruby/CMakeLists.txt @@ -26,7 +26,7 @@ list(APPEND SWIG_MODULE_cproton-ruby_EXTRA_DEPS ) include_directories (${RUBY_INCLUDE_PATH}) -swig_add_module(cproton-ruby ruby ruby.i) +swig_add_library(cproton-ruby LANGUAGE ruby SOURCES ruby.i) swig_link_libraries(cproton-ruby ${BINDING_DEPS} ${RUBY_LIBRARY}) # set a compiler macro to relay the Ruby version to the extension. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bdac005a/tools/cmake/Modules/FindSWIG.cmake ---------------------------------------------------------------------- diff --git a/tools/cmake/Modules/FindSWIG.cmake b/tools/cmake/Modules/FindSWIG.cmake new file mode 100644 index 0000000..979ebab --- /dev/null +++ b/tools/cmake/Modules/FindSWIG.cmake @@ -0,0 +1,43 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +include(${CMAKE_ROOT}/Modules/FindSWIG.cmake) + +if (NOT COMMAND swig_add_library) + macro (SWIG_ADD_LIBRARY name) + set(options "") + set(oneValueArgs LANGUAGE TYPE) + set(multiValueArgs SOURCES) + cmake_parse_arguments(_SAM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if (NOT DEFINED _SAM_LANGUAGE) + message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing LANGUAGE argument") + endif () + + if (NOT DEFINED _SAM_SOURCES) + message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing SOURCES argument") + endif () + + if (DEFINED _SAM_TYPE AND NOT _SAM_LANGUAGE STREQUAL "module") + message(FATAL_ERROR "SWIG_ADD_LIBRARY: This fallback impl of swig_add_library supports the module type only") + endif () + + swig_add_module(${name} ${_SAM_LANGUAGE} ${_SAM_SOURCES}) + endmacro () +endif (NOT COMMAND swig_add_library) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
