Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update maintainer kb windows doc #1956

Merged
merged 14 commits into from
Jun 27, 2023
Merged
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 45 additions & 18 deletions src/maintainer/knowledge_base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,60 @@ use a general web search to explore — while these topics are beyond the
scope of this documentation, there are ample discussions on them on the broader
Internet.

To bootstrap a conda environment and install ``conda-build``, consider
`miniforge <https://github.com/conda-forge/miniforge>`__.


Executing a build
^^^^^^^^^^^^^^^^^

The ``build-locally.py`` script does not support Windows (yet, PRs welcome!).
You can use ``conda build recipe/ -m .ci_support/choose_your_config.yaml`` as
a workaround for now.


Testing a local build
^^^^^^^^^^^^^^^^^^^^^

Using a local channel looks a bit different in Windows, too. The quotes are
important:

.. code-block::

conda create -n my-new-env -c "C:\Users\User\miniforge3\conda-build" my-package
mfisher87 marked this conversation as resolved.
Show resolved Hide resolved

If you installed from a different distribution than ``miniforge`` or to a
different path, you'll need to alter this path.


Notes on native code
jaimergp marked this conversation as resolved.
Show resolved Hide resolved
--------------------

In order to compile native code (C, C++, etc.) on Windows, you will need to
install Microsoft’s Visual C++ build tools on your VM. You must install
particular versions of these tools — this is to maintain compatibility between
compiled libraries used in Python, `as described on this Python wiki page
<https://wiki.python.org/moin/WindowsCompilers>`__. The current relevant
versions are:

* For Python 3.5–3.7: Visual C++ 14.0
* For Python 3.5–3.12+: Visual C++ 14.x

While you can obtain these tools by installing the right version of the full
`Visual Studio <https://visualstudio.microsoft.com/>`__ development
environment, you can save a lot of time and bandwidth by installing standalone
“build tools” packages. The links are as follows:

* For Python 3.5–3.7: `Microsoft Build Tools for Visual Studio 2017
<https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2017-and-other-products>`__.
“build tools” packages. You can get them from `Visual Studio
Subscriptions <https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2019-and-other-products>`__.
To download build tools, you'll need a Microsoft account. Once on the
Visual Studio Subscriptions page, you may also need to join the Dev Essentials
program. Once that's done, you can click the "Download" tab and search for
"Build Tools for Visual Studio 2022".

If you need more information. Please refer `the Python wiki page on Windows compilers
<https://wiki.python.org/moin/WindowsCompilers>`__.

Simple CMake-Based ``bld.bat``
------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some projects provide hooks for CMake to build the project. The following
example ``bld.bat`` file demonstrates how to build a traditional, out-of-core
build for such projects.
Expand Down Expand Up @@ -177,7 +209,7 @@ The following feedstocks are examples of this build structure deployed:


Building for different VC versions
----------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

On Windows, different Visual C versions have different ABI and therefore a package needs to be built for different
Visual C versions. Packages are tied to the VC version that they were built with and some packages have specific
Expand All @@ -202,27 +234,22 @@ To skip building with a particular ``vc`` version, add a skip statement.
build:
- {{ compiler('cxx') }}

Using vs2019
-------------

To use ``vs2019`` make the following changes:
Using vs2022
^^^^^^^^^^^^

In ``conda_build_config.yaml`` file:
In ``recipe/conda_build_config.yaml`` file:

.. code-block:: yaml

c_compiler: # [win]
- vs2019 # [win]
- vs2022 # [win and x86_64]
cxx_compiler: # [win]
- vs2019 # [win]

- vs2022 # [win and x86_64]

For example see the changes made in the ``conda_build_config.yaml`` files in `this
<https://github.com/conda-forge/libignition-msgs1-feedstock/pull/73/commits/81b5ee0e1d23f7f20427dd80d04cf1f7321b441d>`__ commit.
You can look at the changes in `this PR <https://github.com/conda-forge/vcpkg-tool-feedstock/pull/41/files>`__.

After making these changes don't forget to rerender with ``conda-smithy`` (to rerender manually use ``conda smithy rerender`` from the command line).


.. _cmd_batch_syntax:

Tips & tricks for CMD/Batch syntax
Expand Down