Browse Source

Hooked up FindVisualStudio. Not yet used.

macOS
Macoy Madson 1 year ago
parent
commit
71f23fd3c8
  1. 16
      3rdPartySrc/FindVisualStudio.hpp
  2. 5
      Bootstrap_MSVC.cake
  3. 9
      Build.bat
  4. 24
      src/Main.cpp

16
3rdPartySrc/FindVisualStudio.hpp

@ -0,0 +1,16 @@
#pragma once
struct Find_Result {
int windows_sdk_version; // Zero if no Windows SDK found.
wchar_t *windows_sdk_root = NULL;
wchar_t *windows_sdk_um_library_path = NULL;
wchar_t *windows_sdk_ucrt_library_path = NULL;
wchar_t *vs_exe_path = NULL;
wchar_t *vs_library_path = NULL;
};
Find_Result find_visual_studio_and_windows_sdk();
void free_resources(Find_Result *result);

5
Bootstrap_MSVC.cake

@ -1,6 +1,10 @@
(set-cakelisp-option executable-output "bin/cakelisp.exe")
(add-c-search-directory-module "src")
(add-c-search-directory-module "3rdPartySrc")
(add-linker-options "Advapi32.lib" "Ole32.lib" "OleAut32.lib")
(add-cpp-build-dependency
"Tokenizer.cpp"
"Evaluator.cpp"
@ -17,6 +21,7 @@
"Logging.cpp"
"Build.cpp"
"Metadata.cpp"
"FindVisualStudio.cpp"
"Main.cpp")
(add-build-options "/nologo" "/DWINDOWS" "/DCAKELISP_EXPORTING" "/EHsc"

9
Build.bat

@ -44,9 +44,14 @@ CL.exe src/Tokenizer.cpp ^
src/Build.cpp ^
src/Metadata.cpp ^
src/Main.cpp ^
3rdPartySrc/FindVisualStudio.cpp ^
Advapi32.lib Ole32.lib OleAut32.lib ^
/I 3rdPartySrc ^
/EHsc /MP /DWINDOWS /DCAKELISP_EXPORTING ^
/Fe"bin\cakelisp_bootstrap" /Zi /Fd"bin\cakelisp_bootstrap.pdb" /DEBUG:FASTLINK
echo %ERRORLEVEL%
rem Advapi32.lib Ole32.lib OleAut32.lib are for FindVisualStudio.cpp
@if %ERRORLEVEL% == 0 (
echo Success building
@ -72,7 +77,9 @@ CL.exe src/Tokenizer.cpp ^
goto end
:success
rem TODO Remove
rem bin\cakelisp.exe --find-visual-studio
goto end
:end
pause

24
src/Main.cpp

@ -14,6 +14,7 @@
#ifdef WINDOWS
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#include "FindVisualStudio.hpp"
#endif
struct CommandLineOption
@ -59,6 +60,7 @@ int main(int numArguments, char* arguments[])
bool listBuiltInGeneratorsThenQuit = false;
bool listBuiltInGeneratorMetadataThenQuit = false;
bool waitForDebugger = false;
bool listVisualStudioThenQuit = false;
const CommandLineOption options[] = {
{"--ignore-cache", &ignoreCachedFiles,
@ -77,6 +79,10 @@ int main(int numArguments, char* arguments[])
"List all built-in compile-time procedures and a brief explanation of each, then exit."},
{"--wait-for-debugger", &waitForDebugger,
"Wait for a debugger to be attached before starting loading and evaluation"},
#ifdef WINDOWS
{"--find-visual-studio", &listVisualStudioThenQuit,
"List where Visual Studio is and what the current Windows SDK is."},
#endif
// Logging
{"--verbose-phases", &logging.phases,
"Output labels for each major phase Cakelisp goes through"},
@ -186,6 +192,24 @@ int main(int numArguments, char* arguments[])
Log("attached\n");
}
#ifdef WINDOWS
if (listVisualStudioThenQuit)
{
Find_Result result = find_visual_studio_and_windows_sdk();
Logf(
"SDK version: %d\n"
"SDK root: %ws\n"
"SDK UM library: %ws\n"
"SDK UCRT library: %ws\n"
"VS exe path: %ws\n"
"VS library path: %ws\n",
result.windows_sdk_version, result.windows_sdk_root, result.windows_sdk_um_library_path,
result.windows_sdk_ucrt_library_path, result.vs_exe_path, result.vs_library_path);
free_resources(&result);
return 0;
}
#endif
if (listBuiltInGeneratorMetadataThenQuit)
{
EvaluatorEnvironment environment;

Loading…
Cancel
Save