Changeset 624:a5682d003ed9 in freeDiameter for extensions/dbg_interactive/CMakeLists.txt
- Timestamp:
- Dec 9, 2010, 5:14:24 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dbg_interactive/CMakeLists.txt
r618 r624 11 11 FIND_PACKAGE(SWIG REQUIRED) 12 12 INCLUDE(${SWIG_USE_FILE}) 13 SET(CMAKE_SWIG_FLAGS "")13 SET(CMAKE_SWIG_FLAGS -castmode -threads) 14 14 15 15 # Add the dependencies for re-swig-ing the file 16 SET(SWIG_MODULE_ diwrap_EXTRA_DEPS16 SET(SWIG_MODULE_fDpy_EXTRA_DEPS 17 17 ${CMAKE_BINARY_DIR}/include/freeDiameter/freeDiameter-host.h 18 18 ${CMAKE_SOURCE_DIR}/include/freeDiameter/libfreeDiameter.h 19 19 ${CMAKE_SOURCE_DIR}/include/freeDiameter/freeDiameter.h) 20 SET_SOURCE_FILES_PROPERTIES(dbg_interactive.i PROPERTIES SWIG_MODULE_NAME fDpy) 20 21 21 # We create the module even if we don't use it, so that intermediate values are defined (OK, this is stupid...) 22 SWIG_ADD_MODULE(diwrap python diwrap.i) 22 # The following code is inspired from SWIG_ADD_MODULE, but we do only what we need 23 SWIG_MODULE_INITIALIZE(fDpy python) 24 SWIG_ADD_SOURCE_TO_MODULE(fDpy swig_generated_sources "dbg_interactive.i") 25 26 # In order to avoid shipping the python file that contains the shadow class definitions, 27 # we transform this file in a C-style string and compile it within our software. 28 # We use for this purpose xxd tool provided with vim package. 29 FIND_PROGRAM(XXD_EXECUTABLE xxd) 30 # To avoid the dependency, simply compile it if not provided 31 if (NOT XXD_EXECUTABLE) 32 SET_SOURCE_FILES_PROPERTIES(helper/xxd.c PROPERTIES COMPILE_DEFINITIONS UNIX) 33 ADD_EXECUTABLE(xxd helper/xxd.c) 34 SET(XXD_EXECUTABLE xxd) 35 endif (NOT XXD_EXECUTABLE) 36 # And now the magic command 37 ADD_CUSTOM_COMMAND( 38 OUTPUT "fDpy-inc.c" 39 COMMAND "${XXD_EXECUTABLE}" 40 ARGS "-i" 41 "fDpy.py" 42 "fDpy-inc.c" 43 MAIN_DEPENDENCY "${swig_extra_generated_files}" 44 COMMENT "Converting swig proxy class to C string") 45 46 # Ensure that the generated source files are removed 47 GET_DIRECTORY_PROPERTY(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) 48 SET_DIRECTORY_PROPERTIES(PROPERTIES 49 ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources};fDpy-inc.c") 50 23 51 24 52 ##### 25 53 # Extension that embeds the python interpreter 26 FD_ADD_EXTENSION(dbg_interactive dbg_interactive.c ${swig_generated_sources} ${swig_other_sources})54 FD_ADD_EXTENSION(dbg_interactive dbg_interactive.c ${swig_generated_sources} fDpy-inc.c) 27 55 TARGET_LINK_LIBRARIES(dbg_interactive ${PYTHON_LIBRARIES}) 28 56
Note: See TracChangeset
for help on using the changeset viewer.