From 5b202a87afbeab7ddb57bd748defce257a788427 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 4 Sep 2004 09:26:05 +0000 Subject: Some more tweaks on building and CMake I asked for from Bill Hoffman git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6223 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Introduction.html | 46 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) (limited to 'Doc/Manual/Introduction.html') diff --git a/Doc/Manual/Introduction.html b/Doc/Manual/Introduction.html index 7474028e7..9197770b7 100644 --- a/Doc/Manual/Introduction.html +++ b/Doc/Manual/Introduction.html @@ -339,13 +339,6 @@ SWIG is most commonly invoked from within a Makefile, but is also known to be in Microsoft Visual Studio.

-

-There is growing support for SWIG in some build tools, for example CMake -is a cross-platform, open-source build tool with built in support for SWIG. It can detect the SWIG executable, -many of the target language interpreters and libraries for linking against. -It can then use this information to generate a makefile/project file for a host of different compilers/IDEs. -

-

If you are using the GNU Autotools (Autoconf/ @@ -354,10 +347,45 @@ If you are using the GNU Autotools to configure SWIG use in your project, the SWIG Autoconf macros can be used. The primary macro is ac_pkg_swig, see http://www.gnu.org/software/ac-archive/htmldoc/ac_pkg_swig.html. -The ac_python_devel Autoconf macro is also helpful for SWIG generated Python interfaces, see the -Autoconf Macro Archive for further information and other . +The ac_python_devel macro is also helpful for generating Python extensions. See the +Autoconf Macro Archive +for further information on this and other Autoconf macros. +

+ +

+There is growing support for SWIG in some build tools, for example CMake +is a cross-platform, open-source build manager with built in support for SWIG. CMake can detect the SWIG executable +and many of the target language libraries for linking against. +CMake knows how to build shared libraries and loadable modules on many different operating systems. +This allows easy cross platform SWIG development. It also can generate the custom commands necessary for +driving SWIG from IDE's and makefiles. All of this can be done from a single cross platform input file. +The following example is a CMake input file for creating a python wrapper for the SWIG interface file, example.i:

+
+
+# This is a CMake example for Python
+
+FIND_PACKAGE(SWIG REQUIRED)
+INCLUDE(${SWIG_USE_FILE})
+
+FIND_PACKAGE(PythonLibs)
+INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+SET(CMAKE_SWIG_FLAGS "")
+
+SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES SWIG_FLAGS "-includeall")
+SWIG_ADD_MODULE(example python example.i example.cxx)
+SWIG_LINK_LIBRARIES(example ${PYTHON_LIBRARIES})
+
+
+ +The above example will generate native build files such as makefiles, nmake files and Visual Studio projects +which will invoke SWIG and compile the generated C++ files into _example.so (UNIX) or _example.dll (Windows). +

2.7 Hands off code generation

-- cgit v1.2.1