aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Lebedev <lebdron@gmail.com>2018-01-03 01:43:06 +0300
committerAndrei Lebedev <lebdron@gmail.com>2018-01-03 01:43:06 +0300
commita0d09ae1fb4f25efeaadb79d6f97d188c25966f8 (patch)
treea59f668475ffcaec87da0467387158d461965348
parente48a655df06de42e385c6545cc2a159a95f43c02 (diff)
downloadvcpkg-a0d09ae1fb4f25efeaadb79d6f97d188c25966f8.tar.gz
vcpkg-a0d09ae1fb4f25efeaadb79d6f97d188c25966f8.zip
[libpqxx] Initial port
-rw-r--r--ports/libpqxx/CMakeLists.txt68
-rw-r--r--ports/libpqxx/CONTROL4
-rw-r--r--ports/libpqxx/config-internal-compiler.h.in14
-rw-r--r--ports/libpqxx/config-public-compiler.h.in8
-rw-r--r--ports/libpqxx/portfile.cmake23
5 files changed, 117 insertions, 0 deletions
diff --git a/ports/libpqxx/CMakeLists.txt b/ports/libpqxx/CMakeLists.txt
new file mode 100644
index 000000000..c33d8863f
--- /dev/null
+++ b/ports/libpqxx/CMakeLists.txt
@@ -0,0 +1,68 @@
+cmake_minimum_required(VERSION 3.5)
+project(libpqxx VERSION 6.0.0 LANGUAGES CXX)
+set(CMAKE_DEBUG_POSTFIX "D")
+
+find_library(LIBPQD libpqd)
+find_library(LIBPQ libpq)
+find_path(LIBPQ_FE_H libpq-fe.h)
+find_path(POSTGRES_EXT_H postgres_ext.h)
+
+include(CheckIncludeFileCXX)
+
+check_include_file_cxx(poll.h HAVE_POLL)
+check_include_file_cxx(sys/select.h HAVE_SYS_SELECT_H)
+check_include_file_cxx(sys/time.h HAVE_SYS_TIME_H)
+check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
+check_include_file_cxx(unistd.h HAVE_UNISTD_H)
+
+include(CheckCXXSourceCompiles)
+
+check_cxx_source_compiles("[[deprecated]] void f();
+int main() { return 0; }" PQXX_HAVE_DEPRECATED)
+check_cxx_source_compiles("#include <optional>
+int main() { return std::optional<int>(0).value(); }" PQXX_HAVE_OPTIONAL)
+check_cxx_source_compiles("#include <experimental/optional>
+int main() { return std::experimental::optional<int>(0).value(); }" PQXX_HAVE_EXP_OPTIONAL)
+
+configure_file(config-internal-compiler.h.in pqxx/config-internal-compiler.h)
+configure_file(config-public-compiler.h.in pqxx/config-public-compiler.h)
+
+file(GLOB SRCS "${PROJECT_SOURCE_DIR}/src/*.cxx")
+
+if(BUILD_SHARED_LIBS)
+ set(TARGET libpqxx)
+ set(SHARED_DEFINITION -DPQXX_SHARED)
+ list(APPEND SRCS "${PROJECT_SOURCE_DIR}/win32/libpqxx.cxx")
+else()
+ set(TARGET libpqxx_static)
+ set(SHARED_DEFINITION "")
+endif()
+
+add_library(${TARGET} ${SRCS})
+target_compile_definitions(${TARGET} PRIVATE -DPQXX_INTERNAL -DNOMINMAX ${SHARED_DEFINITION})
+target_include_directories(${TARGET} PRIVATE include ${LIBPQ_FE_H} ${POSTGRES_EXT_H} ${CMAKE_BINARY_DIR})
+target_link_libraries(${TARGET} PRIVATE ws2_32)
+if(LIBPQD AND LIBPQ)
+ target_link_libraries(${TARGET} PRIVATE debug ${LIBPQD} optimized ${LIBPQ})
+elseif(LIBPQD)
+ target_link_libraries(${TARGET} PRIVATE ${LIBPQD})
+else()
+ target_link_libraries(${TARGET} PRIVATE ${LIBPQ})
+endif()
+
+install(TARGETS ${TARGET}
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ )
+install(DIRECTORY include/ DESTINATION include
+ CONFIGURATIONS Release
+ PATTERN "doc" EXCLUDE
+ PATTERN "*.am" EXCLUDE
+ PATTERN "*.in" EXCLUDE
+ PATTERN "*.template" EXCLUDE
+ )
+install(DIRECTORY ${CMAKE_BINARY_DIR}/pqxx/ DESTINATION include/pqxx
+ CONFIGURATIONS Release
+ FILES_MATCHING PATTERN "*.h"
+ )
diff --git a/ports/libpqxx/CONTROL b/ports/libpqxx/CONTROL
new file mode 100644
index 000000000..8860ddaf9
--- /dev/null
+++ b/ports/libpqxx/CONTROL
@@ -0,0 +1,4 @@
+Source: libpqxx
+Version: 6.0.0
+Description: The official C++ client API for PostgreSQL
+Build-Depends: libpq
diff --git a/ports/libpqxx/config-internal-compiler.h.in b/ports/libpqxx/config-internal-compiler.h.in
new file mode 100644
index 000000000..6a5f07fbe
--- /dev/null
+++ b/ports/libpqxx/config-internal-compiler.h.in
@@ -0,0 +1,14 @@
+/* System supports poll(). */
+#cmakedefine HAVE_POLL 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#cmakedefine HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#cmakedefine HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
diff --git a/ports/libpqxx/config-public-compiler.h.in b/ports/libpqxx/config-public-compiler.h.in
new file mode 100644
index 000000000..24479707a
--- /dev/null
+++ b/ports/libpqxx/config-public-compiler.h.in
@@ -0,0 +1,8 @@
+/* Define if compiler supports [[deprecated]] attribute */
+#cmakedefine PQXX_HAVE_DEPRECATED 1
+
+/* Define if the compiler supports std::experimental::optional. */
+#cmakedefine PQXX_HAVE_EXP_OPTIONAL 1
+
+/* Define if the compiler supports std::optional. */
+#cmakedefine PQXX_HAVE_OPTIONAL 1
diff --git a/ports/libpqxx/portfile.cmake b/ports/libpqxx/portfile.cmake
new file mode 100644
index 000000000..2ba92b1cb
--- /dev/null
+++ b/ports/libpqxx/portfile.cmake
@@ -0,0 +1,23 @@
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO jtv/libpqxx
+ REF 6.0.0
+ SHA512 f237cc03c01a8262eee44a9428206c1cc11b6034dddf540afef145f58eee5c32b880d84832563480d73d834c24311170e2ef6789e100793afbe0b6e393bd4169
+ HEAD_REF master
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/config-public-compiler.h.in DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/config-internal-compiler.h.in DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpqxx RENAME copyright)