From 8e5a65061d28c9a4ca07a04f76007e209129ec57 Mon Sep 17 00:00:00 2001 From: Shun Wang Date: Fri, 10 May 2024 08:13:13 +0000 Subject: [PATCH] chore: make sure R4.4.0 build on Windows --- Docs/development/jasp-build-guide-windows.md | 1 + R-Interface/CMakeLists.txt | 8 ++++++-- Tools/CMake/Programs.cmake | 12 +++++++++--- Tools/CMake/R.cmake | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Docs/development/jasp-build-guide-windows.md b/Docs/development/jasp-build-guide-windows.md index 3eeeb5abf0..86508a54f6 100644 --- a/Docs/development/jasp-build-guide-windows.md +++ b/Docs/development/jasp-build-guide-windows.md @@ -79,6 +79,7 @@ wget https://github.com/WizardMac/ReadStat/releases/download/v1.1.9/readstat-1.1 tar xvf readstat-1.1.9.tar.gz cd readstat-1.1.9 export CFLAGS=-Wno-error; export CXXFLAGS=-Wno-error; # I couldnt build 1.1.7 nor 1.1.8 without setting these +autoreconf -i -f ./configure --host=x86_64-ucrt-mingw32 --build=x86_64-ucrt-mingw32 make -j make install diff --git a/R-Interface/CMakeLists.txt b/R-Interface/CMakeLists.txt index 1f48a60fe0..7dbfef5013 100644 --- a/R-Interface/CMakeLists.txt +++ b/R-Interface/CMakeLists.txt @@ -58,9 +58,13 @@ if(WIN32) # This is a variable and it's provided by the main CMakeFiles.txt. # It is here only if we someone wants to build the R-Interface separately. - if(${R_VERSION} VERSION_GREATER_EQUAL "4.3.0") + if(${R_VERSION} VERSION_GREATER_EQUAL "4.4.0") set(RTOOLS_PATH - "C:/rtools43/ucrt64" + "C:/rtools44/ucrt64" + CACHE PATH "Path to Rtools44 ucrt64 folder") + elseif(${R_VERSION} VERSION_GREATER_EQUAL "4.3.0") + set(RTOOLS_PATH + "C:/rtools43/ucrt64" CACHE PATH "Path to Rtools43 ucrt64 folder") elseif(${R_VERSION} VERSION_GREATER_EQUAL "4.2.0") set(RTOOLS_PATH diff --git a/Tools/CMake/Programs.cmake b/Tools/CMake/Programs.cmake index dbd089d366..1e3d78ccb2 100644 --- a/Tools/CMake/Programs.cmake +++ b/Tools/CMake/Programs.cmake @@ -146,9 +146,15 @@ if(WIN32) message(CHECK_PASS "found") message(STATUS " ${RTOOLS_PATH}") - message(CHECK_START "Looking for Rtools42 legacy") - if(DEFINED RTOOLS42_HOME) - unset(RTOOLS42_HOME) + message(CHECK_START + "Looking for Rtools legacy and auto remove it, if not work please remove such `RTOOLS43_HOME` manually from Windows environment settings." + ) + if(DEFINED ENV{RTOOLS42_HOME}) + unset(ENV{RTOOLS42_HOME}) + elseif(DEFINED ENV{RTOOLS43_HOME}) + unset(ENV{RTOOLS43_HOME}) + else() + message(CHECK_START "No Rtools legacy found") endif() diff --git a/Tools/CMake/R.cmake b/Tools/CMake/R.cmake index e493928c36..3a35e3f4b0 100644 --- a/Tools/CMake/R.cmake +++ b/Tools/CMake/R.cmake @@ -140,6 +140,7 @@ set(R_BINARY_HASHES list(APPEND CMAKE_MESSAGE_CONTEXT R) +# dont forget check and upgrande Rtools version if major_minor version changed. set(R_VERSION "4.4.0") set(R_VERSION_MAJOR_MINOR "4.4") set(CURRENT_R_VERSION ${R_VERSION_MAJOR_MINOR})