mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Improve CMake integration of PgSQL build (#4767)
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
This commit is contained in:
@@ -604,6 +604,10 @@ set(CPACK_COMPONENT_DOCS_GROUP "Runtime")
|
||||
set(CPACK_COMPONENT_DEV_GROUP "Development")
|
||||
set(CPACK_COMPONENT_PYTHON_GROUP "Python")
|
||||
set(CPACK_COMPONENT_EXTRAS_GROUP "Extras")
|
||||
if(RDK_BUILD_PGSQL)
|
||||
SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} pgsql)
|
||||
set(CPACK_COMPONENT_PGSQL_GROUP "PgSQL")
|
||||
endif()
|
||||
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "RDKit")
|
||||
SET(CPACK_PACKAGE_VENDOR "rdkit.org")
|
||||
|
||||
@@ -160,7 +160,6 @@ if(MSVC)
|
||||
set(PGREGRESS_BINARY "${PG_BINDIR}/pg_regress")
|
||||
string(REGEX REPLACE "/" ${REGEX_SEPARATOR} PGREGRESS_BINARY ${PGREGRESS_BINARY})
|
||||
string(REGEX REPLACE "/" ${REGEX_SEPARATOR} PG_EXTENSIONDIR ${PG_EXTENSIONDIR})
|
||||
string(REGEX REPLACE "/" ${REGEX_SEPARATOR} PGREGRESS_BINARY ${PGREGRESS_BINARY})
|
||||
else()
|
||||
run_pg_config (--pgxs PG_MAKEFILE)
|
||||
get_filename_component(PG_MAKEFILESDIR ${PG_MAKEFILE} PATH)
|
||||
@@ -210,6 +209,7 @@ if(MSVC)
|
||||
string(REGEX REPLACE "/" ${REGEX_SEPARATOR} PG_CURRENT_SOURCE_DIR ${PG_CURRENT_SOURCE_DIR})
|
||||
string(REGEX REPLACE "/" ${REGEX_SEPARATOR} PG_CURRENT_BINARY_DIR ${PG_CURRENT_BINARY_DIR})
|
||||
string(REGEX REPLACE "/" ${REGEX_SEPARATOR} PG_PKGLIBDIR ${PG_PKGLIBDIR})
|
||||
string(REGEX REPLACE "/" ${REGEX_SEPARATOR}${REGEX_SEPARATOR} installPgSQLNameBS ${installPgSQLName})
|
||||
else()
|
||||
set(testPgSQLCommand "sh")
|
||||
set(testPgSQLName "${testPgSQLName}.sh")
|
||||
@@ -276,14 +276,8 @@ foreach(testDir sql data expected)
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||
"${PG_CURRENT_SOURCE_DIR}${testDir}" "${PG_CURRENT_BINARY_DIR}${testDir}")
|
||||
endforeach()
|
||||
message("\n"
|
||||
"=====================================================================\n"
|
||||
"After building, check\n"
|
||||
"${installPgSQLName}\n"
|
||||
"for correctness of installation paths. If everything is OK, gain \n"
|
||||
"administrator privileges, stop the PostgreSQL service, run\n"
|
||||
"${installPgSQLName}\n"
|
||||
"to install the PostgreSQL RDKit cartridge, then start again\n"
|
||||
"the PostgreSQL service\n"
|
||||
"=====================================================================\n")
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/InstallPgSql.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/InstallPgSql.cmake" @ONLY)
|
||||
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/InstallPgSql.cmake" COMPONENT pgsql)
|
||||
add_test(testPgSQL ${testPgSQLCommand} ${testPgSQLName})
|
||||
|
||||
30
Code/PgSQL/rdkit/InstallPgSql.cmake.in
Normal file
30
Code/PgSQL/rdkit/InstallPgSql.cmake.in
Normal file
@@ -0,0 +1,30 @@
|
||||
if(@MSVC@)
|
||||
set(cmd cmd /C "@installPgSQLNameBS@")
|
||||
else()
|
||||
set(cmd bash "@installPgSQLName@")
|
||||
endif()
|
||||
execute_process(COMMAND ${cmd} OUTPUT_VARIABLE err ERROR_VARIABLE err RESULT_VARIABLE res)
|
||||
if(res)
|
||||
message("\n"
|
||||
"=====================================================================\n"
|
||||
"PostgreSQL cartridge installation failed:\n"
|
||||
"=====================================================================\n"
|
||||
"${err}\n"
|
||||
"=====================================================================\n"
|
||||
"This might be due to insufficient privileges.\n"
|
||||
"Check @installPgSQLName@\n"
|
||||
"for correctness of installation paths. If everything is OK, gain \n"
|
||||
"administrator privileges, stop the PostgreSQL service, run\n"
|
||||
"@installPgSQLName@\n"
|
||||
"to install the PostgreSQL RDKit cartridge, then start again\n"
|
||||
"the PostgreSQL service.\n"
|
||||
"=====================================================================\n")
|
||||
else()
|
||||
message("\n"
|
||||
"=====================================================================\n"
|
||||
"PostgreSQL cartridge installation succeeded.\n"
|
||||
"=====================================================================\n"
|
||||
"Restart the PostgreSQL service before using the PostgreSQL\n"
|
||||
"RDKit cartridge.\n"
|
||||
"=====================================================================\n")
|
||||
endif()
|
||||
Reference in New Issue
Block a user