[CMake] (no subject)
Hallo everybody, may I have two more simple questions about CMake and SWIG module? The first is connected to the setting of SWIG parameters - when I create wrapper for Java, I need to set -package name to SWIG. It is impossible to set is as: SET_SOURCE_FILES_PROPERTIES( ErisJava.i PROPERTIES SWIG_FLAGS -package my_package ) as it is replaced by -package\ my_package in the call of SWIG. Moreover, it overwrites all previous definitions of PROPERTIES SWIG_FLAGS. There is possibility of using: SET(CMAKE_SWIG_FLAGS -package my_package) but if I understand it well, it swithes this parameter globally, for all swig calls (also when wrapping e.g. python). So, how to deal with this? Is there another way or is the second way correct? == The second question is about cmake -E copy command. I have notices that the use of wildcards is not possible in this command (event not documented?) - I need to copy all generated Java wrappign classes, but I cannot use the command cmake -E copy source_dir/*.java destin_dir. I have solved it by cmake -E chdir dir comand, but I have completely lost the platform independence. I want kindly to ask you, if it would be possible to add support for wildcards in the cmake -E copy command (or mabye to the others as well?) - it will extend the abilities of the cmake while still be platform independent. Or can it be solved in another way? I use CMake 2.2-1-beta (compiled by gentoo distro). Thank you very much for your help. Dan ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] CMake + SWIG
Hallo everybody, may I have two more simple questions about CMake and SWIG module? The first is connected to the setting of SWIG parameters - when I create wrapper for Java, I need to set -package name to SWIG. It is impossible to set is as: SET_SOURCE_FILES_PROPERTIES( ErisJava.i PROPERTIES SWIG_FLAGS -package my_package ) as it is replaced by -package\ my_package in the call of SWIG. Moreover, it overwrites all previous definitions of PROPERTIES SWIG_FLAGS. There is possibility of using: SET(CMAKE_SWIG_FLAGS -package my_package) but if I understand it well, it swithes this parameter globally, for all swig calls (also when wrapping e.g. python). So, how to deal with this? Is there another way or is the second way correct? == The second question is about cmake -E copy command. I have notices that the use of wildcards is not possible in this command (event not documented?) - I need to copy all generated Java wrappign classes, but I cannot use the command cmake -E copy source_dir/*.java destin_dir. I have solved it by cmake -E chdir dir comand, but I have completely lost the platform independence. I want kindly to ask you, if it would be possible to add support for wildcards in the cmake -E copy command (or mabye to the others as well?) - it will extend the abilities of the cmake while still be platform independent. Or can it be solved in another way? I use CMake 2.2-1-beta (compiled by gentoo distro). Thank you very much for your help. Dan --- P.S. I am really sorry for the previous post, I forget to fill the subject :-( ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Fwd: CMAKE + SWIG + more wrapped languages
Hallo everybody. May I ask you for a help with SWIG module in CMake? I need to create more wrapping libraries from one set of .i SWIG files. To use SWIG from CMake is really trivial for one wrapped language, but I need to create more wrappers in one step, as illustrated below: I have directory structure like this: wrap | +-- Module.i +-- *.i (other SWIG interface files included by Module.i) | +-- python +-- perl +-- java The wrap/CMakeLists.txt looks simple: SUBDIRS(python perl java) And for example wrap/python/CMakeLists.txt looks like (the CMakeLists will look similarly for perl and java packages): # Find and include required packages FIND_PACKAGE( SWIG REQUIRED ) FIND_PACKAGE( PythonLibs REQUIRED ) INCLUDE( ${SWIG_USE_FILE} ) # Set include python path INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) # Generated file is C++, tell it to SWIG SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES CPLUSPLUS ON ) # ! Tell to SWIG that .i files are one directory up ! SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS -I../) # Create wrapper SWIG_ADD_MODULE( module python Module.i ) SWIG_LINK_LIBRARIES( module python2.4 ) # Copy the generated files as post-build step ADD_CUSTOM_COMMAND( TARGET ${SWIG_MODULE_module_REAL_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_BINARY_DIR}/*.py ${CMAKE_CURRENT_SOURCE_DIR} ) # ADD_CUSTOM_COMMAND( TARGET${SWIG_MODULE_module_REAL_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_BINARY_DIR}/*.so ${CMAKE_CURRENT_SOURCE_DIR} ) However, when the build process is started, it finishes by error: make[5]: Entering directory `/home//build//wrap/python' make[5]: *** No rule to make target `/home//wrap/python/Module.i', needed by `/home//build//wrap/python/Module_wrap.c'. Stop. When I looked at .../build/python/Makefile, there is target: /home//build//wrap/python/Module_wrap.c: /home//wrap/python/Module.i @echo Building Swig source /home//build/wrap/python/Module_wrap.c... /usr/bin/swig -python -I/usr/include/python2.4 -o /home//build//wrap/python/Module_wrap.c /home//wrap/python/Module.i However, there is no -I../ switch specified by SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS -I../). Moreover, there is absolute path to the Module.i which is, however, wrong. When I tries to call SWIG directly, but only with Module.i it was OK - the -I switch seems to ensure the right path. I have also tried to set relative paths during CMake configuration, but it leaded to other errors during the build. Could someone give me a hint how to solve this problem? Did I choose the right approach, or should it be solved in different way? Or how to instruct CMake not to use the whole path to .i file (neither absolute, nor relative)? Any help will really be appreciated. Thank you very much, Dan ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CMAKE + SWIG + more wrapped languages
Great, this is a good idea, thank you very much! I have tried to create wrap/python/ModulePy.i including the original wrap/Module.i only, and when it was called as .../python $ swig -c++ -python -I../ Module.py everything seemed to be OK (well, I did not try to compile it, I just saw the module.p and Module_wrap.cxx generated). So even if tricky, it seems to work. However, there is still the issue with -I../ flag set to the SWIG through CMake list files: the setting of: SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS -I../) does not work. The -I../ does not appear in the SWIG call. This call is copied from http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_CMake_to_generate_SWIG_wrapper_libraries.3F;. I have also tried to use CMAKE_SWIG_FLAGS instead of SWIG_FLAGS, but the behavior is the same. Unfortunately, there is not much written about the Mastering CMake book, which I have. Do you know anything about it? Thank you very much, regards Dan BTW: the dependency issue means that CMake dos not check changes in .i files (or the change of date), in order to call SWIG to generate new wrapper classes? On Monday 24 July 2006 13:47, ANTON DEGUET wrote: Daniel, I figured out a solution which is more a trick than anything else. Basically, I created an empty .i file as a stub for each language. For example, you have Module.i and you could add ModulePython.i which contains: %include Module.i. I then use CMake with these stubs. This works but I then run into a long known issue with the CMake SWIG macro, i.e. the dependencies don't handle files included by SWIG using the %include. I believe there is a ticket opened for this issue. Anton - Original Message - From: Daniel Tihelka [EMAIL PROTECTED] Date: Monday, July 24, 2006 4:47 am Subject: [CMake] Fwd: CMAKE + SWIG + more wrapped languages Hallo everybody. May I ask you for a help with SWIG module in CMake? I need to create more wrapping libraries from one set of .i SWIG files. To use SWIG from CMake is really trivial for one wrapped language, but I need to create more wrappersin one step, as illustrated below: I have directory structure like this: wrap +-- Module.i +-- *.i (other SWIG interface files included by Module.i) +-- python +--perl +-- java The wrap/CMakeLists.txt looks simple: SUBDIRS(python perl java) And for example wrap/python/CMakeLists.txt looks like (the CMakeLists will look similarly for perl and java packages): # Find and include required packages FIND_PACKAGE( SWIG REQUIRED ) FIND_PACKAGE( PythonLibs REQUIRED ) INCLUDE( ${SWIG_USE_FILE} ) # Set include python path INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) # Generated file is C++, tell it to SWIG SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES CPLUSPLUS ON ) # ! Tell to SWIG that .i files are one directory up ! SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS -I../) # Create wrapper SWIG_ADD_MODULE( module python Module.i ) SWIG_LINK_LIBRARIES( module python2.4 ) # Copy the generated files as post-build step ADD_CUSTOM_COMMAND( TARGET ${SWIG_MODULE_module_REAL_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_BINARY_DIR}/*.py${CMAKE_CURRENT_SOURCE_DIR} ) # ADD_CUSTOM_COMMAND( TARGET${SWIG_MODULE_module_REAL_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_BINARY_DIR}/*.so${CMAKE_CURRENT_SOURCE_DIR} ) However, when the build process is started, it finishes by error: make[5]: Entering directory `/home//build//wrap/python' make[5]: *** No rule to make target `/home//wrap/python/Module.i', needed by `/home//build//wrap/python/Module_wrap.c'. Stop. When I looked at .../build/python/Makefile, there is target: /home//build//wrap/python/Module_wrap.c: /home//wrap/python/Module.i @echo Building Swig source /home//build/wrap/python/Module_wrap.c... /usr/bin/swig -python -I/usr/include/python2.4 -o /home//build//wrap/python/Module_wrap.c /home//wrap/python/Module.i However, there is no -I../ switch specified by SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS - I../). Moreover, there is absolute path to the Module.i which is, however, wrong. When I tries to call SWIG directly, but only with Module.i it was OK - the -I switch seems to ensure the right path. I have also tried to set relative paths during CMake configuration, but it leaded to other errors during the build. Could someone give me a hint how to solve this problem? Did I
Re: [CMake] CMAKE + SWIG + more wrapped languages
I am sorry - the previous mail was wrong. The directives: SET_SOURCE_FILES_PROPERTIES( ErisPython.i PROPERTIES CPLUSPLUS ON ) SET_SOURCE_FILES_PROPERTIES( ErisPython.i PROPERTIES SWIG_FLAGS -I../) seems to work fine. The -I../ flag is set in the SWIG call. I had to miss something. I am sorry again, and thank you very much for your help! Dan On Monday 24 July 2006 14:22, Daniel Tihelka wrote: Great, this is a good idea, thank you very much! I have tried to create wrap/python/ModulePy.i including the original wrap/Module.i only, and when it was called as .../python $ swig -c++ -python -I../ Module.py everything seemed to be OK (well, I did not try to compile it, I just saw the module.p and Module_wrap.cxx generated). So even if tricky, it seems to work. However, there is still the issue with -I../ flag set to the SWIG through CMake list files: the setting of: SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS -I../) does not work. The -I../ does not appear in the SWIG call. This call is copied from http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_CMake_to_generate_SWIG_wr apper_libraries.3F. I have also tried to use CMAKE_SWIG_FLAGS instead of SWIG_FLAGS, but the behavior is the same. Unfortunately, there is not much written about the Mastering CMake book, which I have. Do you know anything about it? Thank you very much, regards Dan BTW: the dependency issue means that CMake dos not check changes in .i files (or the change of date), in order to call SWIG to generate new wrapper classes? On Monday 24 July 2006 13:47, ANTON DEGUET wrote: Daniel, I figured out a solution which is more a trick than anything else. Basically, I created an empty .i file as a stub for each language. For example, you have Module.i and you could add ModulePython.i which contains: %include Module.i. I then use CMake with these stubs. This works but I then run into a long known issue with the CMake SWIG macro, i.e. the dependencies don't handle files included by SWIG using the %include. I believe there is a ticket opened for this issue. Anton - Original Message - From: Daniel Tihelka [EMAIL PROTECTED] Date: Monday, July 24, 2006 4:47 am Subject: [CMake] Fwd: CMAKE + SWIG + more wrapped languages Hallo everybody. May I ask you for a help with SWIG module in CMake? I need to create more wrapping libraries from one set of .i SWIG files. To use SWIG from CMake is really trivial for one wrapped language, but I need to create more wrappersin one step, as illustrated below: I have directory structure like this: wrap +-- Module.i +-- *.i (other SWIG interface files included by Module.i) +-- python +-- perl +-- java The wrap/CMakeLists.txt looks simple: SUBDIRS(python perl java) And for example wrap/python/CMakeLists.txt looks like (the CMakeLists will look similarly for perl and java packages): # Find and include required packages FIND_PACKAGE( SWIG REQUIRED ) FIND_PACKAGE( PythonLibs REQUIRED ) INCLUDE( ${SWIG_USE_FILE} ) # Set include python path INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) # Generated file is C++, tell it to SWIG SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES CPLUSPLUS ON ) # ! Tell to SWIG that .i files are one directory up ! SET_SOURCE_FILES_PROPERTIES( Module.i PROPERTIES SWIG_FLAGS -I../) # Create wrapper SWIG_ADD_MODULE( module python Module.i ) SWIG_LINK_LIBRARIES( module python2.4 ) # Copy the generated files as post-build step ADD_CUSTOM_COMMAND( TARGET ${SWIG_MODULE_module_REAL_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_BINARY_DIR}/*.py${CMAKE_CURRENT_SOURCE_DIR} ) # ADD_CUSTOM_COMMAND( TARGET${SWIG_MODULE_module_REAL_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_BINARY_DIR}/*.so${CMAKE_CURRENT_SOURCE_DIR} ) However, when the build process is started, it finishes by error: make[5]: Entering directory `/home//build//wrap/python' make[5]: *** No rule to make target `/home//wrap/python/Module.i', needed by `/home//build//wrap/python/Module_wrap.c'. Stop. When I looked at .../build/python/Makefile, there is target: /home//build//wrap/python/Module_wrap.c: /home//wrap/python/Module.i @echo Building Swig source /home//build/wrap/python/Module_wrap.c... /usr/bin/swig -python -I/usr/include/python2.4 -o /home//build//wrap/python/Module_wrap.c /home//wrap/python/Module.i However, there is no -I