# extccomp

Theme:

- 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, hasBuiltinUnreachable

  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++17 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute,
                                         hasBuiltinUnreachable}), ("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++17 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute,
                                         hasBuiltinUnreachable}), ("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++17 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute,
                                         hasBuiltinUnreachable}), ("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++17 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute,
                                         hasBuiltinUnreachable}), ("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",
        "vccexe --command:lib$vccplatform /nologo /OUT:$libfile $objfiles", "cl",
        "$builddll$vccplatform /Fe$exefile $objfiles $buildgui /nologo $options",
        " /I", " /link /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", " -L", " -l$1",
        " -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",
        "vccexe --command:lib$vccplatform /nologo /OUT:$libfile $objfiles", "icl",
        "$builddll$vccplatform /Fe$exefile $objfiles $buildgui /nologo $options",
        " /I", " /link /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++17 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute,
                                         hasBuiltinUnreachable}), ("clang_cl",
        "obj", " /Ogityb2 ", " /O1 ", "clang-cl", "clang-cl",
        "/c$vccplatform $options $include /nologo /Fo$objfile $file",
        " /SUBSYSTEM:WINDOWS user32.lib ", " /LD",
        "vccexe --command:lib$vccplatform /nologo /OUT:$libfile $objfiles",
        "clang-cl", "-fuse-ld=lld $builddll$vccplatform /Fe$exefile $objfiles $buildgui /nologo $options",
        " /I", " /link /LIBPATH:", " $1.lib", " /RTC1 /Z7 ", "", "__asm{$n$1$n}$n",
        "$3$n$1 $2", "/Fa$asmfile", "", {hasCpp, hasAssume, hasDeclspec}), ("hipcc",
        "o", " -O3 -fno-ident", " -Os -fno-ident", "hipcc", "hipcc",
        "-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++17 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute,
                                         hasBuiltinUnreachable}), ("nvcc", "o",
        " -O3 -fno-ident", " -Os -fno-ident", "nvcc", "nvcc",
        "-c -x cu -Xcompiler=\"$options\" $include -o $objfile $file", " -mwindows",
        " -shared", "ar rcs $libfile $objfiles", "",
        "$buildgui $builddll -o $exefile $objfiles -Xcompiler=\"$options\"", " -I",
        " -L", " -l$1", "", "-fPIC", "__asm__($1);$n", "$1 $3 $2 ",
        "-Wa,-acdl=$asmfile -g -fverbose-asm -masm=intel",
        "-std=gnu++17 -funsigned-char", {hasSwitchRange, hasComputedGoto, hasCpp,
                                         hasGcGuard, hasGnuAsm, hasAttribute,
                                         hasBuiltinUnreachable})]

  Source Edit

    hExt = ".h"

  Source Edit

# Procs

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

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

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  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: [], forbids: [].}

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit

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

  Source Edit