Add: conan support

This commit is contained in:
2021-06-03 02:54:44 +02:00
parent 0ad8735519
commit 3baf88ba0a
5 changed files with 58 additions and 19 deletions

3
.gitignore vendored
View File

@@ -20,3 +20,6 @@ CMakeSettings.json
Modules/Website/elm-stuff/
Modules/Website/.vscode/settings.json
build/
.vscode/settings.json

View File

@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.16)
option(USE_VCPKG "Use Vcpkg" OFF)
option(USE_CONAN "use conan" ON)
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{VCPKG_ROOT})
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
endif()
@@ -7,14 +10,21 @@ message("using vcpkg toolchain: ${CMAKE_TOOLCHAIN_FILE}" )
project(localTube)
set(CMAKE_CXX_STANDARD 20)
if(NOT USE_CONAN)
find_package(fmt CONFIG REQUIRED)
find_package(SOCI CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Boost COMPONENTS system filesystem REQUIRED)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
elseif(USE_CONAN)
find_package(fmt CONFIG REQUIRED)
find_package(soci CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Boost COMPONENTS system filesystem REQUIRED)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
endif()
add_subdirectory(Modules)

View File

@@ -8,10 +8,13 @@ set(src_files
src/tables.hpp)
add_executable(. ${src_files})
add_executable(localTubeServer ${src_files})
target_link_libraries(.
if(USE_CONAN)
set(LIBS ${CONAN_LIBS})
else()
set(LIBS
fmt::fmt
spdlog::spdlog
SOCI::soci_core
@@ -21,3 +24,8 @@ target_link_libraries(.
Boost::boost
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY})
endif()
target_link_libraries(localTubeServer ${LIBS})

View File

@@ -1,6 +1,5 @@
module Files exposing (..)
import Debug exposing (toString)
import String
import Element exposing (..)
import Element.Border as Border
import Element.Font as Font
@@ -177,7 +176,7 @@ viewFile file =
, alignBottom
, alignRight
]
{ url = String.concat [ "http://127.0.0.1/api/file/", toString file.id ]
{ url = String.concat [ "http://127.0.0.1/api/file/", String.fromInt file.id ]
, label = text "Download"
}
]

19
conanfile.txt Normal file
View File

@@ -0,0 +1,19 @@
[requires]
boost/1.76.0
soci/4.0.2
fmt/7.1.3
spdlog/1.8.5
cpp-httplib/0.8.8
magic_enum/0.7.2
ctre/3.4.1
nlohmann_json/3.9.1
[generators]
cmake
[options]
soci:shared=True
soci:with_boost=True
soci:with_sqlite3=True
soci:with_odbc=True
soci:with_postgresql=True