# compiler/extccomp

Dark Mode

- Index

Search:
Group by:
Source Edit

# Imports

ropes, platform, condsyms, options, msgs, lineinfos, pathutils, modulepaths

# Types

    TInfoCC = tuple[name: string, objExt: string, optSpeed: string, optSize: string,
                    compilerExe: string, cppCompiler: string, compileTmpl: string,
                    buildGui: string, buildDll: string, buildLib: string,
                    linkerExe: string, linkTmpl: string, includeCmd: string,
                    linkDirCmd: string, linkLibCmd: string, debug: string,
                    pic: string, asmStmtFrmt: string, structStmtFmt: string,
                    produceAsm: string, cppXsupport: string, props: TInfoCCProps]

  Source Edit

    TInfoCCProp = enum
      hasSwitchRange, hasComputedGoto, hasCpp, hasAssume, hasGcGuard, hasGnuAsm,
      hasDeclspec, hasAttribute

  Source Edit

    TInfoCCProps = set[TInfoCCProp]

  Source Edit

# Consts

    CC: array[succ(low(TSystemCC)) .. high(TSystemCC), TInfoCC] = [("gcc", "o",
        " -O3 -fno-ident", " -Os -fno-ident", "gcc", "g++",
        "-c $options $include -o $objfile $file", " -mwindows", " -shared",
        "ar rcs $libfile $objfiles", "",
        "$buildgui $builddll -o $exefile $objfiles $options", " -I", " -L", " -l$1",
        "", "-fPIC", "asm($1);$n", "$1 $3 $2 ",
        "-Wa,-acdl=$asmfile -g -fverbose-asm -masm=intel",
        "-std=gnu++14 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute}), (
        "switch_gcc", "o", " -O3 ", " -Os ", "aarch64-none-elf-gcc",
        "aarch64-none-elf-g++",
        "-w -MMD -MP -MF $dfile -c $options $include -o $objfile $file",
        " -mwindows", " -shared", "aarch64-none-elf-gcc-ar rcs $libfile $objfiles",
        "aarch64-none-elf-gcc",
        "$buildgui $builddll -Wl,-Map,$mapfile -o $exefile $objfiles $options",
        " -I", " -L", " -l$1", "", "-fPIE", "asm($1);$n", "$1 $3 $2 ",
        "-Wa,-acdl=$asmfile -g -fverbose-asm -masm=intel",
        "-std=gnu++14 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute}), (
        "llvm_gcc", "o", " -O3 -fno-ident", " -Os -fno-ident", "llvm-gcc",
        "llvm-g++", "-c $options $include -o $objfile $file", " -mwindows",
        " -shared", "llvm-ar rcs $libfile $objfiles", "",
        "$buildgui $builddll -o $exefile $objfiles $options", " -I", " -L", " -l$1",
        "", "-fPIC", "asm($1);$n", "$1 $3 $2 ",
        "-Wa,-acdl=$asmfile -g -fverbose-asm -masm=intel",
        "-std=gnu++14 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute}), (
        "clang", "o", " -O3 -fno-ident", " -Os -fno-ident", "clang", "clang++",
        "-c $options $include -o $objfile $file", " -mwindows", " -shared",
        "llvm-ar rcs $libfile $objfiles", "",
        "$buildgui $builddll -o $exefile $objfiles $options", " -I", " -L", " -l$1",
        "", "-fPIC", "asm($1);$n", "$1 $3 $2 ",
        "-Wa,-acdl=$asmfile -g -fverbose-asm -masm=intel",
        "-std=gnu++14 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute}), (
        "bcc", "obj", " -O3 -6 ", " -O1 -6 ", "bcc32c", "cpp32c",
        "-c $options $include -o$objfile $file", " -tW", " -tWD", "", "bcc32",
        "$options $buildgui $builddll -e$exefile $objfiles", " -I", "", "", "", "",
        "__asm{$n$1$n}$n", "$1 $2", "", "",
        {hasSwitchRange, hasComputedGoto, hasCpp, hasGcGuard, hasAttribute}), (
        "vcc", "obj", " /Ogityb2 ", " /O1 ", "cl", "cl",
        "/c$vccplatform $options $include /nologo /Fo$objfile $file",
        " /SUBSYSTEM:WINDOWS user32.lib ", " /LD", "lib /OUT:$libfile $objfiles",
        "cl",
        "$builddll$vccplatform /Fe$exefile $objfiles $buildgui /nologo $options",
        " /I", " /LIBPATH:", " $1.lib", " /RTC1 /Z7 ", "", "__asm{$n$1$n}$n",
        "$3$n$1 $2", "/Fa$asmfile", "", {hasCpp, hasAssume, hasDeclspec}), ("tcc",
        "o", "", "", "tcc", "", "-c $options $include -o $objfile $file",
        "-Wl,-subsystem=gui", " -shared", "", "tcc",
        "-o $exefile $options $buildgui $builddll $objfiles", " -I", "", "", " -g ",
        "", "asm($1);$n", "$1 $2",
        "-Wa,-acdl=$asmfile -g -fverbose-asm -masm=intel", "",
        {hasSwitchRange, hasComputedGoto, hasGnuAsm}), ("env", "o", " -O3 ",
        " -O1 ", "", "", "-c $ccenvflags $options $include -o $objfile $file", "",
        " -shared ", "", "", "-o $exefile $buildgui $builddll $objfiles $options",
        " -I", "", "", "", "", "__asm{$n$1$n}$n", "$1 $2", "", "", {hasGnuAsm}), (
        "icl", "obj", " /Ogityb2 ", " /O1 ", "icl", "cl",
        "/c$vccplatform $options $include /nologo /Fo$objfile $file",
        " /SUBSYSTEM:WINDOWS user32.lib ", " /LD", "lib /OUT:$libfile $objfiles",
        "icl",
        "$builddll$vccplatform /Fe$exefile $objfiles $buildgui /nologo $options",
        " /I", " /LIBPATH:", " $1.lib", " /RTC1 /Z7 ", "", "__asm{$n$1$n}$n",
        "$3$n$1 $2", "/Fa$asmfile", "", {hasCpp, hasAssume, hasDeclspec}), ("icc",
        "o", " -O3 -fno-ident", " -Os -fno-ident", "icc", "g++",
        "-c $options $include -o $objfile $file", " -mwindows", " -shared",
        "ar rcs $libfile $objfiles", "icc",
        "$buildgui $builddll -o $exefile $objfiles $options", " -I", " -L", " -l$1",
        "", "-fPIC", "asm($1);$n", "$1 $3 $2 ",
        "-Wa,-acdl=$asmfile -g -fverbose-asm -masm=intel",
        "-std=gnu++14 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute}), (
        "clang_cl", "obj", " /Ogityb2 ", " /O1 ", "clang-cl", "clang-cl",
        "/c$vccplatform $options $include /nologo /Fo$objfile $file",
        " /SUBSYSTEM:WINDOWS user32.lib ", " /LD", "lib /OUT:$libfile $objfiles",
        "clang-cl", "-fuse-ld=lld $builddll$vccplatform /Fe$exefile $objfiles $buildgui /nologo $options",
        " /I", " /LIBPATH:", " $1.lib", " /RTC1 /Z7 ", "", "__asm{$n$1$n}$n",
        "$3$n$1 $2", "/Fa$asmfile", "", {hasCpp, hasAssume, hasDeclspec})]

  Source Edit

    hExt = ".h"

  Source Edit

# Procs

    proc addCompileOption(conf: ConfigRef; option: string) {....raises: [], tags: [].}

  Source Edit

    proc addCompileOptionCmd(conf: ConfigRef; option: string) {....raises: [], tags: [].}

  Source Edit

    proc addExternalFileToCompile(conf: ConfigRef; c: var Cfile) {....raises: [OSError,
        Exception, IOError, ValueError, KeyError, ERecoverableError, EOFError], tags: [
        ReadEnvEffect, ReadIOEffect, RootEffect, ReadDirEffect, WriteIOEffect,
        WriteDirEffect].}

  Source Edit

    proc addExternalFileToCompile(conf: ConfigRef; filename: AbsoluteFile) {....raises: [
        OSError, IOError, Exception, ValueError, KeyError, ERecoverableError,
        EOFError], tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect,
                          ReadDirEffect, RootEffect, WriteIOEffect].}

  Source Edit

    proc addExternalFileToLink(conf: ConfigRef; filename: AbsoluteFile) {.
        ...raises: [], tags: [].}

  Source Edit

    proc addFileToCompile(conf: ConfigRef; cf: Cfile) {....raises: [], tags: [].}

  Source Edit

    proc addLinkOption(conf: ConfigRef; option: string) {....raises: [], tags: [].}

  Source Edit

    proc addLinkOptionCmd(conf: ConfigRef; option: string) {....raises: [], tags: [].}

  Source Edit

    proc addLocalCompileOption(conf: ConfigRef; option: string;
                               nimfile: AbsoluteFile) {.
        ...raises: [OSError, IOError, Exception], tags: [ReadEnvEffect, ReadIOEffect,
        WriteDirEffect, ReadDirEffect, RootEffect].}

  Source Edit

    proc callCCompiler(conf: ConfigRef) {....raises: [Exception, ValueError, KeyError,
        OSError, IOError, ERecoverableError], tags: [ReadEnvEffect, RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, WriteDirEffect, ExecIOEffect,
        TimeEffect].}

  Source Edit

    proc ccHasSaneOverflow(conf: ConfigRef): bool {....raises: [ValueError],
        tags: [ExecIOEffect, ReadIOEffect, RootEffect].}

  Source Edit

    proc changeDetectedViaJsonBuildInstructions(conf: ConfigRef;
        jsonFile: AbsoluteFile): bool {....raises: [OSError, Exception, IOError,
        ValueError], tags: [ReadDirEffect, RootEffect, ReadIOEffect, WriteIOEffect].}

  Source Edit

    proc completeCfilePath(conf: ConfigRef; cfile: AbsoluteFile;
                           createSubDir: bool = true): AbsoluteFile {.
        ...raises: [OSError, IOError],
        tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect, ReadDirEffect].}

  Generate the absolute file path to the generated modules. Source Edit

    proc execExternalProgram(conf: ConfigRef; cmd: string; msg = hintExecuting) {....raises: [
        Exception, ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect,
        ExecIOEffect].}

  Source Edit

    proc getCompileCFileCmd(conf: ConfigRef; cfile: Cfile; isMainFile = false;
                            produceOutput = false): string {....raises: [Exception,
        ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
        ReadEnvEffect, RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect,
        WriteDirEffect].}

  Source Edit

    proc initVars(conf: ConfigRef) {....raises: [], tags: [].}

  Source Edit

    proc isVSCompatible(conf: ConfigRef): bool {....raises: [], tags: [].}

  Source Edit

    proc jsonBuildInstructionsFile(conf: ConfigRef): AbsoluteFile {.
        ...raises: [OSError], tags: [ReadEnvEffect, ReadIOEffect].}

  Source Edit

    proc nameToCC(name: string): TSystemCC {....raises: [], tags: [].}

  Returns the kind of compiler referred to by `name`, or ccNone if the name doesn't refer to any known compiler. Source Edit

    proc resetCompilationLists(conf: ConfigRef) {....raises: [], tags: [].}

  Source Edit

    proc runJsonBuildInstructions(conf: ConfigRef; jsonFile: AbsoluteFile) {....raises: [
        ValueError, OSError, IOError, Exception, KeyError, ERecoverableError], tags: [
        RootEffect, ReadIOEffect, WriteIOEffect, WriteDirEffect, ReadDirEffect,
        ReadEnvEffect, ExecIOEffect, TimeEffect].}

  Source Edit

    proc setCC(conf: ConfigRef; ccname: string; info: TLineInfo) {....raises: [
        Exception, ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}

  Source Edit

    proc toObjFile(conf: ConfigRef; filename: AbsoluteFile): AbsoluteFile {.
        ...raises: [], tags: [].}

  Source Edit

    proc writeJsonBuildInstructions(conf: ConfigRef) {....raises: [OSError, Exception,
        ValueError, KeyError, IOError, ERecoverableError], tags: [ReadEnvEffect,
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, WriteDirEffect,
        TimeEffect].}

  Source Edit

    proc writeMapping(conf: ConfigRef; symbolMapping: Rope) {....raises: [ValueError,
        OSError, IOError, Exception, KeyError, ERecoverableError], tags: [
        WriteIOEffect, RootEffect, ReadDirEffect, ReadIOEffect, ReadEnvEffect].}

  Source Edit