Skip to content

Commit

Permalink
readme: Update to prefer usage of unmodified upstream CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
mstorsjo committed May 8, 2023
1 parent 78241b8 commit a80b5b8
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@ We're going to install it into `~/my_msvc` to avoid needing root privileges on a
# Add wrapper scripts, do minor cleanup of the unpacked MSVC installation
./install.sh ~/my_msvc/opt/msvc

# Custom CMake
git clone https://gitlab.kitware.com/mstorsjo/cmake.git
cd cmake
git checkout 844ccd2280d11ada286d0e2547c0fa5ff22bd4db
mkdir build
cd build
../configure --prefix=~/my_msvc/opt/cmake --parallel=$(nproc) -- -DCMAKE_USE_OPENSSL=OFF
make -j$(nproc)
make install

# Run wine at least once
wineserver -k # kills server (optional)
wineserver -p
Expand All @@ -70,11 +60,10 @@ wine64 wineboot

### Setting up your project with CMake

You need to set the path to prioritize our custom CMake, and also to see our MSVC installation.
You need to add the our MSVC installation to the path.
After that we just run CMake command with a few extra settings:

```bash
export PATH=~/my_msvc/opt/cmake/bin:$PATH
export PATH=~/my_msvc/opt/msvc/bin/x64:$PATH
CC=cl CXX=cl cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows
make
Expand Down Expand Up @@ -135,9 +124,28 @@ Yes, but the install scripts won't work because `msitools` is too old. You'll ne

## Does it work with CMake?

Yes, but a custom version is needed or else CMake will complain that `/opt/msvc/bin/x64/cl` can't build a simple program.

It also fixes the `Ninja` Generator which otherwise has trouble finding RC.
Yes, but you need CMake 3.23, and either need `winbind` installed, or
need to configure the build to always use embedded debug info (or a
custom build of CMake that doesn't try to use separate PDB file debug
info by default).

Even if configuring CMake with `-DCMAKE_BUILD_TYPE=Release`, CMake does
call the compiler in `Debug` mode when it does the first few test
invocations of the compiler. By default, CMake uses separate PDB
file debug info, when compiling in `Debug` mode, i.e. using the
`/Zi` compiler option (as opposed to the `/Z7` option, storing the
debug info in the individual object files).

When MSVC is invoked with the `/Zi` option, it spawns a background
`mspdbsrv.exe` process and communicates with it. This requires
the `winbind` package to be installed for this communication to work.

With CMake 3.25, it's possible to override the type of debug info
even for the first few probing steps. This requires the CMake project
to either set `cmake_minimum_required(VERSION 3.25.0)`, or set
`cmake_policy(SET CMP0141 NEW)`, and requires the user to configure it
with `-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded`; in such a
configuration, `winbind` isn't needed.

## Can it build Debug versions?

Expand Down

0 comments on commit a80b5b8

Please sign in to comment.