Skip to content

Commit

Permalink
use_cmakelists()
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Dec 5, 2022
1 parent c68d38f commit fa3466f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 44 deletions.
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
cmake_minimum_required(VERSION 3.0.0)
# Generated by cynkrathis::use_cmakelists(), do not edit by hand
#
# Call:
# quote(cynkrathis::use_cmakelists())

cmake_minimum_required(VERSION 3.14)
project(RPostgres VERSION 0.1.0)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include(CTest)
enable_testing()

add_subdirectory(src)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
73 changes: 37 additions & 36 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
add_library(RPostgres
connection.cpp
# Generated by cynkrathis::use_cmakelists(), do not edit by hand
#
# Call:
# quote(cynkrathis::use_cmakelists())

add_library(RPostgres
DbColumn.cpp
DbColumn.h
DbColumnDataSource.cpp
DbColumnDataSource.h
DbColumnDataSourceFactory.cpp
DbColumnStorage.cpp
DbConnection.cpp
DbDataFrame.cpp
DbResult.cpp
encode.cpp
encrypt.cpp
logging.cpp
PqColumnDataSource.cpp
PqColumnDataSourceFactory.cpp
PqDataFrame.cpp
PqResult.cpp
PqResultImpl.cpp
PqResultSource.cpp
PqUtils.cpp
RcppExports.cpp
result.cpp
DbColumnDataSourceFactory.h
DbColumnDataSource.h
DbColumnDataType.h
DbColumn.h
DbColumnStorage.cpp
DbColumnStorage.h
DbConnection.cpp
DbConnection.h
DbDataFrame.cpp
DbDataFrame.h
DbResult.cpp
DbResult.h
DbResultImplDecl.h
DbResultImpl.h
encode.h
integer64.h
pch.h
PqColumnDataSourceFactory.h
DbResultImplDecl.h
PqColumnDataSource.cpp
PqColumnDataSource.h
PqColumnDataSourceFactory.cpp
PqColumnDataSourceFactory.h
PqDataFrame.cpp
PqDataFrame.h
PqResult.cpp
PqResult.h
PqResultImpl.cpp
PqResultImpl.h
PqResultSource.cpp
PqResultSource.h
PqUtils.cpp
PqUtils.h
RPostgres-init.c
RPostgres_types.h
RcppExports.cpp
connection.cpp
encode.cpp
encode.h
encrypt.cpp
integer64.h
logging.cpp
pch.h
result.cpp
)

target_include_directories(RPostgres PUBLIC
"/usr/share/R/include"
"/home/gitpod/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include/"
"/home/gitpod/R/x86_64-pc-linux-gnu-library/3.6/plogr/include/"
"/usr/include/postgresql"
"vendor"
)
execute_process(COMMAND bash "-c" "Rscript -e 'cat(R.home(\"include\"))'" OUTPUT_VARIABLE R_INCLUDE)
execute_process(COMMAND bash "-c" "Rscript -e 'x <- desc::desc_get_deps(); pkgs <- x$package[x$type == \"LinkingTo\"]; paths <- file.path(.libPaths()[[1]], pkgs, \"include\"); cat(paths, sep = \";\")'" OUTPUT_VARIABLE R_LIBRARIES_INCLUDES)

target_compile_definitions(RPostgres PUBLIC
"RCPP_DEFAULT_INCLUDE_CALL=false"
"RCPP_USING_UTF8_ERROR_STRING"
"BOOST_NO_AUTO_PTR"
target_include_directories(RPostgres PUBLIC
${R_INCLUDE}
${R_LIBRARIES_INCLUDES}
)

include(./custom.cmake OPTIONAL)
10 changes: 10 additions & 0 deletions src/custom.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target_include_directories(RPostgres PUBLIC
"/usr/include/postgresql"
"vendor"
)

target_compile_definitions(RPostgres PUBLIC
"RCPP_DEFAULT_INCLUDE_CALL=false"
"RCPP_USING_UTF8_ERROR_STRING"
"BOOST_NO_AUTO_PTR"
)

0 comments on commit fa3466f

Please sign in to comment.