mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-14 22:33:43 +00:00
Update microsoft_craziness.h to work correctly with the rest of the codebase (and not use WIN32_LEAN_AND_MEAN)
This commit is contained in:
31
src/main.cpp
31
src/main.cpp
@@ -25,7 +25,7 @@ gb_global Timings global_timings = {0};
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
// NOTE(IC): In order to find Visual C++ paths without relying on environment variables.
|
||||
#include "microsoft_craziness.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// NOTE(bill): 'name' is used in debugging and profiling modes
|
||||
@@ -1179,25 +1179,30 @@ int main(int arg_count, char **arg_ptr) {
|
||||
}
|
||||
|
||||
// NOTE(ic): It would be nice to extend this so that we could specify the Visual Studio version that we want instead of defaulting to the latest.
|
||||
Find_Result_Utf8 result = find_visual_studio_and_windows_sdk_utf8();
|
||||
defer(free_resources(&result));
|
||||
Find_Result_Utf8 find_result = find_visual_studio_and_windows_sdk_utf8();
|
||||
// defer(free_resources(&find_result));
|
||||
|
||||
if (result.windows_sdk_version == 0) {
|
||||
if (find_result.windows_sdk_version == 0) {
|
||||
gb_printf_err("Windows SDK not found.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Add library search paths.
|
||||
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%s\"", result.windows_sdk_um_library_path);
|
||||
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%s\"", result.windows_sdk_ucrt_library_path);
|
||||
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%s\"", result.vs_library_path);
|
||||
if (find_result.vs_library_path.len > 0) {
|
||||
GB_ASSERT(find_result.windows_sdk_um_library_path.len > 0);
|
||||
GB_ASSERT(find_result.windows_sdk_ucrt_library_path.len > 0);
|
||||
|
||||
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%.*s\"", LIT(find_result.vs_library_path));
|
||||
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%.*s\"", LIT(find_result.windows_sdk_um_library_path));
|
||||
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%.*s\"", LIT(find_result.windows_sdk_ucrt_library_path));
|
||||
}
|
||||
|
||||
if (!build_context.use_lld) { // msvc
|
||||
|
||||
if (build_context.has_resource) {
|
||||
exit_code = system_exec_command_line_app("msvc-link",
|
||||
"\"%s\\rc.exe\" /nologo /fo \"%.*s.res\" \"%.*s.rc\"",
|
||||
result.vs_exe_path,
|
||||
"\"%.*src.exe\" /nologo /fo \"%.*s.res\" \"%.*s.rc\"",
|
||||
LIT(find_result.vs_exe_path),
|
||||
LIT(output_base),
|
||||
LIT(build_context.resource_filepath)
|
||||
);
|
||||
@@ -1207,23 +1212,23 @@ int main(int arg_count, char **arg_ptr) {
|
||||
}
|
||||
|
||||
exit_code = system_exec_command_line_app("msvc-link",
|
||||
"\"%s\\link.exe\" \"%.*s.obj\" \"%.*s.res\" -OUT:\"%.*s.%s\" %s "
|
||||
"\"%.*slink.exe\" \"%.*s.obj\" \"%.*s.res\" -OUT:\"%.*s.%s\" %s "
|
||||
"/nologo /incremental:no /opt:ref /subsystem:CONSOLE "
|
||||
" %.*s "
|
||||
" %s "
|
||||
"",
|
||||
result.vs_exe_path, LIT(output_base), LIT(output_base), LIT(output_base), output_ext,
|
||||
LIT(find_result.vs_exe_path), LIT(output_base), LIT(output_base), LIT(output_base), output_ext,
|
||||
lib_str, LIT(build_context.link_flags),
|
||||
link_settings
|
||||
);
|
||||
} else {
|
||||
exit_code = system_exec_command_line_app("msvc-link",
|
||||
"\"%s\\link.exe\" \"%.*s.obj\" -OUT:\"%.*s.%s\" %s "
|
||||
"\"%.*slink.exe\" \"%.*s.obj\" -OUT:\"%.*s.%s\" %s "
|
||||
"/nologo /incremental:no /opt:ref /subsystem:CONSOLE "
|
||||
" %.*s "
|
||||
" %s "
|
||||
"",
|
||||
result.vs_exe_path, LIT(output_base), LIT(output_base), output_ext,
|
||||
LIT(find_result.vs_exe_path), LIT(output_base), LIT(output_base), output_ext,
|
||||
lib_str, LIT(build_context.link_flags),
|
||||
link_settings
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user