[Insight-developers] SimpleITK - CMake question (The Saga of Eggs on Windows…)

Bradley Lowekamp blowekamp at mail.nih.gov
Sat Sep 24 12:49:44 EDT 2011


Hello,

Thanks for all the help I have gotten on this issue. It truly has been extremely difficult getting this egg distribution package working on window!

On my virtual machines I am able to create eggs!!! So we are almost there!!

http://www.cdash.org/CDash/buildSummary.php?buildid=1563093

Unfortunately, on the mayos dashboard machines were are still getting some cmake related issues:

http://www.cdash.org/CDash/buildSummary.php?buildid=1561908
http://www.cdash.org/CDash/buildSummary.php?buildid=1562590

These are running cmake 2.8.4, where as I am running 2.8.5. I am suspicious this may be related to the cmake version. I am running windows 7, and I am not certain which os version is being run at Mayo.

This is the error:
http://www.cdash.org/CDash/viewBuildError.php?buildid=1562590

Error copying file "/.../SimpleITK/Wrapping/PythonPackage/ez_setup.py" to "D:/T/vs10/SimpleITK-build/SimpleITK-build/Wrapping/PythonPackage/".
  
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command ""C:\Program Files\CMake 2.8\bin\cmake.exe" -E copy /.../SimpleITK/Wrapping/PythonPackage/ez_setup.py D:/T/vs10/SimpleITK-build/SimpleITK-build/Wrapping/PythonPackage/ [D:\T\vs10\SimpleITK-build\SimpleITK-build\Wrapping\_SimpleITK.vcxproj] [D:\T\vs10\SimpleITK-build\SimpleITK.vcxproj]
  
I don't know where that triple dot syntax came from or what it should mean. This is the custom command:

  add_custom_command( TARGET ${SWIG_MODULE_SimpleITK_REAL_NAME}
    POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/PythonPackage/ez_setup.py" "${CMAKE_CURRENT_BINARY_DIR}/PythonPackage/"
    COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/__init__.py"
    COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/PythonPackage/setup.py"
    install
    COMMENT "Installing python module to the virtualenv" )

Thanks,
Brad





On Sep 20, 2011, at 6:33 PM, David Cole wrote:

> If the file has one @var@ per line, the following code works to
> extract those variable names. If more than one, you'll have to add to
> this code, but it should be reasonably achievable. The code gives you
> a sorted list of non-duplicated variable names. (But does nothing to
> even detect if there is more than one @var@ per line...
> 
> 
> # save as "read_variables.cmake"
> # usage: 'cmake -Dfilename=config.h.in -P read_variables.cmake'
> 
> if(NOT DEFINED filename)
>  message(FATAL_ERROR "usage: 'cmake -Dfilename=config.h.in -P
> read_variables.cmake'")
> endif()
> 
> set(regex "^.*@([^@]+)@.*$")
> file(STRINGS "${filename}" results REGEX "${regex}")
> set(vars "")
> 
> foreach(line ${results})
>  string(REGEX MATCH "${regex}" line_match "${line}")
>  set(vars ${vars} ${CMAKE_MATCH_1})
>  list(SORT vars)
>  list(REMOVE_DUPLICATES vars)
> 
>  message("line_match='${line_match}'")
>  message("CMAKE_MATCH_0='${CMAKE_MATCH_0}'")
>  message("CMAKE_MATCH_1='${CMAKE_MATCH_1}'")
>  message("")
> endforeach()
> 
> message("vars='${vars}'")
> 
> 
> 
> 
> HTH,
> David
> 
> 
> On Mon, Sep 19, 2011 at 9:08 PM, Bradley Lowekamp
> <blowekamp at mail.nih.gov> wrote:
>> Hello David,
>> 
>> I was thinking about just making a generic re-usable macro to accomplish this. What would make this macro really useful is not having to passing a list of cmake variables, which need to be passed to the launched CMake subprocess.
>> 
>> Would you happen to have some cmake code which would scan a configuration file, and obtain a list of CMake variables which are going to be substituted?
>> 
>> Thanks,
>> Brad
>> 
>> On Sep 19, 2011, at 1:54 PM, David Cole wrote:
>> 
>>> On Sat, Sep 17, 2011 at 5:26 PM, Bradley Lowekamp
>>> <blowekamp at mail.nih.gov> wrote:
>>>> Thanks JC,
>>>> That is very helpful and explains what is going on. And explains that this
>>>> is a bit of a tricky problem.
>>>> It appears that the LOCATION property from:
>>>> 
>>>>> get_target_property( SIMPLEITK_BINARY_MODULE
>>>>>    ${SWIG_MODULE_SimpleITK_REAL_NAME} LOCATION )
>>>>>  configure_file(
>>>>> ${SimpleITK_SOURCE_DIR}/Wrapping/PythonPackage/setup.py.in
>>>>>    ${SimpleITK_BINARY_DIR}/Wrapping/PythonPackage/setup.py )
>>>> 
>>>> already has the CMAKE_CFG_INITDIR value embedded in it. So the value of
>>>>  SIMPLEITK_BINARY_MODULE is
>>>> "C:Build/SimpleITK/lib/$(Configuration)/_SimpleITK.pyd".
>>>> This value is then later used at configuration time in a "configure_file".
>>>> Unfortunately, the documentation linked below, reminds me that the
>>>> configuration type is not known at configuration time and is only known at
>>>> compilation. So it's impossible to know the value of "$(Configure)"  when
>>>> the configuration file is generated.
>>>> I guess I need a build time version of "configure_file" which is aware of
>>>> what build type is occurring…. Anyone done that before?
>>> 
>>> 
>>> Sure, you can run a cmake script as an add_custom_command at build
>>> time, and then inside the script, you can use configure_file. You'll
>>> have to pass -D variable values down into the command if you need
>>> variable values defined for the configure_file call. It is definitely
>>> something I've done before.
>>> 
>>> Let me know specifics if you'd like a recommendation on converting an
>>> existing configure_file call into a build-time scripted call to it
>>> instead...
>>> 
>>> 
>>> David C.
>>> 
>>> 
>>>> Thanks,
>>>> Brad
>>>> 
>>>> ========================================================
>>>> 
>>>> Bradley Lowekamp
>>>> 
>>>> Lockheed Martin Contractor for
>>>> 
>>>> Office of High Performance Computing and Communications
>>>> 
>>>> National Library of Medicine
>>>> 
>>>> blowekamp at mail.nih.gov
>>>> 
>>>> On Sep 17, 2011, at 5:07 PM, Jean-Christophe Fillion-Robin wrote:
>>>> 
>>>> Hi Bradley,
>>>> 
>>>> I am assuming you want the variable to be substituted at build time ...
>>>> 
>>>> Instead of ${Configure} .. try with ${CMAKE_CFG_INTDIR}
>>>> 
>>>> See
>>>> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CFG_INTDIR
>>>> 
>>>> Hth
>>>> Jc
>>>> 
>>>> On Sat, Sep 17, 2011 at 2:59 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>
>>>> wrote:
>>>>> 
>>>>> Hello,
>>>>> 
>>>>> There is a cmake variable which is having the following value:
>>>>> "C:Build/SimpleITK/lib/$(Configure)/_SimpleITK.pyd"
>>>>> 
>>>>> And is needs to be:
>>>>> "C:Build/SimpleITK/lib/Release/_SimpleITK.pyd"
>>>>> 
>>>>> I can finally get the python egg for distribution on windows system, But
>>>>> for some reason the "Configure" is not being substituted as needed.
>>>>> 
>>>>> Here is some other CMake snippets relevant:
>>>>> 
>>>>> # from SimpleITK/CMAKE/UseSWIGLocal.cmake
>>>>> ...
>>>>> ADD_LIBRARY(${SWIG_MODULE_${name}_REAL_NAME}
>>>>>    MODULE
>>>>>    ${swig_generated_sources}
>>>>>    ${swig_other_sources})
>>>>> ...
>>>>> 
>>>>> # from SimpleITK/Wrapping/CMakeLists.txt
>>>>> ..
>>>>>  get_target_property( SIMPLEITK_BINARY_MODULE
>>>>>    ${SWIG_MODULE_SimpleITK_REAL_NAME} LOCATION )
>>>>>  configure_file(
>>>>> ${SimpleITK_SOURCE_DIR}/Wrapping/PythonPackage/setup.py.in
>>>>>    ${SimpleITK_BINARY_DIR}/Wrapping/PythonPackage/setup.py )
>>>>>>>>>> 
>>>>> 
>>>>> Any help would be appreciated.
>>>>> 
>>>>> Thanks,
>>>>> Brad
>>>>> 
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>> 
>>>>> Visit other Kitware open-source projects at
>>>>> http://www.kitware.com/opensource/opensource.html
>>>>> 
>>>>> Kitware offers ITK Training Courses, for more information visit:
>>>>> http://kitware.com/products/protraining.html
>>>>> 
>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>> 
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>> 
>>>> 
>>>> 
>>>> --
>>>> +1 919 869 8849
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>> 
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>> 
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://kitware.com/products/protraining.html
>>>> 
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>> 
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>> 
>>>> 
>> 
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110924/e5e849b7/attachment.htm>


More information about the Insight-developers mailing list