OpenHantek / openhantek

OpenHantek is a DSO software for Hantek (Voltcraft/Darkwire/Protek/Acetech) USB digital signal oscilloscopes
http://openhantek.org/
GNU General Public License v3.0
771 stars 199 forks source link

Cross compiling for windows #226

Closed coozoo closed 6 years ago

coozoo commented 6 years ago

If you are interested to compile it for windows under linux you need to perform few changes.

On fedora it's compiled fine:

  1. change cmake/fftw_on_windows.cmake to use mingw dlltool instead of VS and replace this
    COMMAND ${_vs_bin_path}/lib.exe ${LIBEXE_64} /def:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.def /out:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib

    with this

    COMMAND i686-w64-mingw32-dlltool ${LIBEXE_64} -d ${CMAKE_BINARY_DIR}/fftw/libfftw3-3.def -l ${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib

    Or you can put whole execute_process into if

    if(CMAKE_HOST_UNIX AND WIN32)
  2. change openhantek/CMakeLists.txt to remove console window (it's something like QT+=gui) this string
    add_executable(${PROJECT_NAME} ${SRC} ${HEADERS} ${UI} ${QRC} ${TRANSLATION_BIN_FILES} ${TRANSLATION_QRC})

    add WIN32 to parameters

    add_executable(${PROJECT_NAME} WIN32 ${SRC} ${HEADERS} ${UI} ${QRC} ${TRANSLATION_BIN_FILES} ${TRANSLATION_QRC})

    that's it now you can run inside "build" dir mingw32-cmake ../ mingw32-make -j2

davidgraeff commented 6 years ago

Awesome. If you make a PR that handles this case, I would happily include it.

Cheers David