[CMake] Swig and cmake

Ian.Appru at ubs.com Ian.Appru at ubs.com
Fri Mar 10 04:50:46 EST 2006


Hi 

Thought you might find useful the results of some work I've done with
swig and cmake.

I mailed previously regarding spliting the swig java file generation
step and interface cxx compile step.
This was so that I could compile the java/dotnet files before the cxx
generated files - important to my project since the cxx compile take
quite a while but errors normally appeared in the subsequently compiled
java/dotnet files.

The soln I came up with was to use a dummy file as a dependency of
SWIG_ADD_MODULE and a custom cmd which generated this file and compiled
the java files.

Never really happy with that - as obviously a bit cludgey.

The much simpler solution was to add an extra helper target into Cmakes
SWIG_ADD_MODULE macro 

	ADD_CUSTOM_TARGET(swig
		"@echo" Run the swig build for
${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}
		DEPENDS ${swig_generated_sources}
    ${swig_other_sources}
		)

I can therefore call each step in any order I like and also use gmake
parallel compile for swig and not cxx if I wish - (the MS compiler very
averse to parallel compiles)

	make swig -j$(MAKEJOBS)
	make compile-java
	make my-JNI -j(CXX_MAKEJOBS)

Regards
Ian


Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.
-------------- next part --------------
Skipped content of type multipart/mixed


More information about the CMake mailing list