Пока не билдится
This commit is contained in:
@@ -1,16 +1,58 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(cpp-opds)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(ODB_INCLUDE_DIRS /usr/include)
|
||||
set(ODB_LIBRARY_DIRS /usr/lib/x86_64-linux-gnu)
|
||||
|
||||
include_directories(${ODB_INCLUDE_DIRS})
|
||||
link_directories(${ODB_LIBRARY_DIRS})
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Sql Network)
|
||||
# find_package(ODB REQUIRED)
|
||||
# find_package(SQLite3 REQUIRED)
|
||||
|
||||
find_library(ODB_LIBRARIES NAMES odb HINTS ${ODB_LIBRARY_DIRS})
|
||||
find_library(ODB_SQLITE_LIBRARIES NAMES odb-sqlite HINTS ${ODB_LIBRARY_DIRS})
|
||||
|
||||
|
||||
set(CMAKE_AUTOMOC ON) # <-- Включаем автоматическую генерацию MOC-файлов
|
||||
|
||||
add_executable(cpp-opds
|
||||
# include_directories(${ODB_INCLUDE_DIRS} ${SQLite3_INCLUDE_DIRS})
|
||||
# link_directories(${ODB_LIBRARY_DIRS} ${SQLite3_LIBRARY_DIRS})
|
||||
|
||||
# add_executable(cpp-opds
|
||||
# src/main.cpp
|
||||
# include/backend.cpp
|
||||
# )
|
||||
|
||||
set(SOURCE_FILES
|
||||
src/main.cpp
|
||||
include/backend.cpp
|
||||
# src/database.cpp
|
||||
# src/book.cpp
|
||||
# src/author.hpp
|
||||
)
|
||||
|
||||
set(ODB_SOURCES
|
||||
src/book
|
||||
src/author
|
||||
)
|
||||
|
||||
# Генерация ODB файлов
|
||||
foreach(file ${ODB_SOURCES})
|
||||
add_custom_command(
|
||||
OUTPUT ${file}.odb.cpp ${file}.odb.hpp
|
||||
COMMAND odb --generate-query --generate-schema --database sqlite ${file}.hpp
|
||||
DEPENDS ${file}.hpp
|
||||
COMMENT "Running ODB on ${file}.hpp"
|
||||
)
|
||||
list(APPEND SOURCE_FILES ${file}.odb.cpp)
|
||||
endforeach()
|
||||
|
||||
add_executable(cpp-opds ${SOURCE_FILES})
|
||||
|
||||
target_include_directories(cpp-opds PRIVATE include)
|
||||
target_link_libraries(cpp-opds Qt6::Core Qt6::Sql Qt6::Network)
|
||||
# target_link_libraries(cpp-opds Qt6::Core Qt6::Sql Qt6::Network ${ODB_LIBRARIES} ${SQLite3_LIBRARIES})
|
||||
target_link_libraries(cpp-opds Qt6::Core Qt6::Sql Qt6::Network ${ODB_LIBRARIES} ${ODB_SQLITE_LIBRARIES})
|
||||
|
||||
Reference in New Issue
Block a user