-
Notifications
You must be signed in to change notification settings - Fork 0
Added CMake build process to the project #1
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
33bfb47
19d6b43
acb86b0
398635c
f65f0fe
0937bb0
bcca546
909e1b6
89c3ff2
942c7ed
f22b8c1
2d692eb
d01087e
76169cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| SET(CMAKE_CXX_COMPILER "g++") | ||
|
|
||
| PROJECT(QtVulkan) | ||
|
|
||
| CMAKE_MINIMUM_REQUIRED(VERSION 3.5.0) | ||
|
|
||
| SET(CMAKE_CXX_STANDARD 14) | ||
| SET(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| ADD_SUBDIRECTORY(lib) | ||
| ADD_SUBDIRECTORY(cube) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| CMakeCache.txt | ||
| cmake_install.cmake | ||
| Makefile | ||
| CMakeFiles/ | ||
| cube/ | ||
| lib/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
|
|
||
| # clean up the old build items | ||
| rm -rf CMakeCache.txt CMakeFiles/ cmake_install.cmake cube/ lib/ Makefile | ||
|
|
||
| # build the project | ||
| cmake .. | ||
| make | ||
|
|
||
| # post work for assets | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you make this part of the cmake script? |
||
| mkdir cube/shaders | ||
| cp ../cube/*.spv cube/shaders | ||
| cp ../cube/lunarg.ppm cube | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| SET(CMAKE_AUTOMOC ON) | ||
| SET(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
|
||
| SET(CMAKE_CXX_LINK_FLAGS "-lvulkan") | ||
| SET(CMAKE_CXX_LINK_FLAGS "-lassimp") | ||
| SET(CMAKE_CXX_LINK_FLAGS "-lxcb") | ||
|
|
||
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") | ||
|
|
||
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_XCB_KHR") | ||
|
|
||
| MESSAGE(STATUS ${VULKAN_LIB}) | ||
|
|
||
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX -DVK_PROTOTYPES -D_USE_MATH_DEFINES") | ||
|
|
||
| ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) | ||
|
|
||
| FIND_PACKAGE(Qt5Widgets REQUIRED) | ||
| FIND_PACKAGE(Qt5Gui REQUIRED) | ||
| FIND_PACKAGE(Qt5Core REQUIRED) | ||
| #FIND_PACKAGE(Qt5Quick REQUIRED) | ||
| #FIND_PACKAGE(Qt5Qml REQUIRED) | ||
|
|
||
| SET(qtvulkan_cube_SRCS | ||
| cube.cpp | ||
| ) | ||
|
|
||
| INCLUDE_DIRECTORIES(${Qt5Gui_INCLUDE_DIRS} | ||
| ${Qt5Core_INCLUDE_DIRS} | ||
| ${Qt5Widgets_INCLUDE_DIRS} | ||
| #${Qt5Quick_INCLUDE_DIRS} | ||
| #${Qt5Qml_INCLUDE_DIRS} | ||
| ) | ||
|
|
||
| SET(qtvulkan_cube_LIBS | ||
| ${Qt5Widgets_LIBRARIES} | ||
| ${Qt5Quick_LIBRARIES} | ||
| ${Qt5Core_LIBRARIES} | ||
| #${Qt5Gui_LIBRARIES} | ||
| #${QT5Qml_LIBRARIES} | ||
| ) | ||
|
|
||
| ADD_EXECUTABLE(qtvulkan_cube ${qtvulkan_cube_SRCS} ${qtvulkan_cube_MOC_SRCS}) | ||
|
|
||
| SET_TARGET_PROPERTIES(qtvulkan_cube | ||
| PROPERTIES | ||
| CMAKE_CXX_STANDARD 11 | ||
| CMAKE_CXX_STANDARD_REQUIRED ON | ||
| ) | ||
|
|
||
| TARGET_LINK_LIBRARIES(qtvulkan_cube "-lvulkan" ${qtvulkan_cube_LIBS}) | ||
|
|
||
| # INSTALL | ||
| #INSTALL( TARGETS qtvulkan_cube RUNTIME DESTINATION /usr/local/qtvulkan) | ||
|
|
||
| #FILE(GLOB SPIRV_FILES "*.spv") | ||
| #INSTALL(FILES ${SPIRV_FILES} DESTINATION /usr/local/qtvulkan/shaders) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,10 @@ | |
| #include <QResizeEvent> | ||
|
|
||
| #include <QtMath> | ||
| #include <qpa/qplatformnativeinterface.h> | ||
| //#include <qpa/qplatformnativeinterface.h> | ||
| // TODO - I need to fix this below line so that you can build using the above line | ||
| #include <QtGui/5.6.0/QtGui/qpa/qplatformnativeinterface.h> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, I won't merge it if it ties the whole build to this qt version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you need qplatformnativeinterface for?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to get the xcb handle: https://github.com/heeen/qtvulkan/blob/master/cube/qvulkanview.cpp#L1182 |
||
|
|
||
|
|
||
| static PFN_vkGetDeviceProcAddr g_gdpa = NULL; | ||
|
|
||
|
|
@@ -1343,7 +1346,7 @@ VkShaderModule Demo::prepare_vs() { | |
| char *vertShaderCode; | ||
| size_t size; | ||
|
|
||
| vertShaderCode = demo_read_spv("cube-vert.spv", &size); | ||
| vertShaderCode = demo_read_spv("shaders/cube-vert.spv", &size); | ||
|
|
||
| assert(vertShaderCode); | ||
| m_vert_shader_module = | ||
|
|
@@ -1360,7 +1363,7 @@ VkShaderModule Demo::prepare_fs() { | |
| char *fragShaderCode; | ||
| size_t size; | ||
|
|
||
| fragShaderCode = demo_read_spv("cube-frag.spv", &size); | ||
| fragShaderCode = demo_read_spv("shaders/cube-frag.spv", &size); | ||
| assert(fragShaderCode); | ||
| m_frag_shader_module = | ||
| prepare_shader_module(fragShaderCode, size); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| SET(CMAKE_AUTOMOC ON) | ||
| SET(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
|
||
| SET(CMAKE_CXX_LINK_FLAGS "-lvulkan") | ||
| SET(CMAKE_CXX_LINK_FLAGS "-lassimp") | ||
| SET(CMAKE_CXX_LINK_FLAGS "-lxcb") | ||
|
|
||
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") | ||
|
|
||
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_XCB_KHR") | ||
|
|
||
| MESSAGE(STATUS ${VULKAN_LIB}) | ||
|
|
||
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX -DVK_PROTOTYPES -D_USE_MATH_DEFINES") | ||
|
|
||
| ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) | ||
|
|
||
| FIND_PACKAGE(Qt5Widgets REQUIRED) | ||
| FIND_PACKAGE(Qt5Gui REQUIRED) | ||
| FIND_PACKAGE(Qt5Core REQUIRED) | ||
| #FIND_PACKAGE(Qt5Quick REQUIRED) | ||
| #FIND_PACKAGE(Qt5Qml REQUIRED) | ||
|
|
||
| SET(qtvulkan_SRCS | ||
| qvulkaninstance.cpp | ||
| qvulkanview.cpp | ||
| main.cpp | ||
| ) | ||
|
|
||
| INCLUDE_DIRECTORIES(${Qt5Gui_INCLUDE_DIRS} | ||
| ${Qt5Core_INCLUDE_DIRS} | ||
| ${Qt5Widgets_INCLUDE_DIRS} | ||
| #${Qt5Quick_INCLUDE_DIRS} | ||
| #${Qt5Qml_INCLUDE_DIRS} | ||
| ) | ||
|
|
||
| SET(qtvulkan_LIBS | ||
| ${Qt5Widgets_LIBRARIES} | ||
| ${Qt5Quick_LIBRARIES} | ||
| ${Qt5Core_LIBRARIES} | ||
| #${Qt5Gui_LIBRARIES} | ||
| #${QT5Qml_LIBRARIES} | ||
| ) | ||
|
|
||
| ADD_EXECUTABLE(qtvulkan ${qtvulkan_SRCS} ${qtvulkan_MOC_SRCS}) | ||
|
|
||
| SET_TARGET_PROPERTIES(qtvulkan | ||
| PROPERTIES | ||
| CMAKE_CXX_STANDARD 11 | ||
| CMAKE_CXX_STANDARD_REQUIRED ON | ||
| ) | ||
|
|
||
| TARGET_LINK_LIBRARIES(qtvulkan "-lvulkan" ${qtvulkan_LIBS}) | ||
|
|
||
| # INSTALL | ||
| #INSTALL( TARGETS qtvulkan RUNTIME DESTINATION /usr/local/qtvulkan) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this part of a "make clean" target?