From 832fe65528eef007375406a38efd0659a334ba15 Mon Sep 17 00:00:00 2001 From: David Graeff Date: Sat, 20 Jan 2018 12:34:40 +0100 Subject: [PATCH] Buildsystem: Add the fftw lib to the repository for windows users --- cmake/fftw-3.3.5-dll32.zip | Bin 0 -> 2605879 bytes cmake/fftw-3.3.5-dll64.zip | Bin 0 -> 3112216 bytes cmake/fftw_on_windows.cmake | 21 ++++++++++++++------- docs/build.md | 14 ++++++++++---- openhantek/CMakeLists.txt | 8 ++++---- 5 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 cmake/fftw-3.3.5-dll32.zip create mode 100644 cmake/fftw-3.3.5-dll64.zip diff --git a/cmake/fftw-3.3.5-dll32.zip b/cmake/fftw-3.3.5-dll32.zip new file mode 100644 index 0000000..7b74847 Binary files /dev/null and b/cmake/fftw-3.3.5-dll32.zip differ diff --git a/cmake/fftw-3.3.5-dll64.zip b/cmake/fftw-3.3.5-dll64.zip new file mode 100644 index 0000000..ea97152 Binary files /dev/null and b/cmake/fftw-3.3.5-dll64.zip differ diff --git a/cmake/fftw_on_windows.cmake b/cmake/fftw_on_windows.cmake index a663a68..9a11ef0 100644 --- a/cmake/fftw_on_windows.cmake +++ b/cmake/fftw_on_windows.cmake @@ -9,15 +9,20 @@ macro( CheckExitCodeAndExitIfError MSG) endif() endmacro( CheckExitCodeAndExitIfError ) +set(filename "${CMAKE_BINARY_DIR}/fftw.zip") + if (CMAKE_SIZEOF_VOID_P EQUAL 4) - message("Download FFTW for mingw32") + message("Download/Extract FFTW for 32bit") if (NOT EXISTS "${CMAKE_BINARY_DIR}/fftw.zip") - file(DOWNLOAD "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll32.zip" "${CMAKE_BINARY_DIR}/fftw.zip" SHOW_PROGRESS) + # file(DOWNLOAD "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll32.zip" "${filename}" SHOW_PROGRESS) + set(filename "${CMAKE_CURRENT_LIST_DIR}/fftw-3.3.5-dll32.zip") endif() elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - message("Download FFTW for mingw64") + set(LIBEXE_64 "/machine:x64") + message("Download/Extract FFTW for 64bit") if (NOT EXISTS "${CMAKE_BINARY_DIR}/fftw.zip") - file(DOWNLOAD "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" "${CMAKE_BINARY_DIR}/fftw.zip" SHOW_PROGRESS) + # file(DOWNLOAD "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" "${filename}" SHOW_PROGRESS) + set(filename "${CMAKE_CURRENT_LIST_DIR}/fftw-3.3.5-dll64.zip") endif() else() message(FATAL_ERROR "Target architecture not known") @@ -26,7 +31,7 @@ endif() file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/fftw") execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/fftw.zip + COMMAND ${CMAKE_COMMAND} -E tar xzf "${filename}" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw" RESULT_VARIABLE ExitCode ) @@ -35,10 +40,12 @@ CheckExitCodeAndExitIfError("tar") get_filename_component(_vs_bin_path "${CMAKE_LINKER}" DIRECTORY) execute_process( - COMMAND "${_vs_bin_path}/lib.exe" /machine:x64 /def:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.def /out:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib + COMMAND "${_vs_bin_path}/lib.exe" ${LIBEXE_64} /def:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.def /out:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw" + OUTPUT_VARIABLE OutVar + ERROR_VARIABLE ErrVar RESULT_VARIABLE ExitCode) -CheckExitCodeAndExitIfError("lib") +CheckExitCodeAndExitIfError("lib.exe: ${OutVar} ${ErrVar}") target_link_libraries(${PROJECT_NAME} "${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib") target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}/fftw") diff --git a/docs/build.md b/docs/build.md index 9bfc821..f2c7976 100644 --- a/docs/build.md +++ b/docs/build.md @@ -37,10 +37,16 @@ Please adjust the path to Qt5. You can find the path with the command: ### [Windows](#windows) -Run the **CMake GUI** program and select the source directory, build directory and your compiler. -If your compiler is for example Visual Studio, cmake will generate a Visual Studio Project and solution file (\*.sln). -Open the project and build it. If you use an IDE that has inbuild support for cmake projects like QtCreator, -you can just open and build this project. +We highly recommend to use QtCreator to build this software. All reported issues regarding other IDEs +will be closed as invalid! + +* Open the project in QtCreator +* Compile the software + +Hints for Visual Studio 2015/2017 users: +* Install the right Qt package that matches your Visual Studio installation. +* Build for 64bit. 32bit builds theoretically work, but you are on your own then. +* Use the **CMake GUI** to setup all required Qt include and library paths. Microsoft Windows needs an installed driver for every usb device: diff --git a/openhantek/CMakeLists.txt b/openhantek/CMakeLists.txt index 3614a50..17bebdf 100644 --- a/openhantek/CMakeLists.txt +++ b/openhantek/CMakeLists.txt @@ -43,10 +43,10 @@ else() target_compile_options(${PROJECT_NAME} PRIVATE "$<$:-fno-rtti>") endif() -if(WIN32) - include(../cmake/fftw_on_windows.cmake) - include(../cmake/libusb_on_windows.cmake) -else() +include(../cmake/fftw_on_windows.cmake) +include(../cmake/libusb_on_windows.cmake) + +if(NOT WIN32) find_package(libusb REQUIRED) target_include_directories(${PROJECT_NAME} PRIVATE ${LIBUSB_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} ${LIBUSB_LIBRARIES}) -- libgit2 0.21.4