remove feature for automatic jpeg/png/zlib library download and build

this is a post-stable feature and would require a general rewrite of offline processing
This commit is contained in:
Axel Kohlmeyer 2022-05-28 15:03:26 -04:00
parent 81c327edd8
commit 4c36c79652
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
5 changed files with 11 additions and 86 deletions

View File

@ -421,55 +421,9 @@ endif()
# tweak jpeg library names to avoid linker errors with MinGW cross-compilation
set(JPEG_NAMES libjpeg libjpeg-62)
find_package(JPEG QUIET)
find_package(PNG QUIET)
find_package(ZLIB QUIET)
check_for_internet_connection(HAVE_INTERNET)
# if we have a working internet connection. download and build missing libs
if(HAVE_INTERNET AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16))
include(ExternalCMakeProject)
if(NOT JPEG_FOUND)
set(LIBJPEG_URL https://sourceforge.net/projects/libjpeg-turbo/files/2.1.3/libjpeg-turbo-2.1.3.tar.gz)
set(LIBJPEG_MD5 85244dedeaf06f636a9e7ddea6d236d8)
mark_as_advanced(LIBJPEG_URL)
mark_as_advanced(LIBJPEG_MD5)
ExternalCmakeProject(libjpeg ${LIBJPEG_URL} ${LIBJPEG_MD5} libjpeg-turbo . CMakeLists.jpeg)
add_library(JPEG::JPEG ALIAS jpeg-static)
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libjpeg-src")
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libjpeg-build")
set(JPEG_FOUND TRUE)
endif()
if(NOT ZLIB_FOUND)
set(LIBZ_URL http://prdownloads.sourceforge.net/libpng/zlib-1.2.11.tar.gz)
set(LIBZ_MD5 1c9f62f0778697a09d36121ead88e08e)
mark_as_advanced(LIBZ_URL)
mark_as_advanced(LIBZ_MD5)
ExternalCmakeProject(libz ${LIBZ_URL} ${LIBZ_MD5} zlib . CMakeLists.zlib)
add_library(ZLIB::ZLIB ALIAS zlibstatic)
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libz-src")
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libz-build")
set(ZLIB_FOUND TRUE)
set(ZLIB_INCLUDE_DIR "${CMAKE_BINARY_DIR}/_deps/libz-src;${CMAKE_BINARY_DIR}/_deps/libz-build")
endif()
if(NOT PNG_FOUND)
set(LIBPNG_URL http://prdownloads.sourceforge.net/libpng/libpng-1.6.37.tar.gz)
set(LIBPNG_MD5 6c7519f6c75939efa0ed3053197abd54)
mark_as_advanced(LIBPNG_URL)
mark_as_advanced(LIBPNG_MD5)
ExternalCmakeProject(libpng ${LIBPNG_URL} ${LIBPNG_MD5} libpng . CMakeLists.png)
add_library(PNG::PNG ALIAS png_static)
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libpng-src")
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/libpng-build")
set(PNG_FOUND TRUE)
endif()
endif()
option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
if(WITH_JPEG)
if(NOT JPEG_FOUND)
find_package(JPEG REQUIRED)
endif()
find_package(JPEG REQUIRED)
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
if(CMAKE_VERSION VERSION_LESS 3.12)
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS})
@ -479,18 +433,16 @@ if(WITH_JPEG)
endif()
endif()
find_package(PNG QUIET)
find_package(ZLIB QUIET)
if(PNG_FOUND AND ZLIB_FOUND)
option(WITH_PNG "Enable PNG support" ON)
else()
option(WITH_PNG "Enable PNG support" OFF)
endif()
if(WITH_PNG)
if(NOT PNG_FOUND)
find_package(PNG REQUIRED)
endif()
if(NOT ZLIB_FOUND)
find_package(ZLIB REQUIRED)
endif()
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)
target_link_libraries(lammps PRIVATE PNG::PNG ZLIB::ZLIB)
target_compile_definitions(lammps PRIVATE -DLAMMPS_PNG)
endif()

View File

@ -105,23 +105,6 @@ function(FetchPotentials pkgfolder potfolder)
endif()
endfunction(FetchPotentials)
# Check and record if we have a working internet connection
function(check_for_internet_connection variable)
message("Checking internet connection... ")
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND (NOT CMAKE_CROSSCOMPILING))
execute_process(COMMAND ping www.google.com -n 2
OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE PING_STATUS)
else()
execute_process(COMMAND ping www.google.com -c 2
OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE PING_STATUS)
endif()
if(PING_STATUS EQUAL 0)
set(${variable} TRUE PARENT_SCOPE)
else()
set(${variable} FALSE PARENT_SCOPE)
endif()
endfunction(check_for_internet_connection)
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
file(STRINGS /etc/os-release distro REGEX "^NAME=")

View File

@ -1,10 +1,4 @@
if(NOT ZLIB_FOUND)
find_package(ZLIB)
if(NOT ZLIB_FOUND)
message(WARNING "zlib library not found skipping COMPRESS package")
return()
endif()
endif()
find_package(ZLIB REQUIRED)
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
find_package(PkgConfig QUIET)

View File

@ -9,7 +9,6 @@ set(WIN_PACKAGES
CLASS2
COLLOID
COLVARS
COMPRESS
CORESHELL
DIELECTRIC
DIFFRACTION

View File

@ -297,15 +297,15 @@ requires the following settings:
.. code-block:: bash
-D WITH_JPEG=value # yes or no
# default = yes
# default = yes if CMake finds JPEG files, else no
-D WITH_PNG=value # yes or no
# default = yes
# default = yes if CMake finds PNG and ZLIB files, else no
-D WITH_FFMPEG=value # yes or no
# default = yes if CMake can find ffmpeg, else no
Usually these settings are all that is needed. If those libraries
or executables are installed but CMake cannot find the graphics header,
library, or executable files, you can set these variables accordingly:
Usually these settings are all that is needed. If CMake cannot
find the graphics header, library, executable files, you can set
these variables:
.. code-block:: bash
@ -317,9 +317,6 @@ requires the following settings:
-D ZLIB_LIBRARY=path # path to libz.a (.so) file
-D FFMPEG_EXECUTABLE=path # path to ffmpeg executable
Otherwise, CMake will attempt to download, build, and link with
jpeg, png, and zlib libraries statically from source code.
.. tab:: Traditional make
.. code-block:: make