Exemplo n.º 1
0
void
chaz_CFlags_add_external_library(chaz_CFlags *flags, const char *library) {
    char *string;
    if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
        string = chaz_Util_join("", library, ".lib", NULL);
    }
    else {
        string = chaz_Util_join(" ", "-l", library, NULL);
    }
    chaz_CFlags_append(flags, string);
    free(string);
}
Exemplo n.º 2
0
static char*
S_build_filename(chaz_SharedLib *lib, const char *version, const char *ext) {
    const char *prefix    = S_get_prefix();
    const char *shlib_ext = chaz_OS_shared_lib_ext();

    if (strcmp(shlib_ext, ".dll") == 0) {
        return chaz_Util_join("", prefix, lib->name, "-", version, ext, NULL);
    }
    else if (strcmp(shlib_ext, ".dylib") == 0) {
        return chaz_Util_join("", prefix, lib->name, ".", version, ext, NULL);
    }
    else {
        return chaz_Util_join("", prefix, lib->name, ext, ".", version, NULL);
    }
}
Exemplo n.º 3
0
char*
chaz_SharedLib_no_version_filename(chaz_SharedLib *lib) {
    const char *prefix    = S_get_prefix();
    const char *shlib_ext = chaz_OS_shared_lib_ext();

    return chaz_Util_join("", prefix, lib->name, shlib_ext, NULL);
}
Exemplo n.º 4
0
void
chaz_CFlags_append(chaz_CFlags *flags, const char *string) {
    char *new_string;
    if (flags->string[0] == '\0') {
        new_string = chaz_Util_strdup(string);
    }
    else {
        new_string = chaz_Util_join(" ", flags->string, string, NULL);
    }
    free(flags->string);
    flags->string = new_string;
}
Exemplo n.º 5
0
void
chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
                       const char *value) {
    const char *define;
    char *string;
    if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
        define = "/D";
    }
    else {
        /* POSIX */
        define = "-D ";
    }
    if (value) {
        string = chaz_Util_join("", define, name, "=", value, NULL);
    }
    else {
        string = chaz_Util_join("", define, name, NULL);
    }
    chaz_CFlags_append(flags, string);
    free(string);
}
Exemplo n.º 6
0
void
chaz_CFlags_set_link_output(chaz_CFlags *flags, const char *filename) {
    const char *output;
    char *string;
    if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
        output = "/OUT:";
    }
    else {
        output = "-o ";
    }
    string = chaz_Util_join("", output, filename, NULL);
    chaz_CFlags_append(flags, string);
    free(string);
}
Exemplo n.º 7
0
void
chaz_CFlags_set_shared_library_version(chaz_CFlags *flags,
                                       chaz_SharedLib *lib) {
    const char *shlib_ext = chaz_OS_shared_lib_ext();
    char       *string;

    if (flags->style != CHAZ_CFLAGS_STYLE_GNU
        || strcmp(shlib_ext, ".dll") == 0) {
        return;
    }

    if (strcmp(chaz_OS_shared_lib_ext(), ".dylib") == 0) {
        const char *version = chaz_SharedLib_get_version(lib);
        string = chaz_Util_join(" ", "-current_version", version, NULL);
    }
    else {
        char *soname = chaz_SharedLib_major_version_filename(lib);
        string = chaz_Util_join("", "-Wl,-soname,", soname, NULL);
        free(soname);
    }
    chaz_CFlags_append(flags, string);
    free(string);
}
Exemplo n.º 8
0
void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir) {
    const char *include;
    char *string;
    if (flags->style == CHAZ_CFLAGS_STYLE_MSVC)  {
        include = "/I ";
    }
    else {
        /* POSIX */
        include = "-I ";
    }
    string = chaz_Util_join("", include, dir, NULL);
    chaz_CFlags_append(flags, string);
    free(string);
}
Exemplo n.º 9
0
void
chaz_CFlags_add_library_path(chaz_CFlags *flags, const char *directory) {
    const char *lib_path;
    char *string;
    if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
        if (strcmp(directory, ".") == 0) {
            /* The MS linker searches the current directory by default. */
            return;
        }
        else {
            lib_path = "/LIBPATH:";
        }
    }
    else {
        lib_path = "-L ";
    }
    string = chaz_Util_join("", lib_path, directory, NULL);
    chaz_CFlags_append(flags, string);
    free(string);
}