Merge pull request #1031 from akohlmey/cmake-cross-linux-mingw

Allow cross-compiling from linux to windows with cmake
This commit is contained in:
Steve Plimpton 2018-08-03 14:55:03 -06:00 committed by GitHub
commit 31c3c6c93e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -138,8 +138,11 @@ set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS LAMMPS_SMALLBIG LAMMPS_BIG
add_definitions(-D${LAMMPS_SIZE_LIMIT})
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${LAMMPS_SIZE_LIMIT}")
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS")
add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
# posix_memalign is not available on Windows
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS")
add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
endif()
option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF)
if(LAMMPS_EXCEPTIONS)
@ -467,6 +470,11 @@ if(PKG_COMPRESS)
list(APPEND LAMMPS_LINK_LIBS ${ZLIB_LIBRARIES})
endif()
# the windows version of LAMMPS requires a couple extra libraries
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
list(APPEND LAMMPS_LINK_LIBS -lwsock32 -lpsapi)
endif()
########################################################################
# Basic system tests (standard libraries, headers, functions, types) #
########################################################################
@ -626,6 +634,10 @@ if(PKG_USER-OMP)
# manually add package dependent source files from USER-OMP that do not provide styles
if(PKG_ASPHERE)
list(APPEND USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/fix_nh_asphere_omp.cpp)
endif()
if(PKG_RIGID)
list(APPEND USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/fix_rigid_nh_omp.cpp)
endif()