about summary refs log tree commit diff stats
path: root/CMakeLists.txt
blob: c3186dff33b6ebb096ebc064fe35895169d2303f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
)

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(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
                         GIT_TAG c4713a704ca12237485ecbfec185f76c2a81bd09)

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(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz) ##https://github.com/nlohmann/json/releases/latest/download/json.tar.xz

FetchContent_MakeAvailable(json cpr)

find_package(SQLite3 REQUIRED)

## find_package(PCAP REQUIRED)

# find_package(pybind11 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)
target_include_directories(${PROJECT_NAME} PRIVATE src)
target_compile_definitions(${PROJECT_NAME} PRIVATE DEF_APPDATA="${DEF_APPDATA}")

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
)