diff --git a/native/WinShellIntegration/README.md b/native/WinShellIntegration/README.md index 998ef5c4159d..789f3c1c3d1a 100644 --- a/native/WinShellIntegration/README.md +++ b/native/WinShellIntegration/README.md @@ -12,20 +12,21 @@ Windows 8 and higher are supported. * C++17-compatible compiler; * [CMake](https://cmake.org/download/) >= `v3.15` (Note: it is already shipped with CLion); * [Optional: only for building [winshellintegrationbridge](src/winshellintegrationbridge) target]: - An implementation of Java SE 11 or newer. It's highly recommended to use the JDK you are using to build IDEA. + An implementation of Java SE 11 or newer. It's highly recommended to use the JDK you are using to build IntelliJ IDEA. ## Build Just use CMake normally. If you want to build [winshellintegrationbridge](src/winshellintegrationbridge) target too -you have to set the variable `JDK_PATH` to the path of JDK which will be used for build. +path to a JDK is required. Build script will try to use `JDK_11_0_ARM64`, `JDK_11_0_X64` or `JDK_11_0` env variables depending on target architecture. +However, if it fails, or if you want other JDK, you need to set the CMake variable `JDK_PATH` to the path of JDK which will be used for build. For example, if your `javac.exe` is located at `C:\Soft\jdk\bin\javac.exe` you should set the variable like `-DJDK_PATH="C:\Soft\jdk"`. ## Integration with CLion 1. Configure the toolchain(s) (if you need help, please check [this guide](https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html)); 2. Configure CMake profiles (if you need help, please check [this guide](https://www.jetbrains.com/help/clion/cmake-profile.html)). - Don't forget to pass `JDK_PATH` variable (via `CMake options` field) if you want to build `winshellintegrationbridge` target. + Optionally, pass `JDK_PATH` variable (via `CMake options` field) if you want to build `winshellintegrationbridge` target, see above. Also, you can set the root of each profile to [build](build) dir: it already has `.gitignore` file that will exclude everything under it. diff --git a/native/WinShellIntegration/src/winshellintegrationbridge/CMakeLists.txt b/native/WinShellIntegration/src/winshellintegrationbridge/CMakeLists.txt index ff09e53eee16..5656feb3425b 100644 --- a/native/WinShellIntegration/src/winshellintegrationbridge/CMakeLists.txt +++ b/native/WinShellIntegration/src/winshellintegrationbridge/CMakeLists.txt @@ -1,14 +1,27 @@ -# Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +# Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -if (NOT JDK_PATH) - message(SEND_ERROR "Path to the JDK is not specified. winshellintegrationbridge target will not be generated.") -endif() +include(CheckSymbolExists) +check_symbol_exists("_M_ARM64" "" TARGET_ARM64) +check_symbol_exists("_M_AMD64" "" TARGET_X64) # output binary name -if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") - set(WSIBRIDGE_BINARY_NAME "WinShellIntegrationBridge64") +if(TARGET_ARM64) + set(WSIBRIDGE_BINARY_NAME "WinShellIntegrationBridge64a") + set(JAVA_HOME $ENV{JDK_11_0_ARM64}) +elseif(TARGET_X64) + set(WSIBRIDGE_BINARY_NAME "WinShellIntegrationBridge64") + set(JAVA_HOME $ENV{JDK_11_0_x64}) else() - set(WSIBRIDGE_BINARY_NAME "WinShellIntegrationBridge") + set(WSIBRIDGE_BINARY_NAME "WinShellIntegrationBridge") + set(JAVA_HOME $ENV{JDK_11_0}) +endif() + +if (NOT JDK_PATH) + if (NOT JAVA_HOME) + message(SEND_ERROR "Path to the JDK (JDK_PATH) is not specified, neither heuristics succeed. 'winshellintegrationbridge' target will not be generated.") + else() + set(JDK_PATH "${JAVA_HOME}") + endif() endif() configure_file("resources.rc.in" "${CMAKE_CURRENT_BINARY_DIR}/resources.rc" @ONLY) diff --git a/native/WinShellIntegration/src/winshellintegrationbridge/README.md b/native/WinShellIntegration/src/winshellintegrationbridge/README.md index f0d604a1a66f..1a3c460229a5 100644 --- a/native/WinShellIntegration/src/winshellintegrationbridge/README.md +++ b/native/WinShellIntegration/src/winshellintegrationbridge/README.md @@ -3,6 +3,6 @@ JNI-Dll integrates native [winshellintegration](../winshellintegration) library ## Build dependencies * [winshellintegration](../winshellintegration) library; -* An implementation of Java SE 11 or newer. It's highly recommended to use the JDK you are using to build IDEA; +* An implementation of Java SE 11 or newer. It's highly recommended to use the JDK you are using to build IntelliJ IDEA; * C++17-compatible compiler; * [CMake](https://cmake.org/download/) >= `v3.15`.