diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59c380de29..4903e3c0bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,10 +60,54 @@ jobs: if: runner.os == 'Windows' shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86 - cd opendj-server-legacy\src\build-tools\windows - nmake all + if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( + echo Unable to locate vswhere.exe in the Visual Studio installer directory. + exit /b 1 + ) + for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSINSTALLDIR=%%i" + if not defined VSINSTALLDIR ( + echo Unable to locate a Visual Studio installation with C++ build tools. + exit /b 1 + ) + call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" x64 + if errorlevel 1 exit /b %errorlevel% + pushd opendj-server-legacy\src\build-tools\windows + if errorlevel 1 exit /b %errorlevel% + mc EventLogMsg.mc + if errorlevel 1 exit /b %errorlevel% + rc /fo EventLogMsg.res EventLogMsg.rc + if errorlevel 1 exit /b %errorlevel% + cl -D_WINDOWS -nologo -W3 -O2 -c common.c -Focommon.obj + if errorlevel 1 exit /b %errorlevel% + cl -D_WINDOWS -nologo -W3 -O2 -c service.c -Foservice.obj + if errorlevel 1 exit /b %errorlevel% + cl -D_WINDOWS -nologo -W3 -O2 -c winlauncher.c -Fowinlauncher.obj + if errorlevel 1 exit /b %errorlevel% + link -nologo /machine:x64 /OUT:opendj_service.exe EventLogMsg.res common.obj service.obj advapi32.lib + if errorlevel 1 exit /b %errorlevel% + mt -manifest opendj_service.exe.manifest -outputresource:opendj_service.exe;#1 + if errorlevel 1 exit /b %errorlevel% + link -nologo /machine:x64 common.obj winlauncher.obj /OUT:winlauncher.exe + if errorlevel 1 exit /b %errorlevel% + link -nologo /machine:x64 common.obj winlauncher.obj /OUT:launcher_administrator.exe + if errorlevel 1 exit /b %errorlevel% + mt -manifest launcher_administrator.exe.manifest -outputresource:launcher_administrator.exe;#1 + if errorlevel 1 exit /b %errorlevel% + if not exist opendj_service.exe ( + echo Missing generated executable: opendj_service.exe + exit /b 1 + ) + if not exist winlauncher.exe ( + echo Missing generated executable: winlauncher.exe + exit /b 1 + ) + if not exist launcher_administrator.exe ( + echo Missing generated executable: launcher_administrator.exe + exit /b 1 + ) xcopy /Y *.exe ..\..\..\lib\ + if errorlevel 1 exit /b %errorlevel% + popd git status - name: Set Integration Test Environment id: failsafe diff --git a/opendj-server-legacy/src/build-tools/windows/Makefile b/opendj-server-legacy/src/build-tools/windows/Makefile index c1da51e953..38b5fc38b5 100644 --- a/opendj-server-legacy/src/build-tools/windows/Makefile +++ b/opendj-server-legacy/src/build-tools/windows/Makefile @@ -36,7 +36,7 @@ CC=cl SERVICE_PROGNAME=opendj_service.exe LAUNCHER_ADMINISTRATOR_PROGNAME=launcher_administrator.exe WINLAUNCHER_PROGNAME=winlauncher.exe -LINKER=link -nologo /machine:x86 +LINKER=link -nologo /machine:x64 LIBS=advapi32.lib CFLAGS= -D_WINDOWS -nologo -W3 -O2 diff --git a/opendj-server-legacy/src/build-tools/windows/launcher_administrator.exe.manifest b/opendj-server-legacy/src/build-tools/windows/launcher_administrator.exe.manifest index f0c7d11cfb..febba1d284 100644 --- a/opendj-server-legacy/src/build-tools/windows/launcher_administrator.exe.manifest +++ b/opendj-server-legacy/src/build-tools/windows/launcher_administrator.exe.manifest @@ -1,7 +1,7 @@ + processorArchitecture="amd64" name="launcher_administrator" type="win32"/> Executable used to run code that requires administrator privileges diff --git a/opendj-server-legacy/src/build-tools/windows/opendj_service.exe.manifest b/opendj-server-legacy/src/build-tools/windows/opendj_service.exe.manifest index 55d0c5fe84..1826a8eb97 100644 --- a/opendj-server-legacy/src/build-tools/windows/opendj_service.exe.manifest +++ b/opendj-server-legacy/src/build-tools/windows/opendj_service.exe.manifest @@ -1,7 +1,7 @@ + processorArchitecture="amd64" name="opendj_service" type="win32"/> Executable used to run OpenDJ as a Windows Service