diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 09a1dfbb33a0..6535b30d64c6 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -242,6 +242,32 @@ compiler tcc: cppXsupport: "", props: {hasSwitchRange, hasComputedGoto, hasGnuAsm}) +# OpenWatcom C Compiler +compiler owcc: + result = ( + name: "owcc", + objExt: "o", + optSpeed: " -O3", + optSize: " -Os", + compilerExe: "owcc", + cppCompiler: "owcc", + compileTmpl: "-c $options $include -o $objfile $file", + buildGui: " -mwindows", + buildDll: " -shared", + buildLib: "wlib $libfile $objfiles", + linkerExe: "", + linkTmpl: "$buildgui $builddll -o $exefile $objfiles $options", + includeCmd: " -I", + linkDirCmd: " -L", + linkLibCmd: " -l$1", + debug: "", + pic: "", + asmStmtFrmt: "$1 $2", + structStmtFmt: "$1 $2", # struct|union [packed] $name + produceAsm: gnuAsmListing, + cppXsupport: "", + props: {hasGnuAsm}) + # Your C Compiler compiler envcc: result = ( @@ -280,7 +306,8 @@ const envcc(), icl(), icc(), - clangcl()] + clangcl(), + owcc()] hExt* = ".h" diff --git a/compiler/options.nim b/compiler/options.nim index 69eafb67fd0c..a019916ec7f8 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -231,7 +231,7 @@ type TSystemCC* = enum ccNone, ccGcc, ccNintendoSwitch, ccLLVM_Gcc, ccCLang, ccBcc, ccVcc, - ccTcc, ccEnv, ccIcl, ccIcc, ccClangCl + ccTcc, ccEnv, ccIcl, ccIcc, ccClangCl, ccOwcc ExceptionSystem* = enum excNone, # no exception system selected yet diff --git a/config/nim.cfg b/config/nim.cfg index bfb0b0254194..e0b4752efd44 100644 --- a/config/nim.cfg +++ b/config/nim.cfg @@ -33,12 +33,6 @@ riscv32.linux.gcc.exe = "riscv64-linux-gnu-gcc" riscv32.linux.gcc.linkerexe = "riscv64-linux-gnu-gcc" riscv64.linux.gcc.exe = "riscv64-linux-gnu-gcc" riscv64.linux.gcc.linkerexe = "arm-linux-gnueabihf-gcc" -# 16-bit x86, e.g. 8086: OpenWatcom compiler -i086.dos.gcc.exe = "owcc" -i086.dos.gcc.linkerexe = "owcc" -# 16-bit x86, but with large/huge code and data model -i086big.dos.gcc.exe = "owcc" -i086big.dos.gcc.linkerexe = "owcc" # For OpenWRT, you will also need to adjust PATH to point to your toolchain. mips.linux.gcc.exe = "mips-openwrt-linux-gcc" @@ -99,6 +93,20 @@ nimblepath="$home/.nimble/pkgs/" gcc.options.always %= "${gcc.options.always} -fsanitize=null -fsanitize-undefined-trap-on-error" @end +@if (i086 or i086big) and dos: + # Cross compile for DOS using OpenWatcom + cc = owcc + owcc.options.always %= "${owcc.options.always} -bdos" + owcc.options.linker %= "${owcc.options.linker} -bdos" + @if hugeModel: + owcc.options.always %= "${owcc.options.always} -mcmodel=h" + @elif largeModel or i086big: + owcc.options.always %= "${owcc.options.always} -mcmodel=l" + @elif smallModel or i086: + owcc.options.always %= "${owcc.options.always} -mcmodel=s" + @end +@end + @if unix and mingw: # Cross compile for Windows from Linux/OSX using MinGW i386.windows.gcc.exe = "i686-w64-mingw32-gcc"