Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ avoid adding features or APIs which do not map onto the

## [Unreleased]

## [4.5.0] - 2026-06-08
- Use `PG_MODULE_MAGIC_EXT` macro in PostgreSQL 18 and later ([#203], [Andreas Karlsson])

## [4.5.0] - 2026-06-08

### Project

Expand Down Expand Up @@ -356,7 +357,9 @@ avoid adding features or APIs which do not map onto the
[#192]: https://github.com/postgis/h3-pg/issues/192
[#194]: https://github.com/postgis/h3-pg/pull/194
[#197]: https://github.com/postgis/h3-pg/pull/197
[#203]: https://github.com/postgis/h3-pg/pull/203
[Abel Vázquez Montoro]: https://github.com/AbelVM
[Andreas Karlsson]: https://github.com/jeltz
[Darafei Praliaskouski]: https://github.com/Komzpa
[Eric Schoffstall]: https://github.com/yocontra
[Paul Ramsey]: https://github.com/pramsey
Expand Down
5 changes: 5 additions & 0 deletions h3/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@

#include <fmgr.h> // PG_MODULE_MAGIC

#include "config.h"
#include "guc.h"

/* see https://www.postgresql.org/docs/current/xfunc-c.html#XFUNC-C-DYNLOAD */
#if POSTGRESQL_VERSION_MAJOR >= 18
PG_MODULE_MAGIC_EXT(.name = "h3", .version = POSTGRESQL_H3_VERSION);
#else
PG_MODULE_MAGIC;
#endif

void
_PG_init(void)
Expand Down
9 changes: 9 additions & 0 deletions h3_postgis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ PostgreSQL_add_extension(postgresql_h3_postgis
sql/updates/h3_postgis--4.5.0--unreleased.sql
)

# configure
configure_file(src/config.h.in src/config.h)

# include
target_include_directories(postgresql_h3_postgis PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/src
src
)

# link
target_link_libraries(postgresql_h3_postgis PRIVATE postgresql_h3_shared h3)
target_include_directories(postgresql_h3_postgis PRIVATE ${H3_INTERNAL_INCLUDE_DIR})
Expand Down
22 changes: 22 additions & 0 deletions h3_postgis/src/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2026 Andreas Karlsson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef PGH3_CONFIG_H
#define PGH3_CONFIG_H

#define POSTGRESQL_PGH3_VERSION "@INSTALL_VERSION@"

#endif /* PGH3_CONFIG_H */
6 changes: 6 additions & 0 deletions h3_postgis/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@

#include <fmgr.h> // PG_MODULE_MAGIC

#include "config.h"

/* see https://www.postgresql.org/docs/current/xfunc-c.html#XFUNC-C-DYNLOAD */
#if POSTGRESQL_VERSION_MAJOR >= 18
PG_MODULE_MAGIC_EXT(.name = "h3_postgis", .version = POSTGRESQL_PGH3_VERSION);
#else
PG_MODULE_MAGIC;
#endif
Loading