Skip to content

Commit ffdec9f

Browse files
committed
move to cmake
1 parent 3a0e226 commit ffdec9f

File tree

8 files changed

+88
-223
lines changed

8 files changed

+88
-223
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
*.pro.user
2+
build
3+
.cache

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
project(qt-material-widgets)
2+
cmake_minimum_required(VERSION 3.22)
3+
4+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
5+
add_subdirectory(examples)
6+
add_subdirectory(components)

components/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
project(
4+
components
5+
VERSION 0.1
6+
LANGUAGES CXX)
7+
8+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
9+
10+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
11+
set(CMAKE_AUTOUIC ON)
12+
set(CMAKE_AUTOMOC ON)
13+
set(CMAKE_AUTORCC ON)
14+
15+
set(CMAKE_CXX_STANDARD 17)
16+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
17+
18+
find_package(Qt5 REQUIRED COMPONENTS Core)
19+
find_package(Qt5 REQUIRED COMPONENTS Widgets)
20+
21+
file(GLOB THELIB "lib/*")
22+
file(GLOB LAYOUT "layouts/*")
23+
file(GLOB COMPONENTSHEADER "*.h")
24+
file(GLOB COMPONENTSSOURCE "*.cpp")
25+
set(RCC_FILES resources.qrc)
26+
add_library(${PROJECT_NAME} STATIC ${THELIB} ${LAYOUT} ${COMPONENTSHEADER}
27+
${COMPONENTSSOURCE} ${RCC_FILES})
28+
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Widgets)
29+
30+
target_link_directories(${PROJECT_NAME} PUBLIC .)

components/components.pro

Lines changed: 0 additions & 130 deletions
This file was deleted.

components/qtmaterialavatar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void QtMaterialAvatar::paintEvent(QPaintEvent *event)
234234
painter.setRenderHint(QPainter::Antialiasing);
235235

236236
QRect r = rect();
237-
const qreal hs = d->size/2;
237+
const qreal hs = d->size/2.0;
238238

239239
if (!isEnabled())
240240
{

examples/CMakeLists.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
project(examples VERSION 0.1 LANGUAGES CXX)
4+
5+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
6+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
7+
8+
set(CMAKE_AUTOUIC ON)
9+
set(CMAKE_AUTOMOC ON)
10+
set(CMAKE_AUTORCC ON)
11+
set(CMAKE_CXX_STANDARD 17)
12+
13+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
14+
15+
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
16+
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
17+
18+
file(GLOB HEADER "*.h")
19+
file(GLOB RSOURCE "*.cpp")
20+
file(GLOB UI "*.ui")
21+
22+
SET(RCC_FILES examples.qrc)
23+
24+
add_executable(
25+
${PROJECT_NAME}
26+
${HEADER}
27+
${RSOURCE}
28+
${UI}
29+
${RCC_FILES}
30+
)
31+
target_include_directories(${PROJECT_NAME} PUBLIC
32+
../components/
33+
)
34+
35+
target_link_libraries(
36+
${PROJECT_NAME} PRIVATE
37+
Qt${QT_VERSION_MAJOR}::Widgets
38+
Qt${QT_VERSION_MAJOR}::Core
39+
components
40+
)
41+
42+
set_target_properties(${PROJECT_NAME} PROPERTIES
43+
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
44+
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
45+
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
46+
MACOSX_BUNDLE TRUE
47+
48+
)
49+

examples/examples.pro

Lines changed: 0 additions & 75 deletions
This file was deleted.

qt-material-widgets.pro

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)