Fixing structure of the project
*Root Project |=> shared library called 'components'. |=> executable 'examples'.
This commit is contained in:
parent
a9281b2a42
commit
0a6c3373ca
|
@ -12,21 +12,23 @@ set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat REQUIRED)
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat REQUIRED)
|
||||||
|
|
||||||
add_subdirectory(components)
|
add_subdirectory(components)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
|
||||||
set(PROJECT_SOURCES
|
#set(PROJECT_SOURCES
|
||||||
|
|
||||||
)
|
#)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
qt_add_executable(QtMaterialWidgets
|
# qt_add_executable(QtMaterialWidgets
|
||||||
MANUAL_FINALIZATION
|
# MANUAL_FINALIZATION
|
||||||
${PROJECT_SOURCES}
|
# ${PROJECT_SOURCES}
|
||||||
)
|
# )
|
||||||
# Define target properties for Android with Qt 6 as:
|
# Define target properties for Android with Qt 6 as:
|
||||||
# set_property(TARGET QtMaterialWidgets APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
# set_property(TARGET QtMaterialWidgets APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||||
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
||||||
|
@ -45,20 +47,21 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(QtMaterialWidgets PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
#target_link_libraries(QtMaterialWidgets PRIVATE Qt${QT_VERSION_MAJOR}::Core)
|
||||||
target_link_libraries(QtMaterialWidgets PRIVATE Qt${QT_VERSION_MAJOR}::Core)
|
#target_link_libraries(QtMaterialWidgets PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
target_link_libraries(QtMaterialWidgets PRIVATE Qt${QT_VERSION_MAJOR}::Core5Compat)
|
#target_link_libraries(QtMaterialWidgets PRIVATE Qt${QT_VERSION_MAJOR}::Core5Compat)
|
||||||
|
|
||||||
set_target_properties(QtMaterialWidgets PROPERTIES
|
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
#set_target_properties(QtMaterialWidgets PROPERTIES
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
# MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
# MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
MACOSX_BUNDLE TRUE
|
# MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
WIN32_EXECUTABLE TRUE
|
# MACOSX_BUNDLE TRUE
|
||||||
)
|
# WIN32_EXECUTABLE TRUE
|
||||||
|
#)
|
||||||
|
|
||||||
#file(COPY assets DESTINATION ${CMAKE_BINARY_DIR})
|
#file(COPY assets DESTINATION ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
if(QT_VERSION_MAJOR EQUAL 6)
|
if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
qt_finalize_executable(QtMaterialWidgets)
|
# qt_finalize_executable(QtMaterialWidgets)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
project(components VERSION 0.1 LANGUAGES CXX)
|
#project(components VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat REQUIRED)
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat REQUIRED)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS StateMachine REQUIRED)
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS StateMachine REQUIRED)
|
||||||
|
|
||||||
|
# Create a library called "components" which includes the source file "*.cpp".
|
||||||
|
# The extension is already found. Any number of sources could be listed here.
|
||||||
set(PROJECT_SOURCES
|
set(PROJECT_SOURCES
|
||||||
qtmaterialavatar.cpp
|
qtmaterialavatar.cpp
|
||||||
lib/qtmaterialstyle.cpp
|
lib/qtmaterialstyle.cpp
|
||||||
|
@ -145,25 +147,18 @@ set(PROJECT_SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
qt_add_executable(components
|
add_library(components SHARED ${PROJECT_SOURCES})
|
||||||
MANUAL_FINALIZATION
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
# Define target properties for Android with Qt 6 as:
|
# Define target properties for Android with Qt 6 as:
|
||||||
# set_property(TARGET components APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
# set_property(TARGET components APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||||
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
||||||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
||||||
else()
|
else()
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_library(components SHARED
|
add_library(components SHARED ${PROJECT_SOURCES})
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||||
else()
|
else()
|
||||||
add_executable(components
|
# add_executable(components ${PROJECT_SOURCES})
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -172,6 +167,11 @@ target_link_libraries(components PRIVATE Qt${QT_VERSION_MAJOR}::Core)
|
||||||
target_link_libraries(components PRIVATE Qt${QT_VERSION_MAJOR}::Core5Compat)
|
target_link_libraries(components PRIVATE Qt${QT_VERSION_MAJOR}::Core5Compat)
|
||||||
target_link_libraries(components PRIVATE Qt${QT_VERSION_MAJOR}::StateMachine)
|
target_link_libraries(components PRIVATE Qt${QT_VERSION_MAJOR}::StateMachine)
|
||||||
|
|
||||||
|
# Make sure the compiler can find include files for our components library
|
||||||
|
# when other libraries or executables link to components
|
||||||
|
target_include_directories (components PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
|
||||||
set_target_properties(components PROPERTIES
|
set_target_properties(components PROPERTIES
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
|
@ -183,5 +183,5 @@ set_target_properties(components PROPERTIES
|
||||||
file(COPY icons DESTINATION ${CMAKE_BINARY_DIR})
|
file(COPY icons DESTINATION ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
if(QT_VERSION_MAJOR EQUAL 6)
|
if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
qt_finalize_executable(components)
|
# qt_finalize_executable(components)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat REQUIRED)
|
||||||
|
|
||||||
|
# Add executable called "examples" that is built from the source files
|
||||||
|
# "*.cpp". The extensions are automatically found.
|
||||||
|
# add_executable (examples)
|
||||||
|
|
||||||
|
set(PROJECT_SOURCES
|
||||||
|
#sources
|
||||||
|
main.cpp
|
||||||
|
mainwindow.cpp
|
||||||
|
avatarsettingseditor.cpp
|
||||||
|
badgesettingseditor.cpp
|
||||||
|
checkboxsettingseditor.cpp
|
||||||
|
fabsettingseditor.cpp
|
||||||
|
raisedbuttonsettingseditor.cpp
|
||||||
|
flatbuttonsettingseditor.cpp
|
||||||
|
iconbuttonsettingseditor.cpp
|
||||||
|
progresssettingseditor.cpp
|
||||||
|
circularprogresssettingseditor.cpp
|
||||||
|
slidersettingseditor.cpp
|
||||||
|
radiobuttonsettingseditor.cpp
|
||||||
|
togglesettingseditor.cpp
|
||||||
|
textfieldsettingseditor.cpp
|
||||||
|
tabssettingseditor.cpp
|
||||||
|
snackbarsettingseditor.cpp
|
||||||
|
dialogsettingseditor.cpp
|
||||||
|
drawersettingseditor.cpp
|
||||||
|
scrollbarsettingseditor.cpp
|
||||||
|
appbarsettingseditor.cpp
|
||||||
|
autocompletesettingseditor.cpp
|
||||||
|
menusettingseditor.cpp
|
||||||
|
# Headers
|
||||||
|
mainwindow.h
|
||||||
|
avatarsettingseditor.h
|
||||||
|
badgesettingseditor.h
|
||||||
|
checkboxsettingseditor.h
|
||||||
|
fabsettingseditor.h
|
||||||
|
raisedbuttonsettingseditor.h
|
||||||
|
flatbuttonsettingseditor.h
|
||||||
|
iconbuttonsettingseditor.h
|
||||||
|
progresssettingseditor.h
|
||||||
|
circularprogresssettingseditor.h
|
||||||
|
slidersettingseditor.h
|
||||||
|
radiobuttonsettingseditor.h
|
||||||
|
togglesettingseditor.h
|
||||||
|
textfieldsettingseditor.h
|
||||||
|
tabssettingseditor.h
|
||||||
|
snackbarsettingseditor.h
|
||||||
|
dialogsettingseditor.h
|
||||||
|
drawersettingseditor.h
|
||||||
|
scrollbarsettingseditor.h
|
||||||
|
appbarsettingseditor.h
|
||||||
|
autocompletesettingseditor.h
|
||||||
|
menusettingseditor.h
|
||||||
|
# Forms
|
||||||
|
avatarsettingsform.ui
|
||||||
|
badgesettingsform.ui
|
||||||
|
checkboxsettingsform.ui
|
||||||
|
fabsettingsform.ui
|
||||||
|
flatbuttonsettingsform.ui
|
||||||
|
iconbuttonsettingsform.ui
|
||||||
|
progresssettingsform.ui
|
||||||
|
circularprogresssettingsform.ui
|
||||||
|
slidersettingsform.ui
|
||||||
|
snackbarsettingsform.ui
|
||||||
|
radiobuttonsettingsform.ui
|
||||||
|
togglesettingsform.ui
|
||||||
|
textfieldsettingsform.ui
|
||||||
|
tabssettingsform.ui
|
||||||
|
dialogsettingsform.ui
|
||||||
|
drawersettingsform.ui
|
||||||
|
scrollbarsettingsform.ui
|
||||||
|
appbarsettingsform.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
|
qt_add_executable(examples
|
||||||
|
MANUAL_FINALIZATION
|
||||||
|
${PROJECT_SOURCES}
|
||||||
|
)
|
||||||
|
# Define target properties for Android with Qt 6 as:
|
||||||
|
# set_property(TARGET examples APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||||
|
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
||||||
|
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
||||||
|
else()
|
||||||
|
if(ANDROID)
|
||||||
|
add_library(examples SHARED
|
||||||
|
${PROJECT_SOURCES}
|
||||||
|
)
|
||||||
|
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||||
|
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||||
|
else()
|
||||||
|
add_executable(examples
|
||||||
|
${PROJECT_SOURCES}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(examples PRIVATE Qt${QT_VERSION_MAJOR}::Core)
|
||||||
|
target_link_libraries(examples PRIVATE Qt${QT_VERSION_MAJOR}::Gui)
|
||||||
|
target_link_libraries(examples PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
|
target_link_libraries(examples PRIVATE Qt${QT_VERSION_MAJOR}::Core5Compat)
|
||||||
|
|
||||||
|
|
||||||
|
# Link the executable to the 'components' library. Since the 'components' library has
|
||||||
|
# public include directories we will use those link directories when building
|
||||||
|
# examples
|
||||||
|
target_link_libraries(examples LINK_PUBLIC components)
|
||||||
|
|
||||||
|
|
||||||
|
set_target_properties(examples 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
|
||||||
|
)
|
||||||
|
|
||||||
|
file(COPY assets DESTINATION ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
|
qt_finalize_executable(examples)
|
||||||
|
endif()
|
Loading…
Reference in New Issue