Adding Template
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(CppQtTemplate LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets)
|
||||
|
||||
add_executable(test_app main.cpp)
|
||||
|
||||
target_link_libraries(test_app PRIVATE Qt6::Widgets)
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
pipeline {
|
||||
agent none
|
||||
|
||||
stages {
|
||||
stage('Build Linux') {
|
||||
agent { label 'linux' }
|
||||
|
||||
steps {
|
||||
cleanWs()
|
||||
checkout scm
|
||||
|
||||
sh '''
|
||||
cmake -S . -B build/linux -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
cmake --build build/linux
|
||||
|
||||
mkdir -p dist/linux
|
||||
cp build/linux/test_app dist/linux/test_app
|
||||
'''
|
||||
|
||||
archiveArtifacts artifacts: 'dist/linux/**', fingerprint: true
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Windows Qt') {
|
||||
agent { label 'windows' }
|
||||
|
||||
steps {
|
||||
cleanWs()
|
||||
checkout scm
|
||||
|
||||
bat '''
|
||||
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"
|
||||
|
||||
cmake -S . -B build\\windows -G Ninja ^
|
||||
-DCMAKE_BUILD_TYPE=Release ^
|
||||
-DCMAKE_TOOLCHAIN_FILE=C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake ^
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows
|
||||
|
||||
cmake --build build\\windows
|
||||
|
||||
if exist dist\\windows rmdir /s /q dist\\windows
|
||||
mkdir dist\\windows
|
||||
|
||||
copy build\\windows\\test_app.exe dist\\windows\\test_app.exe
|
||||
|
||||
for /f "delims=" %%i in ('dir /b /s C:\\vcpkg\\installed\\x64-windows\\tools\\Qt6\\windeployqt.exe') do set WINDEPLOYQT=%%i
|
||||
|
||||
"%WINDEPLOYQT%" --release --no-translations dist\\windows\\test_app.exe
|
||||
|
||||
xcopy /Y /I C:\\vcpkg\\installed\\x64-windows\\bin\\*.dll dist\\windows\\
|
||||
'''
|
||||
|
||||
archiveArtifacts artifacts: 'dist/windows/**', fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QMessageBox::information(
|
||||
nullptr,
|
||||
"Qt Jenkins Test",
|
||||
"Hello from Qt + Jenkins!"
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": [
|
||||
"qtbase"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user