76 lines
1.7 KiB
CMake
76 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(jtlsrv-cpp LANGUAGES C CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
# --- Dependencies -----------------------------------------------------------
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(LIBUV REQUIRED libuv)
|
|
pkg_check_modules(OPENSSL REQUIRED openssl)
|
|
pkg_check_modules(VIPS REQUIRED vips)
|
|
find_library(ODBC_LIBRARY odbc)
|
|
find_path(ODBC_INCLUDE_DIR sql.h)
|
|
|
|
# llhttp (vendored)
|
|
add_library(llhttp STATIC
|
|
vendor/llhttp.c
|
|
vendor/api.c
|
|
vendor/http.c
|
|
)
|
|
target_include_directories(llhttp PUBLIC vendor)
|
|
|
|
# nlohmann/json (vendored, header-only)
|
|
add_library(json INTERFACE)
|
|
target_include_directories(json INTERFACE vendor)
|
|
|
|
# --- jtlsrv -----------------------------------------------------------------
|
|
|
|
add_executable(jtlsrv
|
|
src/main.cpp
|
|
src/log.cpp
|
|
src/http.cpp
|
|
src/tls_server.cpp
|
|
src/pairing.cpp
|
|
src/router.cpp
|
|
src/endpoints/client.cpp
|
|
src/endpoints/init.cpp
|
|
src/endpoints/category.cpp
|
|
src/endpoints/product.cpp
|
|
src/endpoints/productcomposite.cpp
|
|
src/endpoints/deleted_entity.cpp
|
|
src/endpoints/customergroup.cpp
|
|
src/endpoints/order.cpp
|
|
src/endpoints/pimage.cpp
|
|
src/endpoints/cimage.cpp
|
|
src/db/pool.cpp
|
|
src/request_log.cpp
|
|
src/order_log.cpp
|
|
)
|
|
|
|
target_include_directories(jtlsrv PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
${LIBUV_INCLUDE_DIRS}
|
|
${OPENSSL_INCLUDE_DIRS}
|
|
${ODBC_INCLUDE_DIR}
|
|
${VIPS_INCLUDE_DIRS}
|
|
)
|
|
|
|
target_link_libraries(jtlsrv PRIVATE
|
|
llhttp
|
|
json
|
|
${LIBUV_LIBRARIES}
|
|
${OPENSSL_LIBRARIES}
|
|
${ODBC_LIBRARY}
|
|
${VIPS_LIBRARIES}
|
|
pthread
|
|
)
|
|
|
|
target_link_directories(jtlsrv PRIVATE
|
|
${LIBUV_LIBRARY_DIRS}
|
|
${OPENSSL_LIBRARY_DIRS}
|
|
${VIPS_LIBRARY_DIRS}
|
|
)
|