From c108c868bfecf8e04cbabd9c10162afa43f65d6a Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Thu, 20 Jan 2022 23:42:44 -0500 Subject: [PATCH] Updated CMake file --- CMakeLists.txt | 34 +++++++++++++++++++++++++++++++++- README.md | 37 +++++++++++++++++++++++++++++++++++++ SpotifyDemo/CMakeLists.txt | 4 ++-- 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c26dd5..1d65e2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,39 @@ # CMakeList.txt : Top-level CMake project file, do global configuration # and include sub-projects here. # -cmake_minimum_required (VERSION 3.8) +cmake_minimum_required (VERSION 3.12) + + +if(NOT DEFINED VCPKG_ROOT_PATH) + set(VCPKG_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/vcpkg) + set(CMAKE_TOOLCHAIN_FILE + "${VCPKG_ROOT_PATH}/scripts/buildsystems/vcpkg.cmake" + CACHE STRING "Vcpkg toolchain file") +endif() + +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() + +if(NOT DEFINED VCPKG_TRIPLET) + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(MACOSX TRUE) + set(VCPKG_TRIPLET "x64-osx") + else () + set(VCPKG_TRIPLET "x64-linux") + endif() + + message("Using default ${VCPKG_TRIPLET} triplet") +endif() + project ("SpotifyDemo") diff --git a/README.md b/README.md new file mode 100644 index 0000000..3bcfd28 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# SpotifyDemo + +Experimenting with the Sptofiy API + + +## Built with + +* C++ +* cmake +* vcpkg +* nlohmann-json +* cpr +* cppcodec + +## Getting Started + +Install dependencies using `vcpkg` + +```console +vcpkg install nlohmann-json cpr cppcodec +``` + +Bootstrap vcpkg + +``` +cd SpotifyDemo/3rdparty/vcpkg +./[bootstrap.bat || bootstrap.sh] +``` + +Build the software + +```console +mkdir build +cd build +cmake .. +cmake --build . +``` diff --git a/SpotifyDemo/CMakeLists.txt b/SpotifyDemo/CMakeLists.txt index 1d37463..5f79930 100644 --- a/SpotifyDemo/CMakeLists.txt +++ b/SpotifyDemo/CMakeLists.txt @@ -1,7 +1,7 @@ # CMakeList.txt : CMake project for SpotifyDemo, include source and define # project specific logic here. # -cmake_minimum_required (VERSION 3.8) +# cmake_minimum_required (VERSION 3.8) set (CMAKE_CXX_STANDARD_REQUIRED ON) set (CMAKE_CXX_STANDARD 14) @@ -33,5 +33,5 @@ configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/client_information.json" "${CMAKE_B # Add source to this project's executable. add_executable (SpotifyDemo ${SOURCES}) -target_link_libraries (SpotifyDemo PRIVATE nlohmann_json nlohmann_json::nlohmann_json cpr) +target_link_libraries (SpotifyDemo PRIVATE nlohmann_json nlohmann_json::nlohmann_json cpr::cpr) target_include_directories (SpotifyDemo PRIVATE ${CPPCODEC_INCLUDE_DIRS})