forked from zzxyb/wsmwayland
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Xiao YaoBing
committed
Oct 30, 2023
1 parent
aac671e
commit 6fb25dc
Showing
33 changed files
with
3,985 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: CMake | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
cmake-build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: debian:latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Debian software sources | ||
run: | | ||
echo "deb http://deb.debian.org/debian/ bullseye main" | tee /etc/apt/sources.list | ||
echo "deb http://deb.debian.org/debian/ bullseye-updates main" | tee -a /etc/apt/sources.list | ||
echo "deb http://security.debian.org/ bullseye-security main" | tee -a /etc/apt/sources.list | ||
echo "deb http://deb.debian.org/debian unstable main" | tee -a /etc/apt/sources.list | ||
# Install build requirements for Linux build. | ||
- name: Install Build Requirements | ||
run: | | ||
apt-get update -q | ||
apt-get install -y g++ cmake extra-cmake-modules qt6-declarative-dev qt6-declarative-private-dev qt6-base-dev qt6-wayland-dev qt6-wayland-private-dev | ||
- name: Configure CMake | ||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | ||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | ||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | ||
|
||
- name: Build | ||
# Build your program with the given configuration | ||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | ||
|
||
# - name: Test | ||
# working-directory: ${{github.workspace}}/build | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
# run: ctest -C ${{env.BUILD_TYPE}} ${{github.workspace}}/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: CppCheck for C++ Project | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
cppcheck: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install cppcheck | ||
run: sudo apt-get update && sudo apt-get install -y cppcheck | ||
|
||
- name: Run Cppcheck | ||
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }} | ||
run: cppcheck --language=c++ . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
project(wsmwayland VERSION 0.1 LANGUAGES CXX) | ||
|
||
SET(CMAKE_AUTOMOC ON) | ||
SET(CMAKE_AUTOUIC ON) | ||
SET(CMAKE_AUTORCC ON) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
add_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII) | ||
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,73 @@ | ||
# wsmwayland | ||
provides a Qt-style Client library wrapper for the wsm compositor. | ||
provides a Qt-style Client library wrapper for the wlroots libraries,It is eazy to convert to QML (Qt Meta-Object Language) Component, which allows developers to easily use the wsm cleint protocol in qml. | ||
|
||
## Release Signatures | ||
|
||
## Installation | ||
Run these commands to make install : | ||
```shell | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug .. | ||
// j8 mean 8 CPUs, which can be set freely according to the device hardware | ||
sudo make install -j8 | ||
``` | ||
|
||
## doxygen | ||
Execute "make doc" or "cmake --build <build_dir> --target doc" in the build directory to generate Doxygen documentation. | ||
|
||
### From Packages | ||
|
||
### Compiling from Source | ||
Install dependencies: | ||
|
||
build dependencies(for arch linux): | ||
* cmake | ||
* extra-cmake-modules | ||
* qt6-base | ||
* qt6-declarative | ||
* qt6-wayland | ||
* doxygen(for doc) | ||
|
||
build dependencies(for debian): | ||
* cmake | ||
* extra-cmake-modules | ||
* qt6-declarative-dev | ||
* qt6-declarative-private-dev | ||
* qt6-base-dev | ||
* qt6-wayland-dev | ||
* qt6-wayland-private-dev | ||
|
||
## Configuration | ||
|
||
## Running | ||
ref example | ||
|
||
## How to Contribute | ||
* Contributing just involves sending a merge request. | ||
* Note: rules are made to be broken. Adjust or ignore any/all of these as you see | ||
fit, but be prepared to justify it to your peers. | ||
|
||
### Code Style | ||
* When modifying existing code, the current code style should be respected. | ||
* New code: the part should follow the code style of Qt (https://wiki.qt.io/Qt_Coding_Style this link is for reference only. The actual Qt source code shall prevail) | ||
* There is no absolute right or wrong code style, please consider the big picture, and do not rigidly stick to the small details | ||
|
||
### Code Architecture Guidelines | ||
* The code should be simple and easy to understand. | ||
* Add comments to key nodes whether you change or add new code | ||
* Security > Compatibility > Extensibility >= Performance | ||
|
||
### Contribution Guideline | ||
* Contribution steps. | ||
1. First login to your Github/Gitee account and fork the project | ||
2. Pull the forked project locally using `git clone`. | ||
3. Push the new commit to your project using `git push`. | ||
4. commit your code to the upstream project on Github/Gitee using the Pull Requese feature. | ||
* commit message specification: align with Qt project, use English. Be sure to describe exactly what the commit "does" and "why it was made" | ||
* A commit only does one thing, and the smaller the code changes, the easier it is to accept the commit. For larger code changes, try to split the commit into multiple commits (satisfying the git commit principle as a prerequisite) | ||
* Please do your own testing and code review before committing the code, and submit the PR after confirming that the code is working correctly | ||
|
||
## Roadmap | ||
* Become an important library for desktop environments. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
PROJECT_NAME = "wsmwayland" | ||
PROJECT_NUMBER = 0.1 | ||
OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIR@ | ||
INPUT = @CMAKE_SOURCE_DIR@/src | ||
RECURSIVE = YES | ||
OUTPUT_LANGUAGE = Chinese | ||
IMAGE_PATH = ../doc/doxygen/images | ||
DOT_PATH = /usr/local/bin | ||
GENERATE TREEVIEW = ALL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(dpmsexample) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
project(dpmsexample VERSION 0.1 LANGUAGES CXX) | ||
|
||
find_package(Qt6 6.4 REQUIRED COMPONENTS Quick) | ||
|
||
qt_standard_project_setup() | ||
|
||
qt_add_executable(appdpmsexample | ||
main.cpp | ||
) | ||
|
||
qt_add_qml_module(appdpmsexample | ||
URI dpmsexample | ||
VERSION 1.0 | ||
QML_FILES Main.qml | ||
) | ||
|
||
set_target_properties(appdpmsexample PROPERTIES | ||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com | ||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} | ||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} | ||
MACOSX_BUNDLE TRUE | ||
WIN32_EXECUTABLE TRUE | ||
) | ||
|
||
target_link_libraries(appdpmsexample | ||
PRIVATE Qt6::Quick | ||
) | ||
|
||
install(TARGETS appdpmsexample | ||
BUNDLE DESTINATION . | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import QtQuick | ||
import QtQuick.Window | ||
import QtQuick.Controls | ||
import QtQuick.Layouts | ||
import org.lychee.wsmwayland | ||
|
||
Window { | ||
width: 640 | ||
height: 480 | ||
visible: true | ||
title: qsTr("Hello World") | ||
|
||
OutputPowerManagement { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <QGuiApplication> | ||
#include <QQmlApplicationEngine> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QGuiApplication app(argc, argv); | ||
app.setApplicationName(QString::fromLatin1("dpmsexample")); | ||
|
||
QQmlApplicationEngine engine; | ||
QString qmlPath = QGuiApplication::applicationDirPath(); | ||
QString qq = QCoreApplication::applicationName(); | ||
#ifdef Q_OS_LINUX | ||
qmlPath.replace(QString::fromUtf8("examples/") + QCoreApplication::applicationName(), QString::fromUtf8("")); | ||
#endif | ||
|
||
engine.addImportPath(qmlPath); | ||
|
||
const QUrl url(u"qrc:/dpmsexample/Main.qml"_qs); | ||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, | ||
&app, []() { QCoreApplication::exit(-1); }, | ||
Qt::QueuedConnection); | ||
engine.load(url); | ||
|
||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
set(CMAKE_AUTOMOC ON) | ||
|
||
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY) | ||
remove_definitions(-DQT_NO_CAST_FROM_ASCII) | ||
remove_definitions(-DQT_NO_CAST_TO_ASCII) | ||
|
||
find_package(ECM REQUIRED NO_MODULE) | ||
find_package(PkgConfig REQUIRED) | ||
find_package(Qt6 6.4 COMPONENTS Quick Core Qml WaylandClient REQUIRED) | ||
|
||
find_package(Doxygen) | ||
if (DOXYGEN_FOUND) | ||
set(DOXYGEN_INPUT ${CMAKE_SOURCE_DIR}/doc/Doxyfile.in) | ||
set(DOXYGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/doc) | ||
configure_file(${DOXYGEN_INPUT} ${CMAKE_BINARY_DIR}/Doxyfile @ONLY) | ||
add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
COMMENT "Generating API documentation with Doxygen" VERBATIM) | ||
# Finally, execute "make doc" or "cmake --build <build_dir> --target doc" in the compilation directory to generate Doxygen documentation. | ||
endif () | ||
|
||
set(CLIENT_GENERATED_SRCS | ||
${CMAKE_CURRENT_BINARY_DIR}/wayland-wlr-output-power-management-unstable-v1-client-protocol.h | ||
) | ||
|
||
set(WSMWAYLAND_SRCS | ||
wsmwaylandglobal.h | ||
wsmwaylandglobal.cpp | ||
outputpowermanagement.h outputpowermanagement.cpp | ||
abstractresource.h abstractresource.cpp | ||
abstractresource_p.h | ||
outputpowermanagement_p.h | ||
) | ||
|
||
add_library(wsmwayland | ||
SHARED | ||
${WSMWAYLAND_SRCS} | ||
) | ||
|
||
set(control_QMLS | ||
) | ||
|
||
#add picture resource | ||
set(image_RSRCS | ||
# image/switch/switch-handle.png | ||
) | ||
|
||
foreach(file IN LISTS control_QMLS image_RSRCS) | ||
get_filename_component(filename ${file} NAME) | ||
set_source_files_properties(${file} PROPERTIES QT_RESOURCE_ALIAS ${filename}) | ||
endforeach() | ||
|
||
set_source_files_properties(${CLIENT_GENERATED_SRCS} PROPERTIES SKIP_AUTOMOC ON) | ||
|
||
qt6_generate_wayland_protocol_client_sources(wsmwayland | ||
FILES | ||
${CMAKE_CURRENT_SOURCE_DIR}/protocol/wlr-output-power-management-unstable-v1.xml | ||
) | ||
|
||
qt_add_qml_module(wsmwayland | ||
URI org.lychee.wsmwayland | ||
VERSION 1.0 | ||
SOURCES ${WSMWAYLAND_SRCS} | ||
QML_FILES ${control_QMLS} | ||
RESOURCES ${image_RSRCS} | ||
) | ||
|
||
set_target_properties(wsmwayland PROPERTIES | ||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com | ||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} | ||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} | ||
MACOSX_BUNDLE TRUE | ||
WIN32_EXECUTABLE TRUE | ||
) | ||
|
||
target_compile_definitions(wsmwayland | ||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) | ||
|
||
target_link_libraries(wsmwayland PRIVATE | ||
Qt6::Core | ||
Qt6::Gui | ||
Qt6::GuiPrivate | ||
Qt6::Quick | ||
Qt6::QuickPrivate | ||
Qt6::WaylandClient | ||
Qt6::WaylandClientPrivate | ||
) | ||
|
||
target_include_directories(wsmwayland PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) | ||
|
||
# Prevent EGL headers from including platform headers, in particular Xlib.h. | ||
add_definitions(-DMESA_EGL_NO_X11_HEADERS) | ||
add_definitions(-DEGL_NO_X11) | ||
add_definitions(-DEGL_NO_PLATFORM_SPECIFIC_TYPES) | ||
|
||
# get QML install dir | ||
function(get_qml_install_dir target_var) | ||
get_target_property(QT6_QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION) | ||
execute_process( | ||
COMMAND ${QT6_QMAKE_EXECUTABLE} -query QT_INSTALL_QML | ||
OUTPUT_VARIABLE QML_INSTALL_DIR | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
set(${target_var} ${QML_INSTALL_DIR} PARENT_SCOPE) | ||
endfunction() | ||
|
||
get_qml_install_dir(QML_INSTALL_DIR) | ||
|
||
install(TARGETS wsmwayland DESTINATION CMAKE_INSTALL_LIBDIR) | ||
install(FILES | ||
${CMAKE_BINARY_DIR}/org/lychee/wsmwayland/qmldir | ||
${CMAKE_BINARY_DIR}/org/lychee/wsmwayland/libwsmwaylandplugin.so | ||
${CMAKE_BINARY_DIR}/org/lychee/wsmwayland/wsmwayland.qmltypes | ||
DESTINATION ${QML_INSTALL_DIR}/org/lychee/wsmwayland/ | ||
) |
Oops, something went wrong.