diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9cc3824..19925d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: run: mvn -B versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} - name: Build and Test id: buildAndTest - run: mvn -B clean test + run: mvn clean test "-DdevCommandFileDir=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\" - name: Codesign DLL on release if: startsWith(github.ref, 'refs/tags/') uses: skymatic/code-sign-action@v3 diff --git a/Makefile b/Makefile index e94d9fe..4734a63 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ +# Note: make apparently thinks, that options specified with "/" are absolute paths and resolves them. see also https://stackoverflow.com/questions/17012419/d9024-make-unrecognized-source-file-type WIN_SDK_VERSION ?= 10.0.22621.0 MSVC_VERSION ?= 14.41.34120 -HEADERS := /I"src/main/headers" \ - /I"${JAVA_HOME}\include" \ - /I"${JAVA_HOME}\include\win32" \ - /I"C:\Program Files (x86)\Windows Kits\10\Include\$(WIN_SDK_VERSION)\cppwinrt" \ - /I"C:\Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/$(MSVC_VERSION)/include" +HEADERS := -I"src\main\headers" \ + -I"${JAVA_HOME}\include" \ + -I"${JAVA_HOME}\include\win32" \ + -I"C:\Program Files (x86)\Windows Kits\10\Include\$(WIN_SDK_VERSION)\cppwinrt" \ + -I"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\$(MSVC_VERSION)\include" SOURCES := $(wildcard src/main/native/*.cpp) ######## @@ -12,8 +13,9 @@ SOURCES := $(wildcard src/main/native/*.cpp) all: install install: - cl /EHsc /std:c++17 /LD /W4 /guard:cf \ - /Fe:src/main/resources/integrations.dll \ - $(HEADERS) $(SOURCES) \ - /link /NXCOMPAT /DYNAMICBASE \ - crypt32.lib shell32.lib ole32.lib uuid.lib user32.lib windowsapp.lib \ No newline at end of file + cl -EHsc /std:c++17 -LD -W4 -guard:cf \ + -Fe"src/main/resources/integrations.dll" \ + -Fo"target/" \ + $(HEADERS) $(SOURCES) \ + -link -NXCOMPAT -DYNAMICBASE \ + crypt32.lib shell32.lib ole32.lib uuid.lib user32.lib windowsapp.lib \ No newline at end of file diff --git a/README.md b/README.md index f7eed0e..5bb547b 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,13 @@ This project uses the following JVM properties: * JDK 22 * Maven -* MSVC 2022 toolchain (Visual Studio 2022, Workset "Desktop development with C++") +* MSVC 2022 toolset (e.g. by installing Visual Studio 2022, Workset "Desktop development with C++") +* make ### Build -Start the _Developer PowerShell for Visual Studio 2022_ and run the following commands: -```pwsh +Open a terminal and run +``` mvn clean verify -``` \ No newline at end of file +``` + +If building the dlls fails with "`cl.exe` cannot be found", you have to specify the developer command file directory as a property `-DdevCommandFileDir=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\"`. \ No newline at end of file diff --git a/pom.xml b/pom.xml index e6a216d..e522bba 100644 --- a/pom.xml +++ b/pom.xml @@ -295,6 +295,9 @@ !skipNativeCompile + + C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\ + @@ -308,13 +311,14 @@ compile - make + cmd ${project.basedir} ${java.home} - install + /c + "${devCommandFileDir}\vcvars64.bat" && make install