From dbb06eac9bae1b8dbc50275b66c975da09b1d09a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 25 Sep 2018 23:22:08 +0200 Subject: Fix build with msvc (windows) Fix freeze when sub process (exec) returns a lot of data (in stdout) --- msvc/locate_windows_sdk.exe | Bin 18432 -> 19968 bytes msvc/locate_windows_sdk/locate_sdk.cpp | 86 ++++++++++++++++----- msvc/locate_windows_sdk/locate_sdk.hpp | 5 ++ .../locate_windows_sdk.vcxproj.user | 5 +- msvc/locate_windows_sdk/main.cpp | Bin 1504 -> 2304 bytes msvc/sibs.exe | Bin 321024 -> 356352 bytes 6 files changed, 74 insertions(+), 22 deletions(-) (limited to 'msvc') diff --git a/msvc/locate_windows_sdk.exe b/msvc/locate_windows_sdk.exe index 6da61ac..10ad369 100644 Binary files a/msvc/locate_windows_sdk.exe and b/msvc/locate_windows_sdk.exe differ diff --git a/msvc/locate_windows_sdk/locate_sdk.cpp b/msvc/locate_windows_sdk/locate_sdk.cpp index b025bdd..a79d032 100644 --- a/msvc/locate_windows_sdk/locate_sdk.cpp +++ b/msvc/locate_windows_sdk/locate_sdk.cpp @@ -12,7 +12,7 @@ // See the comments for how to use this library just below the includes. // -// Modified by dec05eba to support x86 +// Modified by dec05eba to support locating include path #include "locate_sdk.hpp" #include @@ -314,16 +314,36 @@ void find_windows_kit_root(Find_Result *result) { if (windows10_root) { defer{ free(windows10_root); }; - Version_Data data = { 0 }; - auto windows10_lib = concat(windows10_root, L"Lib"); - defer{ free(windows10_lib); }; - - visit_files_w(windows10_lib, &data, win10_best); - if (data.best_name) { - result->windows_sdk_version = 10; - result->windows_sdk_root = data.best_name; - return; - } + + bool foundPaths = false; + { + auto windows10_lib = concat(windows10_root, L"Lib"); + defer{ free(windows10_lib); }; + + Version_Data data = { 0 }; + visit_files_w(windows10_lib, &data, win10_best); + if (data.best_name) { + result->windows_sdk_version = 10; + result->windows_sdk_root = data.best_name; + foundPaths = true; + } + } + + { + auto windows10_include = concat(windows10_root, L"Include"); + defer{ free(windows10_include); }; + + Version_Data data = { 0 }; + visit_files_w(windows10_include, &data, win10_best); + if (data.best_name) { + result->windows_sdk_version = 10; + result->windows_include_root = data.best_name; + foundPaths = true; + } + } + + if (foundPaths) + return; } // Look for a Windows 8 entry. @@ -332,16 +352,29 @@ void find_windows_kit_root(Find_Result *result) { if (windows8_root) { defer{ free(windows8_root); }; - auto windows8_lib = concat(windows8_root, L"Lib"); - defer{ free(windows8_lib); }; - - Version_Data data = { 0 }; - visit_files_w(windows8_lib, &data, win8_best); - if (data.best_name) { - result->windows_sdk_version = 8; - result->windows_sdk_root = data.best_name; - return; - } + { + auto windows8_lib = concat(windows8_root, L"Lib"); + defer{ free(windows8_lib); }; + + Version_Data data = { 0 }; + visit_files_w(windows8_lib, &data, win8_best); + if (data.best_name) { + result->windows_sdk_version = 8; + result->windows_sdk_root = data.best_name; + } + } + + { + auto windows8_include = concat(windows10_root, L"Include"); + defer{ free(windows8_include); }; + + Version_Data data = { 0 }; + visit_files_w(windows8_include, &data, win8_best); + if (data.best_name) { + result->windows_sdk_version = 8; + result->windows_include_root = data.best_name; + } + } } // If we get here, we failed to find anything. @@ -426,6 +459,7 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res auto link_exe_path = concat(bstr_inst_path, L"\\VC\\Tools\\MSVC\\", version, L"\\bin\\Hostx64\\x64"); result->vs_exe_path = link_exe_path; result->vs_library_path = library_path; + result->vs_include_path = concat(bstr_inst_path, L"\\VC\\Tools\\MSVC\\", version, L"\\include"); return; } @@ -479,6 +513,7 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res if (os_file_exists(vcruntime_filename)) { result->vs_exe_path = concat(buffer, L"VC\\bin"); result->vs_library_path = lib_path; + result->vs_include_path = concat(buffer, L"\\VC\\Include"); return; } @@ -498,6 +533,11 @@ Find_Result find_visual_studio_and_windows_sdk(SdkArch sdkArch) { result.windows_sdk_ucrt_library_path = concat(result.windows_sdk_root, L"\\ucrt\\x64"); } + if (result.windows_include_root) { + result.windows_include_um_path = concat(result.windows_include_root, L"\\um"); + result.windows_include_ucrt_path = concat(result.windows_include_root, L"\\ucrt"); + } + find_visual_studio_by_fighting_through_microsoft_craziness(&result); return result; @@ -507,6 +547,10 @@ void free_resources(Find_Result *result) { free(result->windows_sdk_root); free(result->windows_sdk_um_library_path); free(result->windows_sdk_ucrt_library_path); + free(result->windows_include_root); + free(result->windows_include_um_path); + free(result->windows_include_ucrt_path); free(result->vs_exe_path); free(result->vs_library_path); + free(result->vs_include_path); } diff --git a/msvc/locate_windows_sdk/locate_sdk.hpp b/msvc/locate_windows_sdk/locate_sdk.hpp index 6446aa4..49e0dd4 100644 --- a/msvc/locate_windows_sdk/locate_sdk.hpp +++ b/msvc/locate_windows_sdk/locate_sdk.hpp @@ -10,8 +10,13 @@ struct Find_Result { wchar_t *windows_sdk_um_library_path = NULL; wchar_t *windows_sdk_ucrt_library_path = NULL; + wchar_t *windows_include_root = NULL; + wchar_t *windows_include_um_path = NULL; + wchar_t *windows_include_ucrt_path = NULL; + wchar_t *vs_exe_path = NULL; wchar_t *vs_library_path = NULL; + wchar_t *vs_include_path = NULL; }; enum SdkArch diff --git a/msvc/locate_windows_sdk/locate_windows_sdk.vcxproj.user b/msvc/locate_windows_sdk/locate_windows_sdk.vcxproj.user index be25078..e6bd7b3 100644 --- a/msvc/locate_windows_sdk/locate_windows_sdk.vcxproj.user +++ b/msvc/locate_windows_sdk/locate_windows_sdk.vcxproj.user @@ -1,4 +1,7 @@  - + + x64 + WindowsLocalDebugger + \ No newline at end of file diff --git a/msvc/locate_windows_sdk/main.cpp b/msvc/locate_windows_sdk/main.cpp index 7f9b0a4..7fb5657 100644 Binary files a/msvc/locate_windows_sdk/main.cpp and b/msvc/locate_windows_sdk/main.cpp differ diff --git a/msvc/sibs.exe b/msvc/sibs.exe index 21b3e83..7898953 100644 Binary files a/msvc/sibs.exe and b/msvc/sibs.exe differ -- cgit v1.2.3