diff --git a/cmake/CMakeLists.jpeg b/cmake/CMakeLists.jpeg new file mode 100644 index 0000000000..f0bd85a90d --- /dev/null +++ b/cmake/CMakeLists.jpeg @@ -0,0 +1,615 @@ +cmake_minimum_required(VERSION 3.10) +# When using CMake 3.4 and later, don't export symbols from executables unless +# the CMAKE_ENABLE_EXPORTS variable is set. +if(POLICY CMP0065) + cmake_policy(SET CMP0065 NEW) +endif() +if (POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() +if(CMAKE_EXECUTABLE_SUFFIX) + set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX}) +endif() + +project(libjpeg-turbo C) +set(VERSION 2.1.3) +set(COPYRIGHT_YEAR "1991-2022") +string(REPLACE "." ";" VERSION_TRIPLET ${VERSION}) +list(GET VERSION_TRIPLET 0 VERSION_MAJOR) +list(GET VERSION_TRIPLET 1 VERSION_MINOR) +list(GET VERSION_TRIPLET 2 VERSION_REVISION) +function(pad_number NUMBER OUTPUT_LEN) + string(LENGTH "${${NUMBER}}" INPUT_LEN) + if(INPUT_LEN LESS OUTPUT_LEN) + math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1") + set(NUM ${${NUMBER}}) + foreach(C RANGE ${ZEROES}) + set(NUM "0${NUM}") + endforeach() + set(${NUMBER} ${NUM} PARENT_SCOPE) + endif() +endfunction() +pad_number(VERSION_MINOR 3) +pad_number(VERSION_REVISION 3) +set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION}) + +# CMake 3.14 and later sets CMAKE_MACOSX_BUNDLE to TRUE by default when +# CMAKE_SYSTEM_NAME is iOS, tvOS, or watchOS, which breaks the libjpeg-turbo +# build. (Specifically, when CMAKE_MACOSX_BUNDLE is TRUE, executables for +# Apple platforms are built as application bundles, which causes CMake to +# complain that our install() directives for executables do not specify a +# BUNDLE DESTINATION. Even if CMake did not complain, building executables as +# application bundles would break our iOS packages.) +set(CMAKE_MACOSX_BUNDLE FALSE) + +string(TIMESTAMP DEFAULT_BUILD "%Y%m%d") +set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})") + +# NOTE: On Windows, this does nothing except when using MinGW or Cygwin. +# CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to +# Debug when using NMake. +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() +message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") + +message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") + +include(cmakescripts/PackageInfo.cmake) + +# Detect CPU type and whether we're building 64-bit or 32-bit code +math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8") +string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC) +set(COUNT 1) +foreach(ARCH ${CMAKE_OSX_ARCHITECTURES}) + if(COUNT GREATER 1) + message(FATAL_ERROR "The libjpeg-turbo build system does not support multiple values in CMAKE_OSX_ARCHITECTURES.") + endif() + math(EXPR COUNT "${COUNT}+1") +endforeach() +if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32") + if(BITS EQUAL 64 OR CMAKE_C_COMPILER_ABI MATCHES "ELF X32") + set(CPU_TYPE x86_64) + else() + set(CPU_TYPE i386) + endif() + if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE}) + set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE}) + endif() +elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^arm") + if(BITS EQUAL 64) + set(CPU_TYPE arm64) + else() + set(CPU_TYPE arm) + endif() +elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^ppc" OR + CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^powerpc") + set(CPU_TYPE powerpc) +else() + set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC}) +endif() +if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR + CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR + CMAKE_OSX_ARCHITECTURES MATCHES "i386") + set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES}) +endif() +if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc") + set(CPU_TYPE powerpc) +endif() +if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64") + set(CPU_TYPE arm64) +endif() + +message(STATUS "${BITS}-bit build (${CPU_TYPE})") + +macro(report_directory var) + if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var}) + message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}") + else() + message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})") + endif() + mark_as_advanced(CLEAR CMAKE_INSTALL_${var}) +endmacro() + +set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR") +if(UNIX) + list(APPEND DIRLIST "MANDIR") +endif() +foreach(dir ${DIRLIST}) + report_directory(${dir}) +endforeach() + + +############################################################################### +# CONFIGURATION OPTIONS +############################################################################### + +macro(boolean_number var) + if(${var}) + set(${var} 1 ${ARGN}) + else() + set(${var} 0 ${ARGN}) + endif() +endmacro() + +option(ENABLE_SHARED "Build shared libraries" FALSE) +boolean_number(ENABLE_SHARED) +option(ENABLE_STATIC "Build static libraries" TRUE) +boolean_number(ENABLE_STATIC) +option(REQUIRE_SIMD "Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)" FALSE) +boolean_number(REQUIRE_SIMD) +option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_ARITH_DEC=0 WITH_ARITH_ENC=0 WITH_JAVA=0 WITH_SIMD=0 WITH_TURBOJPEG=0 )" FALSE) +boolean_number(WITH_12BIT) +option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE) +boolean_number(WITH_ARITH_DEC) +option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE) +boolean_number(WITH_ARITH_ENC) +if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32") + set(WITH_JAVA 0) +else() + option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE) + boolean_number(WITH_JAVA) +endif() +option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE) +boolean_number(WITH_JPEG7) +option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE) +boolean_number(WITH_JPEG8) +option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE) +boolean_number(WITH_MEM_SRCDST) +option(WITH_SIMD "Include SIMD extensions, if available for this platform" FALSE) +boolean_number(WITH_SIMD) +option(WITH_TURBOJPEG "Include the TurboJPEG API library and associated test programs" FALSE) +boolean_number(WITH_TURBOJPEG) +option(WITH_FUZZ "Build fuzz targets" FALSE) + +macro(report_option var desc) + if(${var}) + message(STATUS "${desc} enabled (${var} = ${${var}})") + else() + message(STATUS "${desc} disabled (${var} = ${${var}})") + endif() +endmacro() + +if(WITH_JAVA) + set(ENABLE_SHARED 1) +endif() + +# Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all +# targets, which will cause the shared library builds to fail. Thus, if shared +# libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set +# to FALSE, we need to unset it, thus restoring the default behavior +# (automatically using PIC for shared library targets.) +if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND + NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED) + unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE) +endif() + +report_option(ENABLE_SHARED "Shared libraries") +report_option(ENABLE_STATIC "Static libraries") + +if(ENABLE_SHARED) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) +endif() + +if(WITH_JPEG8 OR WITH_JPEG7) + set(WITH_ARITH_ENC 1) + set(WITH_ARITH_DEC 1) +endif() +if(WITH_JPEG8) + set(WITH_MEM_SRCDST 0) +endif() + +if(WITH_12BIT) + set(WITH_ARITH_DEC 0) + set(WITH_ARITH_ENC 0) + set(WITH_JAVA 0) + set(WITH_SIMD 0) + set(WITH_TURBOJPEG 0) + set(BITS_IN_JSAMPLE 12) +else() + set(BITS_IN_JSAMPLE 8) +endif() +report_option(WITH_12BIT "12-bit JPEG support") + +if(WITH_ARITH_DEC) + set(D_ARITH_CODING_SUPPORTED 1) +endif() +if(NOT WITH_12BIT) + report_option(WITH_ARITH_DEC "Arithmetic decoding support") +endif() + +if(WITH_ARITH_ENC) + set(C_ARITH_CODING_SUPPORTED 1) +endif() +if(NOT WITH_12BIT) + report_option(WITH_ARITH_ENC "Arithmetic encoding support") +endif() + +if(NOT WITH_12BIT) + report_option(WITH_TURBOJPEG "TurboJPEG API library") + report_option(WITH_JAVA "TurboJPEG Java wrapper") +endif() + +if(WITH_MEM_SRCDST) + set(MEM_SRCDST_SUPPORTED 1) + set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;") +endif() +if(NOT WITH_JPEG8) + report_option(WITH_MEM_SRCDST "In-memory source/destination managers") +endif() + +set(SO_AGE 2) +if(WITH_MEM_SRCDST) + set(SO_AGE 3) +endif() + +if(WITH_JPEG8) + set(JPEG_LIB_VERSION 80) +elseif(WITH_JPEG7) + set(JPEG_LIB_VERSION 70) +else() + set(JPEG_LIB_VERSION 62) +endif() + +math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10") +math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10") +if(JPEG_LIB_VERSION STREQUAL "62") + set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION}) +else() + set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10}) +endif() +if(JPEG_LIB_VERSION STREQUAL "80") + set(DEFAULT_SO_MINOR_VERSION 2) +else() + set(DEFAULT_SO_MINOR_VERSION 0) +endif() + +# This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if +# WITH_JPEG7 or WITH_JPEG8 has changed. +if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR + (DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT)) + set(FORCE_SO_VERSION "FORCE") +endif() +set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "") +set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "") + +set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING + "Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})" + ${FORCE_SO_VERSION}) +set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING + "Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})" + ${FORCE_SO_VERSION}) + +set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}") +message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})") +message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}") + +# Because the TurboJPEG API library uses versioned symbols and changes the +# names of functions whenever they are modified in a backward-incompatible +# manner, it is always backward-ABI-compatible with itself, so the major and +# minor SO versions don't change. However, we increase the middle number (the +# SO "age") whenever functions are added to the API. +set(TURBOJPEG_SO_MAJOR_VERSION 0) +set(TURBOJPEG_SO_AGE 2) +set(TURBOJPEG_SO_VERSION 0.${TURBOJPEG_SO_AGE}.0) + + +############################################################################### +# COMPILER SETTINGS +############################################################################### + +if(MSVC) + option(WITH_CRT_DLL + "Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it." + FALSE) + if(NOT WITH_CRT_DLL) + # Use the static C library for all build types + foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) + if(${var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") + endif() + endforeach() + endif() + add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) +endif() + +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + # Use the maximum optimization level for release builds + foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) + if(${var} MATCHES "-O2") + string(REGEX REPLACE "-O2" "-O3" ${var} "${${var}}") + endif() + endforeach() +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + if(CMAKE_C_COMPILER_ID MATCHES "SunPro") + # Use the maximum optimization level for release builds + foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) + if(${var} MATCHES "-xO3") + string(REGEX REPLACE "-xO3" "-xO5" ${var} "${${var}}") + endif() + if(${var} MATCHES "-xO2") + string(REGEX REPLACE "-xO2" "-xO5" ${var} "${${var}}") + endif() + endforeach() + endif() +endif() + +string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) + +set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}") + +set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}") +message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}") + +include(CheckCSourceCompiles) +include(CheckIncludeFiles) +include(CheckTypeSize) + +check_type_size("size_t" SIZE_T) +check_type_size("unsigned long" UNSIGNED_LONG) + +if(SIZE_T EQUAL UNSIGNED_LONG) + check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }" + HAVE_BUILTIN_CTZL) +endif() +if(MSVC) + check_include_files("intrin.h" HAVE_INTRIN_H) +endif() + +if(UNIX) + if(CMAKE_CROSSCOMPILING) + set(RIGHT_SHIFT_IS_UNSIGNED 0) + else() + include(CheckCSourceRuns) + check_c_source_runs(" + #include + #include + int is_shifting_signed (long arg) { + long res = arg >> 4; + if (res == -0x7F7E80CL) + return 1; /* right shift is signed */ + /* see if unsigned-shift hack will fix it. */ + /* we can't just test exact value since it depends on width of long... */ + res |= (~0L) << (32-4); + if (res == -0x7F7E80CL) + return 0; /* right shift is unsigned */ + printf(\"Right shift isn't acting as I expect it to.\\\\n\"); + printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\"); + return 0; /* try it with unsigned anyway */ + } + int main (void) { + exit(is_shifting_signed(-0x7F7E80B1L)); + }" RIGHT_SHIFT_IS_UNSIGNED) + endif() +endif() + +if(MSVC) + set(INLINE_OPTIONS "__inline;inline") +else() + set(INLINE_OPTIONS "__inline__;inline") +endif() +option(FORCE_INLINE "Force function inlining" TRUE) +boolean_number(FORCE_INLINE) +if(FORCE_INLINE) + if(MSVC) + list(INSERT INLINE_OPTIONS 0 "__forceinline") + else() + list(INSERT INLINE_OPTIONS 0 "inline __attribute__((always_inline))") + list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))") + endif() +endif() +foreach(inline ${INLINE_OPTIONS}) + check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }" + INLINE_WORKS) + if(INLINE_WORKS) + set(INLINE ${inline}) + break() + endif() +endforeach() +if(NOT INLINE_WORKS) + message(FATAL_ERROR "Could not determine how to inline functions.") +endif() +message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})") + +if(WITH_TURBOJPEG) + if(MSVC) + set(THREAD_LOCAL "__declspec(thread)") + else() + set(THREAD_LOCAL "__thread") + endif() + check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL) + if(HAVE_THREAD_LOCAL) + message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}") + else() + message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.") + unset(THREAD_LOCAL) + endif() +endif() + +if(UNIX AND NOT APPLE) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };") + set(CMAKE_REQUIRED_FLAGS + "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") + check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT) + set(CMAKE_REQUIRED_FLAGS) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) + if(HAVE_VERSION_SCRIPT) + message(STATUS "Linker supports GNU-style version scripts") + set(MAPFLAG "-Wl,--version-script,") + set(TJMAPFLAG "-Wl,--version-script,") + else() + message(STATUS "Linker does not support GNU-style version scripts") + if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + # The Solaris linker doesn't like our version script for the libjpeg API + # library, but the version script for the TurboJPEG API library should + # still work. + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map + "VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;") + set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map -shared") + check_c_source_compiles("int foo() { return 0; } int foo2() { return 2; }" + HAVE_MAPFILE) + set(CMAKE_REQUIRED_FLAGS) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) + if(HAVE_MAPFILE) + message(STATUS "Linker supports mapfiles") + set(TJMAPFLAG "-Wl,-M,") + else() + message(STATUS "Linker does not support mapfiles") + endif() + endif() + endif() +endif() + +# Generate files +if(WIN32) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/win/jconfig.h.in jconfig.h) +else() + configure_file(jconfig.h.in jconfig.h) +endif() +configure_file(jconfigint.h.in jconfigint.h) +configure_file(jversion.h.in jversion.h) +if(UNIX) + configure_file(libjpeg.map.in libjpeg.map) +endif() + +# Include directories and compiler definitions +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + + +############################################################################### +# TARGETS +############################################################################### + +if(CMAKE_EXECUTABLE_SUFFIX_TMP) + set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX_TMP}) +endif() +message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}") + +set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c + jcicc.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c + jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c + jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c + jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c + jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c + jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) + +if(WITH_ARITH_ENC OR WITH_ARITH_DEC) + set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c) +endif() + +if(WITH_ARITH_ENC) + set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c) +endif() + +if(WITH_ARITH_DEC) + set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c) +endif() + +if(WITH_SIMD) + add_subdirectory(simd) + if(NEON_INTRINSICS) + add_definitions(-DNEON_INTRINSICS) + endif() +elseif(NOT WITH_12BIT) + message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})") +endif() +if(WITH_SIMD) + message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})") + if(MSVC_IDE OR XCODE) + set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) + endif() +else() + add_library(simd OBJECT jsimd_none.c) + if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)) + set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1) + endif() +endif() + +if(WITH_JAVA) + add_subdirectory(java) +endif() + +if(ENABLE_SHARED) + add_subdirectory(sharedlib) +endif() + +if(ENABLE_STATIC) + add_library(jpeg-static STATIC ${JPEG_SOURCES} $ + ${SIMD_OBJS}) + if(NOT MSVC) + set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) + endif() +endif() + +if(WITH_TURBOJPEG) + if(ENABLE_SHARED) + set(TURBOJPEG_SOURCES ${JPEG_SOURCES} $ ${SIMD_OBJS} + turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c rdppm.c + wrbmp.c wrppm.c) + set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile) + if(WITH_JAVA) + set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) + include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) + set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile.jni) + endif() + if(MSVC) + configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in + ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) + set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} + ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) + endif() + add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) + set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS + "-DBMP_SUPPORTED -DPPM_SUPPORTED") + if(WIN32) + set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) + endif() + if(MINGW) + set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) + endif() + if(APPLE AND (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR + CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.4)) + if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") + endif() + set_target_properties(turbojpeg PROPERTIES MACOSX_RPATH 1) + endif() + set_target_properties(turbojpeg PROPERTIES + SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION}) + if(TJMAPFLAG) + set_target_properties(turbojpeg PROPERTIES + LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}") + endif() + endif() + + if(ENABLE_STATIC) + add_library(turbojpeg-static STATIC ${JPEG_SOURCES} $ + ${SIMD_OBJS} turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c + rdppm.c wrbmp.c wrppm.c) + set_property(TARGET turbojpeg-static PROPERTY COMPILE_FLAGS + "-DBMP_SUPPORTED -DPPM_SUPPORTED") + if(NOT MSVC) + set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) + endif() + endif() +endif() + +if(WIN32) + set(USE_SETMODE "-DUSE_SETMODE") +endif() +if(WITH_12BIT) + set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED ${USE_SETMODE}") +else() + set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}") + set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c) + set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c) +endif() \ No newline at end of file diff --git a/cmake/CMakeLists.png b/cmake/CMakeLists.png new file mode 100644 index 0000000000..2521ab41be --- /dev/null +++ b/cmake/CMakeLists.png @@ -0,0 +1,741 @@ +# CMakeLists.txt + +# Copyright (C) 2018 Cosmin Truta +# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson +# Written by Christian Ehrlicher, 2007 +# Revised by Roger Lowman, 2009-2010 +# Revised by Clifford Yapp, 2011-2012,2017 +# Revised by Roger Leigh, 2016 +# Revised by Andreas Franek, 2016 +# Revised by Sam Serrels, 2017 +# Revised by Vadim Barkov, 2017 +# Revised by Vicky Pfau, 2018 +# Revised by Cameron Cawley, 2018 +# Revised by Cosmin Truta, 2018 +# Revised by Kyle Bentley, 2018 + +# This code is released under the libpng license. +# For conditions of distribution and use, see the disclaimer +# and license in png.h + +cmake_minimum_required(VERSION 3.10) +cmake_policy(VERSION 3.1) +# When using CMake 3.4 and later, don't export symbols from executables unless +# the CMAKE_ENABLE_EXPORTS variable is set. +if(POLICY CMP0065) + cmake_policy(SET CMP0065 NEW) +endif() +if (POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() +set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) + +project(libpng C ASM) +enable_testing() + +set(PNGLIB_MAJOR 1) +set(PNGLIB_MINOR 6) +set(PNGLIB_RELEASE 37) +set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) +set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) + +include(GNUInstallDirs) + +# needed packages + +# Allow users to specify location of Zlib. +# Useful if zlib is being built alongside this as a sub-project. +option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" ON) + +if(NOT PNG_BUILD_ZLIB) + find_package(ZLIB REQUIRED) + include_directories(${ZLIB_INCLUDE_DIR}) +endif() + +if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) + find_library(M_LIBRARY m) +else() + # libm is not needed and/or not available + set(M_LIBRARY "") +endif() + +# COMMAND LINE OPTIONS +option(PNG_SHARED "Build shared lib" OFF) +option(PNG_STATIC "Build static lib" ON) +option(PNG_TESTS "Build libpng tests" OFF) + +# Many more configuration options could be added here +option(PNG_FRAMEWORK "Build OS X framework" OFF) +option(PNG_DEBUG "Build with debug output" OFF) +option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" OFF) + +set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names") +set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings") + +if(PNG_HARDWARE_OPTIMIZATIONS) + +# set definitions and sources for arm +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") + set(PNG_ARM_NEON_POSSIBLE_VALUES check on off) + set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations: + check: (default) use internal checking code; + off: disable the optimizations; + on: turn on unconditionally.") + set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS + ${PNG_ARM_NEON_POSSIBLE_VALUES}) + list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index) + if(index EQUAL -1) + message(FATAL_ERROR + "PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_ARM_NEON} STREQUAL "off") + set(libpng_arm_sources + arm/arm_init.c + arm/filter_neon.S + arm/filter_neon_intrinsics.c + arm/palette_neon_intrinsics.c) + + if(${PNG_ARM_NEON} STREQUAL "on") + add_definitions(-DPNG_ARM_NEON_OPT=2) + elseif(${PNG_ARM_NEON} STREQUAL "check") + add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED) + endif() + else() + add_definitions(-DPNG_ARM_NEON_OPT=0) + endif() +endif() + +# set definitions and sources for powerpc +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*") + set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off) + set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations: + off: disable the optimizations.") + set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS + ${PNG_POWERPC_VSX_POSSIBLE_VALUES}) + list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index) + if(index EQUAL -1) + message(FATAL_ERROR + "PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "off") + set(libpng_powerpc_sources + powerpc/powerpc_init.c + powerpc/filter_vsx_intrinsics.c) + if(${PNG_POWERPC_VSX} STREQUAL "on") + add_definitions(-DPNG_POWERPC_VSX_OPT=2) + endif() + else() + add_definitions(-DPNG_POWERPC_VSX_OPT=0) + endif() +endif() + +# set definitions and sources for intel +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*") + set(PNG_INTEL_SSE_POSSIBLE_VALUES on off) + set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations: + off: disable the optimizations") + set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS + ${PNG_INTEL_SSE_POSSIBLE_VALUES}) + list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index) + if(index EQUAL -1) + message(FATAL_ERROR + "PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_INTEL_SSE} STREQUAL "off") + set(libpng_intel_sources + intel/intel_init.c + intel/filter_sse2_intrinsics.c) + if(${PNG_INTEL_SSE} STREQUAL "on") + add_definitions(-DPNG_INTEL_SSE_OPT=1) + endif() + else() + add_definitions(-DPNG_INTEL_SSE_OPT=0) + endif() +endif() + +# set definitions and sources for MIPS +if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*") + set(PNG_MIPS_MSA_POSSIBLE_VALUES on off) + set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations: + off: disable the optimizations") + set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS + ${PNG_MIPS_MSA_POSSIBLE_VALUES}) + list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index) + if(index EQUAL -1) + message(FATAL_ERROR + "PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_MIPS_MSA} STREQUAL "off") + set(libpng_mips_sources + mips/mips_init.c + mips/filter_msa_intrinsics.c) + if(${PNG_MIPS_MSA} STREQUAL "on") + add_definitions(-DPNG_MIPS_MSA_OPT=2) + endif() + else() + add_definitions(-DPNG_MIPS_MSA_OPT=0) + endif() +endif() + +else(PNG_HARDWARE_OPTIMIZATIONS) + +# set definitions and sources for arm +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") + add_definitions(-DPNG_ARM_NEON_OPT=0) +endif() + +# set definitions and sources for powerpc +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*") + add_definitions(-DPNG_POWERPC_VSX_OPT=0) +endif() + +# set definitions and sources for intel +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*") + add_definitions(-DPNG_INTEL_SSE_OPT=0) +endif() + +# set definitions and sources for MIPS +if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*") + add_definitions(-DPNG_MIPS_MSA_OPT=0) +endif() + +endif(PNG_HARDWARE_OPTIMIZATIONS) + +# SET LIBNAME +set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR}) + +# to distinguish between debug and release lib +set(CMAKE_DEBUG_POSTFIX "d") + +include(CheckCSourceCompiles) +option(ld-version-script "Enable linker version script" ON) +if(ld-version-script AND NOT APPLE) + # Check if LD supports linker scripts. + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 { + global: sym; + local: *; +}; + +VERS_2 { + global: sym2; + main; +} VERS_1; +") + set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'") + check_c_source_compiles("void sym(void) {} +void sym2(void) {} +int main(void) {return 0;} +" HAVE_LD_VERSION_SCRIPT) + if(NOT HAVE_LD_VERSION_SCRIPT) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") + check_c_source_compiles("void sym(void) {} +void sym2(void) {} +int main(void) {return 0;} +" HAVE_SOLARIS_LD_VERSION_SCRIPT) + endif() + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map") +endif() + +# Find symbol prefix. Likely obsolete and unnecessary with recent +# toolchains (it's not done in many other projects). +function(symbol_prefix) + set(SYMBOL_PREFIX) + + execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-" + INPUT_FILE /dev/null + OUTPUT_VARIABLE OUT + RESULT_VARIABLE STATUS) + + if(CPP_FAIL) + message(WARNING "Failed to run the C preprocessor") + endif() + + string(REPLACE "\n" ";" OUT "${OUT}") + foreach(line ${OUT}) + string(REGEX MATCH "^PREFIX=" found_match "${line}") + if(found_match) + string(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}") + string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}") + if(found_match) + string(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}") + endif() + set(SYMBOL_PREFIX "${prefix}") + endif() + endforeach() + + message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}") + set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE) +endfunction() + +if(UNIX) + symbol_prefix() +endif() + +find_program(AWK NAMES gawk awk) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +if(NOT AWK OR ANDROID) + # No awk available to generate sources; use pre-built pnglibconf.h + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt + ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h) + add_custom_target(genfiles) # Dummy +else() + include(CMakeParseArguments) + # Generate .chk from .out with awk + # generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]]) + function(generate_chk) + set(options) + set(oneValueArgs INPUT OUTPUT) + set(multiValueArgs DEPENDS) + cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(NOT _GC_INPUT) + message(FATAL_ERROR "generate_chk: Missing INPUT argument") + endif() + if(NOT _GC_OUTPUT) + message(FATAL_ERROR "generate_chk: Missing OUTPUT argument") + endif() + + add_custom_command(OUTPUT "${_GC_OUTPUT}" + COMMAND "${CMAKE_COMMAND}" + "-DINPUT=${_GC_INPUT}" + "-DOUTPUT=${_GC_OUTPUT}" + -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake" + DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + endfunction() + + # Generate .out from .c with awk + # generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]]) + function(generate_out) + set(options) + set(oneValueArgs INPUT OUTPUT) + set(multiValueArgs DEPENDS) + cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(NOT _GO_INPUT) + message(FATAL_ERROR "generate_out: Missing INPUT argument") + endif() + if(NOT _GO_OUTPUT) + message(FATAL_ERROR "generate_out: Missing OUTPUT argument") + endif() + + add_custom_command(OUTPUT "${_GO_OUTPUT}" + COMMAND "${CMAKE_COMMAND}" + "-DINPUT=${_GO_INPUT}" + "-DOUTPUT=${_GO_OUTPUT}" + -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake" + DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + endfunction() + + # Generate specific source file with awk + # generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]]) + function(generate_source) + set(options) + set(oneValueArgs OUTPUT) + set(multiValueArgs DEPENDS) + cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(NOT _GSO_OUTPUT) + message(FATAL_ERROR "generate_source: Missing OUTPUT argument") + endif() + + add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}" + COMMAND "${CMAKE_COMMAND}" + "-DOUTPUT=${_GSO_OUTPUT}" + -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" + DEPENDS ${_GSO_DEPENDS} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + endfunction() + + # Copy file + function(generate_copy source destination) + add_custom_command(OUTPUT "${destination}" + COMMAND "${CMAKE_COMMAND}" -E remove "${destination}" + COMMAND "${CMAKE_COMMAND}" -E copy "${source}" + "${destination}" + DEPENDS "${source}") + endfunction() + + # Generate scripts/pnglibconf.h + generate_source(OUTPUT "scripts/pnglibconf.c" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk" + "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h") + + # Generate pnglibconf.c + generate_source(OUTPUT "pnglibconf.c" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk" + "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h") + + if(PNG_PREFIX) + set(PNGLIBCONF_H_EXTRA_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst") + set(PNGPREFIX_H_EXTRA_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out") + endif() + + generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out") + + # Generate pnglibconf.h + generate_source(OUTPUT "pnglibconf.h" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" + ${PNGLIBCONF_H_EXTRA_DEPENDS}) + + generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") + + generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" + "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" + "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out") + + # Generate pngprefix.h + generate_source(OUTPUT "pngprefix.h" + DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS}) + + generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") + + generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" + "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt") + + generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h" + "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h" + "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h") + + generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk" + "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def") + + add_custom_target(symbol-check DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk") + + generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" + "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym") + generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out" + "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers") + + add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers") + add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym") + + add_custom_target("genprebuilt" + COMMAND "${CMAKE_COMMAND}" + "-DOUTPUT=scripts/pnglibconf.h.prebuilt" + -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + + # A single target handles generation of all generated files. If + # they are depended upon separately by multiple targets, this + # confuses parallel make (it would require a separate top-level + # target for each file to track the dependencies properly). + add_custom_target(genfiles DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym" + "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers" + "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c" + "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" + "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" + "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h" + "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out" + "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c" + "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out" + "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out" + "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" + "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" + "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out") +endif(NOT AWK OR ANDROID) + +# OUR SOURCES +set(libpng_public_hdrs + png.h + pngconf.h + "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" +) +set(libpng_private_hdrs + pngpriv.h + pngdebug.h + pnginfo.h + pngstruct.h +) +if(AWK AND NOT ANDROID) + list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h") +endif() +set(libpng_sources + ${libpng_public_hdrs} + ${libpng_private_hdrs} + png.c + pngerror.c + pngget.c + pngmem.c + pngpread.c + pngread.c + pngrio.c + pngrtran.c + pngrutil.c + pngset.c + pngtrans.c + pngwio.c + pngwrite.c + pngwtran.c + pngwutil.c + ${libpng_arm_sources} + ${libpng_intel_sources} + ${libpng_mips_sources} + ${libpng_powerpc_sources} +) +set(pngtest_sources + pngtest.c +) +set(pngvalid_sources + contrib/libtests/pngvalid.c +) +set(pngstest_sources + contrib/libtests/pngstest.c +) +set(pngunknown_sources + contrib/libtests/pngunknown.c +) +set(pngimage_sources + contrib/libtests/pngimage.c +) +set(pngfix_sources + contrib/tools/pngfix.c +) +set(png_fix_itxt_sources + contrib/tools/png-fix-itxt.c +) + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) +endif() + +if(PNG_DEBUG) + add_definitions(-DPNG_DEBUG) +endif() + +# NOW BUILD OUR TARGET +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) + +unset(PNG_LIB_TARGETS) + +if(PNG_STATIC) + # does not work without changing name + set(PNG_LIB_NAME_STATIC png_static) + add_library(png_static STATIC ${libpng_sources}) + add_dependencies(png_static genfiles) + # MSVC doesn't use a different file extension for shared vs. static + # libs. We are able to change OUTPUT_NAME to remove the _static + # for all other platforms. + if(NOT MSVC) + set_target_properties(png_static PROPERTIES + OUTPUT_NAME "${PNG_LIB_NAME}" + CLEAN_DIRECT_OUTPUT 1) + else() + set_target_properties(png_static PROPERTIES + OUTPUT_NAME "${PNG_LIB_NAME}_static" + CLEAN_DIRECT_OUTPUT 1) + endif() + list(APPEND PNG_LIB_TARGETS png_static) + if(MSVC) + # msvc does not append 'lib' - do it here to have consistent name + set_target_properties(png_static PROPERTIES PREFIX "lib") + endif() + target_link_libraries(png_static ${M_LIBRARY}) +endif() + +if(NOT PNG_LIB_TARGETS) + message(SEND_ERROR + "No library variant selected to build. " + "Please enable at least one of the following options: " + "PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK") +endif() + +# Set a variable with CMake code which: +# Creates a symlink from src to dest (if possible) or alternatively +# copies if different. +include(CMakeParseArguments) + +function(create_symlink DEST_FILE) + + cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN}) + + if(NOT S_TARGET AND NOT S_FILE) + message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument") + endif() + + if(S_TARGET AND S_FILE) + message(FATAL_ERROR "create_symlink: Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; can only have one.") + endif() + + if(S_FILE) + # If we don't need to symlink something that's coming from a build target, + # we can go ahead and symlink/copy at configure time. + if(CMAKE_HOST_WIN32 AND NOT CYGWIN) + execute_process( + COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + else() + execute_process( + COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + endif() + endif() + + if(S_TARGET) + # We need to use generator expressions, which can be a bit tricky, so for + # simplicity make the symlink a POST_BUILD step and use the TARGET + # signature of add_custom_command. + if(CMAKE_HOST_WIN32 AND NOT CYGWIN) + add_custom_command(TARGET ${S_TARGET} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ $/${DEST_FILE}) + else() + add_custom_command(TARGET ${S_TARGET} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E create_symlink $ $/${DEST_FILE}) + endif() + endif() + +endfunction() + +# Create source generation scripts. +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY) + +# libpng is a library so default to 'lib' +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR lib) +endif() + +# CREATE PKGCONFIG FILES +# We use the same files like ./configure, so we have to set its vars. +# Only do this on Windows for Cygwin - the files don't make much sense outside +# of a UNIX look-alike. +if(NOT WIN32 OR CYGWIN OR MINGW) + set(prefix ${CMAKE_INSTALL_PREFIX}) + set(exec_prefix ${CMAKE_INSTALL_PREFIX}) + set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) + set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) + set(LIBS "-lz -lm") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY) + create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc) + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in + ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) + create_symlink(libpng-config FILE ${PNGLIB_NAME}-config) +endif() + +# SET UP LINKS +if(PNG_SHARED) + set_target_properties(png PROPERTIES +# VERSION 16.${PNGLIB_RELEASE}.1.6.37 + VERSION 16.${PNGLIB_RELEASE}.0 + SOVERSION 16 + CLEAN_DIRECT_OUTPUT 1) +endif() + +# INSTALL +if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) + install(TARGETS ${PNG_LIB_TARGETS} + EXPORT libpng + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + if(PNG_SHARED) + # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin + if(CYGWIN OR MINGW) + create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png) + install(FILES $/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + + if(NOT WIN32) + create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png) + install(FILES $/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + endif() + + if(PNG_STATIC) + if(NOT WIN32 OR CYGWIN OR MINGW) + create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) + install(FILES $/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + endif() +endif() + +if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) + install(FILES ${libpng_public_hdrs} DESTINATION include) + install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME}) +endif() +if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL) + if(NOT WIN32 OR CYGWIN OR MINGW) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) + endif() +endif() + +if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL) + install(TARGETS ${PNG_BIN_TARGETS} + RUNTIME DESTINATION bin) +endif() + +if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) + # Install man pages + if(NOT PNG_MAN_DIR) + set(PNG_MAN_DIR "share/man") + endif() + install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3) + install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5) + # Install pkg-config files + if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config + DESTINATION bin) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config + DESTINATION bin) + endif() +endif() + +# Create an export file that CMake users can include() to import our targets. +if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL) + install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake) +endif() + +# what's with libpng-manual.txt and all the extra files? + +# UNINSTALL +# do we need this? + +# DIST +# do we need this? + +# to create msvc import lib for mingw compiled shared lib +# pexports libpng.dll > libpng.def +# lib /def:libpng.def /machine:x86 diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7ce6568cf0..b0eacc9cff 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -107,7 +107,7 @@ endif() # silence excessive warnings for new Intel Compilers if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") - set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare") + set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare -Wno-unused-command-line-argument") endif() # silence excessive warnings for PGI/NVHPC compilers @@ -116,7 +116,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL " endif() # silence nvcc warnings -if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA)) +if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma") endif() @@ -161,10 +161,12 @@ option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared lib option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF) option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF) -# allow enabling clang-tidy for C++ files +# Support using clang-tidy for C++ files with selected options set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling") if(ENABLE_CLANG_TIDY) - set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*-header-filter=.*" CACHE STRING "") + set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*,performance-trivially-destructible,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,modernize-use-override,modernize-use-bool-literals,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-equals-default,modernize-use-equals-delete,modernize-replace-random-shuffle,modernize-deprecated-headers,modernize-use-nullptr,modernize-use-noexcept,modernize-redundant-void-arg;-fix;-header-filter=.*,header-filter=library.h,header-filter=fmt/*.h" CACHE STRING "clang-tidy settings") +else() + unset(CMAKE_CXX_CLANG_TIDY CACHE) endif() include(GNUInstallDirs) @@ -210,6 +212,7 @@ set(STANDARD_PACKAGES DPD-SMOOTH DRUDE EFF + ELECTRODE EXTRA-COMPUTE EXTRA-DUMP EXTRA-FIX @@ -328,7 +331,9 @@ string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES) target_compile_definitions(lammps PUBLIC -DLAMMPS_${LAMMPS_SIZES}) # posix_memalign is not available on Windows -if(CMAKE_SYSTEM_NAME STREQUAL "Windows") +# with INTEL package and Intel compilers we use TBB's aligned malloc +if((CMAKE_SYSTEM_NAME STREQUAL "Windows") + AND NOT (PKG_INTEL AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")))) set(LAMMPS_MEMALIGN "0" CACHE STRING "posix_memalign() is not available on Windows" FORCE) else() set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable") @@ -354,6 +359,7 @@ pkg_depends(DIELECTRIC KSPACE) pkg_depends(DIELECTRIC EXTRA-PAIR) pkg_depends(CG-DNA MOLECULE) pkg_depends(CG-DNA ASPHERE) +pkg_depends(ELECTRODE KSPACE) # detect if we may enable OpenMP support by default set(BUILD_OMP_DEFAULT OFF) @@ -391,7 +397,7 @@ if(BUILD_OMP) target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX) endif() -if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE) +if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE OR PKG_ELECTRODE) enable_language(C) find_package(LAPACK) find_package(BLAS) @@ -414,9 +420,23 @@ endif() # tweak jpeg library names to avoid linker errors with MinGW cross-compilation set(JPEG_NAMES libjpeg libjpeg-62) find_package(JPEG QUIET) +if((NOT JPEG_FOUND) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)) + 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) + include(ExternalCMakeProject) + 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() option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND}) if(WITH_JPEG) - find_package(JPEG REQUIRED) + if(NOT JPEG_FOUND) + find_package(JPEG REQUIRED) + endif() target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG) if(CMAKE_VERSION VERSION_LESS 3.12) target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS}) @@ -428,14 +448,43 @@ endif() find_package(PNG QUIET) find_package(ZLIB QUIET) +if((NOT ZLIB_FOUND) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)) + 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) + include(ExternalCMakeProject) + 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) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)) + 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) + include(ExternalCMakeProject) + 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() 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) - find_package(PNG REQUIRED) - find_package(ZLIB REQUIRED) + if(NOT PNG_FOUND) + find_package(PNG REQUIRED) + endif() + if(NOT ZLIB_FOUND) + find_package(ZLIB REQUIRED) + endif() target_link_libraries(lammps PRIVATE PNG::PNG ZLIB::ZLIB) target_compile_definitions(lammps PRIVATE -DLAMMPS_PNG) endif() @@ -595,6 +644,10 @@ foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT) endif() endforeach() +if(PKG_ELECTRODE) + target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES}) +endif() + if(PKG_AWPMD) target_link_libraries(awpmd PRIVATE ${LAPACK_LIBRARIES}) endif() @@ -943,6 +996,12 @@ if(PKG_KSPACE) else() message(STATUS "Kokkos FFT: cuFFT") endif() + elseif(Kokkos_ENABLE_HIP) + if(FFT STREQUAL "KISS") + message(STATUS "Kokkos FFT: KISS") + else() + message(STATUS "Kokkos FFT: hipFFT") + endif() else() message(STATUS "Kokkos FFT: ${FFT}") endif() diff --git a/cmake/CMakeLists.zlib b/cmake/CMakeLists.zlib new file mode 100644 index 0000000000..a33f14ce64 --- /dev/null +++ b/cmake/CMakeLists.zlib @@ -0,0 +1,195 @@ +cmake_minimum_required(VERSION 3.10) +# When using CMake 3.4 and later, don't export symbols from executables unless +# the CMAKE_ENABLE_EXPORTS variable is set. +if(POLICY CMP0065) + cmake_policy(SET CMP0065 NEW) +endif() +if (POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() +set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) + +project(zlib C) + +set(VERSION "1.2.11") + +option(ASM686 "Enable building i686 assembly implementation" OFF) +option(AMD64 "Enable building amd64 assembly implementation" OFF) + +set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") +set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") +set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") +set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") +set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") + +include(CheckTypeSize) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckCSourceCompiles) + +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stddef.h HAVE_STDDEF_H) + +# +# Check to see if we have large file support +# +set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) +# We add these other definitions here because CheckTypeSize.cmake +# in CMake 2.4.x does not automatically do so and we want +# compatibility with CMake 2.4.x. +if(HAVE_SYS_TYPES_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) +endif() +if(HAVE_STDINT_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) +endif() +if(HAVE_STDDEF_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) +endif() +check_type_size(off64_t OFF64_T) +check_type_size(off64_t OFF64_T) +if(HAVE_OFF64_T) + add_definitions(-D_LARGEFILE64_SOURCE=1) +endif() +set(CMAKE_REQUIRED_DEFINITIONS) # clear variable + +# +# Check for fseeko +# +check_function_exists(fseeko HAVE_FSEEKO) +if(NOT HAVE_FSEEKO) + add_definitions(-DNO_FSEEKO) +endif() + +# +# Check for unistd.h +# +check_include_file(unistd.h Z_HAVE_UNISTD_H) + +if(MSVC) + set(CMAKE_DEBUG_POSTFIX "d") + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +endif() + +if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) + # If we're doing an out of source build and the user has a zconf.h + # in their source tree... + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) + file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) + endif() +endif() + +set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein + ${ZLIB_PC} @ONLY) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein + ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) + + +#============================================================================ +# zlib +#============================================================================ + +set(ZLIB_PUBLIC_HDRS + ${CMAKE_CURRENT_BINARY_DIR}/zconf.h + zlib.h +) +set(ZLIB_PRIVATE_HDRS + crc32.h + deflate.h + gzguts.h + inffast.h + inffixed.h + inflate.h + inftrees.h + trees.h + zutil.h +) +set(ZLIB_SRCS + adler32.c + compress.c + crc32.c + deflate.c + gzclose.c + gzlib.c + gzread.c + gzwrite.c + inflate.c + infback.c + inftrees.c + inffast.c + trees.c + uncompr.c + zutil.c +) + +if(NOT MINGW) + set(ZLIB_DLL_SRCS + win32/zlib1.rc # If present will override custom build rule below. + ) +endif() + +if(CMAKE_COMPILER_IS_GNUCC) + if(ASM686) + set(ZLIB_ASMS contrib/asm686/match.S) + elseif (AMD64) + set(ZLIB_ASMS contrib/amd64/amd64-match.S) + endif () + + if(ZLIB_ASMS) + add_definitions(-DASMV) + set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) + endif() +endif() + +if(MSVC) + if(ASM686) + ENABLE_LANGUAGE(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx86/inffas32.asm + contrib/masmx86/match686.asm + ) + elseif (AMD64) + ENABLE_LANGUAGE(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx64/gvmat64.asm + contrib/masmx64/inffasx64.asm + ) + endif() + + if(ZLIB_ASMS) + add_definitions(-DASMV -DASMINF) + endif() +endif() + +# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) +string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" + "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) + +if(MINGW) + # This gets us DLL resource information when compiling on MinGW. + if(NOT CMAKE_RC_COMPILER) + set(CMAKE_RC_COMPILER windres.exe) + endif() + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + COMMAND ${CMAKE_RC_COMPILER} + -D GCC_WINDRES + -I ${CMAKE_CURRENT_SOURCE_DIR} + -I ${CMAKE_CURRENT_BINARY_DIR} + -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) +endif(MINGW) + +add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) + +if(UNIX) + # On unix-like platforms the library is almost always called libz + set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z) +endif() \ No newline at end of file diff --git a/cmake/CMakeSettings.json b/cmake/CMakeSettings.json index d8ef47a220..c139114c0b 100644 --- a/cmake/CMakeSettings.json +++ b/cmake/CMakeSettings.json @@ -8,7 +8,7 @@ "installRoot": "${workspaceRoot}\\install\\${name}", "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake", "buildCommandArgs": "", - "ctestCommandArgs": "", + "ctestCommandArgs": "-V", "inheritEnvironments": [ "msvc_x64_x64" ], "variables": [ { @@ -26,11 +26,6 @@ "value": "True", "type": "BOOL" }, - { - "name": "PKG_PYTHON", - "value": "True", - "type": "BOOL" - }, { "name": "ENABLE_TESTING", "value": "True", @@ -46,7 +41,7 @@ "installRoot": "${workspaceRoot}\\install\\${name}", "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake", "buildCommandArgs": "", - "ctestCommandArgs": "", + "ctestCommandArgs": "-V", "inheritEnvironments": [ "msvc_x64_x64" ], "variables": [ { @@ -64,11 +59,6 @@ "value": "True", "type": "BOOL" }, - { - "name": "PKG_PYTHON", - "value": "True", - "type": "BOOL" - }, { "name": "ENABLE_TESTING", "value": "True", @@ -102,11 +92,6 @@ "value": "True", "type": "BOOL" }, - { - "name": "PKG_PYTHON", - "value": "True", - "type": "BOOL" - }, { "name": "ENABLE_TESTING", "value": "True", @@ -122,7 +107,7 @@ "installRoot": "${workspaceRoot}\\install\\${name}", "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe", "buildCommandArgs": "", - "ctestCommandArgs": "", + "ctestCommandArgs": "-V", "inheritEnvironments": [ "clang_cl_x64" ], "variables": [ { @@ -141,7 +126,40 @@ "type": "BOOL" }, { - "name": "PKG_PYTHON", + "name": "ENABLE_TESTING", + "value": "True", + "type": "BOOL" + } + ] + }, + { + "name": "x64-Debug-IntelLLVM", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "buildCommandArgs": "", + "ctestCommandArgs": "-V", + "inheritEnvironments": [], + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-llvm.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "variables": [ + { + "name": "PKG_ELECTRODE", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", "value": "True", "type": "BOOL" }, @@ -149,8 +167,142 @@ "name": "ENABLE_TESTING", "value": "True", "type": "BOOL" + }, + { + "name": "FFT", + "value": "MKL", + "type": "STRING" + } + ] + }, + { + "name": "x64-Release-IntelLLVM", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-llvm.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "buildCommandArgs": "", + "ctestCommandArgs": "-V", + "inheritEnvironments": [], + "variables": [ + { + "name": "PKG_ELECTRODE", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "True", + "type": "BOOL" + }, + { + "name": "FFT", + "value": "MKL", + "type": "STRING" + } + ] + }, + { + "name": "x64-Debug-Intel-Classic", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-classic.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "buildCommandArgs": "", + "ctestCommandArgs": "-V", + "inheritEnvironments": [], + "variables": [ + { + "name": "PKG_ELECTRODE", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "False", + "type": "BOOL" + }, + { + "name": "FFT", + "value": "MKL", + "type": "STRING" + } + ] + }, + { + "name": "x64-Release-Intel-Classic", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows-intel-classic.cmake -C ${workspaceRoot}\\cmake\\presets\\windows.cmake", + "buildCommandArgs": "", + "ctestCommandArgs": "-V", + "inheritEnvironments": [], + "variables": [ + { + "name": "PKG_ELECTRODE", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "False", + "type": "BOOL" + }, + { + "name": "FFT", + "value": "MKL", + "type": "STRING" } ] } ] -} \ No newline at end of file +} diff --git a/cmake/Modules/Packages/COMPRESS.cmake b/cmake/Modules/Packages/COMPRESS.cmake index bdcf1aa3f8..d9e2ccf7ad 100644 --- a/cmake/Modules/Packages/COMPRESS.cmake +++ b/cmake/Modules/Packages/COMPRESS.cmake @@ -1,4 +1,6 @@ -find_package(ZLIB REQUIRED) +if(NOT ZLIB_FOUND) + find_package(ZLIB REQUIRED) +endif() target_link_libraries(lammps PRIVATE ZLIB::ZLIB) find_package(PkgConfig QUIET) diff --git a/cmake/Modules/Packages/INTEL.cmake b/cmake/Modules/Packages/INTEL.cmake index af08249090..ce8455e542 100644 --- a/cmake/Modules/Packages/INTEL.cmake +++ b/cmake/Modules/Packages/INTEL.cmake @@ -38,7 +38,7 @@ if(INTEL_LRT_MODE STREQUAL "C++11") endif() endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") +if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) message(FATAL_ERROR "INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}") endif() @@ -46,12 +46,12 @@ else() message(WARNING "INTEL gives best performance with Intel compilers") endif() -find_package(TBB_MALLOC QUIET) +find_package(TBB_MALLOC) if(TBB_MALLOC_FOUND) target_link_libraries(lammps PRIVATE TBB::TBB_MALLOC) else() target_compile_definitions(lammps PRIVATE -DLMP_INTEL_NO_TBB) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")) message(WARNING "INTEL with Intel compilers should use TBB malloc libraries") endif() endif() @@ -112,5 +112,9 @@ if(PKG_KSPACE) RegisterIntegrateStyle(${INTEL_SOURCES_DIR}/verlet_lrt_intel.h) endif() +if(PKG_ELECTRODE) + list(APPEND INTEL_SOURCES ${INTEL_SOURCES_DIR}/electrode_accel_intel.cpp) +endif() + target_sources(lammps PRIVATE ${INTEL_SOURCES}) target_include_directories(lammps PRIVATE ${INTEL_SOURCES_DIR}) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index 4e35e6dcc0..cf3d19c720 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -47,8 +47,8 @@ if(DOWNLOAD_KOKKOS) list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") include(ExternalProject) - set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.5.00.tar.gz" CACHE STRING "URL for KOKKOS tarball") - set(KOKKOS_MD5 "079323d973ae0e1c38c0a54a150c674e" CACHE STRING "MD5 checksum of KOKKOS tarball") + set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.6.00.tar.gz" CACHE STRING "URL for KOKKOS tarball") + set(KOKKOS_MD5 "b5c44ea961031795f434002cd7b31c20" CACHE STRING "MD5 checksum of KOKKOS tarball") mark_as_advanced(KOKKOS_URL) mark_as_advanced(KOKKOS_MD5) ExternalProject_Add(kokkos_build @@ -72,7 +72,7 @@ if(DOWNLOAD_KOKKOS) add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) elseif(EXTERNAL_KOKKOS) - find_package(Kokkos 3.5.00 REQUIRED CONFIG) + find_package(Kokkos 3.6.00 REQUIRED CONFIG) target_link_libraries(lammps PRIVATE Kokkos::kokkos) target_link_libraries(lmp PRIVATE Kokkos::kokkos) else() @@ -130,6 +130,11 @@ if(PKG_KSPACE) target_compile_definitions(lammps PRIVATE -DFFT_CUFFT) target_link_libraries(lammps PRIVATE cufft) endif() + elseif(Kokkos_ENABLE_HIP) + if(NOT (FFT STREQUAL "KISS")) + target_compile_definitions(lammps PRIVATE -DFFT_HIPFFT) + target_link_libraries(lammps PRIVATE hipfft) + endif() endif() endif() diff --git a/cmake/Modules/Packages/MDI.cmake b/cmake/Modules/Packages/MDI.cmake index 1eec53db37..88859f0285 100644 --- a/cmake/Modules/Packages/MDI.cmake +++ b/cmake/Modules/Packages/MDI.cmake @@ -50,6 +50,7 @@ if(DOWNLOAD_MDI) -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dlanguage=C -Dlibtype=STATIC -Dmpi=${MDI_USE_MPI} diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index d46197114d..635a9ff2f5 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,6 +1,6 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "a2ac3315c41a1a4a5c912bcb1bc9c5cc" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_MD5 "e0572de57039d4afedefb25707b6ceae" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) @@ -15,6 +15,10 @@ execute_process( ) file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*) +# enforce building libyaml-cpp as static library and turn off optional features +set(YAML_BUILD_SHARED_LIBS OFF) +set(YAML_CPP_BUILD_CONTRIB OFF) +set(YAML_CPP_BUILD_TOOLS OFF) add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) diff --git a/cmake/Modules/Tools.cmake b/cmake/Modules/Tools.cmake index c3b0a0771d..d2758f1f24 100644 --- a/cmake/Modules/Tools.cmake +++ b/cmake/Modules/Tools.cmake @@ -3,6 +3,9 @@ if(BUILD_TOOLS) target_compile_definitions(binary2txt PRIVATE -DLAMMPS_${LAMMPS_SIZES}) install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) + add_executable(stl_bin2txt ${LAMMPS_TOOLS_DIR}/stl_bin2txt.cpp) + install(TARGETS stl_bin2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) + include(CheckGeneratorSupport) if(CMAKE_GENERATOR_SUPPORT_FORTRAN) include(CheckLanguage) diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index fff167fa0b..92e79c02c7 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -26,6 +26,7 @@ set(ALL_PACKAGES DPD-REACT DPD-SMOOTH DRUDE + ELECTRODE EFF EXTRA-COMPUTE EXTRA-DUMP diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index df42c09232..3cc705a126 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -28,6 +28,7 @@ set(ALL_PACKAGES DPD-REACT DPD-SMOOTH DRUDE + ELECTRODE EFF EXTRA-COMPUTE EXTRA-DUMP diff --git a/cmake/presets/kokkos-cuda.cmake b/cmake/presets/kokkos-cuda.cmake index c0f9e7f21b..ace8ff0879 100644 --- a/cmake/presets/kokkos-cuda.cmake +++ b/cmake/presets/kokkos-cuda.cmake @@ -3,7 +3,9 @@ # that is compatible with all higher CC, but not the default CC 3.5 set(PKG_KOKKOS ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) -set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE) set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE) set(BUILD_OMP ON CACHE BOOL "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/kokkos-hip.cmake b/cmake/presets/kokkos-hip.cmake new file mode 100644 index 0000000000..827a37152b --- /dev/null +++ b/cmake/presets/kokkos-hip.cmake @@ -0,0 +1,20 @@ +# preset that enables KOKKOS and selects HIP compilation with OpenMP +# enabled as well. Also sets some performance related compiler flags. +set(PKG_KOKKOS ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_HIP ON CACHE BOOL "" FORCE) +set(Kokkos_ARCH_VEGA90A on CACHE BOOL "" FORCE) +set(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS ON CACHE BOOL "" FORCE) +set(BUILD_OMP ON CACHE BOOL "" FORCE) + +set(CMAKE_CXX_COMPILER hipcc CACHE STRING "" FORCE) +set(CMAKE_TUNE_FLAGS "-munsafe-fp-atomics" CACHE STRING "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) + +# these flags are needed to build with Cray MPICH on OLCF Crusher +#-D CMAKE_CXX_FLAGS="-I/${MPICH_DIR}/include" +#-D MPI_CXX_LIBRARIES="-L${MPICH_DIR}/lib -lmpi -L${CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa" diff --git a/cmake/presets/kokkos-openmp.cmake b/cmake/presets/kokkos-openmp.cmake index 27d09f62cf..3a7c19ff3c 100644 --- a/cmake/presets/kokkos-openmp.cmake +++ b/cmake/presets/kokkos-openmp.cmake @@ -4,3 +4,6 @@ set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) set(BUILD_OMP ON CACHE BOOL "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/kokkos-serial.cmake b/cmake/presets/kokkos-serial.cmake index 0208d2ee3a..f1bda7124a 100644 --- a/cmake/presets/kokkos-serial.cmake +++ b/cmake/presets/kokkos-serial.cmake @@ -3,3 +3,6 @@ set(PKG_KOKKOS ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_OPENMP OFF CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) + +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/kokkos-sycl.cmake b/cmake/presets/kokkos-sycl.cmake index 01abe7762f..c706aca7d8 100644 --- a/cmake/presets/kokkos-sycl.cmake +++ b/cmake/presets/kokkos-sycl.cmake @@ -8,6 +8,9 @@ set(Kokkos_ENABLE_SYCL ON CACHE BOOL "" FORCE) set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE) set(BUILD_OMP ON CACHE BOOL "" FORCE) +# hide deprecation warnings temporarily for stable release +set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) + set(CMAKE_CXX_COMPILER clang++ CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 1e78537686..4ac9eddc98 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -22,6 +22,7 @@ set(WIN_PACKAGES DPD-REACT DPD-SMOOTH DRUDE + ELECTRODE EFF EXTRA-COMPUTE EXTRA-DUMP diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index 481193a627..b3e0f5ca6c 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -24,6 +24,7 @@ set(ALL_PACKAGES DPD-REACT DPD-SMOOTH DRUDE + ELECTRODE EFF EXTRA-COMPUTE EXTRA-DUMP diff --git a/cmake/presets/nolib.cmake b/cmake/presets/nolib.cmake index cb9c6f26b3..b6567ad617 100644 --- a/cmake/presets/nolib.cmake +++ b/cmake/presets/nolib.cmake @@ -6,6 +6,7 @@ set(PACKAGES_WITH_LIB ATC AWPMD COMPRESS + ELECTRODE GPU H5MD KIM diff --git a/cmake/presets/windows-intel-classic.cmake b/cmake/presets/windows-intel-classic.cmake new file mode 100644 index 0000000000..ce6db622f0 --- /dev/null +++ b/cmake/presets/windows-intel-classic.cmake @@ -0,0 +1,8 @@ +# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes) + +set(CMAKE_CXX_COMPILER "icl" CACHE STRING "" FORCE) +set(CMAKE_C_COMPILER "icl" CACHE STRING "" FORCE) +set(CMAKE_Fortran_COMPILER "ifort" CACHE STRING "" FORCE) + +unset(HAVE_OMP_H_INCLUDE CACHE) + diff --git a/cmake/presets/windows-intel-llvm.cmake b/cmake/presets/windows-intel-llvm.cmake new file mode 100644 index 0000000000..e9d88d22fe --- /dev/null +++ b/cmake/presets/windows-intel-llvm.cmake @@ -0,0 +1,8 @@ +# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes) + +set(CMAKE_CXX_COMPILER "icx" CACHE STRING "" FORCE) +set(CMAKE_C_COMPILER "icx" CACHE STRING "" FORCE) +set(CMAKE_Fortran_COMPILER "ifx" CACHE STRING "" FORCE) +set(INTEL_LRT_MODE "C++11" CACHE STRING "" FORCE) +unset(HAVE_OMP_H_INCLUDE CACHE) +set(CMAKE_TUNE_FLAGS -Wno-unused-command-line-argument) diff --git a/cmake/presets/windows.cmake b/cmake/presets/windows.cmake index cb75d8aac0..f079e6d442 100644 --- a/cmake/presets/windows.cmake +++ b/cmake/presets/windows.cmake @@ -10,6 +10,7 @@ set(WIN_PACKAGES CLASS2 COLLOID COLVARS + COMPRESS CORESHELL DIELECTRIC DIFFRACTION @@ -44,6 +45,7 @@ set(WIN_PACKAGES PERI PHONON POEMS + PLUGIN PTM QEQ QTB diff --git a/doc/Makefile b/doc/Makefile index 113a64ec10..07b201b07e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -13,6 +13,7 @@ VENV = $(BUILDDIR)/docenv ANCHORCHECK = $(VENV)/bin/rst_anchor_check SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config MATHJAX = $(SPHINXCONFIG)/_static/mathjax +MATHJAXTAG = 3.2.1 PYTHON = $(word 3,$(shell type python3)) DOXYGEN = $(word 3,$(shell type doxygen)) @@ -230,12 +231,13 @@ $(VENV): $(PYTHON) -m venv $(VENV); \ . $(VENV)/bin/activate; \ pip $(PIP_OPTIONS) install --upgrade pip; \ + pip $(PIP_OPTIONS) install --upgrade wheel; \ pip $(PIP_OPTIONS) install -r $(BUILDDIR)/utils/requirements.txt; \ deactivate;\ ) $(MATHJAX): - @git clone -b 3.2.0 -c advice.detachedHead=0 --depth 1 https://github.com/mathjax/MathJax.git $@ + @git clone -b $(MATHJAXTAG) -c advice.detachedHead=0 --depth 1 https://github.com/mathjax/MathJax.git $@ $(ANCHORCHECK): $(VENV) @( \ diff --git a/doc/doxygen/Doxyfile.in b/doc/doxygen/Doxyfile.in index d454898f4e..e905d5a64d 100644 --- a/doc/doxygen/Doxyfile.in +++ b/doc/doxygen/Doxyfile.in @@ -2,7 +2,7 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "LAMMPS Programmer's Guide" -PROJECT_NUMBER = "24 August 2020" +PROJECT_NUMBER = "4 May 2022" PROJECT_BRIEF = "Documentation of the LAMMPS library interface and Python wrapper" PROJECT_LOGO = lammps-logo.png CREATE_SUBDIRS = NO @@ -437,6 +437,8 @@ INPUT = @LAMMPS_SOURCE_DIR@/utils.cpp \ @LAMMPS_SOURCE_DIR@/math_eigen.h \ @LAMMPS_SOURCE_DIR@/platform.h \ @LAMMPS_SOURCE_DIR@/platform.cpp \ + @LAMMPS_SOURCE_DIR@/math_special.h \ + @LAMMPS_SOURCE_DIR@/math_special.cpp \ # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/doc/lammps.1 b/doc/lammps.1 index b8011d0cb0..8ce751844a 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "1" "24 March 2022" "2022-3-24" +.TH LAMMPS "1" "4 May 2022" "2022-5-4" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. Version 24 March 2022 diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index d2d12b48db..14d0e290aa 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -641,14 +641,27 @@ This list was last updated for version 3.5.0 of the Kokkos library. -D CMAKE_CXX_COMPILER=${HOME}/lammps/lib/kokkos/bin/nvcc_wrapper - To simplify compilation, four preset files are included in the + For AMD or NVIDIA GPUs using HIP, set these variables: + + .. code-block:: bash + + -D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above + -D Kokkos_ARCH_GPUARCH=yes # GPUARCH = GPU from list above + -D Kokkos_ENABLE_HIP=yes + -D Kokkos_ENABLE_OPENMP=yes + + This will enable FFTs on the GPU, either by the internal KISSFFT library + or with the hipFFT wrapper library, which will call out to the + platform-appropriate vendor library: rocFFT on AMD GPUs or cuFFT on + NVIDIA GPUs. + + To simplify compilation, five preset files are included in the ``cmake/presets`` folder, ``kokkos-serial.cmake``, - ``kokkos-openmp.cmake``, ``kokkos-cuda.cmake``, and - ``kokkos-sycl.cmake``. They will enable the KOKKOS package and - enable some hardware choice. So to compile with OpenMP host - parallelization, CUDA device parallelization (for GPUs with CC 5.0 - and up) with some common packages enabled, you can do the - following: + ``kokkos-openmp.cmake``, ``kokkos-cuda.cmake``, + ``kokkos-hip.cmake``, and ``kokkos-sycl.cmake``. They will enable + the KOKKOS package and enable some hardware choice. So to compile + with CUDA device parallelization (for GPUs with CC 5.0 and up) + with some common packages enabled, you can do the following: .. code-block:: bash @@ -707,6 +720,15 @@ This list was last updated for version 3.5.0 of the Kokkos library. KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) CC = mpicxx -cxx=$(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper + For AMD or NVIDIA GPUs using HIP: + + .. code-block:: make + + KOKKOS_DEVICES = HIP + KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is hosting the GPU + # GPUARCH = GPU from list above + FFT_INC = -DFFT_HIPFFT # enable use of hipFFT (optional) + FFT_LIB = -lhipfft # link to hipFFT library Advanced KOKKOS compilation settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1252,6 +1274,41 @@ be built for the most part with all major versions of the C++ language. ---------- +.. _electrode: + +ELECTRODE package +----------------- + +This package depends on the KSPACE package. + +.. tabs:: + + .. tab:: CMake build + + No additional settings are needed besides ``-D PKG_KSPACE=yes`` and ``-D + PKG_ELECTRODE=yes``. + + .. tab:: Traditional make + + The package is activated with ``make yes-KSPACE`` and ``make + yes-ELECTRODE`` + + + Note that the ``Makefile.lammps`` file has settings for the BLAS and + LAPACK linear algebra libraries. As explained in ``lib/awpmd/README`` + these can either exist on your system, or you can use the files provided + in ``lib/linalg``. In the latter case you also need to build the library + in ``lib/linalg`` with a command like these: + + .. code-block:: bash + + $ make lib-linalg # print help message + $ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") + $ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") + $ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler + +---------- + .. _ml-pace: ML-PACE package diff --git a/doc/src/Build_package.rst b/doc/src/Build_package.rst index 67639a46b9..9eeda4d8d4 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -150,7 +150,7 @@ other files dependent on that package are also excluded. .. _cmake_presets: CMake presets for installing many packages -"""""""""""""""""""""""""""""""""""""""""" +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Instead of specifying all the CMake options via the command-line, CMake allows initializing its settings cache using script files. @@ -178,6 +178,11 @@ one of them as a starting point and customize it to your needs. cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross compilers +Presets that have names starting with "windows" are specifically for +compiling LAMMPS :doc:`natively on Windows ` and +presets that have names starting with "kokkos" are specifically for +selecting configurations for compiling LAMMPS with :ref:`KOKKOS `. + .. note:: Running cmake this way manipulates the CMake settings cache in your @@ -220,7 +225,8 @@ These commands install/un-install sets of packages: .. code-block:: bash make yes-all # install all packages - make no-all # uninstall all packages + make no-all # check for changes and uninstall all packages + make no-installed # only check and uninstall installed packages make yes-basic # install a few commonly used packages' make no-basic # remove a few commonly used packages' make yes-most # install most packages w/o libs' diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index 6053bdbf8a..bdae796bae 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -287,8 +287,8 @@ Output of JPG, PNG, and movie files The :doc:`dump image ` command has options to output JPEG or PNG image files. Likewise the :doc:`dump movie ` command -outputs movie files in MPEG format. Using these options requires the -following settings: +outputs movie files in a variety of movie formats. Using these options +requires the following settings: .. tabs:: @@ -297,15 +297,15 @@ following settings: .. code-block:: bash -D WITH_JPEG=value # yes or no - # default = yes if CMake finds JPEG files, else no + # default = yes -D WITH_PNG=value # yes or no - # default = yes if CMake finds PNG and ZLIB files, else no + # default = yes -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 CMake cannot - find the graphics header, library, executable files, you can set - these variables: + 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: .. code-block:: bash @@ -317,6 +317,9 @@ 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 @@ -328,11 +331,12 @@ following settings: JPG_LIB = -ljpeg -lpng -lz # library names As with CMake, you do not need to set ``JPG_INC`` or ``JPG_PATH``, - if make can find the graphics header and library files. You must - specify ``JPG_LIB`` with a list of graphics libraries to include - in the link. You must insure ffmpeg is in a directory where - LAMMPS can find it at runtime, that is a directory in your PATH - environment variable. + if make can find the graphics header and library files in their + default system locations. You must specify ``JPG_LIB`` with a + list of graphics libraries to include in the link. You must make + certain that the ffmpeg executable (or ffmpeg.exe on Windows) is + in a directory where LAMMPS can find it at runtime; that is + usually a directory list in your ``PATH`` environment variable. Using ``ffmpeg`` to output movie files requires that your machine supports the "popen" function in the standard runtime library. diff --git a/doc/src/Build_windows.rst b/doc/src/Build_windows.rst index 28fd3ff48b..d1748825eb 100644 --- a/doc/src/Build_windows.rst +++ b/doc/src/Build_windows.rst @@ -5,6 +5,7 @@ Notes for building LAMMPS on Windows * :ref:`Running Linux on Windows ` * :ref:`Using GNU GCC ported to Windows ` * :ref:`Using Visual Studio ` +* :ref:`Using Intel oneAPI compilers and libraries ` * :ref:`Using a cross-compiler ` ---------- @@ -25,8 +26,10 @@ assistance in resolving portability issues. This is particularly true for compiling LAMMPS on Windows, since this platform has significant differences in some low-level functionality. As of LAMMPS version 14 December 2021, large parts of LAMMPS can be compiled natively with the -Microsoft Visual C++ Compilers. This is largely facilitated by using -the :doc:`Developer_platform` in the ``platform`` namespace. +Microsoft Visual C++ Compilers. As of LAMMPS version 31 May 2022, also +the Intel oneAPI compilers can compile large parts of LAMMPS natively on +Windows. This is mostly facilitated by using the +:doc:`Developer_platform` in the ``platform`` namespace and CMake. Before trying to build LAMMPS on Windows yourself, please consider the `pre-compiled Windows installer packages `_ @@ -99,6 +102,10 @@ It is possible to use both the integrated CMake support of the Visual Studio IDE or use an external CMake installation (e.g. downloaded from cmake.org) to create build files and compile LAMMPS from the command line. +Compilation via command line and unit tests are checked automatically +for the LAMMPS development branch through +`GitHub Actions `_. + .. note:: Versions of Visual Studio before version 17.1 may scan the entire @@ -111,6 +118,10 @@ Please note, that for either approach CMake will create a so-called the command lines for building and testing LAMMPS must be adjusted accordingly. +The LAMMPS cmake folder contains a ``CMakeSettings.json`` file with +build configurations for MSVC compilers and the MS provided Clang +compiler package in Debug and Release mode. + To support running in parallel you can compile with OpenMP enabled using the OPENMP package or install Microsoft MPI (including the SDK) and compile LAMMPS with MPI enabled. @@ -121,6 +132,53 @@ LAMMPS with MPI enabled. via GitHub or the `LAMMPS forum at MatSci `_, if you have questions or LAMMPS specific problems. +.. _oneapi: + +Using Intel oneAPI Compilers and Libraries +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 31May2022 + +After installing the `Intel oneAPI +`_ +base toolkit and the HPC toolkit, it is also possible to compile large +parts of LAMMPS natively on Windows using Intel compilers. The HPC +toolkit provides two sets of C/C++ and Fortran compilers: the so-called +"classic" compilers (``icl.exe`` and ``ifort.exe``) and newer, LLVM +based compilers (``icx.exe`` and ``ifx.exe``). In addition to the +compilers and their dependent modules, also the thread building blocks +(TBB) and the math kernel library (MKL) need to be installed. Two +presets (``cmake/presets/windows-intel-llvm.cmake`` and +``cmake/presets/windows-intel-classic.cmake``) are provided for +selecting the LLVM based or classic compilers, respectively. The preset +``cmake/presets/windows.cmake`` enables compatible packages that are not +dependent on additional features or libraries. You **must** use the +CMake based build procedure and use Ninja as build tool. For compiling +from the command prompt, thus both `CMake `_ and +`Ninja-build `_ binaries must be installed. It +is also possible to use Visual Studio, if it is started (``devenv.exe``) +from a command prompt that has the Intel oneAPI compilers enabled. The +Visual Studio settings file in the ``cmake`` folder contains +configurations for both compiler variants in debug and release settings. +Those will use the CMake and Ninja binaries bundled with Visual Studio, +thus a separate installation is not required. + +.. admonition:: Known Limitations + :class: note + + In addition to portability issues with several packages and external + libraries, the classic Intel compilers are currently not able to + compile the googletest libraries and thus enabling the ``-DENABLE_TESTING`` + option will result in compilation failure. The LLVM based compilers + are compatible. + +.. note:: + + This is work in progress and you should contact the LAMMPS developers + via GitHub or the `LAMMPS forum at MatSci `_, + if you have questions or LAMMPS specific problems. + + .. _cross: Using a cross-compiler @@ -145,14 +203,3 @@ LAMMPS developers. We instead rely on the feedback of the users of these pre-compiled LAMMPS packages for Windows. We will try to resolve issues to the best of our abilities if we become aware of them. However this is subject to time constraints and focus on HPC platforms. - -.. _native: - -Native Visual C++ support -^^^^^^^^^^^^^^^^^^^^^^^^^ - -Support for the Visual C++ compilers is currently not available. The -CMake build system is capable of creating suitable a Visual Studio -style build environment, but the LAMMPS source code itself is not -ported to fully support Visual C++. Volunteers to take on this task -are welcome. diff --git a/doc/src/Commands_all.rst b/doc/src/Commands_all.rst index bc25d0c0e0..a868ad84fc 100644 --- a/doc/src/Commands_all.rst +++ b/doc/src/Commands_all.rst @@ -14,7 +14,7 @@ General commands ================ -An alphabetic list of all general LAMMPS commands. +An alphabetic list of general LAMMPS commands. .. table_from_list:: :columns: 5 @@ -47,35 +47,26 @@ An alphabetic list of all general LAMMPS commands. * :doc:`displace_atoms ` * :doc:`dump ` * :doc:`dump_modify ` - * :doc:`dynamical_matrix (k) ` * :doc:`echo ` * :doc:`fix ` * :doc:`fix_modify ` * :doc:`group ` - * :doc:`group2ndx ` - * :doc:`hyper ` * :doc:`if ` * :doc:`improper_coeff ` * :doc:`improper_style ` * :doc:`include ` * :doc:`info ` * :doc:`jump ` - * :doc:`kim ` * :doc:`kspace_modify ` * :doc:`kspace_style ` * :doc:`label