Skip to content

Commit

Permalink
Fix the current Windows build
Browse files Browse the repository at this point in the history
As logged in `bld.bat`: as of July 2023, the build system for this
package can run into issues if the version of `cl` found via %PATH% is
not exactly the same as the version used by MSBuild. The only way I can
figure out to avoid the problem is to avoid MSBuild altogether, which
can be done by using the NMake Makefiles generator, as well as
explicitly specifying the full path to the desired compilers.

The error messages were:

```
Exception in file D:/dev/cppan2/client2/src/sw/driver/module.cpp:120, function operator ():
  error in module (C:/Users/VssAdministrator/.sw/storage/tmp/cfg/793929/loc.sw.self.4a156b-0.0.31.dll):
    Exception in file D:/dev/cppan2/client2/src/sw/driver/target/native.cpp:799, function findCompiler:
      Cannot find compiler com.Microsoft.VisualStudio.VC.cl->=19.35.0 <19.36.0 for settings: {...}
```
  • Loading branch information
pkgw committed Jul 29, 2023
1 parent f92c290 commit 6a751b5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@ set PATH=%PATH%;%CD%
sw setup
if errorlevel 1 exit 1

:: As of July 2023, the build system for this package can run into issues if the
:: version of `cl` found via %PATH% is not exactly the same as the version used
:: by MSBuild. The only way I can figure out to avoid the problem is to avoid
:: MSBuild altogether, which can be done by using the NMake Makefiles generator,
:: as well as explicitly specifying the full path to the desired compilers.
set "clpathunix=%VCToolsInstallDir%bin\Hostx64\x64\cl.exe"
set "clpathunix=%clpathunix:\=/%"

cmake %CMAKE_ARGS% ^
-D BUILD_PROG=1 ^
-D CMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-D CMAKE_INCLUDE_PATH=%LIBRARY_INC% ^
-D CMAKE_LIBRARY_PATH=%LIBRARY_LIB% ^
-D BUILD_SHARED_LIBS=ON ^
-D CMAKE_MODULE_LINKER_FLAGS=-whole-archive ^
-D "CMAKE_C_COMPILER=%clpathunix%" ^
-D "CMAKE_CXX_COMPILER=%clpathunix%" ^
-G "NMake Makefiles" ^
..
if errorlevel 1 exit 1

Expand Down

0 comments on commit 6a751b5

Please sign in to comment.