-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
88 changed files
with
141 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[submodule "QCloudMusicApi/openssl-cmake"] | ||
path = QCloudMusicApi/openssl-cmake | ||
[submodule "src/QCloudMusicApi/openssl-cmake"] | ||
path = src/QCloudMusicApi/openssl-cmake | ||
url = https://github.com/janbar/openssl-cmake.git | ||
[submodule "Test/libqrencode"] | ||
path = Test/libqrencode | ||
[submodule "src/Test/libqrencode"] | ||
path = src/Test/libqrencode | ||
url = https://github.com/fukuchi/libqrencode.git |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(QCloudMusicApiProject VERSION 1.0) | ||
project(QCloudMusicApi VERSION 1.0) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD ON) | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
|
||
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows/Macos") | ||
|
||
option(MUSICAPI_TEST "Build Test" ON) | ||
option(MUSICAPI_SERVER "Build ApiServer" ON) | ||
option(MUSICAPI_SETOUTPUTPATH "Set default output path" ON) | ||
|
||
if(ANDROID OR IOS) | ||
set(MUSICAPI_SETOUTPUTPATH OFF) | ||
endif() | ||
# 生成动态库 | ||
option(BUILD_SHARED_LIBS "Build shared libraries" ON) | ||
|
||
if(MUSICAPI_SETOUTPUTPATH) | ||
# set default output path | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${CMAKE_INSTALL_BINDIR}) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${CMAKE_INSTALL_LIBDIR}) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${CMAKE_INSTALL_BINDIR}) | ||
set(CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${CMAKE_INSTALL_BINDIR}) | ||
set(CMAKE_HEADER_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/include) | ||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) | ||
set(CMAKE_PDB_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} ${CMAKE_PDB_OUTPUT_DIRECTORY}) | ||
|
||
|
||
# 设置安装前缀为二进制目录 | ||
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}) | ||
endif() | ||
|
||
add_subdirectory(QCloudMusicApi) | ||
if(MUSICAPI_TEST) | ||
add_subdirectory(Test) | ||
endif() | ||
|
||
find_package(QT NAMES Qt6 Qt5) | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS HttpServer) | ||
if(Qt${QT_VERSION_MAJOR}HttpServer_FOUND) | ||
# Qt6.4后才支持QHttpServer库 | ||
if(MUSICAPI_SERVER) | ||
add_subdirectory(ApiServer) | ||
endif() | ||
endif() | ||
link_directories(${CMAKE_BINARY_DIR}/lib) | ||
|
||
add_subdirectory(src) | ||
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT Test) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "logger.h" | ||
|
||
Q_LOGGING_CATEGORY(LOGGER_NAME, TARGET_NAME) | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/Debug/src) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/Release/src) | ||
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/bin/${PROJECT_NAME} CACHE PATH "Specify Install Dir" FORCE) | ||
|
||
add_subdirectory(QCloudMusicApi) | ||
if(MUSICAPI_TEST) | ||
add_subdirectory(Test) | ||
endif() | ||
find_package(QT NAMES Qt6 Qt5) | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS HttpServer) | ||
if(Qt${QT_VERSION_MAJOR}HttpServer_FOUND) | ||
# Qt6.4后才支持QHttpServer库 | ||
if(MUSICAPI_SERVER) | ||
add_subdirectory(ApiServer) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
set(TARGET_NAME QCloudMusicApi) | ||
|
||
# Provides dependency openssl | ||
option( WITH_APPS "Build applications" OFF ) | ||
#find_package(OpenSSL QUIET) | ||
if(NOT OPENSSL_FOUND) | ||
add_subdirectory( | ||
${CMAKE_CURRENT_SOURCE_DIR}/openssl-cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/openssl-cmake | ||
EXCLUDE_FROM_ALL | ||
) | ||
set(OPENSSL_SSL_LIBRARY ssl) | ||
set(OPENSSL_CRYPTO_LIBRARY crypto) | ||
set(OPENSSL_INCLUDE_DIR "${openssl_BINARY_DIR}/include" "${openssl_BINARY_DIR}") | ||
set(OPENSSL_FOUND ON) | ||
set(OPENSSL_BUILD_SHARED_LIBS ON) | ||
message(STATUS "Build OpenSSL: ${openssl_BINARY_DIR}") | ||
endif() | ||
|
||
set (HAVE_OPENSSL 1) | ||
include_directories (${OPENSSL_INCLUDE_DIR}) | ||
|
||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network Gui) | ||
|
||
FILE(GLOB HEADERS ./*.h ./util/*.h) | ||
FILE(GLOB SOURCES ./*.cpp ./util/*.cpp) | ||
|
||
FILE(GLOB PUBLIC_HEADERS ./*.h) | ||
|
||
add_library(${TARGET_NAME} | ||
${HEADERS} | ||
${SOURCES} | ||
) | ||
target_compile_definitions(${TARGET_NAME} PRIVATE | ||
QCLOUDMUSICAPI_LIBRARY | ||
TARGET_NAME="${TARGET_NAME}" | ||
) | ||
target_compile_definitions(${TARGET_NAME} PRIVATE QT_MESSAGELOGCONTEXT) | ||
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "") | ||
|
||
target_link_libraries(${TARGET_NAME} | ||
Qt${QT_VERSION_MAJOR}::Core | ||
Qt${QT_VERSION_MAJOR}::Network | ||
Qt${QT_VERSION_MAJOR}::Gui | ||
${OPENSSL_SSL_LIBRARY} | ||
${OPENSSL_CRYPTO_LIBRARY} | ||
) | ||
|
||
if(BUILD_SHARED_LIBS) | ||
target_compile_definitions(${TARGET_NAME} PRIVATE BUILD_SHARED_LIBS) | ||
endif() | ||
|
||
install(FILES ${PUBLIC_HEADERS} DESTINATION $<CONFIG>/include/${TARGET_NAME}) | ||
install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION $<CONFIG>/bin ARCHIVE DESTINATION $<CONFIG>/lib) | ||
install(DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/ CONFIGURATIONS Debug DESTINATION $<CONFIG>/bin FILES_MATCHING PATTERN *.pdb) | ||
install(DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/ CONFIGURATIONS Release DESTINATION $<CONFIG>/bin FILES_MATCHING PATTERN *.pdb) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
QCloudMusicApi/util/logger.cpp → src/QCloudMusicApi/util/logger.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#include "logger.h" | ||
|
||
namespace QCloudMusicApi { | ||
Q_LOGGING_CATEGORY(LOGGER_NAME, PROJECT_NAME) | ||
Q_LOGGING_CATEGORY(LOGGER_NAME, TARGET_NAME) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.