Compiling Boost.Python for Python in Visual Studio
[
Front page
] [
New
|
List of pages
|
Search
|
Recent changes
|
Help
]
Start:
[[SIGVerse with Python]]
-------
If you questions after reading this page: Please feel fre...
-------
The aim of this tutorial is to guide you with the steps r...
***This tutorial is independent of SIGVerse simulator and...
Please note that:
-This installs all the libs and headers supplied with boo...
-Even if you are using x64 bit architecture, you don't ha...
-This tutorials uses boost from source, you may find pre-...
Okay, here are the steps.
-1. Install Microsoft Visual Studio 2008. Apply all the p...
-2. Install Python. You can get it from [[here:http://www...
--In this example I used C:\Python27\ as the destination ...
--We also tested with Python 3.3.2. It works fine.
-3. Download and unzip boost. You can get it from [[here:...
--I used version "boost_1_54_0.7z".
--In this example I used "C:\Program Files\boost\boost_1_...
-4. Add user-config.jam to your home directory. Placing ...
--In my case it was C:\Users\(myname)\. The contents of t...
#highlight(c){{
using msvc : 9.0 ;
import toolset : using ;
using python
: 2.7
: C:\\Python27\\python # cmd-or-prefix
: #C:\\Python27\\include
: #C:\\Python27\\libs
;
}}
Please modify the contents according to your version of V...
-5. Strat cmd and type the following:
#highlight(c){{
cd "C:\Program Files\boost\boost_1_54_0"
bootstrap
b2 -jX link=static,shared threading=single,multi toolset=...
}}
Note: X in above command, is the number of threads your...
This will compile both static and shared libraries and in...
Please note that, if you use the option to parallelize th...
-6. Start Visual Studio 2008. Choose "File-->New-->Projec...
Choose "Visual C++ --> General--> Empty Project". Please ...
In menu, go to Project-->Properties( Alt+F7 ).
Expand "Common Properties --> C/C++ --> General".
In "Additional Include Directories" add these two entries:
C:\Python27\include;
C:\Boost\include\boost-1_54
Expand "Common Properties --> Linker --> General".
In "Additional Library Directories" add these two entries:
C:\Python27\libs;
C:\Boost\lib\i386
Expand "Common Properties --> Linker --> Input".
C:\Python27\libs\python27.lib
C:\Boost\lib\i386\boost_python-vc90-mt-gd-1_54.lib
--7. Go to "Solution Explorer"-->Source-->C++ File. Pleas...
#highlight(c){{
#include <boost/python.hpp>
using namespace boost::python;
int main()
{
try {
Py_Initialize();
object main_module((
handle<>(borrowed(PyImport_AddModule("__main_...
object main_namespace = main_module.attr("__dict_...
handle<> ignored(( PyRun_String( "print (\"Hello,...
Py_file_input,
main_namespace.ptr(),
main_namespace.ptr() ) ));
} catch( error_already_set ) {
PyErr_Print();
}
}
}}
--8. Build the application (F7).
In order to run the application, you need to copy "C:\Boo...
Run the application (F5).
You should see "Hello, World" text in the console output.
Congratulations, you have successful installed boost.pyth...
The next step is to create a Sigservice with embedded pyt...
I will show it in next tutorial.
#highlight(end)
#counter
End:
[[SIGVerse with Python]]
-------
If you questions after reading this page: Please feel fre...
-------
The aim of this tutorial is to guide you with the steps r...
***This tutorial is independent of SIGVerse simulator and...
Please note that:
-This installs all the libs and headers supplied with boo...
-Even if you are using x64 bit architecture, you don't ha...
-This tutorials uses boost from source, you may find pre-...
Okay, here are the steps.
-1. Install Microsoft Visual Studio 2008. Apply all the p...
-2. Install Python. You can get it from [[here:http://www...
--In this example I used C:\Python27\ as the destination ...
--We also tested with Python 3.3.2. It works fine.
-3. Download and unzip boost. You can get it from [[here:...
--I used version "boost_1_54_0.7z".
--In this example I used "C:\Program Files\boost\boost_1_...
-4. Add user-config.jam to your home directory. Placing ...
--In my case it was C:\Users\(myname)\. The contents of t...
#highlight(c){{
using msvc : 9.0 ;
import toolset : using ;
using python
: 2.7
: C:\\Python27\\python # cmd-or-prefix
: #C:\\Python27\\include
: #C:\\Python27\\libs
;
}}
Please modify the contents according to your version of V...
-5. Strat cmd and type the following:
#highlight(c){{
cd "C:\Program Files\boost\boost_1_54_0"
bootstrap
b2 -jX link=static,shared threading=single,multi toolset=...
}}
Note: X in above command, is the number of threads your...
This will compile both static and shared libraries and in...
Please note that, if you use the option to parallelize th...
-6. Start Visual Studio 2008. Choose "File-->New-->Projec...
Choose "Visual C++ --> General--> Empty Project". Please ...
In menu, go to Project-->Properties( Alt+F7 ).
Expand "Common Properties --> C/C++ --> General".
In "Additional Include Directories" add these two entries:
C:\Python27\include;
C:\Boost\include\boost-1_54
Expand "Common Properties --> Linker --> General".
In "Additional Library Directories" add these two entries:
C:\Python27\libs;
C:\Boost\lib\i386
Expand "Common Properties --> Linker --> Input".
C:\Python27\libs\python27.lib
C:\Boost\lib\i386\boost_python-vc90-mt-gd-1_54.lib
--7. Go to "Solution Explorer"-->Source-->C++ File. Pleas...
#highlight(c){{
#include <boost/python.hpp>
using namespace boost::python;
int main()
{
try {
Py_Initialize();
object main_module((
handle<>(borrowed(PyImport_AddModule("__main_...
object main_namespace = main_module.attr("__dict_...
handle<> ignored(( PyRun_String( "print (\"Hello,...
Py_file_input,
main_namespace.ptr(),
main_namespace.ptr() ) ));
} catch( error_already_set ) {
PyErr_Print();
}
}
}}
--8. Build the application (F7).
In order to run the application, you need to copy "C:\Boo...
Run the application (F5).
You should see "Hello, World" text in the console output.
Congratulations, you have successful installed boost.pyth...
The next step is to create a Sigservice with embedded pyt...
I will show it in next tutorial.
#highlight(end)
#counter
Page: