mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add macos sdk / min version to pass to the linker.
This commit is contained in:
@@ -689,6 +689,18 @@ static void parse_option(BuildOptions *options)
|
|||||||
options->win.crt_linking = (WinCrtLinking)parse_multi_option(argopt, 3, wincrt_linking);
|
options->win.crt_linking = (WinCrtLinking)parse_multi_option(argopt, 3, wincrt_linking);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (match_longopt("macos-sdk-version"))
|
||||||
|
{
|
||||||
|
if (at_end() || next_is_opt()) error_exit("error: --macos-sdk-version needs a version.");
|
||||||
|
options->macos.sdk_version = next_arg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (match_longopt("macos-min-version"))
|
||||||
|
{
|
||||||
|
if (at_end() || next_is_opt()) error_exit("error: --macos-min-version needs a version.");
|
||||||
|
options->macos.min_version = next_arg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (match_longopt("build-dir"))
|
if (match_longopt("build-dir"))
|
||||||
{
|
{
|
||||||
if (at_end() || next_is_opt()) error_exit("error: --build-dir needs a directory.");
|
if (at_end() || next_is_opt()) error_exit("error: --build-dir needs a directory.");
|
||||||
|
|||||||
@@ -242,6 +242,8 @@ typedef struct BuildOptions_
|
|||||||
} win;
|
} win;
|
||||||
struct {
|
struct {
|
||||||
const char *sdk;
|
const char *sdk;
|
||||||
|
const char *min_version;
|
||||||
|
const char *sdk_version;
|
||||||
} macos;
|
} macos;
|
||||||
int build_threads;
|
int build_threads;
|
||||||
const char** files;
|
const char** files;
|
||||||
@@ -379,6 +381,8 @@ typedef struct
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
const char *sdk;
|
const char *sdk;
|
||||||
|
const char *min_version;
|
||||||
|
const char *sdk_version;
|
||||||
} macos;
|
} macos;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -228,6 +228,8 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions *
|
|||||||
target->testing = options->testing;
|
target->testing = options->testing;
|
||||||
if (options->macos.sdk) target->macos.sdk = options->macos.sdk;
|
if (options->macos.sdk) target->macos.sdk = options->macos.sdk;
|
||||||
if (options->win.sdk) target->win.sdk = options->win.sdk;
|
if (options->win.sdk) target->win.sdk = options->win.sdk;
|
||||||
|
if (options->macos.min_version) target->macos.min_version = options->macos.min_version;
|
||||||
|
if (options->macos.sdk_version) target->macos.sdk_version = options->macos.sdk_version;
|
||||||
if (options->win.crt_linking != WIN_CRT_DEFAULT) target->win.crt_linking = options->win.crt_linking;
|
if (options->win.crt_linking != WIN_CRT_DEFAULT) target->win.crt_linking = options->win.crt_linking;
|
||||||
if (options->x86_vector_capability != X86VECTOR_DEFAULT)
|
if (options->x86_vector_capability != X86VECTOR_DEFAULT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -327,6 +327,12 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg
|
|||||||
// macossdk
|
// macossdk
|
||||||
target->macos.sdk = get_valid_string(json, "macossdk", type, false);
|
target->macos.sdk = get_valid_string(json, "macossdk", type, false);
|
||||||
|
|
||||||
|
// macos-min-version
|
||||||
|
target->macos.min_version = get_valid_string(json, "macos-min-version", type, false);
|
||||||
|
|
||||||
|
// macos-sdk-version
|
||||||
|
target->macos.sdk_version = get_valid_string(json, "macos-sdk-version", type, false);
|
||||||
|
|
||||||
// version
|
// version
|
||||||
const char *version = get_valid_string(json, "version", type, false);
|
const char *version = get_valid_string(json, "version", type, false);
|
||||||
if (version) target->version = version;
|
if (version) target->version = version;
|
||||||
|
|||||||
@@ -585,6 +585,7 @@ typedef enum
|
|||||||
TOKEN_CT_FOR, // $for
|
TOKEN_CT_FOR, // $for
|
||||||
TOKEN_CT_FOREACH, // $foreach
|
TOKEN_CT_FOREACH, // $foreach
|
||||||
TOKEN_CT_IF, // $if
|
TOKEN_CT_IF, // $if
|
||||||
|
TOKEN_CT_INCLUDE, // $include
|
||||||
TOKEN_CT_NAMEOF, // $nameof
|
TOKEN_CT_NAMEOF, // $nameof
|
||||||
TOKEN_CT_OFFSETOF, // $offsetof
|
TOKEN_CT_OFFSETOF, // $offsetof
|
||||||
TOKEN_CT_QNAMEOF, // $qnameof
|
TOKEN_CT_QNAMEOF, // $qnameof
|
||||||
|
|||||||
@@ -301,8 +301,22 @@ static void linker_setup_macos(const char ***args_ref, LinkerType linker_type)
|
|||||||
if (is_pie(platform_target.reloc_model)) add_arg("-pie");
|
if (is_pie(platform_target.reloc_model)) add_arg("-pie");
|
||||||
add_arg("-platform_version");
|
add_arg("-platform_version");
|
||||||
add_arg("macos");
|
add_arg("macos");
|
||||||
add_arg(str_printf("%d.%d.0", mac_sdk->macos_min_deploy_target.major, mac_sdk->macos_min_deploy_target.minor));
|
if (active_target.macos.min_version)
|
||||||
add_arg(str_printf("%d.%d", mac_sdk->macos_deploy_target.major, mac_sdk->macos_deploy_target.minor));
|
{
|
||||||
|
add_arg(active_target.macos.min_version);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
add_arg(str_printf("%d.%d.0", mac_sdk->macos_min_deploy_target.major, mac_sdk->macos_min_deploy_target.minor));
|
||||||
|
}
|
||||||
|
if (active_target.macos.sdk_version)
|
||||||
|
{
|
||||||
|
add_arg(active_target.macos.sdk_version);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
add_arg(str_printf("%d.%d", mac_sdk->macos_deploy_target.major, mac_sdk->macos_deploy_target.minor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1315,6 +1315,7 @@ Ast *parse_stmt(ParseContext *c)
|
|||||||
case TOKEN_CT_ENDFOREACH:
|
case TOKEN_CT_ENDFOREACH:
|
||||||
case TOKEN_CT_VASPLAT:
|
case TOKEN_CT_VASPLAT:
|
||||||
case TOKEN_IMPLIES:
|
case TOKEN_IMPLIES:
|
||||||
|
case TOKEN_CT_INCLUDE:
|
||||||
SEMA_ERROR_HERE("Unexpected '%s' found when expecting a statement.",
|
SEMA_ERROR_HERE("Unexpected '%s' found when expecting a statement.",
|
||||||
token_type_to_string(c->tok));
|
token_type_to_string(c->tok));
|
||||||
advance(c);
|
advance(c);
|
||||||
|
|||||||
@@ -360,6 +360,8 @@ const char *token_type_to_string(TokenType type)
|
|||||||
return "$extnameof";
|
return "$extnameof";
|
||||||
case TOKEN_CT_IF:
|
case TOKEN_CT_IF:
|
||||||
return "$if";
|
return "$if";
|
||||||
|
case TOKEN_CT_INCLUDE:
|
||||||
|
return "$include";
|
||||||
case TOKEN_CT_VACOUNT:
|
case TOKEN_CT_VACOUNT:
|
||||||
return "$vacount";
|
return "$vacount";
|
||||||
case TOKEN_CT_VATYPE:
|
case TOKEN_CT_VATYPE:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define COMPILER_VERSION "0.3.126"
|
#define COMPILER_VERSION "0.3.127"
|
||||||
Reference in New Issue
Block a user