public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Hans-Bernhard Bröker" <HBBroeker@t-online.de>
To: cygwin@cygwin.com
Subject: Re: Setting up toolchains
Date: Mon, 27 Sep 2021 23:06:13 +0200	[thread overview]
Message-ID: <72e93446-9bb8-75a3-8f59-2a20f58138ca@t-online.de> (raw)
In-Reply-To: <3034fa70-ad4c-3e8a-31da-d892c7deb3b7@reckeng.com>

Am 27.09.2021 um 13:27 schrieb Anthony Webber:

> Anyway, I am trying to set up my gcc toolchains in Cygwin, by which I 
> mean that I'm trying to set up the environment so that the right 
> programs are called at the right time by build systems like cmake and 
> waf, or if I want to build in a more manual fashion. Particularly, I 
> want to be able to switch between toolchains easily.

That's hardly ever a question of "setting up" the toolchains.  It's 
rather a question of

a) which build system those programs you're trying to build uses, and
b) how you initialize/use said build systems.

GNU autoconf and cmake have relatively mature mechanisms for doing this.

For autoconf you just pass --host=... to configure, and that takes care 
of everything (assuming the package is capable of cross-building in the 
first place).  For cmake you can preload a cmake script like this:

cmake -C some/where/preload_mingw.cmake ../../path/to/source

where preload_mingw.cmake might look like this:

set(CMAKE_CXX_COMPILER "/usr/bin/x86_64-w64-mingw32-g++" CACHE FILEPATH 
"CXX compiler")
set(CMAKE_C_COMPILER "/usr/bin/x86_64-w64-mingw32-gcc" CACHE FILEPATH "C 
compiler")
set(CMAKE_CXX_FLAGS "-D_WIN32_WINNT=0x0601" CACHE STRING "")
set(CMAKE_C_FLAGS "-D_WIN32_WINNT=0x0601" CACHE STRING "")
set(WIN32 "1" CACHE STRING "")

The benefit of doing it this way is that the preload script can stay the 
same for quite a lot of packages, and the system default compiler does 
not even enter the picture, so there will be no misled tests.

      parent reply	other threads:[~2021-09-27 21:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 11:27 Anthony Webber
2021-09-27 14:27 ` Lee
2021-09-27 17:10   ` Brian Inglis
2021-09-27 21:06 ` Hans-Bernhard Bröker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=72e93446-9bb8-75a3-8f59-2a20f58138ca@t-online.de \
    --to=hbbroeker@t-online.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).