Skip to content

Commit

Permalink
Merge pull request #407 from Antonov548/main
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr authored Oct 17, 2022
2 parents ac81983 + 025cc30 commit ada8346
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ windows
^autobrew$
^cleanup$
^CRAN-SUBMISSION$
^\.gitpod\.yml$
^\.gitpod\.Dockerfile$
^CMakeLists\.txt$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ cleanup
.vscode
.Renviron
CRAN-SUBMISSION
/build
11 changes: 11 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# You can find the new timestamped tags here: https://hub.docker.com/r/gitpod/workspace-base/tags
FROM gitpod/workspace-base:2022-05-08-14-31-53

# Install R and ccache
RUN sudo apt update
RUN sudo apt install -y \
r-base \
ccache \
cmake \
# Install dependencies for rlang packet
libharfbuzz-dev libfribidi-dev
32 changes: 32 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
image:
file: .gitpod.Dockerfile
tasks:
- name: dependencies
init: |
# Scriptlets, with custom Git config
mv ~/.gitconfig ~/.gitconfig.gitpod
curl -s https://raw.githubusercontent.com/krlmlr/scriptlets/master/bootstrap | sh
echo -e "[credential]\n\thelper = /usr/bin/gp credential-helper" >> ~/.gitconfig
# .editorconfig
ln -s ~/.editorconfig ..
# Set up ccache
ln -s /usr/lib/ccache/* ~/bin/
# Set up Makevars
mkdir -p ~/.R
echo -e "MAKEFLAGS = -j8\nCXXFLAGS = -O0 -g" > ~/.R/Makevars
# Install R packages
echo 'options(repos = "https://packagemanager.rstudio.com/all/__linux__/'$(cat /etc/lsb-release | sed -n '/DISTRIB_CODENAME=/ {s///;p}')'/latest")' > ~/.Rprofile
mkdir -p ~/R/x86_64-pc-linux-gnu-library/$(Rscript -e 'writeLines(gsub("[.][^.]+$", "", as.character(getRversion())))')
## Install pak in R
R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))'
## Install devtools and R dependencies
R -q -e 'pak::pak(c("devtools", "deps::."))'
vscode:
extensions:
- ms-vscode.cpptools-extension-pack
- go2sh.cmake-integration-vscode
- EditorConfig.EditorConfig
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.0.0)
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)
58 changes: 58 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
add_library(RPostgres
connection.cpp
DbColumn.cpp
DbColumnDataSource.cpp
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.h
DbConnection.h
DbDataFrame.h
DbResult.h
DbResultImplDecl.h
DbResultImpl.h
encode.h
integer64.h
pch.h
PqColumnDataSourceFactory.h
PqColumnDataSource.h
PqDataFrame.h
PqResult.h
PqResultImpl.h
PqResultSource.h
PqUtils.h
RPostgres-init.c
RPostgres_types.h
)

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"
)

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

0 comments on commit ada8346

Please sign in to comment.