OSGeo / libgeotiff

Official repository of the libgeotiff project
183 stars 70 forks source link

Automate release generation from tags and refactor CI #115

Closed hobu closed 4 months ago

hobu commented 4 months ago

This PR does a bunch of stuff at once (sorry):

hobu commented 4 months ago

Updated this builder to create the tarball using CMake/CPack and attach it as an artifact to the build

hobu commented 4 months ago

@rouault can we kill the VCPKG CI builder? It's now busted and points at a bunch of old stuff. It either needs to be updated or dropped.

Additionally, we still need a CTest target for the tests on UNIX.

rouault commented 4 months ago

can we kill the VCPKG CI builder?

yes, it was just a means of testing on Windows, not an aim per se. Conda based builds will do just fine.

nono303 commented 4 months ago

Hi @hobu, Thx for this PR! I’ve just tested CMake build on Windows MSVC and FIND_PACKAGE for PROJ & JPEG failed. Fixed it changing some option and order; I’ll let you check that’s ok for your platform regression tests

Also, related to https://github.com/OSGeo/libgeotiff/issues/117 here are some improvements that could be integrated:


diff --git "a/libgeotiff/CMakeLists.txt" "b/libgeotiff/CMakeLists.txt"
index 44c6b23..811505b 100644
--- "a/libgeotiff/CMakeLists.txt"
+++ "b/libgeotiff/CMakeLists.txt"
@@ -46,6 +46,8 @@ SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
 # General build settings

 option(BUILD_SHARED_LIBS "Set ON to build shared library" ON)
+option(BUILD_MAN "Set ON to build man pages" ON)
+option(BUILD_DOC "Set ON to build doc files" ON)

 IF(NOT CMAKE_BUILD_TYPE)
     SET(CMAKE_BUILD_TYPE Debug CACHE STRING
@@ -82,26 +84,31 @@ CHECK_INCLUDE_FILES(strings.h GEOTIFF_HAVE_STRINGS_H)
 ###############################################################################
 # User-defined build settings

-SET(WITH_UTILITIES TRUE CACHE BOOL "Choose if GeoTIFF utilities should be built")
+option(WITH_UTILITIES "Choose if GeoTIFF utilities should be built" ON)
+
+SET(LIB_SUFFIX _i CACHE STRING "Static library suffix")

 ###############################################################################
 # Search for dependencies

 # TIFF support - required, default=ON
-SET(WITH_TIFF TRUE CACHE BOOL "Choose if TIFF support should be built")
+option(WITH_TIFF "Choose if TIFF support should be built" ON)

-FIND_PACKAGE(PROJ NO_MODULE REQUIRED)
+FIND_PACKAGE(PROJ NO_MODULE QUIET)
+if (NOT PROJ_FOUND)
+  FIND_PACKAGE(PROJ REQUIRED)
+endif ()

 # Zlib support - optional, default=OFF
-SET(WITH_ZLIB FALSE CACHE BOOL "Choose if zlib support should be built")
+option(WITH_ZLIB "Choose if zlib support should be built" OFF)

 # JPEG support - optional, default=OFF
-SET(WITH_JPEG FALSE CACHE BOOL "Choose if JPEG support should be built")
+option(WITH_JPEG  "Choose if JPEG support should be built" OFF)

 # Turn off TOWGS84 support
-SET(WITH_TOWGS84 TRUE CACHE BOOL "Build with TOWGS84 support")
+option(WITH_TOWGS84 "Build with TOWGS84 support" ON)
 IF (NOT WITH_TOWGS84)
    SET(GEO_NORMALIZE_DISABLE_TOWGS84 1)
 endif()
@@ -154,13 +161,16 @@ SET(GEOTIFF_MAN_PAGES
 #    ${PROJECT_BINARY_DIR}/geotiff_version.h

 # Install doc files
-INSTALL(FILES
+if(BUILD_DOC)
+  INSTALL(FILES
     AUTHORS ChangeLog COPYING LICENSE README README_BIN README.WIN
     DESTINATION ${CMAKE_INSTALL_DOCDIR})
+endif ()

 # Install man pages
-INSTALL(FILES ${GEOTIFF_MAN_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
-
+if(BUILD_MAN)
+  INSTALL(FILES ${GEOTIFF_MAN_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
+endif ()

 # Install header files for development distribution
 INSTALL(FILES ${GEOTIFF_LIB_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@@ -202,9 +212,9 @@ set_property(TARGET ${GEOTIFF_LIBRARY_TARGET} PROPERTY POSITION_INDEPENDENT_CODE
 set_property(TARGET ${GEOTIFF_LIBRARY_TARGET} PROPERTY OUTPUT_NAME ${GEOTIFF_LIB_NAME})

 IF(WITH_JPEG)
-    FIND_PACKAGE(JPEG NO_MODULE QUIET CONFIG)
+    FIND_PACKAGE(JPEG NO_MODULE QUIET)
     if (NOT JPEG_FOUND)
-      FIND_PACKAGE(JPEG CONFIG)
+      FIND_PACKAGE(JPEG)
     endif ()

     IF(JPEG_FOUND)
@@ -257,7 +267,7 @@ TARGET_INCLUDE_DIRECTORIES(${GEOTIFF_LIBRARY_TARGET} PUBLIC
                             $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/libxtiff>
                             $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
 IF(WIN32 AND MSVC)
-    SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES IMPORT_SUFFIX "_i.lib")
+    SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES IMPORT_SUFFIX "${LIB_SUFFIX}.lib")
 ENDIF(WIN32 AND MSVC)

 # Unix, linux:
@@ -332,10 +342,11 @@ target_include_directories( ${GEOTIFF_LIBRARY_TARGET} PUBLIC

 INSTALL( TARGETS ${GEOTIFF_LIBRARY_TARGET}
      EXPORT depends
-     RUNTIME DESTINATION ${CMAKE_INSTALLL_BINDIR}
+     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
      PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )
+INSTALL(FILES $<TARGET_PDB_FILE:${GEOTIFF_LIBRARY_TARGET}> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)

 # Install libgeotiff.pc
 set(prefix "${CMAKE_INSTALL_PREFIX}")
@@ -371,3 +382,16 @@ IF(WITH_UTILITIES)
 ENDIF()

 ADD_SUBDIRECTORY(cmake)
+
+message(STATUS "
+################################
+Summary of build options:
+   Build shared library:     ${BUILD_SHARED_LIBS}
+   Build man pages:          ${BUILD_MAN}
+   Build doc files:          ${BUILD_DOC}
+   Build GeoTIFF utilities:  ${WITH_UTILITIES}
+   Build TIFF support:       ${WITH_TIFF}
+   Build zlib support:       ${WITH_ZLIB}
+   Build JPEG support:       ${WITH_JPEG}
+   Build TOWGS84 support:    ${WITH_TOWGS84}
+################################")

++NoNo

rouault commented 4 months ago

@hobu Any comment regarding above @nono303 's remark ? I know that with GDAL I had some issues with find_package(PROJ) with module vs config, depending on the PROJ version. In https://github.com/OSGeo/gdal/blob/be425562003bf26bd9927a99076edc807f189ee5/cmake/helpers/CheckDependentLibraries.cmake#L381I've some fairly complicated logic to make that configurable I'm also wondering how to deal with the commit history. Perhaps I should just stash everything as it might not be easy to create a clean commit history

hobu commented 4 months ago

@nono303 I have applied your patch with some small modifications

hobu commented 4 months ago

I'm also wondering how to deal with the commit history. Perhaps I should just stash everything as it might not be easy to create a clean commit history

Squash it all down as you see fit. Sorry for such a big ball of stuff.

rouault commented 4 months ago

Squashed and merged. Thanks @hobu (and @nono303) for this update!

nono303 commented 4 months ago

Many Thx @hobu! U applied it in a better way ;) Pulled 9af3298 ant tested it with success!

...just to be sure about FIND_PACKAGE(PROJ NO_MODULE QUIET) l.100

hobu commented 4 months ago

PROJ and TIFF are hard requirements of libgeotiff. We should update the find_package calls to reflect this (it wasn't always true).

nono303 commented 4 months ago

All clear now !

patch.txt result.txt