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/elm-stuff/
Modules/Website/.vscode/settings.json Modules/Website/.vscode/settings.json
build/
.vscode/settings.json

View File

@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.16) 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}) if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{VCPKG_ROOT})
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
endif() endif()
@@ -7,14 +10,21 @@ message("using vcpkg toolchain: ${CMAKE_TOOLCHAIN_FILE}" )
project(localTube) project(localTube)
set(CMAKE_CXX_STANDARD 20) 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) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
find_package(soci CONFIG REQUIRED) conan_basic_setup()
find_package(spdlog CONFIG REQUIRED) endif()
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Boost COMPONENTS system filesystem REQUIRED)
add_subdirectory(Modules) add_subdirectory(Modules)

View File

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

View File

@@ -1,6 +1,5 @@
module Files exposing (..) module Files exposing (..)
import String
import Debug exposing (toString)
import Element exposing (..) import Element exposing (..)
import Element.Border as Border import Element.Border as Border
import Element.Font as Font import Element.Font as Font
@@ -177,7 +176,7 @@ viewFile file =
, alignBottom , alignBottom
, alignRight , 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" , 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