[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] Best Practise for Multiple Platforms of External Project
From:       Bo Zhou <bo.schwarzstein () gmail ! com>
Date:       2016-12-16 1:15:06
Message-ID: CAMX42NDFBUR=nWKLDCZV6Qu9LbFuJcQ57J8ZLHiXNJTNE=N6YQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Craig

I got a workaround for that, using FILE command to create an empty file
inside that folder, then it works. I also tried your script, because of too
many dependencies, so it takes such a long time in Configuration phase, I
will use that later in small project.

Thank you for your help.

On Wed, Dec 14, 2016 at 4:51 AM, Craig Scott <craig.scott@crascit.com>
wrote:

> You could try using file(MAKE_DIRECTORY ...) between the two
> ExternalProject_Add() calls to actually ensure the directory exists, but
> I'm not 100% sure whether this would not interfere with the download step
> when it goes to do that at build time. I'm pretty sure it works, but you
> should confirm it.
>
> Another choice is to do the download at configure time rather than build
> time. This would mean the source would already be there by the time you
> reached the second ExternalProject_Add() call in your example. There are
> pros and cons to this, with the main objection being that ideally the
> configure step should be quick and making the download part of configure
> can increase the time that stage takes. For a general implementation
> supporting this functionality, have a look here:
>
> https://github.com/Crascit/DownloadProject
>
>
>
> On Wed, Dec 14, 2016 at 12:29 AM, Bo Zhou <bo.schwarzstein@gmail.com>
> wrote:
>
>> Hi
>>
>> In my project I have to compile the same external projects by the
>> different generators, is that possible to handle this cases
>> by ExternalProject_Add ?
>>
>> I tried this way, firstly, just download the repository
>>
>> ExternalProject_Add(OPENEXR_DOWNLOAD
>>     PREFIX ${OPENEXR_PREFIX}
>>     GIT_REPOSITORY https://github.com/openexr/openexr.git
>>     GIT_TAG v2.2.0
>>     CONFIGURE_COMMAND ""
>>     BUILD_COMMAND ""
>>     INSTALL_COMMAND "")
>>
>>
>> ExternalProject_Get_Property(OPENEXR_DOWNLOAD SOURCE_DIR)
>> SET(OPENEXR_SOURCE_DIR ${SOURCE_DIR})
>>
>> Then I tried to create a specific new target to use specific generator
>>
>> ExternalProject_Add(OPENEXR_VC11
>>   DEPENDS OPENEXR_DOWNLOAD
>>   SOURCE_DIR ${OPENEXR_SOURCE_DIR}/IlmBase)
>>
>>
>> Seems can't work, it requires an non-empty SOURCE_DIR, but before
>> downloading, it's empty :(
>>
>> So is there any better way to do this ? Thanks very much !
>>
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>>
>
>
>
> --
> Craig Scott
> Melbourne, Australia
> https://crascit.com
>

[Attachment #5 (text/html)]

<div dir="ltr">Hi Craig<div><br></div><div>I got a workaround for that, using FILE \
command to create an empty file inside that folder, then it works. I also tried your \
script, because of too many dependencies, so it takes such a long time in \
Configuration phase, I will use that later in small \
project.</div><div><br></div><div>Thank you for your help.</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 14, 2016 at 4:51 AM, \
Craig Scott <span dir="ltr">&lt;<a href="mailto:craig.scott@crascit.com" \
target="_blank">craig.scott@crascit.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">You could try using file(MAKE_DIRECTORY ...) \
between the two ExternalProject_Add() calls to actually ensure the directory exists, \
but I&#39;m not 100% sure whether this would not interfere with the download step \
when it goes to do that at build time. I&#39;m pretty sure it works, but you should \
confirm it.<div><br></div><div>Another choice is to do the download at configure time \
rather than build time. This would mean the source would already be there by the time \
you reached the second ExternalProject_Add() call in your example. There are pros and \
cons to this, with the main objection being that ideally the configure step should be \
quick and making the download part of configure can increase the time that stage \
takes. For a general implementation supporting this functionality, have a look \
here:</div><div><br></div><div><a href="https://github.com/Crascit/DownloadProject" \
target="_blank">https://github.com/Crascit/<wbr>DownloadProject</a><br></div><div><br></div><div><br></div></div><div \
class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Dec 14, \
2016 at 12:29 AM, Bo Zhou <span dir="ltr">&lt;<a \
href="mailto:bo.schwarzstein@gmail.com" \
target="_blank">bo.schwarzstein@gmail.com</a>&gt;</span> \
wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div \
dir="ltr">Hi<div><br></div><div>In my project I have to compile the same external \
projects by the different generators, is that possible to handle this cases by  \
ExternalProject_Add ?</div><div><br></div><div>I tried this way, firstly, just \
download the repository</div><div><br></div><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div>ExternalProject_Add(OPENEXR_DO<wbr>WNLOAD</div><div> \
PREFIX ${OPENEXR_PREFIX}</div><div>       GIT_REPOSITORY  <a \
href="https://github.com/openexr/openexr.git" \
target="_blank">https://githu<wbr>b.com/openexr/openexr.git</a></div><div>      \
GIT_TAG  v2.2.0</div><div>       CONFIGURE_COMMAND &quot;&quot;</div><div>      \
BUILD_COMMAND &quot;&quot;</div><div>      INSTALL_COMMAND \
&quot;&quot;)</div></blockquote><div><br></div><div>ExternalProject_Get_Property(O<wbr>PENEXR_DOWNLOAD \
SOURCE_DIR)<br></div><div>SET(OPENEXR_SOURCE_DIR \
${SOURCE_DIR})</div><div><br></div><div>Then I tried to create a specific new target \
to use specific generator</div><div><br></div><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div><div>ExternalProject_Add(OPENEXR_VC<wbr>11</div></div><div><div> \
DEPENDS OPENEXR_DOWNLOAD</div></div><div><div>   SOURCE_DIR \
${OPENEXR_SOURCE_DIR}/IlmBase)</div></div></blockquote><div><br></div><div>Seems \
can&#39;t work, it requires an non-empty SOURCE_DIR, but before downloading, it&#39;s \
empty :(</div><div><br></div><div>So is there any better way to do this ? Thanks very \
much !</div><div><br></div></div> <br></div></div>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> <br>
Please keep messages on-topic and check the CMake FAQ at: <a \
href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" \
target="_blank">http://www.cmake.org/Wiki/CMak<wbr>e_FAQ</a><br> <br>
Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:<br> <br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/su<wbr>pport.html</a><br> CMake \
Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" \
target="_blank">http://cmake.org/cmake/help/co<wbr>nsulting.html</a><br> CMake \
Training Courses: <a href="http://cmake.org/cmake/help/training.html" \
rel="noreferrer" target="_blank">http://cmake.org/cmake/help/tr<wbr>aining.html</a><br>
 <br>
Visit other Kitware open-source projects at <a \
href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br> <br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" \
target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/cmake</a><span \
class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span \
class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div \
class="m_-1762476658928264969gmail_signature" data-smartmail="gmail_signature"><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Craig Scott<br><div>Melbourne, \
Australia</div><div><a href="https://crascit.com" \
target="_blank">https://crascit.com</a><br></div></div></div></div></div></div></div> \
</font></span></div> </blockquote></div><br></div>



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic