Quantitative Analysis
Parallel Processing
Numerical Analysis
C++ Multithreading
Python for Excel
Python Utilities
Services
Author

I. Python Object Browser.
II. Python to R Communicator.
III. Manipulation of piecewise polynomial functions.
IV. Building C++ projects.
1. Why not use bjam?
2. Installation of ots.make.
3. Code structure (ots.make).
4. Example. Building boost::python DLL.
5. Example. Building boost::python extension involving Cuda code.
6. Example. Building in-process COM DLL with embedded boost::python engine.
Downloads. Index. Contents.

Building C++ projects.


resented here library covers coding with STLport and without, MSVC runtimes 7.1 and 9.0, building and using several boost libraries, boost::python extensions, pythons 2.5,2.6,2.7, COM dll (in-process) and COM exe (local), console dll,exe and developing with Cuda. All these features may be taken in any combination, debug or release.

Presently, the library only covers 32-bit Windows.

Building the initial boost::python example (see the directory OTSProjects/tests/hello_ext/ots_make of OTSProjects.zip in the Download section) may be coded in Python as follows.

import ots.make.options as opt

import ots.make.generator as gen

import ots.io as io

version=opt.Version.Release

runtime=opt.Runtime.Msvc9

boost=opt.Libs.Boost_1_51

python=opt.Libs.Python26

stlport=opt.Libs.STLport

libs=[stlport,python,boost,boost.Python]

testDir=io.CDrive+'OTSProjects'+'tests'+'hello_ext'

files=[ ( testDir+'src', [ 'main.cpp'] ) ]

g=gen.MakeFile(

outputName='hello_ext',

outputDir=testDir+'ots_make'+'bin',

version=version,

runtime=runtime,

output=opt.Output.Pyd,

libs=libs,

files=files

)

g.make()

g.build()

g.copyDependencies()

The line g.make() would produce the following make file.

CP_OPTS = \

-DBOOST_ALL_DYN_LINK=1 \

-DBOOST_ALL_NO_LIB=1 \

-I"c:/STLport-5.2.1/stlport" \

-I"c:/boost_1_51_0" \

-I"c:/python26/include" \

-c \

/EHs \

/GR \

/GS \

/MD \

/O2 \

/Ob2 \

/W3 \

/Zc:forScope \

/Zc:wchar_t \

/wd4675

LN_LIBS = \

bPy_b151_msvc9_py26_release_stlp521.lib \

python26.lib

LN_OPTS = \

/DLL \

/IMPLIB:$(OUTPUT_DIR)/$(RESULT_NAME).lib \

/INCREMENTAL:NO \

/LIBPATH:"c:/OTSProjects/Boost/Python/bin/bPy_b151_msvc9_py26_release_stlp521" \

/LIBPATH:"c:/STLport-5.2.1/build/lib/obj/vc9/shared" \

/LIBPATH:"c:/python26/libs" \

/MACHINE:X86 \

/NOLOGO \

/out:"$(OUTPUT_DIR)/$(RESULT_NAME).pyd" \

/subsystem:console

OBJS = $(OBJ_DIR0)/main.obj

OBJ_DIR0 = c:/OTSProjects/tests/hello_ext/ots_make/bin/objs/dir0

OUTPUT_DIR = c:/OTSProjects/tests/hello_ext/ots_make/bin

RESULT_NAME = hello_ext

SRC_DIR0 = c:/OTSProjects/tests/hello_ext/src

goal : "$(OUTPUT_DIR)/$(RESULT_NAME).pyd"

"$(OBJ_DIR0)/main.obj" : "$(SRC_DIR0)/main.cpp"

cl $? -Fo$@ $(CP_OPTS)

"$(OUTPUT_DIR)/$(RESULT_NAME).pyd" : $(OBJS)

link $(LN_OPTS) $(OBJS) $(LN_LIBS)

mt -nologo -manifest "$(OUTPUT_DIR)/$(RESULT_NAME).pyd.manifest" -outputresource:"$(OUTPUT_DIR)/$(RESULT_NAME).pyd;#2"

The line g.build() would build the above make file and the line g.copyDependencies() would copy all non-standard dll dependencies (boost::python dll, stlport dll) into the output directory. If building process fails then g.build() would throw exception.




1. Why not use bjam?
2. Installation of ots.make.
3. Code structure (ots.make).
4. Example. Building boost::python DLL.
5. Example. Building boost::python extension involving Cuda code.
6. Example. Building in-process COM DLL with embedded boost::python engine.

Downloads. Index. Contents.


















Copyright 2007