Skip to content

Commit

Permalink
chore: update CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
mhduiy committed Dec 8, 2024
1 parent 9401844 commit 781980c
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 46 deletions.
31 changes: 12 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ project(AndroidTools VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)

set(EXE_NAME ${PROJECT_NAME})

file(GLOB_RECURSE SRC_PATHS src/cpp/*.cpp src/cpp/*.hpp)
file(GLOB_RECURSE HEAD_PATHS src/cpp/*.h)
file(GLOB_RECURSE QML_PATHS src/qml/*.qml)
Expand All @@ -23,6 +25,12 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Widgets Gui Ne

include_directories(.)

add_executable(${EXE_NAME}
${QRC_SOURCES}
${SRC_PATHS}
${RES_PATHS}
)

add_subdirectory(${CMAKE_SOURCE_DIR}/src/cpp/adb)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/cpp/appPageTools)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/cpp/components)
Expand All @@ -33,27 +41,12 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/src/cpp/infoPageTool)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/cpp/settingPageTools)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/cpp/utils)

add_executable(${PROJECT_NAME}
${QRC_SOURCES}
${SRC_PATHS}
${RES_PATHS}

${ADB_SRC}
${COMPONENTS_SRC}
${APP_PAGE_SRC}
${CONTROL_PAGE_SRC}
${FLASH_PAGE_SRC}
${IMAGE_PAGE_SRC}
${INFO_PAGE_SRC}
${SETTING_PAGE_SRC}
${UTILS_SRC}
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(${PROJECT_NAME} PRIVATE QT_QML_DEBUG)
target_compile_definitions(${EXE_NAME} PRIVATE QT_QML_DEBUG)
endif()


# 遍历所有qml文件
# MFloat
file(GLOB_RECURSE QML_PATHS ${CMAKE_SOURCE_DIR}/src/MFloat/*.qml)

foreach(QML_FILE ${QML_PATHS})
Expand All @@ -74,7 +67,7 @@ foreach(MFloat_QRC_FILE ${MFloat_QRC_FILE_LIST})
)
endforeach()

qt_add_qml_module(${PROJECT_NAME}
qt_add_qml_module(${EXE_NAME}
URI MFloat
VERSION 1.0
RESOURCES ${CMAKE_SOURCE_DIR}/src/MFloat/mfloat.qrc
Expand All @@ -84,7 +77,7 @@ qt_add_qml_module(${PROJECT_NAME}
${QML_PATHS}
)

target_link_libraries(${PROJECT_NAME} PRIVATE
target_link_libraries(${EXE_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Widgets
Expand Down
5 changes: 2 additions & 3 deletions src/cpp/adb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 添加源文件
set(ADB_SRC
${CMAKE_CURRENT_SOURCE_DIR}/adbinterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/adbinterface.h
Expand All @@ -7,8 +6,8 @@ set(ADB_SRC
${CMAKE_CURRENT_SOURCE_DIR}/connectmanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connectmanager.h
${CMAKE_CURRENT_SOURCE_DIR}/keycodes.h
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${ADB_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
5 changes: 2 additions & 3 deletions src/cpp/appPageTools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 添加源文件
set(APP_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/appDetailControl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/appDetailControl.h
Expand All @@ -9,8 +8,8 @@ set(APP_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/softlistmodel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/softlistmodel.h
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${APP_PAGE_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
5 changes: 2 additions & 3 deletions src/cpp/components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# 添加源文件
set(COMPONENTS_SRC
${CMAKE_CURRENT_SOURCE_DIR}/deivicelistviewmodel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/deivicelistviewmodel.h
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${COMPONENTS_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
5 changes: 2 additions & 3 deletions src/cpp/controlPageTool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 添加源文件
set(CONTROL_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/batterydisguise.cpp
${CMAKE_CURRENT_SOURCE_DIR}/batterydisguise.h
Expand All @@ -15,8 +14,8 @@ set(CONTROL_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/startactivity.h
${CMAKE_CURRENT_SOURCE_DIR}/textinput.cpp
${CMAKE_CURRENT_SOURCE_DIR}/textinput.h
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${CONTROL_PAGE_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
5 changes: 2 additions & 3 deletions src/cpp/flashPageTools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 添加源文件
set(FLASH_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/fastbootdevicemanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fastbootdevicemanager.h
Expand All @@ -8,8 +7,8 @@ set(FLASH_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/flashtools.h
${CMAKE_CURRENT_SOURCE_DIR}/flashUrlHandle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/flashUrlHandle.h
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${FLASH_PAGE_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
5 changes: 2 additions & 3 deletions src/cpp/imagePageTool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# 添加源文件
set(IMAGE_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/imagePageTool.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imagePageTool.h
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${IMAGE_PAGE_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
5 changes: 2 additions & 3 deletions src/cpp/infoPageTool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 添加源文件
set(INFO_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/adbcontrol.cpp
${CMAKE_CURRENT_SOURCE_DIR}/adbcontrol.h
Expand All @@ -12,8 +11,8 @@ set(INFO_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/infopagetool.h
${CMAKE_CURRENT_SOURCE_DIR}/realtimeinfohelper.h
${CMAKE_CURRENT_SOURCE_DIR}/realtimeinfohelper.cpp
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${INFO_PAGE_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
5 changes: 2 additions & 3 deletions src/cpp/settingPageTools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 添加源文件
set(SETTING_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/bingwallpaperhander.cpp
${CMAKE_CURRENT_SOURCE_DIR}/bingwallpaperhander.h
Expand All @@ -8,8 +7,8 @@ set(SETTING_PAGE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/wallpaperhelper.h
${CMAKE_CURRENT_SOURCE_DIR}/othersettingshandler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/othersettingshandler.h
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${SETTING_PAGE_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
5 changes: 2 additions & 3 deletions src/cpp/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 添加源文件
set(UTILS_SRC
${CMAKE_CURRENT_SOURCE_DIR}/constants.cpp
${CMAKE_CURRENT_SOURCE_DIR}/constants.h
Expand All @@ -10,8 +9,8 @@ set(UTILS_SRC
${CMAKE_CURRENT_SOURCE_DIR}/notificationcontroller.h
${CMAKE_CURRENT_SOURCE_DIR}/singleton.hpp
${CMAKE_CURRENT_SOURCE_DIR}/utils.hpp
PARENT_SCOPE
)

# 添加头文件路径
target_sources(${EXE_NAME} PRIVATE ${UTILS_SRC})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

0 comments on commit 781980c

Please sign in to comment.