Merge pull request #15 from kdeng00/v0.3

V0.3
This commit was merged in pull request #15.
This commit is contained in:
Kun Deng
2022-08-07 21:37:39 -04:00
committed by GitHub
10 changed files with 269 additions and 37 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "3rdparty/vcpkg"]
path = 3rdparty/vcpkg
url = https://github.com/microsoft/vcpkg
Vendored Submodule
+1
Submodule 3rdparty/vcpkg added at f93ba152d5
+46 -27
View File
@@ -1,41 +1,63 @@
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.23.3)
set(VCPKG_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/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()
project(IcarusDownloadManager)
set(SOFTWARE_DESCRIPTION
"A tool to interact with the Icarus Music streaming API")
set(SOFTWARE_VERSION
"0.3.0")
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 +67,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()
@@ -69,19 +91,16 @@ 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(${CPR_INCLUDE_DIRS} ${IDM_INCLUDE_DIR})
include_directories(${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 PUBLIC ${CONAN_LIBS})
target_link_libraries(icd PRIVATE nlohmann_json::nlohmann_json OpenSSL::SSL OpenSSL::Crypto CURL::libcurl cpr::cpr)
+31
View File
@@ -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
+157
View File
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectGuid>{12955990-643F-4A99-95E5-4752AFA179B0}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(ProjectDir)include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(ProjectDir)include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\Main.cpp" />
<ClCompile Include="src\managers\ActionManager.cpp" />
<ClCompile Include="src\managers\CommitManager.cpp" />
<ClCompile Include="src\managers\FileManager.cpp" />
<ClCompile Include="src\managers\TokenManager.cpp" />
<ClCompile Include="src\managers\UserManager.cpp" />
<ClCompile Include="src\models\Song.cpp" />
<ClCompile Include="src\parsers\APIParser.cpp" />
<ClCompile Include="src\syncers\Delete.cpp" />
<ClCompile Include="src\syncers\Download.cpp" />
<ClCompile Include="src\syncers\RetrieveRecords.cpp" />
<ClCompile Include="src\syncers\Upload.cpp" />
<ClCompile Include="src\utilities\Conversions.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\managers\ActionManager.h" />
<ClInclude Include="include\managers\CommitManager.h" />
<ClInclude Include="include\managers\FileManager.h" />
<ClInclude Include="include\managers\TokenManager.h" />
<ClInclude Include="include\managers\UserManager.h" />
<ClInclude Include="include\models\API.h" />
<ClInclude Include="include\models\Flags.h" />
<ClInclude Include="include\models\IcarusAction.h" />
<ClInclude Include="include\models\Song.h" />
<ClInclude Include="include\models\Token.h" />
<ClInclude Include="include\models\UploadForm.h" />
<ClInclude Include="include\models\User.h" />
<ClInclude Include="include\parsers\APIParser.h" />
<ClInclude Include="include\syncers\Delete.h" />
<ClInclude Include="include\syncers\Download.h" />
<ClInclude Include="include\syncers\RetrieveRecords.h" />
<ClInclude Include="include\syncers\SyncerBase.h" />
<ClInclude Include="include\syncers\Upload.h" />
<ClInclude Include="include\utilities\Checks.h" />
<ClInclude Include="include\utilities\Conversions.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+18 -6
View File
@@ -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,17 +17,29 @@ IcarusDownloadManager is a Linux CLI software client application that has the fe
### Getting Started
Build the project:
Clone the repo
```
git clone --recursive https://github.com/kdeng00/IcarusDownloadManager
```
Install packages
```
vcpkg install nlohman-json
vcpkg install openssl
vcpkg install curl
vcpkg install cpr
```
Build the project:
```
cd IcarusDownloadManager
mkdir build
cd build
conan install .. --build
cmake ..
cmake --build . --config release -j
```
+1
View File
@@ -2,6 +2,7 @@
#define CHECKS_H_
#include<algorithm>
#include<string>
#include<cstdlib>
#include<ctype.h>
+9 -1
View File
@@ -14,7 +14,7 @@ using Managers::CommitManager;
constexpr static auto IcarusDownloadManager_version()
{
return "v0.2.0";
return "v0.3.0";
}
void printHelp()
@@ -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 with metadata\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";
+1 -1
View File
@@ -48,7 +48,7 @@ void ActionManager::initialize()
}
void ActionManager::validateFlags()
{
cout<<"Validating flags\n";
cout<<"Validating flags\n";
const auto flagVals = parsedFlags();
+2 -2
View File
@@ -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;