diff --git a/cmake/NewUseSWIG.cmake b/cmake/UseSWIG.cmake similarity index 89% rename from cmake/NewUseSWIG.cmake rename to cmake/UseSWIG.cmake index 93447b092..c8b1cd7c4 100644 --- a/cmake/NewUseSWIG.cmake +++ b/cmake/UseSWIG.cmake @@ -10,9 +10,10 @@ # :: # # SWIG_ADD_LIBRARY( -# language> -# [TYPE ] -# [[SOURCES] ...]) +# [TYPE ] +# LANGUAGE +# SOURCES ... +# ) # - Define swig module with given name and specified language # SWIG_LINK_LIBRARIES(name [ libraries ]) # - Link libraries to swig module @@ -56,7 +57,8 @@ set(SWIG_CXX_EXTENSION "cxx") set(SWIG_EXTRA_LIBRARIES "") -set(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py") +set(SWIG_PYTHON_EXTRA_FILE_EXTENSIONS ".py") +set(SWIG_JAVA_EXTRA_FILE_EXTENSIONS ".java" "JNI.java") # # For given swig module initialize variables associated with it @@ -80,10 +82,6 @@ macro(SWIG_MODULE_INITIALIZE name language) set(SWIG_MODULE_${name}_REAL_NAME "_${name}") elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xPERL") set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") - elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xCSHARP") - # This makes sure that the name used in the generated DllImport - # matches the library name created by CMake - set(SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport;${name}") endif() endmacro() @@ -122,9 +120,11 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) endif () endif() - foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) - set(${outfiles} ${${outfiles}} - "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}") + foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS}) + set(extra_file "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}${it}") + list(APPEND ${outfiles} ${extra_file}) + # Treat extra outputs as plain files regardless of language. + set_property(SOURCE "${extra_file}" PROPERTY LANGUAGE "") endforeach() endmacro() @@ -190,6 +190,13 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) if(swig_source_file_cplusplus) set(swig_special_flags ${swig_special_flags} "-c++") endif() + if("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xCSHARP") + if(NOT ";${swig_source_file_flags};${CMAKE_SWIG_FLAGS};" MATCHES ";-dllimport;") + # This makes sure that the name used in the generated DllImport + # matches the library name created by CMake + set(SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport;${name}") + endif() + endif() set(swig_extra_flags) if(SWIG_MODULE_${name}_EXTRA_FLAGS) set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) @@ -210,6 +217,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) "${swig_source_file_fullname}" MAIN_DEPENDENCY "${swig_source_file_fullname}" DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} + IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}" COMMENT "Swig source") set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files} PROPERTIES GENERATED 1) @@ -229,8 +237,6 @@ endmacro() macro(SWIG_ADD_LIBRARY name) - - include(CMakeParseArguments) set(options "") set(oneValueArgs LANGUAGE TYPE) @@ -247,6 +253,8 @@ macro(SWIG_ADD_LIBRARY name) if(NOT DEFINED _SAM_TYPE) set(_SAM_TYPE MODULE) + elseif("${_SAM_TYPE}" STREQUAL "USE_BUILD_SHARED_LIBS") + unset(_SAM_TYPE) endif() swig_module_initialize(${name} ${_SAM_LANGUAGE}) @@ -273,7 +281,9 @@ macro(SWIG_ADD_LIBRARY name) ${_SAM_TYPE} ${swig_generated_sources} ${swig_other_sources}) - set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON) + if("${_SAM_TYPE}" STREQUAL "MODULE") + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON) + endif() string(TOLOWER "${_SAM_LANGUAGE}" swig_lowercase_language) if ("${swig_lowercase_language}" STREQUAL "octave") set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") @@ -291,7 +301,9 @@ macro(SWIG_ADD_LIBRARY name) set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib") endif () elseif ("${swig_lowercase_language}" STREQUAL "lua") - set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") + if("${_SAM_TYPE}" STREQUAL "MODULE") + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") + endif() elseif ("${swig_lowercase_language}" STREQUAL "python") # this is only needed for the python case where a _modulename.so is generated set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") @@ -319,6 +331,9 @@ macro(SWIG_ADD_LIBRARY name) if (APPLE) set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".bundle") endif () + else() + # assume empty prefix because we expect the module to be dynamically loaded + set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") endif () endmacro() @@ -332,4 +347,3 @@ macro(SWIG_LINK_LIBRARIES name) message(SEND_ERROR "Cannot find Swig library \"${name}\".") endif() endmacro() - diff --git a/packages/raptor/doc/CMakeLists.txt b/packages/raptor/doc/CMakeLists.txt new file mode 100644 index 000000000..f8c8e4148 --- /dev/null +++ b/packages/raptor/doc/CMakeLists.txt @@ -0,0 +1,4 @@ + + +include(PackageDocs) +