How to specify conditional flags in user-config.jam

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

How to specify conditional flags in user-config.jam

Boost - Build mailing list
Hi, I'm trying to build Boost 1.73.0 with clang-cl compiler and MSVC2017
toolchain/libraries on Windows. I chose msvc toolset rather than
clang-win because recent clang-cl supports PDB and clang-win.jam does
not.

I wrote user-config.jam like below


using msvc
    : clang9.0
    :
    : <compiler>"\"C:/Program Files/LLVM/bin/clang-cl.exe\""
      <compileflags>-m32
    ;


and hit


b2 toolset=msvc-clang9.0 address-model=32 variant=debug link=static
runtime-link=shared --without-python --layout=tagged stage


It worked fine. Now, I want to build release variant and 64bit versions.
For release variant, I have to specify -flto compile flag, and for 64bit,
I have to specify -m64 instead of -m32. But I don't want to change
user-config.jam each time I change the options to pass to b2. Is there a
way to switch flags based on the whole build configuration? I tried


toolset.flags msvc.compile OPTIONS
<version>msvc-clang9.0/<address-model>64 : -m64 ;


which I thought used to work with some old situations but now it
complained


D:/Libraries/boost_1_73_0/tools/build/src/build\toolset.jam:170: in toolset.flags from module toolset
error: Module user-config attempted to set flags for module msvc
C:\Users\skhrshin\user-config.jam:12: in modules.load from module user-config
D:/Libraries/boost_1_73_0/tools/build/src\build-system.jam:255: in load-config from module build-system
D:/Libraries/boost_1_73_0/tools/build/src\build-system.jam:453: in load-configuration-files from module build-system
D:/Libraries/boost_1_73_0/tools/build/src\build-system.jam:607: in load from module build-system
D:\Libraries\boost_1_73_0\tools\build\src/kernel\modules.jam:295: in import from module modules
D:\Libraries\boost_1_73_0\tools\build\src/kernel/bootstrap.jam:139: in boost-build from module
D:\Libraries\boost_1_73_0\boost-build.jam:17: in module scope from module


A workaround is doing like below


using msvc
    : clang9.0debug32
    :
    : <compiler>"\"C:/Program Files/LLVM/bin/clang-cl.exe\""
      <compileflags>-m32
    ;
using msvc
    : clang9.0release32
    :
    : <compiler>"\"C:/Program Files/LLVM/bin/clang-cl.exe\""
      <compileflags>-m32
      <compileflags>-flto
    ;
using msvc
    : clang9.0debug64
    :
    : <compiler>"\"C:/Program Files/LLVM/bin/clang-cl.exe\""
      <compileflags>-m64
    ;
...


but you know, it's ugly. I would appreciate if someone tells me a better
solution.

Shintaro Sakahara <[hidden email]>

_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to specify conditional flags in user-config.jam

Boost - Build mailing list
I solved the problem...

> toolset.flags msvc.compile OPTIONS
> <version>msvc-clang9.0/<address-model>64 : -m64 ;

This should be

toolset.flags msvc.compile CFLAGS
<toolset>msvc-clang9.0/<address-model>64 : -m64 : unchecked ;

Thanks.

Shintaro Sakahara <[hidden email]>

_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build