mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 10:20:17 -06:00
cmake: build qcustomplot as static lib and fix windows build
This commit is contained in:
@@ -9,9 +9,11 @@ endif()
|
||||
|
||||
set(ANTLR_DIR libs/antlr-2.7.7)
|
||||
set(QHEXEDIT_DIR libs/qhexedit)
|
||||
set(QCUSTOMPLOT_DIR libs/qcustomplot-source)
|
||||
|
||||
add_subdirectory(${ANTLR_DIR})
|
||||
add_subdirectory(${QHEXEDIT_DIR})
|
||||
add_subdirectory(${QCUSTOMPLOT_DIR})
|
||||
|
||||
if(USE_QT5)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
@@ -49,7 +51,6 @@ set(SQLB_MOC_HDR
|
||||
src/sqlitetablemodel.h
|
||||
src/sqltextedit.h
|
||||
src/DbStructureModel.h
|
||||
libs/qcustomplot-source/qcustomplot.h
|
||||
)
|
||||
|
||||
set(SQLB_SRC
|
||||
@@ -73,7 +74,6 @@ set(SQLB_SRC
|
||||
src/DbStructureModel.cpp
|
||||
src/grammar/Sqlite3Lexer.cpp
|
||||
src/grammar/Sqlite3Parser.cpp
|
||||
libs/qcustomplot-source/qcustomplot.cpp
|
||||
src/main.cpp
|
||||
)
|
||||
|
||||
@@ -138,19 +138,19 @@ if(WIN32)
|
||||
ENDIF( MINGW )
|
||||
endif(WIN32)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${ANTLR_DIR} ${QHEXEDIT_DIR} src)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${ANTLR_DIR} ${QHEXEDIT_DIR} ${QCUSTOMPLOT_DIR} src)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SQLB_HDR} ${SQLB_SRC} ${SQLB_FORM_HDR} ${SQLB_MOC} ${SQLB_RESOURCES_RCC})
|
||||
|
||||
if(USE_QT5)
|
||||
qt5_use_modules(${PROJECT_NAME} Gui Widgets PrintSupport Network Test)
|
||||
qt5_use_modules(${PROJECT_NAME} Gui Widgets Network Test)
|
||||
set(QT_LIBRARIES "")
|
||||
endif()
|
||||
add_dependencies(${PROJECT_NAME} antlr qhexedit)
|
||||
add_dependencies(${PROJECT_NAME} antlr qhexedit qcustomplot)
|
||||
|
||||
link_directories(${CMAKE_CURRENT_BINARY_DIR}/${ANTLR_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${QHEXEDIT_DIR})
|
||||
link_directories(${CMAKE_CURRENT_BINARY_DIR}/${ANTLR_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${QHEXEDIT_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${QCUSTOMPLOT_DIR})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} antlr qhexedit ${QT_LIBRARIES} ${WIN32_STATIC_LINK} sqlite3 ${ADDITIONAL_LIBS})
|
||||
target_link_libraries(${PROJECT_NAME} antlr qhexedit qcustomplot ${QT_LIBRARIES} ${WIN32_STATIC_LINK} sqlite3 ${ADDITIONAL_LIBS})
|
||||
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
RUNTIME DESTINATION bin
|
||||
|
||||
33
libs/qcustomplot-source/CMakeLists.txt
Normal file
33
libs/qcustomplot-source/CMakeLists.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
cmake_minimum_required(VERSION 2.8.9)
|
||||
|
||||
if(USE_QT5)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
add_definitions(${QT_DEFINITIONS})
|
||||
endif()
|
||||
|
||||
set(QCUSTOMPLOT_SRC
|
||||
qcustomplot.cpp
|
||||
)
|
||||
|
||||
set(QCUSTOMPLOT_HDR
|
||||
)
|
||||
|
||||
set(QCUSTOMPLOT_MOC_HDR
|
||||
qcustomplot.h
|
||||
)
|
||||
|
||||
if(NOT USE_QT5)
|
||||
QT4_WRAP_CPP(QCUSTOMPLOT_MOC ${QCUSTOMPLOT_MOC_HDR})
|
||||
endif()
|
||||
|
||||
add_library(qcustomplot ${QCUSTOMPLOT_SRC} ${QCUSTOMPLOT_HDR} ${QCUSTOMPLOT_MOC})
|
||||
|
||||
if(USE_QT5)
|
||||
qt5_use_modules(qcustomplot Widgets PrintSupport)
|
||||
endif()
|
||||
|
||||
@@ -1359,7 +1359,7 @@
|
||||
<customwidget>
|
||||
<class>QCustomPlot</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>libs/qcustomplot-source/qcustomplot.h</header>
|
||||
<header>qcustomplot.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
||||
Reference in New Issue
Block a user