[librttopo] Revise windows build (#20584)

* Use common indentation of 4 spaces

* Minimize makefiles patch

* Fix single-config build

* Install pc file for windows

* Update versions
This commit is contained in:
Kai Pastor 2021-10-12 05:51:03 +02:00 committed by GitHub
parent 9deacd9e5b
commit 1c91b14312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 48 deletions

View File

@ -1,8 +1,8 @@
diff --git a/makefile.vc b/makefile.vc
index 1f790f0de..2f7e00f7b 100644
index 1f790f0..f78d0c9 100644
--- a/makefile.vc
+++ b/makefile.vc
@@ -17,11 +17,11 @@ LIBOBJ = src\box2d.obj src\bytebuffer.obj src\g_box.obj \
@@ -17,7 +17,7 @@ LIBOBJ = src\box2d.obj src\bytebuffer.obj src\g_box.obj \
src\rtout_kml.obj src\rtout_svg.obj src\rtout_twkb.obj src\rtout_wkb.obj \
src\rtout_wkt.obj src\rtout_x3d.obj src\rtpoint.obj src\rtpoly.obj src\rtprint.obj \
src\rtpsurface.obj src\rtspheroid.obj src\rtstroke.obj src\rttin.obj src\rttree.obj \
@ -11,25 +11,3 @@ index 1f790f0de..2f7e00f7b 100644
LIBRTTOPO_DLL = librttopo$(VERSION).dll
-CFLAGS = /nologo -IC:\OSGeo4W\include -I. -Iheaders $(OPTFLAGS)
+CFLAGS = /nologo -I. -Iheaders $(OPTFLAGS)
default: all
diff --git a/nmake.opt b/nmake.opt
index 938979df1..ea80dab00 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -1,9 +1,8 @@
# Directory tree where RTTOPO will be installed.
-INSTDIR=C:\OSGeo4W
+INSTDIR=$(INSTALLDIR)
# Uncomment the first for an optimized build, or the second for debug.
-OPTFLAGS= /nologo /Ox /fp:precise /W4 /MD /D_CRT_SECURE_NO_WARNINGS \
- /DDLL_EXPORT
+OPTFLAGS= /nologo /fp:precise /W4 $(CL_FLAGS) /D_CRT_SECURE_NO_WARNINGS
#OPTFLAGS= /nologo /Zi /MD /Fdlibrttopo.pdb /DDLL_EXPORT
# Set the version number for the DLL. Normally we leave this blank since

View File

@ -18,33 +18,59 @@ vcpkg_extract_source_archive_ex(
)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
file(REMOVE "${SOURCE_PATH}/src/rttopo_config.h")
configure_file("${CMAKE_CURRENT_LIST_DIR}/rttopo_config.h.in" "${SOURCE_PATH}/src/rttopo_config.h" @ONLY)
file(REMOVE "${SOURCE_PATH}/src/rttopo_config.h")
configure_file("${CMAKE_CURRENT_LIST_DIR}/rttopo_config.h.in" "${SOURCE_PATH}/src/rttopo_config.h" @ONLY)
vcpkg_build_nmake(
SOURCE_PATH "${SOURCE_PATH}"
TARGET librttopo.lib
)
set(OPTFLAGS "/nologo /fp:precise /W4 /D_CRT_SECURE_NO_WARNINGS /DDLL_EXPORT")
vcpkg_build_nmake(
SOURCE_PATH "${SOURCE_PATH}"
TARGET librttopo.lib
OPTIONS
"OPTFLAGS=${OPTFLAGS}"
"CFLAGS=-I. -Iheaders ${OPTFLAGS}"
)
file(GLOB LIBRTTOPO_INCLUDE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/headers/*.h")
file(COPY ${LIBRTTOPO_INCLUDE} DESTINATION "${CURRENT_PACKAGES_DIR}/include")
file(GLOB LIBRTTOPO_INCLUDE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/headers/*.h")
file(COPY ${LIBRTTOPO_INCLUDE} DESTINATION "${CURRENT_PACKAGES_DIR}/include")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/librttopo.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/librttopo.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
else() # Build in UNIX
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS_DEBUG
"--with-geosconfig=${CURRENT_INSTALLED_DIR}/tools/geos/debug/bin/geos-config"
OPTIONS_RELEASE
"--with-geosconfig=${CURRENT_INSTALLED_DIR}/tools/geos/bin/geos-config"
)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/librttopo.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/librttopo.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
endif()
set(VERSION "${LIBRTTOPO_VERSION_STR}")
set(libdir [[${prefix}/lib]])
set(exec_prefix [[${prefix}]])
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
set(includedir [[${prefix}/include]])
set(outfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/rttopo.pc")
configure_file("${SOURCE_PATH}/rttopo.pc.in" "${outfile}" @ONLY)
vcpkg_replace_string("${outfile}" " -lrttopo -lm" " -llibrttopo")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(includedir [[${prefix}/../include]])
set(outfile "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/rttopo.pc")
configure_file("${SOURCE_PATH}/rttopo.pc.in" "${outfile}" @ONLY)
vcpkg_replace_string("${outfile}" " -lrttopo -lm" " -llibrttopo")
endif()
else()
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS_DEBUG
"--with-geosconfig=${CURRENT_INSTALLED_DIR}/tools/geos/debug/bin/geos-config"
OPTIONS_RELEASE
"--with-geosconfig=${CURRENT_INSTALLED_DIR}/tools/geos/bin/geos-config"
)
vcpkg_install_make()
endif()
vcpkg_fixup_pkgconfig()
# Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,7 +1,7 @@
{
"name": "librttopo",
"version": "1.1.0",
"port-version": 4,
"port-version": 5,
"description": "The RT Topology Library exposes an API to create and manage standard (ISO 13249 aka SQL/MM) topologies using user-provided data stores.",
"homepage": "https://git.osgeo.org/gitea/rttopo/librttopo",
"dependencies": [

View File

@ -3750,7 +3750,7 @@
},
"librttopo": {
"baseline": "1.1.0",
"port-version": 4
"port-version": 5
},
"libsamplerate": {
"baseline": "0.2.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d747c88d429ff781b11627623d0958967f912a41",
"version": "1.1.0",
"port-version": 5
},
{
"git-tree": "fae3fefb29d1972caa2643351ebf83ca47f7d04a",
"version": "1.1.0",