From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout04.t-online.de (mailout04.t-online.de [194.25.134.18]) by sourceware.org (Postfix) with ESMTPS id 2A539385840A for ; Mon, 27 Sep 2021 21:06:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2A539385840A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=t-online.de Received: from fwd72.dcpf.telekom.de (fwd72.aul.t-online.de [10.223.144.98]) by mailout04.t-online.de (Postfix) with SMTP id 5B01B4466 for ; Mon, 27 Sep 2021 23:06:27 +0200 (CEST) Received: from [192.168.178.26] ([79.228.91.195]) by fwd72.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1mUxpJ-3kxRrM0; Mon, 27 Sep 2021 23:06:17 +0200 Subject: Re: Setting up toolchains To: cygwin@cygwin.com References: <3034fa70-ad4c-3e8a-31da-d892c7deb3b7@reckeng.com> From: =?UTF-8?Q?Hans-Bernhard_Br=c3=b6ker?= Message-ID: <72e93446-9bb8-75a3-8f59-2a20f58138ca@t-online.de> Date: Mon, 27 Sep 2021 23:06:13 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <3034fa70-ad4c-3e8a-31da-d892c7deb3b7@reckeng.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TOI-EXPURGATEID: 150726::1632776777-00001454-D5B3EA89/0/0 CLEAN NORMAL X-TOI-MSGID: f4427573-b6ac-4879-9809-31a3d63599a7 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 21:06:34 -0000 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.