Skip to content

Commit

Permalink
[Postgres] Add Postgres C++ library. Postgres can be used as a multi-…
Browse files Browse the repository at this point in the history
…user replacement for our SQLite database, and it also could be used as a JSON database for the PatchInterchange format?
  • Loading branch information
christofmuc committed Jul 7, 2024
1 parent f763403 commit 2c3dbf7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@
[submodule "third_party/spdlog"]
path = third_party/spdlog
url = https://github.com/gabime/spdlog.git
[submodule "third_party/libpqxx"]
path = third_party/libpqxx
url = https://github.com/jtv/libpqxx.git
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ IF (WIN32)
include_directories("${asiosdk_SOURCE_DIR}/common")
ENDIF()

FetchContent_Declare(
postgresql
# Download the PostgreSQL 16.3 binaries from the official distributor. We need only the include and the library actually, need to look for a smaller distribution
URL https://sbp.enterprisedb.com/getfile.jsp?fileid=1259104
)
FetchContent_MakeAvailable(postgresql)
message("${postgresql_SOURCE_DIR} is the location for the postgres libraries")

FetchContent_Declare(
pythonembedded
URL https://www.python.org/ftp/python/${PYTHON_VERSION_TO_DOWNLOAD}/python-${PYTHON_VERSION_TO_DOWNLOAD}-embed-amd64.zip
Expand Down Expand Up @@ -228,6 +236,19 @@ add_subdirectory(third_party/fmt)
option(SPDLOG_FMT_EXTERNAL "" ON)
add_subdirectory(third_party/spdlog)

# Add PostgreSQL
set(PostgreSQL_LIBRARY "${postgresql_SOURCE_DIR}/lib" CACHE STRING "Lib directory for the Postgres SQL server")
set(PostgreSQL_INCLUDE_DIR "${postgresql_SOURCE_DIR}/include" CACHE STRING "Include directory for the libpq C library for Postgres")
set(PostgreSQL_TYPE_INCLUDE_DIR "${postgresql_SOURCE_DIR}/include" CACHE STRING "Type include directory for Postgres")
message("${PostgreSQL_INCLUDE_DIR} is the include dir")
set(SKIP_BUILD_TEST ON)
IF (WIN32)
set(BUILD_SHARED_LIBS ON)
ELSE()
set(BUILD_SHARED_LIBS OFF)
ENDIF()
add_subdirectory(third_party/libpqxx build-pqxx)

# Import MidiKraft infrastructure
add_subdirectory(juce-utils)
add_subdirectory(juce-widgets)
Expand Down
1 change: 1 addition & 0 deletions third_party/libpqxx
Submodule libpqxx added at 30d41b

0 comments on commit 2c3dbf7

Please sign in to comment.