From c41cd9dbb78b81af0a2d6233421505ff8c6109fd Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Aug 2022 19:51:29 -0400 Subject: [PATCH 1/8] Fixed build issue --- CMakeLists.txt | 41 ++++++++++++++++++++-------------- src/Main.cpp | 2 +- src/Managers/ActionManager.cpp | 2 +- src/Managers/CommitManager.cpp | 4 ++-- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9f6ce7..eceaa09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,41 +1,48 @@ -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.23.3) + +set(SOFTWARE_DESCRIPTION + "A music streaming Web API that provides a way for users to stream their personal music collection") +set(SOFTWARE_VERSION + "0.3.0") -project(IcarusDownloadManager) +project(IcarusDownloadManager VERSION ${SOFTWARE_VERSION} DESCRIPTION ${SOFTWARE_DESCRIPTION} LANGUAGES CXX) -message(STATUS "Checking compiler flags for C++17 support.") -# Set C++17 support flags for various compilers +message(STATUS "Checking compiler flags for C++20 support.") +# Set C++20 support flags for various compilers include(CheckCXXCompilerFlag) if(WIN32) - message("Windows") - set(vs_ver 19.29.30138) + message("Windows environment") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL ${vs_ver}) + if (MSVC_VERSION GREATER_EQUAL "1900") message("Visual Studio version is at least ${vs_ver}") - set(CMAKE_CXX_STANDARD_COMPILE_OPTION "-std:c++latest") - set(CMAKE_CXX_EXTENSION_COMPILE_OPTION "-std:c++latest") + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("/std:c++20" _cpp_latest_flag_supported) + if (_cpp_latest_flag_supported) + add_compile_options("/std:c++20") + endif() - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() else() - check_cxx_compiler_flag("-std=c++17" COMPILER_SUPPORTS_CXX17) + check_cxx_compiler_flag("-std=c++20" COMPILER_SUPPORTS_CXX20) check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X) - if(COMPILER_SUPPORTS_CXX17) - message(STATUS "C++17 is supported.") + if(COMPILER_SUPPORTS_CXX20) + message(STATUS "C++20 is supported.") - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -stdlib=libc++") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") endif() elseif(COMPILER_SUPPORTS_CXX0X) message(STATUS "C++0x is supported.") @@ -45,7 +52,7 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") endif() else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.") + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++20 support. Please use a different C++ compiler.") endif() endif() diff --git a/src/Main.cpp b/src/Main.cpp index eada2a0..0008c1b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -14,7 +14,7 @@ using Managers::CommitManager; constexpr static auto IcarusDownloadManager_version() { - return "v0.2.0"; + return "v0.3.0"; } void printHelp() diff --git a/src/Managers/ActionManager.cpp b/src/Managers/ActionManager.cpp index 697f5d4..27a6bfc 100644 --- a/src/Managers/ActionManager.cpp +++ b/src/Managers/ActionManager.cpp @@ -48,7 +48,7 @@ void ActionManager::initialize() } void ActionManager::validateFlags() { - cout<<"Validating flags\n"; + cout<<"Validating flags\n"; const auto flagVals = parsedFlags(); diff --git a/src/Managers/CommitManager.cpp b/src/Managers/CommitManager.cpp index 0fec9ac..bc56e12 100644 --- a/src/Managers/CommitManager.cpp +++ b/src/Managers/CommitManager.cpp @@ -308,8 +308,8 @@ void CommitManager::singTargetUpload(const std::string &songPath, const std::str } song = *sng; - const auto p = fs::path(songPath); - song.directory = p.parent_path.string(); + const auto p = filesystem::path(songPath); + song.directory = p.parent_path().string(); song.generate_filename_from_track(); Models::CoverArt cover; -- 2.47.3 From f70acba7048729cf3306d2b0db1257038845cfe2 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Aug 2022 20:04:02 -0400 Subject: [PATCH 2/8] Added vcpkg --- .gitmodules | 3 +++ 3rdparty/vcpkg | 1 + CMakeLists.txt | 29 ++++++++++++++++++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) create mode 160000 3rdparty/vcpkg diff --git a/.gitmodules b/.gitmodules index e69de29..90e3bc2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "3rdparty/vcpkg"] + path = 3rdparty/vcpkg + url = https://github.com/microsoft/vcpkg diff --git a/3rdparty/vcpkg b/3rdparty/vcpkg new file mode 160000 index 0000000..9b22b40 --- /dev/null +++ b/3rdparty/vcpkg @@ -0,0 +1 @@ +Subproject commit 9b22b40c6c61bf0da2d46346dd44a11e90972cc9 diff --git a/CMakeLists.txt b/CMakeLists.txt index eceaa09..edcd7ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,20 @@ cmake_minimum_required(VERSION 3.23.3) +set(VCPKG_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/icarus/3rdparty/vcpkg) + +message("The vcpkg root path ${VCPKG_ROOT_PATH}") + +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + set(TOOLCHAIN_PATH ${VCPKG_ROOT_PATH}/scripts/buildsystems/vcpkg.cmake) + + set(CMAKE_TOOLCHAIN_FILE + "${TOOLCHAIN_PATH}" + CACHE STRING "Vcpkg toolchain file") + + message("Using default toolchain file") +endif() + + set(SOFTWARE_DESCRIPTION "A music streaming Web API that provides a way for users to stream their personal music collection") set(SOFTWARE_VERSION @@ -77,18 +92,18 @@ set(IDM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") # conan -set(CONAN_BUILDINFO -${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +# set(CONAN_BUILDINFO +# ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -message("conan build info ${CONAN_BUILDINFO}") -include(${CONAN_BUILDINFO}) -conan_basic_setup() +# message("conan build info ${CONAN_BUILDINFO}") +# include(${CONAN_BUILDINFO}) +# conan_basic_setup() -include_directories(${CPR_INCLUDE_DIRS} ${IDM_INCLUDE_DIR}) +# include_directories(${CPR_INCLUDE_DIRS} ${IDM_INCLUDE_DIR}) set(USE_SYSTEM_CURL OFF) set(BUILD_CPR_TESTS OFF) add_executable(icd ${SOURCES}) -target_link_libraries(icd PUBLIC ${CONAN_LIBS}) +# target_link_libraries(icd PUBLIC ${CONAN_LIBS}) -- 2.47.3 From ed5ceedb44592fa5fb7e72be0fe21ab6e70cf28b Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Aug 2022 20:04:57 -0400 Subject: [PATCH 3/8] vcpkg version Version 2022.07.25 --- 3rdparty/vcpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/vcpkg b/3rdparty/vcpkg index 9b22b40..f93ba15 160000 --- a/3rdparty/vcpkg +++ b/3rdparty/vcpkg @@ -1 +1 @@ -Subproject commit 9b22b40c6c61bf0da2d46346dd44a11e90972cc9 +Subproject commit f93ba152d55e1d243160e690bc302ffe8638358e -- 2.47.3 From 3195011f996839bf60ec594940f1cd73b7005a76 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Aug 2022 20:42:11 -0400 Subject: [PATCH 4/8] vcpkg is operational --- CMakeLists.txt | 11 +++++++++-- README.md | 17 ++++++++++++----- src/Main.cpp | 8 ++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edcd7ff..7375465 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.23.3) -set(VCPKG_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/icarus/3rdparty/vcpkg) +set(VCPKG_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/vcpkg) message("The vcpkg root path ${VCPKG_ROOT_PATH}") @@ -16,7 +16,7 @@ endif() set(SOFTWARE_DESCRIPTION - "A music streaming Web API that provides a way for users to stream their personal music collection") + "A tool to interact with the Icarus Music streaming API") set(SOFTWARE_VERSION "0.3.0") @@ -99,11 +99,18 @@ set(IDM_INCLUDE_DIR # include(${CONAN_BUILDINFO}) # conan_basic_setup() +include_directories(${IDM_INCLUDE_DIR}) # include_directories(${CPR_INCLUDE_DIRS} ${IDM_INCLUDE_DIR}) set(USE_SYSTEM_CURL OFF) set(BUILD_CPR_TESTS OFF) +find_package(nlohmann_json CONFIG REQUIRED) +find_package(OpenSSL REQUIRED) +find_package(CURL REQUIRED) +find_package(cpr CONFIG REQUIRED) + add_executable(icd ${SOURCES}) +target_link_libraries(icd PRIVATE nlohmann_json::nlohmann_json OpenSSL::SSL OpenSSL::Crypto CURL::libcurl cpr::cpr) # target_link_libraries(icd PUBLIC ${CONAN_LIBS}) diff --git a/README.md b/README.md index 4434a28..b686713 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ IcarusDownloadManager is a Linux CLI software client application that has the fe ## Built With -* C++ with C++17 features +* C++ with C++20 features * CMake -* GCC >= 9 or Visual Studio >= 16 [2019] -* [conan](https://github.com/conan-io/conan) +* GCC >= 10 or Visual Studio >= 17 [2022] +* [vcpkg](https://github.com/microsoft/vcpkg) * [json](https://github.com/nlohmann/json) * [openssl](https://github.com/openssl/openssl) * [curl](https://github.com/curl/curl) @@ -17,6 +17,15 @@ IcarusDownloadManager is a Linux CLI software client application that has the fe ### Getting Started +Install packages + +``` +vcpkg install nlohman-json +vcpkg install openssl +vcpkg install curl +vcpkg install cpr +``` + Build the project: ``` @@ -26,8 +35,6 @@ git clone --recursive https://github.com/kdeng00/IcarusDownloadManager mkdir build cd build -conan install .. --build - cmake .. cmake --build . --config release -j ``` diff --git a/src/Main.cpp b/src/Main.cpp index 0008c1b..ceec347 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -24,6 +24,7 @@ void printHelp() cout<<"Actions\n"; cout<<"download\n"; cout<<"upload\n"; + cout<<"upload-meta\n"; cout<<"retrieve\n"; cout<<"delete\n\n"; @@ -39,6 +40,13 @@ void printHelp() cout<<"-sr directory where to recursively search for songs to upload (Optional)\n"; cout<<"-nc will not prompt the user when uploading from a directory\n\n"; + cout<<"Required for upload\n"; + cout<<"-s path of song\n"; + cout<<"-t track number\n"; + cout<<"-m metadata filepath\n"; + cout<<"-ca coverart filepath\n"; + cout<<"-scma directory where songs, metadata, and cover art exists and will be uploaded (Optional)\n\n"; + cout<<"Required for download\n"; cout<<"-b song id\n"; cout<<"-d path to download song (Optional)\n\n"; -- 2.47.3 From 274354310291ffe39ba00c204bd884247ad3f2c7 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Aug 2022 20:44:37 -0400 Subject: [PATCH 5/8] Clean up --- CMakeLists.txt | 12 +----------- README.md | 11 ++++++++--- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7375465..c009a5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,8 @@ set(SOFTWARE_VERSION project(IcarusDownloadManager VERSION ${SOFTWARE_VERSION} DESCRIPTION ${SOFTWARE_DESCRIPTION} LANGUAGES CXX) - message(STATUS "Checking compiler flags for C++20 support.") + # Set C++20 support flags for various compilers include(CheckCXXCompilerFlag) @@ -91,16 +91,7 @@ set(SOURCES set(IDM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") -# conan -# set(CONAN_BUILDINFO -# ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -# message("conan build info ${CONAN_BUILDINFO}") -# include(${CONAN_BUILDINFO}) -# conan_basic_setup() - include_directories(${IDM_INCLUDE_DIR}) -# include_directories(${CPR_INCLUDE_DIRS} ${IDM_INCLUDE_DIR}) set(USE_SYSTEM_CURL OFF) set(BUILD_CPR_TESTS OFF) @@ -113,4 +104,3 @@ find_package(cpr CONFIG REQUIRED) add_executable(icd ${SOURCES}) target_link_libraries(icd PRIVATE nlohmann_json::nlohmann_json OpenSSL::SSL OpenSSL::Crypto CURL::libcurl cpr::cpr) -# target_link_libraries(icd PUBLIC ${CONAN_LIBS}) diff --git a/README.md b/README.md index b686713..5d0a2a4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ IcarusDownloadManager is a Linux CLI software client application that has the fe ### Getting Started +Clone the repo + +``` +git clone --recursive https://github.com/kdeng00/IcarusDownloadManager +``` + Install packages ``` @@ -26,12 +32,11 @@ vcpkg install curl vcpkg install cpr ``` + Build the project: ``` -git clone --recursive https://github.com/kdeng00/IcarusDownloadManager - - +cd IcarusDownloadManager mkdir build cd build -- 2.47.3 From c624c4de5102f8d7525c613bed84050c10cd917e Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Aug 2022 21:15:07 -0400 Subject: [PATCH 6/8] Missing include --- include/Utilities/Checks.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/Utilities/Checks.h b/include/Utilities/Checks.h index b4c186d..eb684ea 100644 --- a/include/Utilities/Checks.h +++ b/include/Utilities/Checks.h @@ -2,6 +2,7 @@ #define CHECKS_H_ #include +#include #include #include -- 2.47.3 From 435a0df9419f403d1303d9c921a6cc28fbeaa6cd Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Aug 2022 21:15:54 -0400 Subject: [PATCH 7/8] Added build files Added Visual studio build files --- IcarusDownloadManager.sln | 31 +++++++ IcarusDownloadManager.vcxproj | 157 ++++++++++++++++++++++++++++++++++ 2 files changed, 188 insertions(+) create mode 100644 IcarusDownloadManager.sln create mode 100644 IcarusDownloadManager.vcxproj diff --git a/IcarusDownloadManager.sln b/IcarusDownloadManager.sln new file mode 100644 index 0000000..df5cd41 --- /dev/null +++ b/IcarusDownloadManager.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32630.192 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IcarusDownloadManager", "IcarusDownloadManager.vcxproj", "{12955990-643F-4A99-95E5-4752AFA179B0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {12955990-643F-4A99-95E5-4752AFA179B0}.Debug|x64.ActiveCfg = Debug|x64 + {12955990-643F-4A99-95E5-4752AFA179B0}.Debug|x64.Build.0 = Debug|x64 + {12955990-643F-4A99-95E5-4752AFA179B0}.Debug|x86.ActiveCfg = Debug|Win32 + {12955990-643F-4A99-95E5-4752AFA179B0}.Debug|x86.Build.0 = Debug|Win32 + {12955990-643F-4A99-95E5-4752AFA179B0}.Release|x64.ActiveCfg = Release|x64 + {12955990-643F-4A99-95E5-4752AFA179B0}.Release|x64.Build.0 = Release|x64 + {12955990-643F-4A99-95E5-4752AFA179B0}.Release|x86.ActiveCfg = Release|Win32 + {12955990-643F-4A99-95E5-4752AFA179B0}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EA22B463-3EA6-4452-9AF1-D300C3BDE72D} + EndGlobalSection +EndGlobal diff --git a/IcarusDownloadManager.vcxproj b/IcarusDownloadManager.vcxproj new file mode 100644 index 0000000..7fa6cf8 --- /dev/null +++ b/IcarusDownloadManager.vcxproj @@ -0,0 +1,157 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + {12955990-643F-4A99-95E5-4752AFA179B0} + Win32Proj + 10.0 + + + + Application + true + v143 + + + Application + false + v143 + + + Application + true + v143 + + + Application + false + v143 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + $(ProjectDir)include;$(IncludePath) + + + $(ProjectDir)include;$(IncludePath) + + + + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + stdcpp20 + + + + + stdcpp20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.47.3 From 77acd151058744a099d147c49e9bf243f670a4a2 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Aug 2022 21:34:41 -0400 Subject: [PATCH 8/8] Able to debug with Visual Studio --- src/Main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Main.cpp b/src/Main.cpp index ceec347..73a1980 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -40,7 +40,7 @@ void printHelp() cout<<"-sr directory where to recursively search for songs to upload (Optional)\n"; cout<<"-nc will not prompt the user when uploading from a directory\n\n"; - cout<<"Required for upload\n"; + cout<<"Required for upload with metadata\n"; cout<<"-s path of song\n"; cout<<"-t track number\n"; cout<<"-m metadata filepath\n"; -- 2.47.3