Example build recipes for Windows?

50 views
Skip to first unread message

James Mansion

unread,
Dec 24, 2015, 3:59:52 AM12/24/15
to Shake build system
The shake-language-c package doesn't support the Microsoft toolchain - and seems to focus on just the C language issues.

Does anyone know of an example shake build that will build a more fully featured old-style Windows app, with resource files, MIDL-generated clients and servers etc?

I'm especially interested in something that builds a COM server with embedded type library resource etc.

Thanks for any tips,
James

Neil Mitchell

unread,
Dec 26, 2015, 2:37:17 PM12/26/15
to James Mansion, Shake build system
Hi James,

Most people using Shake tend to be working against open source
toolchains, so while there are C++ examples against Clang
(https://github.com/jfeltz/shake-cpp), finding them for MSVC is a bit
harder. However, if you know the command lines you want to use, then
writing a Shake build system isn't that hard. Taking the example from
the manual (http://shakebuild.com/manual), if you switch to cl and
link instead of gcc you get most of the way there
(neededMakefileDependencies can either be done using the transitive
technique from the bottom of the page, or the cl option to echo which
headers are read). Adding in the IDL compiler and resource compiler is
a few lines, nothing too challenging.

However, before rushing into a Shake build system, I'd first consider
what you want over a Visual Studio project file? Are you hoping to
integrate the project into a bigger system? Are you wanting to
generate some of the files from other source files (e.g. XML/JSON)?

Thanks, Neil

James Mansion

unread,
Dec 30, 2015, 4:42:18 PM12/30/15
to Neil Mitchell, Shake build system
On 26/12/2015 19:37, Neil Mitchell wrote:
Hi James,

Most people using Shake tend to be working against open source
toolchains, so while there are C++ examples against Clang
(https://github.com/jfeltz/shake-cpp), finding them for MSVC is a bit
harder.
In fact its not so much the toolchain, as the build steps and dependencies that are painful.

There are open source tools that act as replacements for MIDL and the resource compiler.

The painful bit is the slightly odd output file naming and the equivalent of the inclusion
scanning in the resource file.  The idl file has includes that could be identified with
a cpp run,  and the resource file can too - but ideally you'd only want the resource
file to be reprocessed when an input actually changed, and this line is effectively an
inclusion:
  1 TYPELIB "EasyRTDX.tlb"




headers are read). Adding in the IDL compiler and resource compiler is
a few lines, nothing too challenging.
Well, if you do the dependency stuff entirely manually like a makefile, then that's
so, yes.



However, before rushing into a Shake build system, I'd first consider
what you want over a Visual Studio project file? Are you hoping to
integrate the project into a bigger system? Are you wanting to
generate some of the files from other source files (e.g. XML/JSON)?
I had been hoping to create a build scheme that would build all the portable code
on other platforms (where the COM stuff doesn't apply) and ideally I'd like to
be able to cross-compile to a Windows target from Unix, and in that case having
something that's a bit smart and can construct a MIDL/WIDL command line
based on the platform would be nice.

I might also want to generate sources in future.

At the moment, CMake is doing a passable job on Windows, but I really don't
like the CMake language, and the MIDL stuff is a bit 'magic'.

James

Neil Mitchell

unread,
Dec 31, 2015, 3:22:50 PM12/31/15
to James Mansion, Shake build system
Hi James,

> a cpp run, and the resource file can too - but ideally you'd only want the
> resource
> file to be reprocessed when an input actually changed, and this line is
> effectively an
> inclusion:
> 1 TYPELIB "EasyRTDX.tlb"

Using the technique from
http://shakebuild.com/manual#generated-transitive-imports should work,
and will let you spot TYPELIB just as easily as #include. That might
be the way to go.

> I had been hoping to create a build scheme that would build all the portable
> code
> on other platforms (where the COM stuff doesn't apply) and ideally I'd like
> to
> be able to cross-compile to a Windows target from Unix, and in that case
> having
> something that's a bit smart and can construct a MIDL/WIDL command line
> based on the platform would be nice.
>
> I might also want to generate sources in future.

That all seems very sensible - Shake seems like a good choice there.

> At the moment, CMake is doing a passable job on Windows, but I really don't
> like the CMake language, and the MIDL stuff is a bit 'magic'.

Shake has almost no magic, CMake has a lot, which means CMake is
shorter for projects that conform to its idea of how the magic should
be cast, and Shake is a bit longer for the ones CMake is ideal for,
and doesn't get any harder when CMake starts to get confusing.

Thanks, Neil
Reply all
Reply to author
Forward
0 new messages