From 29e970ed6f08c4acc406e591656eeead64bb3d0d Mon Sep 17 00:00:00 2001 From: Patrick Stewart Date: Fri, 2 Oct 2020 14:40:47 +0100 Subject: [PATCH 1/3] Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR This means that the project can be used with CMake fetchcontent / add_subdriectory --- cmake/jkqtplotter_cmake_options.cmake | 4 ++-- lib/jkqtcommon/CMakeLists.txt | 4 ++-- lib/jkqtfastplotter/CMakeLists.txt | 4 ++-- lib/jkqtmathtext/CMakeLists.txt | 8 ++++---- lib/jkqtplotter/CMakeLists.txt | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmake/jkqtplotter_cmake_options.cmake b/cmake/jkqtplotter_cmake_options.cmake index bf757bd6fe..1f6bb6ce68 100644 --- a/cmake/jkqtplotter_cmake_options.cmake +++ b/cmake/jkqtplotter_cmake_options.cmake @@ -32,8 +32,8 @@ if (NOT CMAKE_INSTALL_INCLUDEDIR) endif() # place all DLLs and EXEs in the subdirectory output of the top level directory of the build tree -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output) -set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output) +set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/output) +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/output) if(JKQtPlotter_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE) diff --git a/lib/jkqtcommon/CMakeLists.txt b/lib/jkqtcommon/CMakeLists.txt index d1d6e3b757..acf7b15b2e 100644 --- a/lib/jkqtcommon/CMakeLists.txt +++ b/lib/jkqtcommon/CMakeLists.txt @@ -173,7 +173,7 @@ install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir} COMPONENT Headers) -configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/JKQtPlotter ) -install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) +install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) diff --git a/lib/jkqtfastplotter/CMakeLists.txt b/lib/jkqtfastplotter/CMakeLists.txt index 5679fd6323..a7f8c6aeaf 100644 --- a/lib/jkqtfastplotter/CMakeLists.txt +++ b/lib/jkqtfastplotter/CMakeLists.txt @@ -135,7 +135,7 @@ install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir} COMPONENT Headers) -configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/JKQtPlotter ) -install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) +install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) diff --git a/lib/jkqtmathtext/CMakeLists.txt b/lib/jkqtmathtext/CMakeLists.txt index c22565ab68..7bfec50492 100644 --- a/lib/jkqtmathtext/CMakeLists.txt +++ b/lib/jkqtmathtext/CMakeLists.txt @@ -146,9 +146,9 @@ install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir} COMPONENT Headers) -configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/JKQtPlotter ) -install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) -install(FILES "${CMAKE_SOURCE_DIR}/lib/jkqtmathtext/resources/xits/OFL.txt" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_XITS_LICENSE.txt" ) -install(FILES "${CMAKE_SOURCE_DIR}/lib/jkqtmathtext/resources/xits/README.md" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_XITS_README.md" ) +install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) +install(FILES "${PROJECT_SOURCE_DIR}/lib/jkqtmathtext/resources/xits/OFL.txt" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_XITS_LICENSE.txt" ) +install(FILES "${PROJECT_SOURCE_DIR}/lib/jkqtmathtext/resources/xits/README.md" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_XITS_README.md" ) diff --git a/lib/jkqtplotter/CMakeLists.txt b/lib/jkqtplotter/CMakeLists.txt index c22efa13db..b81e727232 100644 --- a/lib/jkqtplotter/CMakeLists.txt +++ b/lib/jkqtplotter/CMakeLists.txt @@ -250,8 +250,8 @@ install(FILES ${HEADERS_GUI} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}/gui COMPONENT Headers) -configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/JKQtPlotter ) -install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) +install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) From 2e85504d894a5a8dd4d05a6bf18f31c0e65f5052 Mon Sep 17 00:00:00 2001 From: Patrick Stewart Date: Fri, 2 Oct 2020 14:41:26 +0100 Subject: [PATCH 2/3] Support Qt in namespace --- examples/jkqtmathtext_test/testform.h | 3 ++- examples/mandelbrot/mandelbrotmainwindow.h | 2 ++ examples/multiplot/test_multiplot_ui.h | 2 ++ examples/styling/test_styling.h | 2 ++ examples/ui/formwithjkqtplotter.h | 2 ++ lib/jkqtplotter/jkqtplotter.h | 4 ++++ 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/jkqtmathtext_test/testform.h b/examples/jkqtmathtext_test/testform.h index ccf6d49718..06a9a23083 100644 --- a/examples/jkqtmathtext_test/testform.h +++ b/examples/jkqtmathtext_test/testform.h @@ -8,10 +8,11 @@ #include #include - +QT_BEGIN_NAMESPACE namespace Ui { class TestForm; } +QT_END_NAMESPACE class TestForm : public QWidget { diff --git a/examples/mandelbrot/mandelbrotmainwindow.h b/examples/mandelbrot/mandelbrotmainwindow.h index 800a8a618d..359281f948 100644 --- a/examples/mandelbrot/mandelbrotmainwindow.h +++ b/examples/mandelbrot/mandelbrotmainwindow.h @@ -4,9 +4,11 @@ #include #include "jkqtplotter/graphs/jkqtpimage.h" +QT_BEGIN_NAMESPACE namespace Ui { class MandelbrotMainWindow; } +QT_END_NAMESPACE class MandelbrotMainWindow : public QMainWindow { diff --git a/examples/multiplot/test_multiplot_ui.h b/examples/multiplot/test_multiplot_ui.h index 217939662c..3cc05942fa 100644 --- a/examples/multiplot/test_multiplot_ui.h +++ b/examples/multiplot/test_multiplot_ui.h @@ -5,9 +5,11 @@ #include "jkqtplotter/jkqtplotter.h" #include +QT_BEGIN_NAMESPACE namespace Ui { class TestMultiplotUI; } +QT_END_NAMESPACE class TestMultiplotUI : public QDialog { diff --git a/examples/styling/test_styling.h b/examples/styling/test_styling.h index 998dcbf9e1..0c6998f71e 100644 --- a/examples/styling/test_styling.h +++ b/examples/styling/test_styling.h @@ -4,9 +4,11 @@ #include #include "jkqtplotter/jkqtplotter.h" +QT_BEGIN_NAMESPACE namespace Ui { class TestStyling; } +QT_END_NAMESPACE class TestStyling : public QMainWindow { diff --git a/examples/ui/formwithjkqtplotter.h b/examples/ui/formwithjkqtplotter.h index 5d19c0517e..774bfc3c7a 100644 --- a/examples/ui/formwithjkqtplotter.h +++ b/examples/ui/formwithjkqtplotter.h @@ -4,9 +4,11 @@ #include #include "jkqtplotter/graphs/jkqtpparsedfunction.h" +QT_BEGIN_NAMESPACE namespace Ui { class FormWithJKQTPlotter; } +QT_END_NAMESPACE class FormWithJKQTPlotter : public QWidget { diff --git a/lib/jkqtplotter/jkqtplotter.h b/lib/jkqtplotter/jkqtplotter.h index 13e1046c88..1025eaaee9 100644 --- a/lib/jkqtplotter/jkqtplotter.h +++ b/lib/jkqtplotter/jkqtplotter.h @@ -1721,6 +1721,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget { }; +QT_BEGIN_NAMESPACE + /** \brief qHash-variant used by JKQTPlotter * \internal * \ingroup jkqtpplottersupprt @@ -1748,4 +1750,6 @@ inline uint qHash(const Qt::KeyboardModifiers &key, uint /*seed*/ ) noexcept(noe return static_cast(key); } +QT_END_NAMESPACE + #endif // JKQTPLOTTER_H From 872b31bc2d6f83ab69c193ff14b7c2fabb60a984 Mon Sep 17 00:00:00 2001 From: Patrick Stewart Date: Fri, 2 Oct 2020 14:41:42 +0100 Subject: [PATCH 3/3] Add missing #include --- lib/jkqtcommon/jkqtpdebuggingtools.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/jkqtcommon/jkqtpdebuggingtools.h b/lib/jkqtcommon/jkqtpdebuggingtools.h index 00626f412a..e399439307 100644 --- a/lib/jkqtcommon/jkqtpdebuggingtools.h +++ b/lib/jkqtcommon/jkqtpdebuggingtools.h @@ -24,6 +24,7 @@ #include "jkqtcommon/jkqtcommon_imexport.h" #include #include +#include #ifndef __WINDOWS__