Integration with Qode 2.0 (#400)

* Moves qt integration solely to the nodegui core addon

* Adds lint fixes

* moved to integration core

* cleans up export snippet

* revert package.json

* Add exit if app->exec finishes.

* lint fix

* Makes QApplication custom

* adds qobject to wrap of qapp

* Adds working qt run looper

* Adds font default

* Adds qt installer

* Updates qode integration to v2.0.1

* fix cpp lints

* Fixes lint and deps

* Adds miniqt installation

* adds setup mini qt script

* skips tests due to issues with jest

* fix config and download path for linux and windows

* Adds multiple artifact downloader

* fix qt config and compilation

* Fixes qode path for windows (now it can load dll's easily)

* Add compilation

* fix windows path setup

* use scripts directly

* enabled tests back

* fix ubuntu deps

* update to alpha release

* fix workflow

* adds more artifacts and funding field

* change to alpha v2

* update prebuild yml

* revert build action

* disabling prebuild for now

* switch to stable release 5.14.1

* version bump
This commit is contained in:
Atul R
2020-03-07 10:28:30 +01:00
committed by GitHub
parent bbf3cfd9bd
commit 86c3ef089c
147 changed files with 563 additions and 484 deletions
+2
View File
@@ -1,3 +1,5 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
+18 -72
View File
@@ -1,79 +1,25 @@
# Adds Qt support
# make sure you include this at the top of whichever Cmakelist file you are going to use.
# Need for automatic moc. Moc executable path is set in qt.cmake
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(QT_VERSION_MAJOR 5)
set(QT_VERSION_MINOR 13)
add_executable(Qt5::moc IMPORTED)
# Need for automatic moc.
function(AddQtSupport addonName)
execute_process(COMMAND node -p "require('@nodegui/qode').qtHome"
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(QTCONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/qtConfig.js)
macro(AddQtSupport addonName)
execute_process(COMMAND node -p "require('${QTCONFIG_FILE}').qtCmakeDir"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE QT_HOME_DIR
OUTPUT_VARIABLE QT_CMAKE_HOME_DIR
)
if(DEFINED ENV{QT_INSTALL_DIR})
# Allows to use custom Qt installation via QT_INSTALL_DIR env variable
message(STATUS "Using Custom QT installation for ${addonName} QT_INSTALL_DIR:$ENV{QT_INSTALL_DIR}")
set(QT_HOME_DIR "$ENV{QT_INSTALL_DIR}")
endif()
string(REPLACE "\n" "" QT_HOME_DIR "${QT_HOME_DIR}")
string(REPLACE "\"" "" QT_HOME_DIR "${QT_HOME_DIR}")
if(APPLE)
set(CUSTOM_QT_MOC_PATH "${QT_HOME_DIR}/bin/moc")
target_include_directories(${addonName} PRIVATE
"${QT_HOME_DIR}/include"
"${QT_HOME_DIR}/lib/QtCore.framework/Versions/5/Headers"
"${QT_HOME_DIR}/lib/QtGui.framework/Versions/5/Headers"
"${QT_HOME_DIR}/lib/QtWidgets.framework/Versions/5/Headers"
)
target_link_libraries(${addonName} PRIVATE
"${QT_HOME_DIR}/lib/QtCore.framework/Versions/5/QtCore"
"${QT_HOME_DIR}/lib/QtGui.framework/Versions/5/QtGui"
"${QT_HOME_DIR}/lib/QtWidgets.framework/Versions/5/QtWidgets"
)
endif()
if (WIN32)
set(CUSTOM_QT_MOC_PATH "${QT_HOME_DIR}\\bin\\moc.exe")
target_include_directories(${addonName} PRIVATE
"${QT_HOME_DIR}\\include"
"${QT_HOME_DIR}\\include\\QtCore"
"${QT_HOME_DIR}\\include\\QtGui"
"${QT_HOME_DIR}\\include\\QtWidgets"
)
target_link_libraries(${addonName} PRIVATE
"${QT_HOME_DIR}\\lib\\Qt5Core.lib"
"${QT_HOME_DIR}\\lib\\Qt5Gui.lib"
"${QT_HOME_DIR}\\lib\\Qt5Widgets.lib"
)
endif()
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
if(LINUX)
set(CUSTOM_QT_MOC_PATH "${QT_HOME_DIR}/bin/moc")
target_include_directories(${addonName} PRIVATE
"${QT_HOME_DIR}/include"
"${QT_HOME_DIR}/include/QtCore"
"${QT_HOME_DIR}/include/QtGui"
"${QT_HOME_DIR}/include/QtWidgets"
)
target_link_libraries(${addonName} PRIVATE
"${QT_HOME_DIR}/lib/libQt5Core.so"
"${QT_HOME_DIR}/lib/libQt5Gui.so"
"${QT_HOME_DIR}/lib/libQt5Widgets.so"
)
endif()
string(REPLACE "\n" "" QT_CMAKE_HOME_DIR "${QT_CMAKE_HOME_DIR}")
string(REPLACE "\"" "" QT_CMAKE_HOME_DIR "${QT_CMAKE_HOME_DIR}")
# set custom moc executable location
set_target_properties(Qt5::moc PROPERTIES IMPORTED_LOCATION "${CUSTOM_QT_MOC_PATH}")
endfunction(AddQtSupport addonName)
message(STATUS "Using QT installation for ${addonName} QT_CMAKE_HOME_DIR:${QT_CMAKE_HOME_DIR}")
set(Qt5_DIR ${QT_CMAKE_HOME_DIR})
find_package(Qt5 COMPONENTS Widgets Gui Core REQUIRED)
endmacro(AddQtSupport addonName)
+72
View File
@@ -0,0 +1,72 @@
const os = require('os');
const path = require('path');
const SETUP_DIR = path.resolve(__dirname, '..', 'miniqt');
const QT_VERSION = '5.14.1';
function getMiniQtConfig() {
switch (os.platform()) {
case 'darwin': {
return {
qtHome: path.resolve(SETUP_DIR, QT_VERSION, 'clang_64'),
artifacts: [
{
name: 'Qt Base',
link: `https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt5_5141/qt.qt5.5141.clang_64/5.14.1-0-202001241000qtbase-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z`,
},
{
name: 'Qt Tools',
link: `https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt5_5141/qt.qt5.5141.clang_64/5.14.1-0-202001241000qttools-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z`,
},
],
};
}
case 'win32': {
return {
qtHome: path.resolve(SETUP_DIR, QT_VERSION, 'msvc2017_64'),
artifacts: [
{
name: 'Qt Base',
link: `https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5141/qt.qt5.5141.win64_msvc2017_64/5.14.1-0-202001240957qtbase-Windows-Windows_10-MSVC2017-Windows-Windows_10-X86_64.7z`,
},
{
name: 'Qt Tools',
link: `https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5141/qt.qt5.5141.win64_msvc2017_64/5.14.1-0-202001240957qttools-Windows-Windows_10-MSVC2017-Windows-Windows_10-X86_64.7z`,
},
],
};
}
case 'linux': {
return {
qtHome: path.resolve(SETUP_DIR, QT_VERSION, 'gcc_64'),
artifacts: [
{
name: 'Qt Base',
link: `https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/qt5_5141/qt.qt5.5141.gcc_64/5.14.1-0-202001240953qtbase-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64.7z`,
},
{
name: 'Qt ICU',
link: `https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/qt5_5141/qt.qt5.5141.gcc_64/5.14.1-0-202001240953icu-linux-Rhel7.2-x64.7z`,
},
],
};
}
}
}
const miniQt = {
...getMiniQtConfig(),
version: QT_VERSION,
setupDir: SETUP_DIR,
};
const useCustomQt = Boolean(process.env.QT_INSTALL_DIR);
const qtHome = useCustomQt ? process.env.QT_INSTALL_DIR : miniQt.qtHome;
const qtCmakeDir = path.resolve(qtHome, 'lib', 'cmake', 'Qt5');
module.exports = {
qtHome,
miniQt,
qtCmakeDir,
useCustomQt,
};
-5
View File
@@ -1,5 +0,0 @@
const { QApplication } = require('../../dist');
module.exports = async () => {
global.qApp = QApplication.instance();
qApp.setQuitOnLastWindowClosed(false);
};
-3
View File
@@ -1,3 +0,0 @@
module.exports = async () => {
global.qApp.quit();
};