added OPTION RTL_STATIC_BUILD for MinGW/Win32, default: ON

* Build rtl-tools static (except RTLSDR.DLL) on MinGW/Win32
  Option is ON by default, cause it only affects MinGW/Win32.
* win32-qtcreator/README.txt has some explanations howto setup
  for compilation with QT 5.5/qtcreator

Signed-off-by: hayati ayguen <h_ayguen@web.de>
development
hayati ayguen 2017-02-15 21:11:17 +01:00
parent 7d46a6e3d5
commit f236b57bb9
2 changed files with 28 additions and 0 deletions

View File

@ -57,6 +57,22 @@ if(CMAKE_COMPILER_IS_GNUCC AND NOT WIN32)
add_definitions(-fvisibility=hidden)
endif()
OPTION(RTL_STATIC_BUILD "Build rtl-tools static (except RTLSDR.DLL) on MinGW/Win32" ON)
if(RTL_STATIC_BUILD)
if (WIN32)
if(MINGW)
# Special MINGW stuff here
# see https://cmake.org/pipermail/cmake/2012-September/051970.html
# see http://stackoverflow.com/questions/13768515/how-to-do-static-linking-of-libwinpthread-1-dll-in-mingw
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s")
endif()
endif()
endif()
#########################################################################
# Bug Fix
#########################################################################

View File

@ -29,3 +29,15 @@ the resulting executables have no other dependencies than libwinpthread-1.dll
from the MINGW system at C:\Qt\Qt5.5.1\Tools\mingw492_32\bin\
or C:\Qt\Qt5.5.1\5.5\mingw492_32\bin
=======================================================================
opening main CMakeLists.txt in root (above win32-qtcreator) with above QT 5.5/qtcreator
set RTL_STATIC_BUILD = ON
set LIBUSB_FOUND = TRUE
set LIBUSB_INCLUDE_DIR = C:/src/_foreign/libusb-1.0.20/include/libusb-1.0
set LIBUSB_LIBRARIES = C:/src/_foreign/libusb-1.0.20/MinGW32/static/libusb-1.0.a
set THREADS_PTHREADS_INCLUDE_DIR = C:/Qt/Qt5.6.1/Tools/mingw492_32/i686-w64-mingw32/include
set THREADS_PTHREADS_WIN32_LIBRARY = C:/Qt/Qt5.6.1/Tools/mingw492_32/i686-w64-mingw32/lib/libwinpthread.a
the resulting executables have no other dependencies, except the freshly built librtlsdr.dll