Commit a9f782e2e58e8c7395c1189b1c68d3033d4bdbe8
Committed by
David Gräff
1 parent
28784716
Crossforwin (#227)
* Add possibility to cross compile on linux for windows * Added dlltool availability verification
Showing
2 changed files
with
34 additions
and
8 deletions
cmake/fftw_on_windows.cmake
| @@ -39,13 +39,34 @@ CheckExitCodeAndExitIfError("tar") | @@ -39,13 +39,34 @@ CheckExitCodeAndExitIfError("tar") | ||
| 39 | 39 | ||
| 40 | get_filename_component(_vs_bin_path "${CMAKE_LINKER}" DIRECTORY) | 40 | get_filename_component(_vs_bin_path "${CMAKE_LINKER}" DIRECTORY) |
| 41 | 41 | ||
| 42 | -execute_process( | ||
| 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 | ||
| 44 | - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw" | ||
| 45 | - OUTPUT_VARIABLE OutVar | ||
| 46 | - ERROR_VARIABLE ErrVar | ||
| 47 | - RESULT_VARIABLE ExitCode) | ||
| 48 | -CheckExitCodeAndExitIfError("lib.exe: ${OutVar} ${ErrVar}") | 42 | +if(CMAKE_HOST_UNIX AND WIN32) |
| 43 | + set(DLLTOOL "i686-w64-mingw32-dlltool") | ||
| 44 | + execute_process ( | ||
| 45 | + COMMAND bash -c "command -v ${DLLTOOL}" | ||
| 46 | + OUTPUT_VARIABLE isExists | ||
| 47 | + ) | ||
| 48 | + message(STATUS "Found dlltool: ${isExists}") | ||
| 49 | + if("${isExists}" MATCHES "${DLLTOOL}") | ||
| 50 | + execute_process( | ||
| 51 | + COMMAND ${DLLTOOL} ${LIBEXE_64} -d ${CMAKE_BINARY_DIR}/fftw/libfftw3-3.def -l ${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib | ||
| 52 | + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw" | ||
| 53 | + OUTPUT_VARIABLE OutVar | ||
| 54 | + ERROR_VARIABLE ErrVar | ||
| 55 | + RESULT_VARIABLE ExitCode) | ||
| 56 | + CheckExitCodeAndExitIfError("${DLLTOOL}: ${OutVar} ${ErrVar}") | ||
| 57 | + else() | ||
| 58 | + message(FATAL_ERROR "Your cross compiler dlltool is not installed or name is different from i686-w64-mingw32-dlltool. If you running Fedora or Fedora based distro you can install it by running:\n# dnf install mingw32-binutils") | ||
| 59 | + endif() | ||
| 60 | +else() | ||
| 61 | + execute_process( | ||
| 62 | + COMMAND "${_vs_bin_path}/lib.exe" ${LIBEXE_64} /def:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.def /out:${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib | ||
| 63 | + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/fftw" | ||
| 64 | + OUTPUT_VARIABLE OutVar | ||
| 65 | + ERROR_VARIABLE ErrVar | ||
| 66 | + RESULT_VARIABLE ExitCode) | ||
| 67 | + CheckExitCodeAndExitIfError("lib.exe: ${OutVar} ${ErrVar}") | ||
| 68 | +endif() | ||
| 69 | + | ||
| 49 | 70 | ||
| 50 | target_link_libraries(${PROJECT_NAME} "${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib") | 71 | target_link_libraries(${PROJECT_NAME} "${CMAKE_BINARY_DIR}/fftw/libfftw3-3.lib") |
| 51 | target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}/fftw") | 72 | target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}/fftw") |
openhantek/CMakeLists.txt
| @@ -29,8 +29,13 @@ add_subdirectory(translations) | @@ -29,8 +29,13 @@ add_subdirectory(translations) | ||
| 29 | 29 | ||
| 30 | add_definitions(-DVERSION="${CPACK_PACKAGE_VERSION}") | 30 | add_definitions(-DVERSION="${CPACK_PACKAGE_VERSION}") |
| 31 | 31 | ||
| 32 | +set(EXECTYPE "") | ||
| 33 | +if(WIN32 AND MINGW) | ||
| 34 | + set(EXECTYPE WIN32) | ||
| 35 | +endif() | ||
| 36 | + | ||
| 32 | # make executable | 37 | # make executable |
| 33 | -add_executable(${PROJECT_NAME} ${SRC} ${HEADERS} ${UI} ${QRC} ${TRANSLATION_BIN_FILES} ${TRANSLATION_QRC}) | 38 | +add_executable(${PROJECT_NAME} ${EXECTYPE} ${SRC} ${HEADERS} ${UI} ${QRC} ${TRANSLATION_BIN_FILES} ${TRANSLATION_QRC}) |
| 34 | target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::PrintSupport Qt5::OpenGL ${OPENGL_LIBRARIES} ) | 39 | target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::PrintSupport Qt5::OpenGL ${OPENGL_LIBRARIES} ) |
| 35 | target_compile_features(${PROJECT_NAME} PRIVATE cxx_range_for) | 40 | target_compile_features(${PROJECT_NAME} PRIVATE cxx_range_for) |
| 36 | if(MSVC) | 41 | if(MSVC) |