修改以解决引用问题

This commit is contained in:
DevWiki 2023-10-10 16:25:43 +08:00
parent 50298ad6e8
commit 3145ee0d7d
5 changed files with 53 additions and 24 deletions

View File

@ -15,11 +15,6 @@ add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
# sdplog
include_directories(include/third_lib)
# WinDevice
add_subdirectory(../WinDevice WinDevice)
set(PROJECT_SOURCES
main.cpp
@ -51,14 +46,17 @@ else()
endif()
endif()
# WinDevice
add_subdirectory(../WinDevice WinDevice)
target_link_libraries(DeviceManager PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
# WinDevice
target_link_libraries(DeviceManager PRIVATE WinDevice)
# WinDevice
target_include_directories(DeviceManager PRIVATE
../WinDevice
)
# WinDeviceDeviceManager
target_include_directories(DeviceManager PRIVATE
../WinDevice/src #
include/third_lib
../WinDevice/src
)
set_target_properties(DeviceManager PROPERTIES

View File

@ -1,7 +1,9 @@
#include "mainwindow.h"
#include <QApplication>
#include "spdlog/spdlog.h"
#include "Video/ScreenManager.h"
#include "Utils/CmdUtil.h"
int main(int argc, char *argv[])
{
@ -9,5 +11,9 @@ int main(int argc, char *argv[])
MainWindow w;
w.show();
// ScreenManager screen_manager;
// screen_manager.UpdateDisplayInfo();
CmdUtil::ExecuteCommand("ls");
spdlog::info("000");
return a.exec();
}

View File

@ -1,23 +1,48 @@
# CMake
cmake_minimum_required(VERSION 3.12)
#
project(WinDevice VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
# C++
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# UTF-8
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
# UTF-8
option(ENABLE_UTF8_SOURCE "Enable UTF-8 source code encoding" ON)
# sdplog
include_directories(include/third_lib)
# UTF-8
if (ENABLE_UTF8_SOURCE)
# MSVC
if (MSVC)
# MSVCUTF-8
add_compile_options("/source-charset:utf-8")
# MinGW
elseif (CMAKE_COMPILER_IS_GNUCXX)
# MinGWUTF-8
add_compile_options("-fexec-charset=UTF-8" "-finput-charset=UTF-8")
endif()
endif()
# 使
file(GLOB WinDevice_SOURCES
"${CMAKE_SOURCE_DIR}/src/*.cpp"
"${CMAKE_SOURCE_DIR}/src/Audio/*.cpp"
"${CMAKE_SOURCE_DIR}/src/Video/*.cpp"
"${CMAKE_SOURCE_DIR}/src/Utils/*.cpp"
)
#
set(PROJECT_SOURCES
"src/Audio"
"src/Video"
"src/Utils"
add_library(WinDevice ${WinDevice_SOURCES})
# WinDevice
target_include_directories(WinDevice PUBLIC
"${CMAKE_SOURCE_DIR}/src"
)
# WinDevice
set(THIRD_LIB_DIR ${CMAKE_SOURCE_DIR}/include/third_lib)
target_include_directories(WinDevice PRIVATE
${THIRD_LIB_DIR}
"${CMAKE_SOURCE_DIR}/src"
)