Commit 832fe65528eef007375406a38efd0659a334ba15

Authored by David Graeff
Committed by David Gräff
1 parent 6dddef1f

Buildsystem: Add the fftw lib to the repository for windows users

cmake/fftw-3.3.5-dll32.zip 0 → 100644
No preview for this file type
cmake/fftw-3.3.5-dll64.zip 0 → 100644
No preview for this file type
cmake/fftw_on_windows.cmake
@@ -9,15 +9,20 @@ macro( CheckExitCodeAndExitIfError MSG) @@ -9,15 +9,20 @@ macro( CheckExitCodeAndExitIfError MSG)
9 endif() 9 endif()
10 endmacro( CheckExitCodeAndExitIfError ) 10 endmacro( CheckExitCodeAndExitIfError )
11 11
  12 +set(filename "${CMAKE_BINARY_DIR}/fftw.zip")
  13 +
12 if (CMAKE_SIZEOF_VOID_P EQUAL 4) 14 if (CMAKE_SIZEOF_VOID_P EQUAL 4)
13 - message("Download FFTW for mingw32") 15 + message("Download/Extract FFTW for 32bit")
14 if (NOT EXISTS "${CMAKE_BINARY_DIR}/fftw.zip") 16 if (NOT EXISTS "${CMAKE_BINARY_DIR}/fftw.zip")
15 - file(DOWNLOAD "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll32.zip" "${CMAKE_BINARY_DIR}/fftw.zip" SHOW_PROGRESS) 17 + # file(DOWNLOAD "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll32.zip" "${filename}" SHOW_PROGRESS)
  18 + set(filename "${CMAKE_CURRENT_LIST_DIR}/fftw-3.3.5-dll32.zip")
16 endif() 19 endif()
17 elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) 20 elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
18 - message("Download FFTW for mingw64") 21 + set(LIBEXE_64 "/machine:x64")
  22 + message("Download/Extract FFTW for 64bit")
19 if (NOT EXISTS "${CMAKE_BINARY_DIR}/fftw.zip") 23 if (NOT EXISTS "${CMAKE_BINARY_DIR}/fftw.zip")
20 - file(DOWNLOAD "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" "${CMAKE_BINARY_DIR}/fftw.zip" SHOW_PROGRESS) 24 + # file(DOWNLOAD "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" "${filename}" SHOW_PROGRESS)
  25 + set(filename "${CMAKE_CURRENT_LIST_DIR}/fftw-3.3.5-dll64.zip")
21 endif() 26 endif()
22 else() 27 else()
23 message(FATAL_ERROR "Target architecture not known") 28 message(FATAL_ERROR "Target architecture not known")
@@ -26,7 +31,7 @@ endif() @@ -26,7 +31,7 @@ endif()
26 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/fftw") 31 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/fftw")
27 32
28 execute_process( 33 execute_process(
29 - COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/fftw.zip 34 + COMMAND ${CMAKE_COMMAND} -E tar xzf "${filename}"
30 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw" 35 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw"
31 RESULT_VARIABLE ExitCode 36 RESULT_VARIABLE ExitCode
32 ) 37 )
@@ -35,10 +40,12 @@ CheckExitCodeAndExitIfError("tar") @@ -35,10 +40,12 @@ CheckExitCodeAndExitIfError("tar")
35 get_filename_component(_vs_bin_path "${CMAKE_LINKER}" DIRECTORY) 40 get_filename_component(_vs_bin_path "${CMAKE_LINKER}" DIRECTORY)
36 41
37 execute_process( 42 execute_process(
38 - COMMAND "${_vs_bin_path}/lib.exe" /machine:x64 /def:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.def /out:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib 43 + COMMAND "${_vs_bin_path}/lib.exe" ${LIBEXE_64} /def:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.def /out:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib
39 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw" 44 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw"
  45 + OUTPUT_VARIABLE OutVar
  46 + ERROR_VARIABLE ErrVar
40 RESULT_VARIABLE ExitCode) 47 RESULT_VARIABLE ExitCode)
41 -CheckExitCodeAndExitIfError("lib") 48 +CheckExitCodeAndExitIfError("lib.exe: ${OutVar} ${ErrVar}")
42 49
43 target_link_libraries(${PROJECT_NAME} "${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib") 50 target_link_libraries(${PROJECT_NAME} "${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib")
44 target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}/fftw") 51 target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}/fftw")
docs/build.md
@@ -37,10 +37,16 @@ Please adjust the path to Qt5. You can find the path with the command: @@ -37,10 +37,16 @@ Please adjust the path to Qt5. You can find the path with the command:
37 37
38 ### [Windows](#windows) 38 ### [Windows](#windows)
39 39
40 -Run the **CMake GUI** program and select the source directory, build directory and your compiler.  
41 -If your compiler is for example Visual Studio, cmake will generate a Visual Studio Project and solution file (\*.sln).  
42 -Open the project and build it. If you use an IDE that has inbuild support for cmake projects like QtCreator,  
43 -you can just open and build this project. 40 +We highly recommend to use QtCreator to build this software. All reported issues regarding other IDEs
  41 +will be closed as invalid!
  42 +
  43 +* Open the project in QtCreator
  44 +* Compile the software
  45 +
  46 +Hints for Visual Studio 2015/2017 users:
  47 +* Install the right Qt package that matches your Visual Studio installation.
  48 +* Build for 64bit. 32bit builds theoretically work, but you are on your own then.
  49 +* Use the **CMake GUI** to setup all required Qt include and library paths.
44 50
45 Microsoft Windows needs an installed driver for every usb device: 51 Microsoft Windows needs an installed driver for every usb device:
46 52
openhantek/CMakeLists.txt
@@ -43,10 +43,10 @@ else() @@ -43,10 +43,10 @@ else()
43 target_compile_options(${PROJECT_NAME} PRIVATE "$<$<CONFIG:RELEASE>:-fno-rtti>") 43 target_compile_options(${PROJECT_NAME} PRIVATE "$<$<CONFIG:RELEASE>:-fno-rtti>")
44 endif() 44 endif()
45 45
46 -if(WIN32)  
47 - include(../cmake/fftw_on_windows.cmake)  
48 - include(../cmake/libusb_on_windows.cmake)  
49 -else() 46 +include(../cmake/fftw_on_windows.cmake)
  47 +include(../cmake/libusb_on_windows.cmake)
  48 +
  49 +if(NOT WIN32)
50 find_package(libusb REQUIRED) 50 find_package(libusb REQUIRED)
51 target_include_directories(${PROJECT_NAME} PRIVATE ${LIBUSB_INCLUDE_DIRS}) 51 target_include_directories(${PROJECT_NAME} PRIVATE ${LIBUSB_INCLUDE_DIRS})
52 target_link_libraries(${PROJECT_NAME} ${LIBUSB_LIBRARIES}) 52 target_link_libraries(${PROJECT_NAME} ${LIBUSB_LIBRARIES})