static linking of qwt

This commit is contained in:
Erik Frojdh
2022-11-21 16:12:04 +01:00
parent b08bf08ea9
commit 0ae15e5aa2
5 changed files with 61 additions and 4 deletions

View File

@ -225,6 +225,7 @@ if (SLS_USE_RECEIVER)
endif (SLS_USE_RECEIVER)
if (SLS_USE_GUI)
add_subdirectory(libs/qwt)
add_subdirectory(slsDetectorGui)
endif (SLS_USE_GUI)

View File

@ -42,11 +42,13 @@
# either expressed or implied, of the FreeBSD Project.
#=============================================================================
#TODO! add notice that we modified the file
find_path ( QWT_INCLUDE_DIR
NAMES qwt_plot.h
HINTS ${QT_INCLUDE_DIR}
PATH_SUFFIXES qwt qwt-qt3 qwt-qt4 qwt-qt5
PATH_SUFFIXES qwt-qt5 qwt
)
set ( QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR} )

51
libs/qwt/CMakeLists.txt Normal file
View File

@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 3.12)
project(qwt)
set(PROJECT_VERSION 6.1.5)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
#Extract qwt sources from the supplied source file
set(INTERNALQWTDIR "qwt-source/")
set(QWTBASE ${CMAKE_CURRENT_BINARY_DIR}/${INTERNALQWTDIR})
file(MAKE_DIRECTORY ${QWTBASE})
execute_process(
COMMAND tar -xf ${CMAKE_CURRENT_SOURCE_DIR}/qwt-6.1.5.tar.bz2 -C ${QWTBASE} --strip-components=1
COMMAND_ERROR_IS_FATAL ANY
)
# # Without this define moc files are not included and linking of examples fails.
add_definitions(-DQWT_MOC_INCLUDE)
find_package(Qt5 REQUIRED
COMPONENTS
Core
Gui
Widgets
OpenGL
Concurrent
PrintSupport
Svg
)
file(GLOB QWT_SOURCES ${QWTBASE}src/*.cpp)
file(GLOB QWT_HEADERS ${QWTBASE}src/*.h)
add_library(qwt STATIC ${QWT_SOURCES} ${QWT_HEADERS} )
target_include_directories(qwt PUBLIC
$<BUILD_INTERFACE:${QWTBASE}/src>
)
target_link_libraries(qwt PUBLIC
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::OpenGL
Qt5::Concurrent
Qt5::PrintSupport
Qt5::Svg
)
target_compile_options(qwt PRIVATE -w)

BIN
libs/qwt/qwt-6.1.5.tar.bz2 Normal file

Binary file not shown.

View File

@ -10,7 +10,9 @@ find_package(Qt5 5.9 COMPONENTS Widgets Core Gui REQUIRED)
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Qwt 6.1 REQUIRED)
# find_package(Qwt 6.1 REQUIRED)
# add_subdirectory(${PROJECT_SOURCE_DIR}/libs/qwt)
set(SOURCES
slsDetectorPlotting/src/SlsQt1DPlot.cpp
@ -89,7 +91,7 @@ add_executable(slsDetectorGui
target_include_directories(slsDetectorGui PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${QWT_INCLUDE_DIR}>"
# "$<BUILD_INTERFACE:${QWT_INCLUDE_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/slsDetectorPlotting/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<BUILD_INTERFACE:${QT5Widgets_INCLUDE_DIRS}>"
@ -100,7 +102,7 @@ target_include_directories(slsDetectorGui PUBLIC
target_link_libraries(slsDetectorGui PUBLIC
slsProjectOptions
slsDetectorStatic
${QWT_LIBRARIES}
# ${QWT_LIBRARIES}
PNG::PNG
ZLIB::ZLIB
Qt5::Widgets
@ -110,6 +112,7 @@ target_link_libraries(slsDetectorGui PUBLIC
PRIVATE
slsProjectWarnings
qwt
)
set_target_properties(slsDetectorGui PROPERTIES