From 7c5147bbccdfb9b0a42a3a38439cd153e87f2840 Mon Sep 17 00:00:00 2001 From: memsharded Date: Wed, 8 May 2024 21:16:39 +0200 Subject: [PATCH 1/2] new mingw example --- examples/dev_flow.rst | 1 + examples/dev_flow/tool_requires/mingw.rst | 83 +++++++++++++++++++ .../use_tools_as_conan_packages.rst | 2 +- 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 examples/dev_flow/tool_requires/mingw.rst diff --git a/examples/dev_flow.rst b/examples/dev_flow.rst index 2e01c58fb11b..4363e2e079b5 100644 --- a/examples/dev_flow.rst +++ b/examples/dev_flow.rst @@ -8,3 +8,4 @@ Developer tools and flows dev_flow/debug/step_into_dependencies dev_flow/debug/debugging_visual + dev_flow/tool_requires/mingw diff --git a/examples/dev_flow/tool_requires/mingw.rst b/examples/dev_flow/tool_requires/mingw.rst new file mode 100644 index 000000000000..bc57a38f0ae3 --- /dev/null +++ b/examples/dev_flow/tool_requires/mingw.rst @@ -0,0 +1,83 @@ +.. _examples_dev_flow_tool_requires_mingw: + +Using a MinGW as tool_requires to build with gcc in Windows +----------------------------------------------------------- + +If we had MinGW installed in our environment, we could define a profile like: + +.. code-block:: + + [settings] + os=Windows + compiler=gcc + compiler.version=12 + compiler.libcxx=libstdc++11 + compiler.threads=posix + compiler.exception=sjlj + arch=x86_64 + build_type=Release + + [buildenv] + PATH+=(path)C:/path/to/mingw/bin + # other environment we might need like + CXX=C:/path/to/mingw/bin/g++ + # etc + + [conf] + # some configuration like compiler-execuables might be needed for some cases + + +But we can also use a Conan package that contains a copy of the MinGW compiler and use it +as a ``tool_requires`` instead: + +.. code-block:: + :caption: mingw-profile.txt + + [settings] + os=Windows + compiler=gcc + compiler.version=12 + compiler.libcxx=libstdc++11 + compiler.threads=posix + compiler.exception=seh + arch=x86_64 + build_type=Release + + + [tool_requires] + mingw-builds/12.2.0 + + +With this profile we can for example create a package in Windows with: + + +.. code-block:: bash + + # Using a basic template project + $ conan new cmake_lib -d name=mypkg -d version=0.1 + $ conan create . -pr=mingw + ... + -- The CXX compiler identification is GNU 12.2.0 + ... + + + ======== Testing the package: Executing test ======== + mypkg/0.1 (test package): Running test() + mypkg/0.1 (test package): RUN: .\example + mypkg/0.1: Hello World Release! + mypkg/0.1: _M_X64 defined + mypkg/0.1: __x86_64__ defined + mypkg/0.1: _GLIBCXX_USE_CXX11_ABI 1 + mypkg/0.1: MSVC runtime: MultiThreadedDLL + mypkg/0.1: __cplusplus201703 + mypkg/0.1: __GNUC__12 + mypkg/0.1: __GNUC_MINOR__2 + mypkg/0.1: __MINGW32__1 + mypkg/0.1: __MINGW64__1 + mypkg/0.1 test_package + + +.. seealso:: + + - The ConanCenter web page for the `mingw-builds package `_ + - The ``conan-center-index`` `mingw-builds Github repo recipe `_ diff --git a/tutorial/consuming_packages/use_tools_as_conan_packages.rst b/tutorial/consuming_packages/use_tools_as_conan_packages.rst index 83b7ef333366..f8f6f2792871 100644 --- a/tutorial/consuming_packages/use_tools_as_conan_packages.rst +++ b/tutorial/consuming_packages/use_tools_as_conan_packages.rst @@ -239,6 +239,6 @@ the environment activation: - :ref:`Using [system_tools] in your profiles `. - :ref:`Creating recipes for tool_requires: packaging build tools `. - :ref:`examples_graph_tool_requires_protobuf` - - Using MinGW as tool_requires + - :ref:`examples_dev_flow_tool_requires_mingw` - :ref:`Using tool_requires in profiles ` - Using conf to set a toolchain from a tool requires From 160215b9a7ca10db19b339dd52e13835bde15d1d Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Thu, 9 May 2024 10:08:10 +0200 Subject: [PATCH 2/2] Update examples/dev_flow/tool_requires/mingw.rst --- examples/dev_flow/tool_requires/mingw.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/dev_flow/tool_requires/mingw.rst b/examples/dev_flow/tool_requires/mingw.rst index bc57a38f0ae3..bbe5d8a18eb3 100644 --- a/examples/dev_flow/tool_requires/mingw.rst +++ b/examples/dev_flow/tool_requires/mingw.rst @@ -24,7 +24,7 @@ If we had MinGW installed in our environment, we could define a profile like: # etc [conf] - # some configuration like compiler-execuables might be needed for some cases + # some configuration like 'tools.build:compiler_executables' might be needed for some cases But we can also use a Conan package that contains a copy of the MinGW compiler and use it