[llvm-dev] [CMake] Re-configuring Debug and Release builds

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] [CMake] Re-configuring Debug and Release builds

Teresa Johnson via llvm-dev
If I've configured a Release build, build it and then go back and re-run
cmake with -DCMAKE_BUILD_TYPE=Debug (and nothing else changed), almost
nothing gets rebuilt when I try to build.  Is this expected?  I know I
can edit CMakeCache.txt directly and trigger an essentially full
rebuild.

                             -David
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] [CMake] Re-configuring Debug and Release builds

Teresa Johnson via llvm-dev

> -----Original Message-----
> From: llvm-dev [mailto:[hidden email]] On Behalf Of David
> Greene via llvm-dev
> Sent: Friday, March 08, 2019 10:49 AM
> To: [hidden email]
> Subject: [llvm-dev] [CMake] Re-configuring Debug and Release builds
>
> If I've configured a Release build, build it and then go back and re-run
> cmake with -DCMAKE_BUILD_TYPE=Debug (and nothing else changed), almost
> nothing gets rebuilt when I try to build.  Is this expected?  I know I
> can edit CMakeCache.txt directly and trigger an essentially full
> rebuild.

IME rerunning CMake with new options really does nothing; CMakeCache.txt
appears to override the command line, which is not intuitive but seems
to be how it actually works.

I would hope that this is not a choice made by the LLVM project but a
bug/feature of CMake itself.  But I haven't ever had the energy to
pursue it.
--paulr

>
>                              -David
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] [CMake] Re-configuring Debug and Release builds

Teresa Johnson via llvm-dev
<[hidden email]> writes:

>> If I've configured a Release build, build it and then go back and re-run
>> cmake with -DCMAKE_BUILD_TYPE=Debug (and nothing else changed), almost
>> nothing gets rebuilt when I try to build.  Is this expected?  I know I
>> can edit CMakeCache.txt directly and trigger an essentially full
>> rebuild.
>
> IME rerunning CMake with new options really does nothing; CMakeCache.txt
> appears to override the command line, which is not intuitive but seems
> to be how it actually works.

I thought so too at first, except changing LLVM_TARGETS_TO_BUILD when
re-running CMake does indeed cause any new targets to be built.  So it
can't be the case that the cache overrides everything.

> I would hope that this is not a choice made by the LLVM project but a
> bug/feature of CMake itself.  But I haven't ever had the energy to
> pursue it.

https://llvm.org/docs/CMake.html#cmake-caches seems to imply that -D
options should override cache values, but it doesn't for
CMAKE_BUILD_TYPE.

                               -David
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] [CMake] Re-configuring Debug and Release builds

Teresa Johnson via llvm-dev
In reply to this post by Teresa Johnson via llvm-dev
I'm unable to repro this – configuring once and then reconfiguring with a different -DCMAKE_BUILD_TYPE= does the right thing for me. What's your exact invocation?

If you're setting it from a cache file, you'll need to use FORCE in the set in your cache file to override any existing cache setting.

On 3/8/19, 1:18 PM, "llvm-dev on behalf of David Greene via llvm-dev" <[hidden email] on behalf of [hidden email]> wrote:

    <[hidden email]> writes:
   
    >> If I've configured a Release build, build it and then go back and re-run
    >> cmake with -DCMAKE_BUILD_TYPE=Debug (and nothing else changed), almost
    >> nothing gets rebuilt when I try to build.  Is this expected?  I know I
    >> can edit CMakeCache.txt directly and trigger an essentially full
    >> rebuild.
    >
    > IME rerunning CMake with new options really does nothing; CMakeCache.txt
    > appears to override the command line, which is not intuitive but seems
    > to be how it actually works.
   
    I thought so too at first, except changing LLVM_TARGETS_TO_BUILD when
    re-running CMake does indeed cause any new targets to be built.  So it
    can't be the case that the cache overrides everything.
   
    > I would hope that this is not a choice made by the LLVM project but a
    > bug/feature of CMake itself.  But I haven't ever had the energy to
    > pursue it.
   
    https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_docs_CMake.html-23cmake-2Dcaches&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=QX_nCpK2peaty_XOC8I0mM2FCcsrB0u93ckBWasLzfU&s=krJ8pnxDwobl6hQ3IB_hpM54u0pvD5MU-Ft5l6EL__4&e= seems to imply that -D
    options should override cache values, but it doesn't for
    CMAKE_BUILD_TYPE.
   
                                   -David
    _______________________________________________
    LLVM Developers mailing list
    [hidden email]
    https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=QX_nCpK2peaty_XOC8I0mM2FCcsrB0u93ckBWasLzfU&s=J_T6_Sw0gdNOhChuI3RLRB-hUzsFpXWROa6KhwYK1T0&e=
   

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] [CMake] Re-configuring Debug and Release builds

Teresa Johnson via llvm-dev
Whether or not reconfiguring changing `CMAKE_BUILD_TYPE` does anything remotely like what you want depends on which generator you use. It will result in full rebuilds if you are using Ninja, but not Unix Makefiles. This is because Ninja treats the command that generates the output as a dependency of the output.

That said in some environments the CMAKE_BUILD_TYPE can impact the values of other cache variables that result from checks for libraries, headers, and symbols. Those cache variables may not be updated in the re-run, which could result in the build not doing what you expect.

In general many of the CMAKE_* variables like CMAKE_BUILD_TYPE and CMAKE_<LANG>_COMPILER, cannot be safely changed without a full re-configure, so I'd advise caution.

-Chris

> On Mar 8, 2019, at 1:22 PM, Shoaib Meenai via llvm-dev <[hidden email]> wrote:
>
> I'm unable to repro this – configuring once and then reconfiguring with a different -DCMAKE_BUILD_TYPE= does the right thing for me. What's your exact invocation?
>
> If you're setting it from a cache file, you'll need to use FORCE in the set in your cache file to override any existing cache setting.
>
> On 3/8/19, 1:18 PM, "llvm-dev on behalf of David Greene via llvm-dev" <[hidden email] on behalf of [hidden email]> wrote:
>
>    <[hidden email]> writes:
>
>>> If I've configured a Release build, build it and then go back and re-run
>>> cmake with -DCMAKE_BUILD_TYPE=Debug (and nothing else changed), almost
>>> nothing gets rebuilt when I try to build.  Is this expected?  I know I
>>> can edit CMakeCache.txt directly and trigger an essentially full
>>> rebuild.
>>
>> IME rerunning CMake with new options really does nothing; CMakeCache.txt
>> appears to override the command line, which is not intuitive but seems
>> to be how it actually works.
>
>    I thought so too at first, except changing LLVM_TARGETS_TO_BUILD when
>    re-running CMake does indeed cause any new targets to be built.  So it
>    can't be the case that the cache overrides everything.
>
>> I would hope that this is not a choice made by the LLVM project but a
>> bug/feature of CMake itself.  But I haven't ever had the energy to
>> pursue it.
>
>    https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_docs_CMake.html-23cmake-2Dcaches&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=QX_nCpK2peaty_XOC8I0mM2FCcsrB0u93ckBWasLzfU&s=krJ8pnxDwobl6hQ3IB_hpM54u0pvD5MU-Ft5l6EL__4&e= seems to imply that -D
>    options should override cache values, but it doesn't for
>    CMAKE_BUILD_TYPE.
>
>                                   -David
>    _______________________________________________
>    LLVM Developers mailing list
>    [hidden email]
>    https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=QX_nCpK2peaty_XOC8I0mM2FCcsrB0u93ckBWasLzfU&s=J_T6_Sw0gdNOhChuI3RLRB-hUzsFpXWROa6KhwYK1T0&e=
>
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev