From e01d8b6581a2cddf3ac9776a2d96b1d8ecdfef1c Mon Sep 17 00:00:00 2001 From: ledoge <8040316+ledoge@users.noreply.github.com> Date: Tue, 26 Jan 2021 12:33:50 +0100 Subject: [PATCH] Update build instructions --- DEVELOPERS.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index a0c46a3..84d354d 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -6,15 +6,20 @@ #### Visual Studio or Build Tools 2017+ -Use `Developer Command Prompt for Visual Studio` or run these in the Windows Command Prompt +Use `x64 Native Tools Command Prompt for VS 2017` or run this in the Windows Command Prompt (replace `2017` with `2019` for VS 2019) ```cmd :: initialize x64 build environment CALL "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" x64 ``` +Generate wslapi.lib +```cmd +lib /nologo /def:wslapi.def /machine:X64 +``` + To compile Launcher.exe ```cmd -cl /nologo /O2 /W4 /WX /Ob2 /Oi /Oy /Gs- /GF /Gy /Tc main.c /Fe:Launcher.exe Advapi32.lib Shell32.lib shlwapi.lib +cl /nologo /O2 /W4 /WX /Ob2 /Oi /Oy /Gs- /GF /Gy /Tc main.c /Fe:Launcher.exe Advapi32.lib Shell32.lib shlwapi.lib wslapi.lib ``` Optionally, to add an icon to the exe, create and link a resource with @@ -26,7 +31,7 @@ rc /nologo res\%YourDistroName%\res.rc :: compile to %YourDistroName%.exe cl /nologo /O2 /W4 /WX /Ob2 /Oi /Oy /Gs- /GF /Gy /Tc main.c /Fe:%YourDistroName%.exe ^ - Advapi32.lib Shell32.lib shlwapi.lib res\%YourDistroName%\res.res + Advapi32.lib Shell32.lib shlwapi.lib wslapi.lib res\%YourDistroName%\res.res ``` ### MinGW @@ -35,14 +40,14 @@ Install x86_64 version of MSYS2(https://www.msys2.org). Run these commands in msys shell ```bash $ pacman -S mingw-w64-x86_64-toolchain # install tool chain -$ gcc -std=c99 --static -lshlwapi main.c -o Launcher.exe # compile main.c +$ gcc -std=c99 --static main.c -lshlwapi -lwslapi -o Launcher.exe # compile main.c ``` Optionally, to add an icon to the exe, create and link a resource with ```bash -YourDistroName=Fedora +$ YourDistroName=Fedora $ windres res/$YourDistroName/res.rc res.o # compile resource -$ gcc -std=c99 --static -lshlwapi main.c -o ${YourDistroName}.exe res.o # compile main.c +$ gcc -std=c99 --static main.c -lshlwapi -lwslapi -o ${YourDistroName}.exe res.o # compile main.c ``` ### Linux (cross compile) @@ -50,5 +55,5 @@ Install mingw-w64 toolchain include gcc-mingw-w64-x86-64. Run this command in shell ```bash - $ x86_64-w64-mingw32-gcc -std=c99 --static -lshlwapi main.c -o Launcher.exe # compile main.c + $ x86_64-w64-mingw32-gcc -std=c99 --static main.c -lshlwapi -lwslapi -o Launcher.exe # compile main.c ```