Skip to content

Commit

Permalink
C++20 build for ms vc.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnoel committed Jan 31, 2024
1 parent b7e7784 commit 95acfc0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
25 changes: 15 additions & 10 deletions scripts/admb/admb.bat
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,17 @@ if "!CXX!"=="cl" (
echo Error: Unable to find !CXX!
exit /B 1
)
set CPPSTD=17
for /f "tokens=*" %%i in ('!CXX! 2^>^&1 ^| findstr " 19.3"') do (
set CPPSTD=/std:c++20
)
if not defined CPPSTD (
set CPPSTD=/std:c++17
)
set LD=!CXX!
if defined CXXFLAGS (
set CXXFLAGS= /c /nologo /std:c++!CPPSTD! /EHsc !CXXFLAGS!
set CXXFLAGS= /c /nologo !CPPSTD! /EHsc !CXXFLAGS!
) else (
set CXXFLAGS= /c /nologo /std:c++!CPPSTD! /EHsc
set CXXFLAGS= /c /nologo !CPPSTD! /EHsc
)
if defined g (
set CXXFLAGS=!CXXFLAGS! /Z7
Expand Down Expand Up @@ -217,7 +222,7 @@ if "!CXX!"=="cl" (
)
)
if defined fast (
set CXXFLAGS=!CXXFLAGS! /nologo /std:c++!CPPSTD! /DOPT_LIB
set CXXFLAGS=!CXXFLAGS! /nologo !CPPSTD! /DOPT_LIB
if defined g (
if exist "!ADMB_HOME!\lib\admb-contribo!OSNAME!!CXXVERSION!-debug.lib" (
set libs="!ADMB_HOME!\lib\admb-contribo!OSNAME!!CXXVERSION!-debug.lib" /link
Expand Down Expand Up @@ -690,9 +695,9 @@ if not defined tpls (
) else (
if "!CXX!"=="cl" (
if defined output (
set CMD=!LD!!LDFLAGS! /nologo /std:c++!CPPSTD! /Fe!output! !objs! !libs!
set CMD=!LD!!LDFLAGS! /nologo !CPPSTD! /Fe!output! !objs! !libs!
) else (
set CMD=!LD!!LDFLAGS! /nologo /std:c++!CPPSTD! /Fe!main!.exe !objs! !libs!
set CMD=!LD!!LDFLAGS! /nologo !CPPSTD! /Fe!main!.exe !objs! !libs!
)
) else (
if defined output (
Expand Down Expand Up @@ -755,15 +760,15 @@ if not defined tpls (
if "!CXX!"=="cl" (
if defined objs (
if defined output (
set CMD=!LD!!LDFLAGS! /nologo /std:c++!CPPSTD! /Fe!output! !tpl!.obj !objs! !libs!
set CMD=!LD!!LDFLAGS! /nologo !CPPSTD! /Fe!output! !tpl!.obj !objs! !libs!
) else (
set CMD=!LD!!LDFLAGS! /nologo /std:c++!CPPSTD! /Fe!tpl!.exe !tpl!.obj !objs! !libs!
set CMD=!LD!!LDFLAGS! /nologo !CPPSTD! /Fe!tpl!.exe !tpl!.obj !objs! !libs!
)
) else (
if defined output (
set CMD=!LD!!LDFLAGS! /nologo /std:c++!CPPSTD! /Fe!output! !tpl!.obj !libs!
set CMD=!LD!!LDFLAGS! /nologo !CPPSTD! /Fe!output! !tpl!.obj !libs!
) else (
set CMD=!LD!!LDFLAGS! /nologo /std:c++!CPPSTD! /Fe!tpl!.exe !tpl!.obj !libs!
set CMD=!LD!!LDFLAGS! /nologo !CPPSTD! /Fe!tpl!.exe !tpl!.obj !libs!
)
)
) else (
Expand Down
10 changes: 7 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ CXXVERSION=-cl19
CXXVERSION=-cl
!ENDIF

CPPSTD=17
!IF ([cl 2>&1 | findstr " 19.3" > nul] == 0)
CPPSTD=/std:c++20
!ELSE
CPPSTD=/std:c++17
!ENDIF

!IF ([cl 2>&1 | findstr " x64" > nul] == 0)
OSNAME=win64
Expand All @@ -32,8 +36,8 @@ CXXFLAGS_OPT=/nologo /Z7 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DDEBUG /D_USE_MA
!ENDIF
!ELSE
OBJDESTDIR=..\build\objects\$(OSNAME)$(CXXVERSION)
CXXFLAGS_SAF=/nologo /std:c++$(CPPSTD) /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc$(SAFE_ALL) /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I$(DESTDIR)\include
CXXFLAGS_OPT=/nologo /std:c++$(CPPSTD) /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I$(DESTDIR)\include
CXXFLAGS_SAF=/nologo $(CPPSTD) /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc$(SAFE_ALL) /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I$(DESTDIR)\include
CXXFLAGS_OPT=/nologo $(CPPSTD) /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I$(DESTDIR)\include
!ENDIF

!INCLUDE df1b2-separable\objects.lst
Expand Down

0 comments on commit 95acfc0

Please sign in to comment.