|
@@ -56,6 +56,19 @@ enum TargetABIKind : u16 {
|
|
|
TargetABI_COUNT,
|
|
|
};
|
|
|
|
|
|
+enum Windows_Subsystem : u8 {
|
|
|
+ Windows_Subsystem_BOOT_APPLICATION,
|
|
|
+ Windows_Subsystem_CONSOLE, // Default,
|
|
|
+ Windows_Subsystem_EFI_APPLICATION,
|
|
|
+ Windows_Subsystem_EFI_BOOT_SERVICE_DRIVER,
|
|
|
+ Windows_Subsystem_EFI_ROM,
|
|
|
+ Windows_Subsystem_EFI_RUNTIME_DRIVER,
|
|
|
+ Windows_Subsystem_NATIVE,
|
|
|
+ Windows_Subsystem_POSIX,
|
|
|
+ Windows_Subsystem_WINDOWS,
|
|
|
+ Windows_Subsystem_WINDOWSCE,
|
|
|
+ Windows_Subsystem_COUNT,
|
|
|
+};
|
|
|
|
|
|
gb_global String target_os_names[TargetOs_COUNT] = {
|
|
|
str_lit(""),
|
|
@@ -120,6 +133,19 @@ gb_global TargetEndianKind target_endians[TargetArch_COUNT] = {
|
|
|
TargetEndian_Little,
|
|
|
};
|
|
|
|
|
|
+gb_global String windows_subsystem_names[Windows_Subsystem_COUNT] = {
|
|
|
+ str_lit("BOOT_APPLICATION"),
|
|
|
+ str_lit("CONSOLE"), // Default
|
|
|
+ str_lit("EFI_APPLICATION"),
|
|
|
+ str_lit("EFI_BOOT_SERVICE_DRIVER"),
|
|
|
+ str_lit("EFI_ROM"),
|
|
|
+ str_lit("EFI_RUNTIME_DRIVER"),
|
|
|
+ str_lit("NATIVE"),
|
|
|
+ str_lit("POSIX"),
|
|
|
+ str_lit("WINDOWS"),
|
|
|
+ str_lit("WINDOWSCE"),
|
|
|
+};
|
|
|
+
|
|
|
#ifndef ODIN_VERSION_RAW
|
|
|
#define ODIN_VERSION_RAW "dev-unknown-unknown"
|
|
|
#endif
|
|
@@ -287,18 +313,18 @@ enum SanitizerFlags : u32 {
|
|
|
// This stores the information for the specify architecture of this build
|
|
|
struct BuildContext {
|
|
|
// Constants
|
|
|
- String ODIN_OS; // target operating system
|
|
|
- String ODIN_ARCH; // target architecture
|
|
|
- String ODIN_VENDOR; // compiler vendor
|
|
|
- String ODIN_VERSION; // compiler version
|
|
|
- String ODIN_ROOT; // Odin ROOT
|
|
|
- String ODIN_BUILD_PROJECT_NAME; // Odin main/initial package's directory name
|
|
|
- bool ODIN_DEBUG; // Odin in debug mode
|
|
|
- bool ODIN_DISABLE_ASSERT; // Whether the default 'assert' et al is disabled in code or not
|
|
|
+ String ODIN_OS; // Target operating system
|
|
|
+ String ODIN_ARCH; // Target architecture
|
|
|
+ String ODIN_VENDOR; // Compiler vendor
|
|
|
+ String ODIN_VERSION; // Compiler version
|
|
|
+ String ODIN_ROOT; // Odin ROOT
|
|
|
+ String ODIN_BUILD_PROJECT_NAME; // Odin main/initial package's directory name
|
|
|
+ String ODIN_WINDOWS_SUBSYSTEM; // Empty string for non-Windows targets
|
|
|
+ bool ODIN_DEBUG; // Odin in debug mode
|
|
|
+ bool ODIN_DISABLE_ASSERT; // Whether the default 'assert' et al is disabled in code or not
|
|
|
bool ODIN_DEFAULT_TO_NIL_ALLOCATOR; // Whether the default allocator is a "nil" allocator or not (i.e. it does nothing)
|
|
|
bool ODIN_FOREIGN_ERROR_PROCEDURES;
|
|
|
bool ODIN_VALGRIND_SUPPORT;
|
|
|
- bool WINDOWS_SUBSYSTEM; // True only for Windows targets with -subsystem:windows
|
|
|
|
|
|
ErrorPosStyle ODIN_ERROR_POS_STYLE;
|
|
|
|
|
@@ -368,7 +394,6 @@ struct BuildContext {
|
|
|
bool ignore_lazy;
|
|
|
bool ignore_llvm_build;
|
|
|
|
|
|
- bool use_subsystem_windows;
|
|
|
bool ignore_microsoft_magic;
|
|
|
bool linker_map_file;
|
|
|
|
|
@@ -1328,6 +1353,11 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Default to subsystem:CONSOLE on Windows targets
|
|
|
+ if (bc->ODIN_WINDOWS_SUBSYSTEM == "" && bc->metrics.os == TargetOs_windows) {
|
|
|
+ bc->ODIN_WINDOWS_SUBSYSTEM = windows_subsystem_names[Windows_Subsystem_CONSOLE];
|
|
|
+ }
|
|
|
+
|
|
|
// NOTE(zangent): The linker flags to set the build architecture are different
|
|
|
// across OSs. It doesn't make sense to allocate extra data on the heap
|
|
|
// here, so I just #defined the linker flags to keep things concise.
|