blob: 0618420bff1f6b869823779bb5d1ab8f3ad537e6 (
plain) (
tree)
|
|
cmake_minimum_required(VERSION 3.26.0)
project(ytcpp
LANGUAGES CXX
VERSION 0.0.1
HOMEPAGE_URL https://crow.port0.org/git/comradecrow/ytcpp.git
)
if(PROJECT_IS_TOP_LEVEL)
include(CTest)
enable_testing()
endif()
# set(PROJECT_SOURCE_DIR "src")
set(PROJECT_INCLUDE_DIR "include")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
if(WIN32) # Install dlls in the same directory as the executable on Windows
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
include(FetchContent)
FetchContent_Declare(ftxui GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui.git
GIT_TAG d301fab1f4ecdd3544ed99b9c98e647d5804c341)
FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
FetchContent_Populate(ftxui)
add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 86545977e719fe3a54c407845e8cd340d15f0fd2)
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
URL_HASH SHA256=8c4b26bf4b422252e13f332bc5e388ec0ab5c3443d24399acb675e68278d341f) ##https://github.com/nlohmann/json/releases/latest/download/json.tar.xz
FetchContent_MakeAvailable(json cpr)
find_package(SQLite3 REQUIRED)
add_subdirectory(extern/pybind11)
find_package(Ytdlp REQUIRED RUNTIME)
if(UNIX)
file(TO_CMAKE_PATH "$ENV{HOME}/.local/share/${PROJECT_NAME}" DEF_APPDATA)
elseif(WIN32)
file(TO_CMAKE_PATH "$ENV{LOCALAPPDATA}\\${PROJECT_NAME}" DEF_APPDATA)
else()
message(SEND_ERROR "OS not recognized!")
file(TO_CMAKE_PATH "./data" DEF_APPDATA)
endif()
add_executable(${PROJECT_NAME}
src/main.cpp
src/tui.cpp
src/invapi.cpp
src/YtdlpWrapper.cpp
src/sqliteinterface.cpp
src/video.cpp
)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE_DIR})
target_compile_definitions(${PROJECT_NAME}
PRIVATE DEF_APPDATA="${DEF_APPDATA}"
PRIVATE PROGRAM_NAME="${PROJECT_NAME}"
PRIVATE VERSION="${PROJECT_VERSION}"
)
target_link_libraries(${PROJECT_NAME}
PRIVATE cpr::cpr
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component
PRIVATE nlohmann_json::nlohmann_json
PRIVATE SQLite::SQLite3
PRIVATE pybind11::embed
)
# set(CPACK_PROJECT_NAME ${PROJECT_NAME})
# set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_VENDOR "ComradeCrow")
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE.txt)
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
set(PROJECT_SOURCE_DIR "src")
include(CPack)
|