1 # CMake file for crosscompiling Maxima/wxMaxima for Windows
2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (C) by Wolfgang Dautermann
4 # License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
5 # This is free software: you are free to change and redistribute it.
6 # There is NO WARRANTY, to the extent permitted by law.
8 # If you want to use a updated version of a program,
9 # update the version number and the checksum.
10 # If no further patches are needed, you should get a
11 # updated setup-file automatically.
13 set(WXMAXIMAVERSION "24.05.0")
15 set(WXMAXIMA_MD5 "79d2e675f41b55ad4f18044c65fd94b2")
17 set(WXMAXIMA_URL "https://github.com/wxMaxima-developers/wxmaxima/archive/refs/tags/Version-${WXMAXIMAVERSION}.tar.gz")
19 set(WXMAXIMA_GIT "https://github.com/wxmaxima-developers/wxmaxima.git")
22 find_package(Git REQUIRED)
23 message(STATUS "Cloning or updating local wxmaxima git repository.")
24 execute_process(COMMAND mkdir -p ${CMAKE_SOURCE_DIR}/downloads/wxmaxima-git
25 COMMAND sh -c "test -d wxmaxima-git/.git || \"${GIT_EXECUTABLE}\" clone \"${WXMAXIMA_GIT}\" wxmaxima-git"
26 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/downloads)
28 execute_process(COMMAND sh -c "test -d .git && \"${GIT_EXECUTABLE}\" pull"
29 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/downloads/wxmaxima-git)
31 externalproject_add(wxmaxima-git
32 GIT_REPOSITORY ${CMAKE_SOURCE_DIR}/downloads/wxmaxima-git
35 # search wx-config here - do not use the host wx-config
36 # had to set CMAKE_LIBRARY_PATH=/usr/${HOST}/lib - libraries for mingw are installed there, but CMake (>3.8)
37 # tries to check all the libraries reported by wx-config, but does not check this directory...
38 CMAKE_CACHE_ARGS "-DCMAKE_PROGRAM_PATH:PATH=${CMAKE_BINARY_DIR}/wxwidgets/wxwidgets-prefix/src/wxwidgets-build"
39 CMAKE_ARGS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_RC_COMPILER=${CMAKE_RC_COMPILER} -DCMAKE_LIBRARY_PATH=/usr/${HOST}/lib -DCMAKE_INSTALL_PREFIX=${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION} -DCMAKE_BUILD_TYPE=DEBUG
42 install(DIRECTORY ${CMAKE_BINARY_DIR}/wxmaxima/wxmaxima-git-prefix/src/wxmaxima-git-build/${WINDOWS_DRIVELETTER}\:/maxima-${MAXIMAVERSION}/ DESTINATION . COMPONENT wxMaxima)
44 externalproject_add(wxmaxima
46 DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/downloads
47 DOWNLOAD_NAME wxmaxima-${WXMAXIMAVERSION}.tar.gz
48 URL_MD5 ${WXMAXIMA_MD5}
50 # search wx-config here - do not use the host wx-config
51 # had to set CMAKE_LIBRARY_PATH=/usr/${HOST}/lib - libraries for mingw are installed there, but CMake (>3.8)
52 # tries to check all the libraries reported by wx-config, but does not check this directory...
53 CMAKE_CACHE_ARGS "-DCMAKE_PROGRAM_PATH:PATH=${CMAKE_BINARY_DIR}/wxwidgets/wxwidgets-prefix/src/wxwidgets-build"
54 CMAKE_ARGS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_RC_COMPILER=${CMAKE_RC_COMPILER} -DCMAKE_LIBRARY_PATH=/usr/${HOST}/lib -DCMAKE_INSTALL_PREFIX=${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION}
57 install(DIRECTORY ${CMAKE_BINARY_DIR}/wxmaxima/wxmaxima-prefix/src/wxmaxima-build/${WINDOWS_DRIVELETTER}\:/maxima-${MAXIMAVERSION}/ DESTINATION . COMPONENT wxMaxima)
61 # wxMaxima uses C++ threads, include the required mingw library.
62 execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -print-file-name=libwinpthread-1.dll OUTPUT_VARIABLE MINGW_LIBWINPTHREAD OUTPUT_STRIP_TRAILING_WHITESPACE)
63 message(STATUS "Found libwinpthread at ${MINGW_LIBWINPTHREAD}")
65 # Include DLLs from the current Mingw environment.
66 install(FILES "${MINGW_LIBWINPTHREAD}" DESTINATION bin/ COMPONENT wxMaxima)