Merge branch 'develop' of github.com:lammps/lammps into kk_update_4.0
This commit is contained in:
@ -1,615 +0,0 @@
|
||||
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
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} $<TARGET_OBJECTS:simd>
|
||||
${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} $<TARGET_OBJECTS:simd> ${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} $<TARGET_OBJECTS:simd>
|
||||
${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()
|
||||
@ -1,741 +0,0 @@
|
||||
# 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 $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
||||
else()
|
||||
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${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 $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
|
||||
install(FILES $<TARGET_LINKER_FILE_DIR:png>/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 $<TARGET_LINKER_FILE_DIR:png_static>/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
|
||||
@ -1,195 +0,0 @@
|
||||
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()
|
||||
@ -89,7 +89,7 @@ else()
|
||||
if(CMAKE_REQUEST_PIC)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR} EXCLUDE_FROM_ALL)
|
||||
|
||||
set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src
|
||||
${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src
|
||||
|
||||
@ -203,7 +203,7 @@ Bibliography
|
||||
A Caro, DA Crowson, M Caro; Phys Rev Lett, 95, 075702 (2005)
|
||||
|
||||
**(CasP)**
|
||||
CasP webpage: https://www.helmholtz-berlin.de/people/gregor-schiwietz/casp_en.html
|
||||
CasP webpage: http://www.casp-program.org/
|
||||
|
||||
**(Cawkwell2012)**
|
||||
A.\ M. N. Niklasson, M. J. Cawkwell, Phys. Rev. B, 86 (17), 174308 (2012).
|
||||
|
||||
@ -13,9 +13,9 @@ box with a single z plane of atoms - e.g.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
create box 1 -10 10 -10 10 -0.25 0.25
|
||||
create_box 1 -10 10 -10 10 -0.25 0.25
|
||||
|
||||
If using the :doc:`read data <read_data>` command to read in a file of
|
||||
If using the :doc:`read_data <read_data>` command to read in a file of
|
||||
atom coordinates, set the "zlo zhi" values to be finite but narrow,
|
||||
similar to the create_box command settings just described. For each
|
||||
atom in the file, assign a z coordinate so it falls inside the
|
||||
|
||||
@ -79,9 +79,9 @@ As bonds can be broken between neighbor list builds, the
|
||||
bond styles. There are two possible settings which determine how pair
|
||||
interactions work between bonded particles. First, one can overlay
|
||||
pair forces with bond forces such that all bonded particles also
|
||||
feel pair interactions. This can be accomplished by using the *overlay/pair*
|
||||
keyword present in all bpm bond styles and by using the following special
|
||||
bond settings
|
||||
feel pair interactions. This can be accomplished by setting the *overlay/pair*
|
||||
keyword present in all bpm bond styles to *yes* and requires using the
|
||||
following special bond settings
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -107,7 +107,17 @@ bond lists is expensive. By setting the lj weight for 1-2 bonds to
|
||||
zero, this turns off pairwise interactions. Even though there are no
|
||||
charges in BPM models, setting a nonzero coul weight for 1-2 bonds
|
||||
ensures all bonded neighbors are still included in the neighbor list
|
||||
in case bonds break between neighbor list builds.
|
||||
in case bonds break between neighbor list builds. If bond breakage is
|
||||
disabled during a simulation run by setting the *break* keyword to *no*,
|
||||
a zero coul weight for 1-2 bonds can be used to exclude bonded atoms
|
||||
from the neighbor list builds
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
special_bonds lj 0 1 1 coul 0 1 1
|
||||
|
||||
This can be useful for post-processing, or to determine pair interaction
|
||||
properties between distinct bonded particles.
|
||||
|
||||
To monitor the fracture of bonds in the system, all BPM bond styles
|
||||
have the ability to record instances of bond breakage to output using
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC add_molecule command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> add_molecule <small|large> <tag> <group-ID>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC add_species command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> add_species <tag> <group|type> <ID>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC atom_element_map command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> atom_element_map <eulerian|lagrangian> [<frequency>]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC atom_weight command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> atom_weight <method> <args>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC atomic_charge command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> <include|omit> atomic_charge
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC boundary_dynamics command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> boundary_dynamics <on|damped_harmonic|prescribed|coupled|none>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC boundary_faceset command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> boundary_faceset <is|add> <faceset_name>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC boundary type command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> boundary type <atom-type-id>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC consistent_fe_initialization command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> consistent_fe_initialization <on|off>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC control localized_lambda command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> control localized_lambda <on|off>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC control momentum command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> control <physics_type> <solution_parameter> <value>
|
||||
fix_modify AtC control momentum none
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC control thermal command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> control <physics_type> <solution_parameter> <value>
|
||||
fix_modify <AtC fixID> control thermal <control_type> <optional_args>
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC decomposition command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> decomposition <type>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC extrinsic electron_integration command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> extrinsic electron_integration <integration_type> [<num_subcycle_steps>]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC equilibrium_start command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> equilibrium_start <on|off>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC extrinsic exchange command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> extrinsic exchange <on|off>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC fe_md_boundary command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> fe_md_boundary <faceset|interpolate|no_boundary>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC filter scale command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> filter scale <scale>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC filter type command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> filter type <exponential|step|no_filter>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC fix command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> fix <field> <nodeset> <constant|function>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC fix_flux command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> fix_flux <field> <face_set> <value|function>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC computes command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> computes <add|delete> <per-atom compute-ID> <volume|number>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC fields command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> fields <all|none>
|
||||
fix_modify <AtC fixID> fields <add|delete> <list_of_fields>
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC gradients command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> gradients <add|delete> <list_of_fields>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC kernel command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> kernel <type> <parameters>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC on_the_fly command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> on_the_fly <bond|kernel> <on|off>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC rates command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> rates <add|delete> <list_of_fields>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC initial command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> initial <field> <nodeset> <constant|function>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC internal_element_set command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> internal_element_set <element_set_name>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC internal_quadrature command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> internal_quadrature <on|off> [region]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC kernel_bandwidth command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> kernel_bandwidth <value>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC control lumped_lambda_solve command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> control lumped_lambda_solve <on|off>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC control mask_direction command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> control mask_direction <direction> <on|off>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mass_matrix command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mass_matrix <fe|md_fe>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC material command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> material <elementset_name> <material_id>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh add_to_nodeset command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh add_to_nodeset <id> <xmin> <xmax> <ymin> <ymax> <zmin> <zmax>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh create command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh create <nx> <ny> <nz> <region-ID> <f|p> <f|p> <f|p>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh create_elementset command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh create_elementset <id> <xmin> <xmax> <ymin> <ymax> <zmin> <zmax>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh create_faceset box command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh create_faceset <id> box <xmin> <xmax> <ymin> <ymax> <zmin> <zmax> <in|out> [units]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh create_faceset plane command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh create_faceset <id> plane <x|y|z> <val1> <x|y|z> <lval2> <uval2> [units]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh create_nodeset command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh create_nodeset <id> <xmin> <xmax> <ymin> <ymax> <zmin> <zmax>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh delete_elements command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh delete_elements <id>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh nodeset_to_elementset command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh nodeset_to_elementset <nodeset_id> <elementset_id> <max/min>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh output command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh output <file_prefix>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh quadrature command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh quatrature <quad>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh read command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh read <f|p> <f|p> <f|p>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC mesh write command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> mesh write <f|p> <f|p> <f|p>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC output command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> output <filename_prefix> <frequency> [text|full_text|binary|vector_components|tensor_components]
|
||||
fix_modify <AtC fixID> output index [step|time]
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC output boundary_integral command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> output boundary_integral <fieldname> faceset [name]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC output contour_integral command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> output contour_integral <fieldname> faceset <name> [axis [x|y|z]]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC output nodeset command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> output nodeset <nodeset_name> <operation>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC output volume_integral command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> output volume_integral <elementset_name> <field>
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ fix_modify AtC bond_interactions command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> pair_interactions <on|off>
|
||||
fix_modify <AtC fixID> bond_interactions <on|off>
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC poisson_solver command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> poisson_solver mesh create <nx> <ny> <nz> <region-ID> <f|p> <f|p> <f|p>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC read_restart command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> read_restart <file_name>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC remove_molecule command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> remove_molecule <tag>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC remove_source command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> remove_source <field> <element_set>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC remove_species command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> remove_species <tag>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC reset_atomic_reference_positions command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> reset_atomic_reference_positions
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC reset_time command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> reset_time <value>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC sample_frequency command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> sample_frequency <freq>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC set reference_potential_energy command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> set reference_potential_energy [<value|filename>]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC source command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> source <field> <element_set> <value|function>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC source_integration command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> source_integration <fe|atom>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC temperature_definition command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> temperature_definition <kinetic|total>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC filter command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> filter <on|off|equilibrate>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC time_integration command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> time_integration <descriptor>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC track_displacement command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> track_displacement <on|off>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC unfix command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> unfix <field> <nodeset>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC unfix_flux command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> unfix_flux <field> <face_set> <value|function>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC write_atom_weights command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> write_atom_weights <filename> <frequency>
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ fix_modify AtC write_restart command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix_modify <AtC fixID> write_restart <file_name>
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ Syntax
|
||||
|
||||
bond_style bpm/rotational keyword value attribute1 attribute2 ...
|
||||
|
||||
* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break/no*
|
||||
* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -80,32 +80,32 @@ respectively. Details on the calculations of shear displacements and
|
||||
angular displacements can be found in :ref:`(Wang) <Wang2009>` and
|
||||
:ref:`(Wang and Mora) <Wang2009b>`.
|
||||
|
||||
Bonds will break under sufficient stress. A breaking criteria is calculated
|
||||
Bonds will break under sufficient stress. A breaking criterion is calculated
|
||||
|
||||
.. math::
|
||||
|
||||
B = \mathrm{max}\{0, \frac{f_r}{f_{r,c}} + \frac{|f_s|}{f_{s,c}} +
|
||||
\frac{|\tau_b|}{\tau_{b,c}} + \frac{|\tau_t|}{\tau_{t,c}} \}
|
||||
B = \mathrm{max}\left\{0, \frac{f_r}{f_{r,c}} + \frac{|f_s|}{f_{s,c}} +
|
||||
\frac{|\tau_b|}{\tau_{b,c}} + \frac{|\tau_t|}{\tau_{t,c}} \right\}
|
||||
|
||||
where :math:`|f_s|` is the magnitude of the shear force and
|
||||
:math:`|\tau_b|` and :math:`|\tau_t|` are the magnitudes of the
|
||||
bending and twisting forces, respectively. The corresponding variables
|
||||
bending and twisting torques, respectively. The corresponding variables
|
||||
:math:`f_{r,c}` :math:`f_{s,c}`, :math:`\tau_{b,c}`, and
|
||||
:math:`\tau_{t,c}` are critical limits to each force or torque. If
|
||||
:math:`B` is ever equal to or exceeds one, the bond will break. This
|
||||
is done by setting by setting its type to 0 such that forces and
|
||||
is done by setting the bond type to 0 such that forces and
|
||||
torques are no longer computed.
|
||||
|
||||
After computing the base magnitudes of the forces and torques, they
|
||||
can be optionally multiplied by an extra factor :math:`w` to smoothly
|
||||
interpolate forces and torques to zero as the bond breaks. This term
|
||||
is calculated as :math:`w = (1.0 - B^4)`. This smoothing factor can be
|
||||
added or removed using the *smooth* keyword.
|
||||
is calculated as :math:`w = (1.0 - B^4)`. This smoothing factor can be added
|
||||
or removed by setting the *smooth* keyword to *yes* or *no*, respectively.
|
||||
|
||||
Finally, additional damping forces and torques are applied to the two
|
||||
particles. A force is applied proportional to the difference in the
|
||||
normal velocity of particles using a similar construction as
|
||||
dissipative particle dynamics (:ref:`(Groot) <Groot3>`):
|
||||
dissipative particle dynamics :ref:`(Groot) <Groot3>`:
|
||||
|
||||
.. math::
|
||||
|
||||
@ -115,8 +115,8 @@ where :math:`\gamma_n` is the damping strength, :math:`\hat{r}` is the
|
||||
radial normal vector, and :math:`\vec{v}` is the velocity difference
|
||||
between the two particles. Similarly, tangential forces are applied to
|
||||
each atom proportional to the relative differences in sliding
|
||||
velocities with a constant prefactor :math:`\gamma_s` (:ref:`(Wang et
|
||||
al.) <Wang20152>`) along with their associated torques. The rolling and
|
||||
velocities with a constant prefactor :math:`\gamma_s` :ref:`(Wang et
|
||||
al.) <Wang20152>` along with their associated torques. The rolling and
|
||||
twisting components of the relative angular velocities of the two
|
||||
atoms are also damped by applying torques with prefactors of
|
||||
:math:`\gamma_r` and :math:`\gamma_t`, respectively.
|
||||
@ -139,21 +139,23 @@ or :doc:`read_restart <read_restart>` commands:
|
||||
* :math:`\gamma_r` (force*distance/velocity units)
|
||||
* :math:`\gamma_t` (force*distance/velocity units)
|
||||
|
||||
However, the *normalize* option will normalize the radial and shear forces
|
||||
by :math:`r_0` such that :math:`k_r` and :math:`k_s` are unit less.
|
||||
If the *normalize* keyword is set to *yes*, the radial and shear forces
|
||||
will be normalized by :math:`r_0` such that :math:`k_r` and :math:`k_s`
|
||||
must be given in force units.
|
||||
|
||||
By default, pair forces are not calculated between bonded particles.
|
||||
Pair forces can alternatively be overlaid on top of bond forces using
|
||||
the *overlay/pair* option. These settings require specific
|
||||
Pair forces can alternatively be overlaid on top of bond forces by setting
|
||||
the *overlay/pair* keyword to *yes*. These settings require specific
|
||||
:doc:`special_bonds <special_bonds>` settings described in the
|
||||
restrictions. Further details can be found in the `:doc: how to
|
||||
<Howto_BPM>` page on BPMs.
|
||||
restrictions. Further details can be found in the :doc:`how to
|
||||
<Howto_bpm>` page on BPMs.
|
||||
|
||||
.. versionadded:: 28Mar2023
|
||||
|
||||
If the *break* option is used, then LAMMPS assumes bonds should not break
|
||||
If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break
|
||||
during a simulation run. This will prevent some unnecessary calculation.
|
||||
However, if a bond does break, it will trigger an error.
|
||||
However, if a bond reaches a damage criterion greater than one,
|
||||
it will trigger an error.
|
||||
|
||||
If the *store/local* keyword is used, an internal fix will track bonds that
|
||||
break during the simulation. Whenever a bond breaks, data is processed
|
||||
@ -232,16 +234,15 @@ This bond style is part of the BPM package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
By default if pair interactions are to be disabled, this bond style
|
||||
requires setting
|
||||
By default if pair interactions between bonded atoms are to be disabled,
|
||||
this bond style requires setting
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
special_bonds lj 0 1 1 coul 1 1 1
|
||||
|
||||
and :doc:`newton <newton>` must be set to bond off. If the
|
||||
*overlay/pair* option is used, this bond style alternatively requires
|
||||
setting
|
||||
and :doc:`newton <newton>` must be set to bond off. If the *overlay/pair*
|
||||
keyword is set to *yes*, this bond style alternatively requires setting
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ Syntax
|
||||
|
||||
bond_style bpm/spring keyword value attribute1 attribute2 ...
|
||||
|
||||
* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break/no*
|
||||
* optional keyword = *overlay/pair* or *store/local* or *smooth* or *break*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -72,13 +72,13 @@ particles based on a model described by Clemmer and Robbins
|
||||
where :math:`k` is a stiffness, :math:`r` is the current distance
|
||||
and :math:`r_0` is the initial distance between the two particles, and
|
||||
:math:`w` is an optional smoothing factor discussed below. Bonds will
|
||||
break at a strain of :math:`\epsilon_c`. This is done by setting by
|
||||
setting its type to 0 such that forces are no longer computed.
|
||||
break at a strain of :math:`\epsilon_c`. This is done by setting
|
||||
the bond type to 0 such that forces are no longer computed.
|
||||
|
||||
An additional damping force is applied to the bonded
|
||||
particles. This forces is proportional to the difference in the
|
||||
normal velocity of particles using a similar construction as
|
||||
dissipative particle dynamics (:ref:`(Groot) <Groot4>`):
|
||||
dissipative particle dynamics :ref:`(Groot) <Groot4>`:
|
||||
|
||||
.. math::
|
||||
|
||||
@ -88,9 +88,10 @@ where :math:`\gamma` is the damping strength, :math:`\hat{r}` is the
|
||||
radial normal vector, and :math:`\vec{v}` is the velocity difference
|
||||
between the two particles.
|
||||
|
||||
The smoothing factor :math:`w` can be added or removed using the
|
||||
*smooth* keyword. It is constructed such that forces smoothly go
|
||||
to zero, avoiding discontinuities, as bonds approach the critical strain
|
||||
The smoothing factor :math:`w` can be added or removed by setting the
|
||||
*smooth* keyword to *yes* or *no*, respectively. It is constructed such
|
||||
that forces smoothly go to zero, avoiding discontinuities, as bonds
|
||||
approach the critical strain
|
||||
|
||||
.. math::
|
||||
|
||||
@ -105,21 +106,22 @@ the data file or restart files read by the :doc:`read_data
|
||||
* :math:`\epsilon_c` (unit less)
|
||||
* :math:`\gamma` (force/velocity units)
|
||||
|
||||
However, the *normalize* option will normalize the elastic bond force by
|
||||
:math:`r_0` such that :math:`k` is unit less.
|
||||
If the *normalize* keyword is set to *yes*, the elastic bond force will be
|
||||
normalized by :math:`r_0` such that :math:`k` must be given in force units.
|
||||
|
||||
By default, pair forces are not calculated between bonded particles.
|
||||
Pair forces can alternatively be overlaid on top of bond forces using
|
||||
the *overlay/pair* option. These settings require specific
|
||||
Pair forces can alternatively be overlaid on top of bond forces by setting
|
||||
the *overlay/pair* keyword to *yes*. These settings require specific
|
||||
:doc:`special_bonds <special_bonds>` settings described in the
|
||||
restrictions. Further details can be found in the `:doc: how to
|
||||
<Howto_BPM>` page on BPMs.
|
||||
restrictions. Further details can be found in the :doc:`how to
|
||||
<Howto_bpm>` page on BPMs.
|
||||
|
||||
.. versionadded:: 28Mar2023
|
||||
|
||||
If the *break* option is used, then LAMMPS assumes bonds should not break
|
||||
If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break
|
||||
during a simulation run. This will prevent some unnecessary calculation.
|
||||
However, if a bond does break, it will trigger an error.
|
||||
However, if a bond reaches a strain greater than :math:`\epsilon_c`,
|
||||
it will trigger an error.
|
||||
|
||||
If the *store/local* keyword is used, an internal fix will track bonds that
|
||||
break during the simulation. Whenever a bond breaks, data is processed
|
||||
@ -189,16 +191,15 @@ This bond style is part of the BPM package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
By default if pair interactions are to be disabled, this bond style
|
||||
requires setting
|
||||
By default if pair interactions between bonded atoms are to be disabled,
|
||||
this bond style requires setting
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
special_bonds lj 0 1 1 coul 1 1 1
|
||||
|
||||
and :doc:`newton <newton>` must be set to bond off. If the
|
||||
*overlay/pair* option is used, this bond style alternatively requires
|
||||
setting
|
||||
and :doc:`newton <newton>` must be set to bond off. If the *overlay/pair*
|
||||
keyword is set to *yes*, this bond style alternatively requires setting
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
||||
@ -12,16 +12,14 @@ Syntax
|
||||
|
||||
* compute-ID = ID of the compute to modify
|
||||
* one or more keyword/value pairs may be listed
|
||||
* keyword = *extra/dof* or *extra* or *dynamic/dof* or *dynamic*
|
||||
* keyword = *extra/dof* or *dynamic/dof*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*extra/dof* value = N
|
||||
N = # of extra degrees of freedom to subtract
|
||||
*extra* syntax is identical to *extra/dof*, will be disabled at some point
|
||||
*dynamic/dof* value = *yes* or *no*
|
||||
yes/no = do or do not re-compute the number of degrees of freedom (DOF) contributing to the temperature
|
||||
*dynamic* syntax is identical to *dynamic/dof*, will be disabled at some point
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -37,19 +35,18 @@ Description
|
||||
Modify one or more parameters of a previously defined compute. Not
|
||||
all compute styles support all parameters.
|
||||
|
||||
The *extra/dof* or *extra* keyword refers to how many degrees of
|
||||
freedom are subtracted (typically from :math:`3N`) as a normalizing
|
||||
factor in a temperature computation. Only computes that compute a
|
||||
temperature use this option. The default is 2 or 3 for :doc:`2d or 3d
|
||||
systems <dimension>` which is a correction factor for an ensemble of
|
||||
velocities with zero total linear momentum. For compute temp/partial,
|
||||
if one or more velocity components are excluded, the value used for
|
||||
*extra* is scaled accordingly. You can use a negative number for the
|
||||
*extra* parameter if you need to add degrees-of-freedom. See the
|
||||
:doc:`compute temp/asphere <compute_temp_asphere>` command for an
|
||||
example.
|
||||
The *extra/dof* keyword refers to how many degrees of freedom are
|
||||
subtracted (typically from :math:`3N`) as a normalizing factor in a
|
||||
temperature computation. Only computes that compute a temperature use
|
||||
this option. The default is 2 or 3 for :doc:`2d or 3d systems
|
||||
<dimension>` which is a correction factor for an ensemble of velocities
|
||||
with zero total linear momentum. For compute temp/partial, if one or
|
||||
more velocity components are excluded, the value used for *extra/dof* is
|
||||
scaled accordingly. You can use a negative number for the *extra/dof*
|
||||
parameter if you need to add degrees-of-freedom. See the :doc:`compute
|
||||
temp/asphere <compute_temp_asphere>` command for an example.
|
||||
|
||||
The *dynamic/dof* or *dynamic* keyword determines whether the number
|
||||
The *dynamic/dof* keyword determines whether the number
|
||||
of atoms :math:`N` in the compute group and their associated degrees
|
||||
of freedom (DOF) are re-computed each time a temperature is computed.
|
||||
Only compute styles that calculate a temperature use this option. By
|
||||
@ -61,12 +58,6 @@ are adding atoms or molecules to the system (see the :doc:`fix pour
|
||||
<fix_evaporate>`), then this option should be used to ensure the
|
||||
temperature is correctly normalized.
|
||||
|
||||
.. note::
|
||||
|
||||
The *extra* and *dynamic* keywords should not be used as they
|
||||
are deprecated (March 2017) and will eventually be disabled. Instead,
|
||||
use the equivalent *extra/dof* and *dynamic/dof* keywords.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
none
|
||||
@ -79,5 +70,5 @@ Related commands
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The option defaults are extra/dof = 2 or 3 for 2d or 3d systems and
|
||||
dynamic/dof = *no*.
|
||||
The option defaults are extra/dof = 2 or 3 for 2d or 3d systems,
|
||||
respectively, and dynamic/dof = *no*.
|
||||
|
||||
@ -6,7 +6,7 @@ compute property/grid command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID property/grid Nx Ny Nz input1 input2 ...
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ change from zero to one at the location of the spike in :math:`g(r)`.
|
||||
parallel efficiency and scaling. For systems, where only the type
|
||||
of atoms changes (e.g., when using :doc:`fix atom/swap <fix_atom_swap>`),
|
||||
you need to explicitly request the dynamic normalization updates
|
||||
via :doc:`compute_modify dynamic yes <compute_modify>`
|
||||
via :doc:`compute_modify dynamic/dof yes <compute_modify>`
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
@ -6,7 +6,7 @@ compute reduce/chunk command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID reduce/chunk chunkID mode input1 input2 ...
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute saed command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID saed lambda type1 type2 ... typeN keyword value ...
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute slice command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID slice Nstart Nstop Nskip input1 input2 ...
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/contact/radius command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/contact/radius
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/damage command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/damage
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/hourglass/error command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/hourglass/error
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/internal/energy command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/internal/energy
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/plastic/strain command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/plastic/strain
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/plastic/strain/rate command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/plastic/strain/rate
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/rho command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/rho
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/tlsph/defgrad command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/tlsph/defgrad
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/tlsph/dt command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/tlsph/dt
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/tlsph/num/neighs command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/tlsph/num/neighs
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/tlsph/shape command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/tlsph/shape
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/tlsph/strain command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/tlsph/strain
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ compute smd/tlsph/strain/rate command
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ID group-ID smd/tlsph/strain/rate
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user