Getting stated with boost and CMake

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

Getting stated with boost and CMake

Boost - Build mailing list
Having spent a decade watching the Cmake versus bjam/b2 battle, I had thought it wise to wait until the dust has settled.

It would appear that the enthusiasm for CMake and Boost is much greater among  consumers than producers ☹

But recently I have been working on a project that is possible Boost library and thought that I would dip my toe in the water.

After some research, I am still puzzled how I should replace a simple b2/bjam program (say a classic “hello World”) that is run like this

  \example >  b2 -a  toolset=msvc,gcc,clang cxxstd=14 release > my_log.log

The jamfile contains

run hello_world.cpp ; # Simplest hello_world, no other includes apart from iostream.

And the b2 run .log contains some outputs of "Hello world" and 3 nice   **passed** lines and  ...updated 3(?) targets..., one for each compiler (and version too, perhaps with some potentially using build info too), and return exit_success value.

(I also would expect to get a simple setup to run a test using the /included version of unit_test_framework.
Trying to walk before I fall over running, I have avoided any pre-compiler libraries, at least at first.)

After some research (getting as far as generating a Visual Studio project, where I can intervene manually to build and run my hello_world program),
I am still unclear how to replicate this b2 test to end with a .exe run and some log file with pass/fail indications.

I am of course building on Windows 10 with three recent versions of MSVC, GCC and Clang compilers working, and in my bjam/b2 user-config.jam.

Advice from less-than-novice CMakers most welcome.

Thank you.

Paul






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

Re: Getting stated with boost and CMake

Boost - Build mailing list
On 2/24/21 7:46 AM, Paul A Bristow via Boost-build wrote:

> Having spent a decade watching the Cmake versus bjam/b2 battle, I had thought it wise to wait until the dust has settled.
>
> It would appear that the enthusiasm for CMake and Boost is much greater among  consumers than producers ☹
>
> But recently I have been working on a project that is possible Boost library and thought that I would dip my toe in the water.
>
> After some research, I am still puzzled how I should replace a simple b2/bjam program (say a classic “hello World”) that is run like this
>
>    \example >  b2 -a  toolset=msvc,gcc,clang cxxstd=14 release > my_log.log
>
> The jamfile contains
>
> run hello_world.cpp ; # Simplest hello_world, no other includes apart from iostream.
>
> And the b2 run .log contains some outputs of "Hello world" and 3 nice   **passed** lines and  ...updated 3(?) targets..., one for each compiler (and version too, perhaps with some potentially using build info too), and return exit_success value.
>
> (I also would expect to get a simple setup to run a test using the /included version of unit_test_framework.
> Trying to walk before I fall over running, I have avoided any pre-compiler libraries, at least at first.)
>
> After some research (getting as far as generating a Visual Studio project, where I can intervene manually to build and run my hello_world program),
> I am still unclear how to replicate this b2 test to end with a .exe run and some log file with pass/fail indications.
>
> I am of course building on Windows 10 with three recent versions of MSVC, GCC and Clang compilers working, and in my bjam/b2 user-config.jam.
>
> Advice from less-than-novice CMakers most welcome.

You might check out the serialization and/or the safe numerics library.
  They are a little different projects.  One is header only while the
other isn't.  The serialization library CMake is a little older and
structures the CMake.txt files a little differently.  But in both cases
they are designed to run all the tests.

serialization:

It has a very elaborate bjam file in the test directory.  It builds all
the required boost componenents, the serialization library itself and
runs all the tests. The "equivalent" (as far as I can make it) CMake ...
I use to build the IDE.  From the IDE (xcode in my case) I pick targets
(e.g. BUILD_ALL, RUN, ... or some specific target (test) name) and
invoke the IDE.  Works pretty well.  Once I've got things debugged, I
re-run the same thing with b2 to make sure everyone is in agreement.
Then I check-in.

My motivation for spending time with CMake was to be able to use an IDE
without constantly syncing it with the bjam settings.  This is a problem
I had using the IDE with windows.  All in all I'm pleased with the whole
mess.

safe numerics

header only library with both compile and execute tests.  A more modern
CMake.txt layout.

FYI - I consider myself a novice CMake user.  But then I also consider
myself a novie B2 user.

So, truth be told, I actually like CMake and B2 - I see them as useful
in different ways.  Of course hey both make one pull his hair out in
different ways also.

Robert Ramey





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


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

Re: Getting stated with boost and CMake

Boost - Build mailing list


> -----Original Message-----
> From: Boost-build <[hidden email]> On Behalf Of Robert Ramey via Boost-build
> Sent: 24 February 2021 19:49
> To: [hidden email]
> Cc: Robert Ramey <[hidden email]>; [hidden email]
> Subject: Re: [Boost-build] Getting stated with boost and CMake
>
> On 2/24/21 7:46 AM, Paul A Bristow via Boost-build wrote:
> > Having spent a decade watching the Cmake versus bjam/b2 battle, I had thought it wise to wait until
> the dust has settled.
> >
> > It would appear that the enthusiasm for CMake and Boost is much
> > greater among  consumers than producers ☹
> >
> > But recently I have been working on a project that is possible Boost library and thought that I would
> dip my toe in the water.
> >
> > After some research, I am still puzzled how I should replace a simple
> > b2/bjam program (say a classic “hello World”) that is run like this
> >
> >    \example >  b2 -a  toolset=msvc,gcc,clang cxxstd=14 release >
> > my_log.log
> >
> > The jamfile contains
> >
> > run hello_world.cpp ; # Simplest hello_world, no other includes apart from iostream.
> >
> > And the b2 run .log contains some outputs of "Hello world" and 3 nice   **passed** lines and
> ...updated 3(?) targets..., one for each compiler (and version too, perhaps with some potentially using
> build info too), and return exit_success value.
> >
> > (I also would expect to get a simple setup to run a test using the /included version of
> unit_test_framework.
> > Trying to walk before I fall over running, I have avoided any
> > pre-compiler libraries, at least at first.)
> >
> > After some research (getting as far as generating a Visual Studio
> > project, where I can intervene manually to build and run my hello_world program), I am still unclear
> how to replicate this b2 test to end with a .exe run and some log file with pass/fail indications.
> >
> > I am of course building on Windows 10 with three recent versions of MSVC, GCC and Clang compilers
> working, and in my bjam/b2 user-config.jam.
> >
> > Advice from less-than-novice CMakers most welcome.
>
> You might check out the serialization and/or the safe numerics library.
>   They are a little different projects.  One is header only while the other isn't.  The serialization library
> CMake is a little older and structures the CMake.txt files a little differently.  But in both cases they are
> designed to run all the tests.
>
> serialization:
>
> It has a very elaborate bjam file in the test directory.  It builds all the required boost componenents, the
> serialization library itself and runs all the tests. The "equivalent" (as far as I can make it) CMake ...
> I use to build the IDE.  From the IDE (xcode in my case) I pick targets (e.g. BUILD_ALL, RUN, ... or some
> specific target (test) name) and invoke the IDE.  Works pretty well.

I have yet to find the output from ALL_BUILD  in VS.

I normally use a custom build event to run each project, as recommended by Gennadiy using Boost.Test.

"$(TargetDir)$(TargetName).exe" --build_info=yes

(and I add a custom Property page to each project using the property window).

But that doesn't happen of course.

So how do I get them all to run?

> Once I've got things debugged, I re- run the same thing with b2 to make sure everyone is in agreement.
> Then I check-in.
>
> My motivation for spending time with CMake was to be able to use an IDE without constantly syncing it
> with the bjam settings.  This is a problem I had using the IDE with windows.  All in all I'm pleased with
> the whole mess.
>
> safe numerics
>
> header only library with both compile and execute tests.  A more modern CMake.txt layout.

I've worked from this and this builds a plausible VS solution that builds OK. (But I have yet to get run to produce output).

I also don't see how CMake is any help if you don't have an IDE for the compiler.

toolset=msvc,gcc,clang

(Actually I can use GCC and Clang with Codeblocks, but to *have to* and to run it seems not to do what b2 does at all).

Thanks - but still puzzled.

Paul

PS
> FYI - I consider myself a novice CMake user.  But then I also consider myself a novice B2 user.
> So, truth be told, I actually like CMake and B2 - I see them as useful in different ways.  
> Of course they both make one pull his hair out in different ways also.

Ah so that may explain some aspects of my appearance 😉


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

Re: Getting stated with boost and CMake

Boost - Build mailing list
On 2/25/21 10:02 AM, Paul Bristow via Boost-build wrote:

> I have yet to find the output from ALL_BUILD  in VS

 > So how do I get them all to run?
 >

Hmmm - i use xcode.  CMake builds a project in xcode which includes:

a target for each test
ALL_BUILD target
RUN_ALL? target

So I just invoke ALL BUILD then RUN_ALL and I'm good to go.  If I just
want build and maybe run a specific test, I just select that target from
the xcode IDE.  Easy as pie.  I'm guessing it should be similar for VS
but of course I don't really know.


>> Once I've got things debugged, I re- run the same thing with b2 to make sure everyone is in agreement.
>> Then I check-in.
>>
>> My motivation for spending time with CMake was to be able to use an IDE without constantly syncing it
>> with the bjam settings.  This is a problem I had using the IDE with windows.  All in all I'm pleased with
>> the whole mess.
>>
>> safe numerics
>>
>> header only library with both compile and execute tests.  A more modern CMake.txt layout.

>
> I've worked from this and this builds a plausible VS solution that builds OK. (But I have yet to get run to produce output).
>
> I also don't see how CMake is any help if you don't have an IDE for the compiler.

CMake can build a makefile for the whole project and you can just "make"
the targets you're interested in.

>
> toolset=msvc,gcc,clang

This is a b2 thing.  CMake would be used to create a project for each
compiler/ide combination.

>
> (Actually I can use GCC and Clang with Codeblocks, but to *have to* and to run it seems not to do what b2 does at all).
>
> Thanks - but still puzzled.
>
> Paul
>
> PS
>> FYI - I consider myself a novice CMake user.  But then I also consider myself a novice B2 user.
>> So, truth be told, I actually like CMake and B2 - I see them as useful in different ways.
>> Of course they both make one pull his hair out in different ways also.
>
> Ah so that may explain some aspects of my appearance 😉
>
>
> _______________________________________________
> Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
>


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