Mercurial > hg > freeDiameter
annotate extensions/dbg_interactive/CMakeLists.txt @ 624:a5682d003ed9
Finally got the proxy aka shadow class to work
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 09 Dec 2010 17:14:24 +0900 |
parents | 1dbc4c5397d6 |
children | 2cd2cf7abe2a |
rev | line source |
---|---|
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 # The rt_debug extension |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 PROJECT("Interactive debug facility based on SWIG" C) |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
3 |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
5 # This module is using Python |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 FIND_PACKAGE(PythonLibs) |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
8 |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 ##### |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 # Wrapper to fD in python |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 FIND_PACKAGE(SWIG REQUIRED) |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 INCLUDE(${SWIG_USE_FILE}) |
624
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
13 SET(CMAKE_SWIG_FLAGS -castmode -threads) |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 |
618
1dbc4c5397d6
Attempting to improve python wrapper usability (work in progress)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
609
diff
changeset
|
15 # Add the dependencies for re-swig-ing the file |
624
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
16 SET(SWIG_MODULE_fDpy_EXTRA_DEPS |
618
1dbc4c5397d6
Attempting to improve python wrapper usability (work in progress)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
609
diff
changeset
|
17 ${CMAKE_BINARY_DIR}/include/freeDiameter/freeDiameter-host.h |
1dbc4c5397d6
Attempting to improve python wrapper usability (work in progress)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
609
diff
changeset
|
18 ${CMAKE_SOURCE_DIR}/include/freeDiameter/libfreeDiameter.h |
1dbc4c5397d6
Attempting to improve python wrapper usability (work in progress)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
609
diff
changeset
|
19 ${CMAKE_SOURCE_DIR}/include/freeDiameter/freeDiameter.h) |
624
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
20 SET_SOURCE_FILES_PROPERTIES(dbg_interactive.i PROPERTIES SWIG_MODULE_NAME fDpy) |
618
1dbc4c5397d6
Attempting to improve python wrapper usability (work in progress)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
609
diff
changeset
|
21 |
624
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
22 # The following code is inspired from SWIG_ADD_MODULE, but we do only what we need |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
23 SWIG_MODULE_INITIALIZE(fDpy python) |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
24 SWIG_ADD_SOURCE_TO_MODULE(fDpy swig_generated_sources "dbg_interactive.i") |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
25 |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
26 # In order to avoid shipping the python file that contains the shadow class definitions, |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
27 # we transform this file in a C-style string and compile it within our software. |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
28 # We use for this purpose xxd tool provided with vim package. |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
29 FIND_PROGRAM(XXD_EXECUTABLE xxd) |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
30 # To avoid the dependency, simply compile it if not provided |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
31 if (NOT XXD_EXECUTABLE) |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
32 SET_SOURCE_FILES_PROPERTIES(helper/xxd.c PROPERTIES COMPILE_DEFINITIONS UNIX) |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
33 ADD_EXECUTABLE(xxd helper/xxd.c) |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
34 SET(XXD_EXECUTABLE xxd) |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
35 endif (NOT XXD_EXECUTABLE) |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
36 # And now the magic command |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
37 ADD_CUSTOM_COMMAND( |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
38 OUTPUT "fDpy-inc.c" |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
39 COMMAND "${XXD_EXECUTABLE}" |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
40 ARGS "-i" |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
41 "fDpy.py" |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
42 "fDpy-inc.c" |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
43 MAIN_DEPENDENCY "${swig_extra_generated_files}" |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
44 COMMENT "Converting swig proxy class to C string") |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
45 |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
46 # Ensure that the generated source files are removed |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
47 GET_DIRECTORY_PROPERTY(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
48 SET_DIRECTORY_PROPERTIES(PROPERTIES |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
49 ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources};fDpy-inc.c") |
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
50 |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
52 ##### |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 # Extension that embeds the python interpreter |
624
a5682d003ed9
Finally got the proxy aka shadow class to work
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
618
diff
changeset
|
54 FD_ADD_EXTENSION(dbg_interactive dbg_interactive.c ${swig_generated_sources} fDpy-inc.c) |
609
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
55 TARGET_LINK_LIBRARIES(dbg_interactive ${PYTHON_LIBRARIES}) |
2d15fd8ef5ba
Very very early python interactive extension, using SWIG
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
56 |