Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit ccf7005

Browse files
steve-m-hayrurban
authored andcommitted
Fix up CCINCDIR/CCLIBDIR for VC++ 14.1 (and VC++ 8.0-14.0 too!)
These settings just end up in $Config{incpath}/$Config{libpth} and don't otherwise affect the build, but we might as well get them right if we can. (cherry picked from commit 74102a8)
1 parent 6439f2e commit ccf7005

File tree

2 files changed

+67
-31
lines changed

2 files changed

+67
-31
lines changed

win32/Makefile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,23 @@ CCTYPE = MSVC110FREE
225225
#ALL_STATIC = define
226226

227227
#
228+
# set the install location of the compiler
229+
# Running VCVARS32.BAT, VCVARSALL.BAT or similar is *required* when using
230+
# Visual C++.
231+
# Versions of Visual C++ up to VC++ 7.1 define $(MSVCDir); versions since then
232+
# define $(VCINSTALLDIR) instead, but for VC++ 14.1 we need the subfolder given
233+
# by $(VCToolsInstallDir).
228234
#
229-
# set the install locations of the compiler include/libraries
230-
# Running VCVARS32.BAT is *required* when using Visual C.
231-
# Some versions of Visual C don't define MSVCDIR in the environment,
232-
# so you may have to set CCHOME explicitly (spaces in the path name should
233-
# not be quoted), for MSVC141 replace $(MSVCDIR) with $(VCToolsInstallDir)
234-
#
235+
!IF "$(CCTYPE)" == "MSVC60" || \
236+
"$(CCTYPE)" == "MSVC70" || "$(CCTYPE)" == "MSVC70FREE"
235237
CCHOME = $(MSVCDIR)
236-
CCINCDIR = $(CCHOME)\include
237-
CCLIBDIR = $(CCHOME)\lib
238+
!ELSE
239+
! IF "$(CCTYPE)" == "MSVC141"
240+
CCHOME = $(VCTOOLSINSTALLDIR)
241+
! ELSE
242+
CCHOME = $(VCINSTALLDIR)
243+
! ENDIF
244+
!ENDIF
238245

239246
#
240247
# Additional compiler flags can be specified here.
@@ -458,6 +465,19 @@ EMBED_EXE_MANI = if exist $@.manifest mt -nologo -manifest $@.manifest -outputre
458465
EMBED_DLL_MANI = if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 && \
459466
if exist $@.manifest del $@.manifest
460467

468+
# Set the install location of the compiler headers/libraries.
469+
# These are saved into $Config{incpath} and $Config{libpth}.
470+
CCINCDIR = $(CCHOME)\include
471+
!IF "$(CCTYPE)" == "MSVC141"
472+
! IF "$(WIN64)" == "define"
473+
CCLIBDIR = $(CCHOME)\lib\x64
474+
! ELSE
475+
CCLIBDIR = $(CCHOME)\lib\x86
476+
! ENDIF
477+
!ELSE
478+
CCLIBDIR = $(CCHOME)\lib
479+
!ENDIF
480+
461481
ARCHDIR = ..\lib\$(ARCHNAME)
462482
COREDIR = ..\lib\CORE
463483
AUTODIR = ..\lib\auto
@@ -468,7 +488,6 @@ CPANDIR = ..\cpan
468488
PODDIR = ..\pod
469489
HTMLDIR = .\html
470490

471-
#
472491
INST_SCRIPT = $(INST_TOP)$(INST_VER)\bin
473492
INST_BIN = $(INST_SCRIPT)$(INST_ARCH)
474493
INST_LIB = $(INST_TOP)$(INST_VER)\lib

win32/makefile.mk

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,9 @@ DEFAULT_INC_EXCLUDES_DOT *= define
245245
#ALL_STATIC *= define
246246

247247
#
248-
# set the install locations of the compiler include/libraries
249-
# Running VCVARS32.BAT is *required* when using Visual C.
250-
# Some versions of Visual C don't define MSVCDIR in the environment,
251-
# so you may have to set CCHOME explicitly (spaces in the path name should
252-
# not be quoted), for MSVC141 the value for %VCToolsInstallDir%
248+
# set the install location of the compiler
249+
# Running VCVARS32.BAT, VCVARSALL.BAT or similar is *required* when using
250+
# Visual C++.
253251
#
254252

255253
#CCHOME *= C:\MinGW
@@ -373,29 +371,22 @@ CCTYPE := MSVC$(MSVCVER)0
373371
.ENDIF
374372
.ENDIF
375373

376-
374+
# Versions of Visual C++ up to VC++ 7.1 define $(MSVCDir); versions since then
375+
# define $(VCINSTALLDIR) instead, but for VC++ 14.1 we need the subfolder given
376+
# by $(VCToolsInstallDir).
377377
.IF "$(CCHOME)" == ""
378378
.IF "$(CCTYPE)" == "GCC"
379379
CCHOME *= C:\MinGW
380+
.ELIF "$(CCTYPE)" == "MSVC60" || \
381+
"$(CCTYPE)" == "MSVC70" || "$(CCTYPE)" == "MSVC70FREE"
382+
CCHOME *= $(MSVCDir)
383+
.ELIF "$(CCTYPE)" == "MSVC141"
384+
CCHOME *= $(VCToolsInstallDir)
380385
.ELSE
381-
CCHOME *= $(MSVCDIR)
386+
CCHOME *= $(VCINSTALLDIR)
382387
.ENDIF
383388
.ENDIF
384389

385-
#
386-
# Following sets $Config{incpath} and $Config{libpth}
387-
#
388-
389-
.IF "$(GCCCROSS)" == "define"
390-
CCINCDIR *= $(CCHOME)\x86_64-w64-mingw32\include
391-
CCLIBDIR *= $(CCHOME)\x86_64-w64-mingw32\lib
392-
CCDLLDIR *= $(CCLIBDIR)
393-
.ELSE
394-
CCINCDIR *= $(CCHOME)\include
395-
CCLIBDIR *= $(CCHOME)\lib
396-
CCDLLDIR *= $(CCHOME)\bin
397-
.ENDIF
398-
399390
PROCESSOR_ARCHITECTURE *= x86
400391

401392
.IF "$(WIN64)" == "undef"
@@ -467,6 +458,33 @@ ARCHNAME !:= $(ARCHNAME)-64int
467458
ARCHNAME !:= $(ARCHNAME)-ld
468459
.ENDIF
469460

461+
# Set the install location of the compiler headers/libraries.
462+
# These are saved into $Config{incpath} and $Config{libpth}.
463+
.IF "$(GCCCROSS)" == "define"
464+
CCINCDIR *= $(CCHOME)\x86_64-w64-mingw32\include
465+
CCLIBDIR *= $(CCHOME)\x86_64-w64-mingw32\lib
466+
.ELSE
467+
CCINCDIR *= $(CCHOME)\include
468+
.IF "$(CCTYPE)" == "MSVC141"
469+
.IF "$(WIN64)" == "define"
470+
CCLIBDIR *= $(CCHOME)\lib\x64
471+
.ELSE
472+
CCLIBDIR *= $(CCHOME)\lib\x86
473+
.ENDIF
474+
.ELSE
475+
CCLIBDIR *= $(CCHOME)\lib
476+
.ENDIF
477+
.ENDIF
478+
479+
# Set DLL location for GCC compilers.
480+
.IF "$(CCTYPE)" == "GCC"
481+
.IF "$(GCCCROSS)" == "define"
482+
CCDLLDIR *= $(CCLIBDIR)
483+
.ELSE
484+
CCDLLDIR *= $(CCHOME)\bin
485+
.ENDIF
486+
.ENDIF
487+
470488
ARCHDIR = ..\lib\$(ARCHNAME)
471489
COREDIR = ..\lib\CORE
472490
AUTODIR = ..\lib\auto
@@ -477,7 +495,6 @@ CPANDIR = ..\cpan
477495
PODDIR = ..\pod
478496
HTMLDIR = .\html
479497

480-
#
481498
INST_SCRIPT = $(INST_TOP)$(INST_VER)\bin
482499
INST_BIN = $(INST_SCRIPT)$(INST_ARCH)
483500
INST_LIB = $(INST_TOP)$(INST_VER)\lib

0 commit comments

Comments
 (0)