Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CMake file for Designer. #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

RealXuChe
Copy link
Collaborator

image

I tested it, it builds on Windows in Qt Creator. If you want to build it using Qt Creator, you can't use the toolchain shipped with Qt Creator. You have to use the MinGW64 toolchain from msys to build it. I'll later write a guide for setting it up.

This PR breaks the existing sln project. To be exact, I changed the include file path in file propertiesdialog.ui, this will cause issues with the sln project.

Also, I collected all Q_DECLARE_METATYPE into a single header, to avoid some symbol-redefine issue.

I tried my best to not break the sln project, but you may need to change the include file path in `propertiesdialog.ui` to make it build.
Read the BUILDING file for building it with CMake manually.
@RealXuChe RealXuChe requested a review from Vouk April 30, 2024 12:09
@RealXuChe RealXuChe self-assigned this Apr 30, 2024

include(FetchContent)

set(CMAKE_CXX_STANDARD 23)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other project we are using c++20? Shouldn't that be enough?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I'll change it to 20.

# TODO: make qttools version as a variable
FetchContent_Declare(
QtTools
URL https://download.qt.io/official_releases/qt/6.6/6.6.1/submodules/qttools-everywhere-src-6.6.1.tar.xz
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set(CMAKE_CXX_STANDARD 23)

find_package(Boost REQUIRED COMPONENTS filesystem)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Gui Network UiTools)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better: find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Gui Network UiTools)

set(VCPKG_INSTALL_OPTIONS "--x-buildtrees-root=D:/v/")
endif ()

project(VoukoderDesigner LANGUAGES CXX)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use "VoukoderProDesigner" rather than "VoukoderDesigner"

@@ -0,0 +1,136 @@
cmake_minimum_required(VERSION 3.28)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have difficulties to let Qt use a different CMake version higher than 3.27.7

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may run into this problem because the QtCreator-bundled CMake is 3.27.7. CMake shipped with VS Buildtools is 3.28, you can use that.
图片
I think you can just go to the 'CMake' tab, click 'add', and select the CMake from VS Buildtools. Then you can change the CMake in the 'Kit' tab.
Of course, you may run into some problems other than the CMake version, such as dependencies. I plan to write down the steps later so you can follow them.

#set(PatchNE2Cmake git apply ${CMAKE_CURRENT_SOURCE_DIR}/BuildNodeEditor2.patch)
FetchContent_Declare(
NodeEditor2
GIT_REPOSITORY https://github.com/RealXuChe/nodeeditor.git
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the official repo would be better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read paceholder/nodeeditor#409
The official repo has problems building as a static library. I made a temporary fix in my fork. I plan to test more and try to get my fix merged. After that, I'll change it back to the official repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants