[CMake] Automated packaging

Dixon, Shane Shane.Dixon at atmel.com
Wed Oct 14 18:07:09 EDT 2009


Ok, I got this working, but the only way I could get it to work is to use the configure_file.  For some reason using the execute_process in ctest doesn't like the "-D" options.  Maybe I did something wrong?  Here's what worked:

CopyToArchive.cmake.in:

include(CPackConfig.cmake)
	
EXECUTE_PROCESS(
	WORKING_DIRECTORY "@CTEST_BINARY_DIRECTORY@"
	COMMAND @CTEST_CMAKE_COMMAND@}
	-E echo "CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}" )
	
EXECUTE_PROCESS(
	WORKING_DIRECTORY "@CTEST_BINARY_DIRECTORY@"
	COMMAND @CTEST_CMAKE_COMMAND@ 
	-E copy ${CPACK_PACKAGE_FILE_NAME}.exe @PACKAGE_ARCHIVE@
	RESULT_VARIABLE copy_result )

Here's the call:

CONFIGURE_FILE(
  "${CTEST_SOURCE_DIRECTORY}/cmake/CopyToArchive.cmake.in"
  "${CTEST_BINARY_DIRECTORY}/cmake/CopyToArchive.cmake"
  IMMEDIATE @ONLY)
  
EXECUTE_PROCESS(
	WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
	COMMAND ${CTEST_CMAKE_COMMAND}
    -P ${CTEST_BINARY_DIRECTORY}/cmake/CopyToArchive.cmake 
	RESULT_VARIABLE copy_result )


Any reason why the -D options may not work when calling Cmake in this fashion?

--
Shane Dixon
Linux Engineer
Atmel Corporation 


-----Original Message-----
From: Clinton Stimpson [mailto:clinton at elemtech.com] 
Sent: Wednesday, October 14, 2009 12:12 PM
To: cmake at cmake.org
Cc: Dixon, Shane
Subject: Re: [CMake] Automated packaging


I build the packages in a directory cleaned with each run, and use file(GLOB ...), to get the names of the packages.  Then ssh to copy them to other locations.

Clint

On Wednesday 14 October 2009 12:06:17 pm Dixon, Shane wrote:
> I tried this:
>
> LOAD_CACHE( ${CTEST_BINARY_DIRECTORY/CMakeCache.txt
> 	READ_WITH_PREFIX LOCAL_
> 	CPACK_PACKAGE_FILE_NAME )
>
> EXECUTE_PROCESS(
> 	WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
> 	COMMAND ${CTEST_CMAKE_COMMAND}
> 	-E copy ${LOCAL_CPACK_PACKAGE_FILE_NAME}.exe ${PACKAGE_ARCHIVE}
> 	RESULT_VARIABLE copy_result )
>
> But LOAD_CACHE isn't available in CTest.
>
>
> --
> Shane Dixon
> Linux Engineer
> Atmel Corporation
>
>
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On 
> Behalf Of Dixon, Shane Sent: Wednesday, October 14, 2009 11:50 AM
> To: cmake at cmake.org
> Subject: Re: [CMake] Automated packaging
>
> Clinton,
>
> Okay, that PARTIALLY works.  It does in fact build everything the way 
> it should.  The problem comes when I try to copy the file.  I don't 
> know what the product of the Cpack step is unless I have visibility to 
> the variable CPACK_PACKAGE_FILE_NAME.  I try this block:
>
> EXECUTE_PROCESS(
> 	WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
> 	COMMAND ${CTEST_CMAKE_COMMAND}
> 	-E copy ${CPACK_PACKAGE_FILE_NAME}.exe ${PACKAGE_ARCHIVE}
> 	RESULT_VARIABLE copy_result )
>
> And it doesn't work.  I get this:
>
> Error copying file ".exe" to "C:/temp/ctest_builds/archive".
>
> The CPACK_PACKAGE_FILE_NAME is empty.  If I try to load the 
> CPackConfig.cmake with --config, the -E option balks and doesn't like that.
>  Is there any way to load that variable in my script?  Am I going to 
> have to REGEX it out of the CMakeCache.txt?
>
> --
> Shane Dixon
> Linux Engineer
> Atmel Corporation
>
>
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On 
> Behalf Of Clinton Stimpson Sent: Tuesday, October 13, 2009 4:39 PM
> To: cmake at cmake.org
> Cc: Dixon, Shane
> Subject: Re: [CMake] Automated packaging
>
>
> You could do something like this in your ctest script:
>
>     EXECUTE_PROCESS(WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
>                     COMMAND ${CTEST_CPACK_COMMAND}
>                     --config ${CTEST_BINARY_DIRECTORY}/CPackConfig.cmake
>                     RESULT_VARIABLE package_result)
>
> You can also use EXECUTE_PROCESS to copy packages to an archive.
>
> Clint
>
> On Tuesday 13 October 2009 04:34:15 pm Dixon, Shane wrote:
> > I have a build system that can build multiple packages.  One has a 
> > built-in simulator and the other runs in "real" mode.  I end up with 
> > 2 NSIS packages, one ending in -emul and one ending in -real.  I 
> > want to automate this process so that I can do this:
> >
> >   1. Check out from SVN
> >   2. Configure (for simulation mode)
> >   3. Build
> >   4. Test
> >   5. Package simulation version
> >   6. Reconfigure (for real mode)
> >   7. Test
> >   8. Package real version
> >   9. Copy both packages to an archive
> >
> > I've done a Ctest script, so I can checkout, build, test, etc., but 
> > it doesn't seem to let me "nmake package".  How can I script these 
> > steps so that I can build two different variants of my program?  How 
> > can I invoke the "nmake package".  Does this even belong in a Ctest 
> > script or should it be elsewhere (it seems outside of the scope of Ctest)?
> >
> > --
> > Shane Dixon
> > Linux Engineer
> > Atmel Corporation
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at 
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list