spglib: add new package (#7321)

This commit is contained in:
Denis Davydov 2018-02-27 13:00:07 +01:00 committed by Massimiliano Culpo
parent 3a9cd2614e
commit 03cf03e581
3 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3296d91..d18d26c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,17 +47,17 @@ set(SOURCES ${PROJECT_SOURCE_DIR}/src/arithmetic.c
add_library(symspg SHARED ${SOURCES})
set_property(TARGET symspg PROPERTY VERSION ${serial})
set_property(TARGET symspg PROPERTY SOVERSION ${soserial})
-install(TARGETS symspg LIBRARY DESTINATION ${PROJECT_SOURCE_DIR}/lib)
+install(TARGETS symspg LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
# Static link library
add_library(symspg_static STATIC ${SOURCES})
set_property(TARGET symspg_static PROPERTY VERSION ${serial})
set_property(TARGET symspg_static PROPERTY SOVERSION ${soserial})
set_property(TARGET symspg_static PROPERTY OUTPUT_NAME symspg)
-install(TARGETS symspg_static ARCHIVE DESTINATION ${PROJECT_SOURCE_DIR}/lib)
+install(TARGETS symspg_static ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
# Header file
-install(FILES ${PROJECT_SOURCE_DIR}/src/spglib.h DESTINATION ${PROJECT_SOURCE_DIR}/include)
+install(FILES ${PROJECT_SOURCE_DIR}/src/spglib.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
# make check
enable_testing()

View file

@ -0,0 +1,34 @@
From a91ea68d6771ed7d6b03bcbffd891489dc77e574 Mon Sep 17 00:00:00 2001
From: Krishnendu Ghosh
Date: Thu, 22 Feb 2018 14:24:14 -0500
Subject: [PATCH] added extern "C"
---
src/spglib.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/spglib.h b/src/spglib.h
index e1746b1..530dfa4 100644
--- a/src/spglib.h
+++ b/src/spglib.h
@@ -35,6 +35,9 @@
#ifndef __spglib_H__
#define __spglib_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
/* SPGCONST is used instead of 'const' so to avoid gcc warning. */
/* However there should be better way than this way.... */
#ifndef SPGCONST
@@ -481,4 +484,7 @@ void spg_get_neighboring_grid_points(int relative_grid_points[],
/* Return 0 if failed */
int spg_niggli_reduce(double lattice[3][3], const double symprec);
+#ifdef __cplusplus
+}
+#endif
#endif
--
2.7.4.1.g5468f9e

View file

@ -0,0 +1,39 @@
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Spglib(CMakePackage):
"""C library for finding and handling crystal symmetries."""
homepage = "https://atztogo.github.io/spglib/"
url = "https://github.com/atztogo/spglib/archive/v1.10.3.tar.gz"
patch('fix_cmake_install.patch', when='@:1.10.3')
# patch by Krishnendu Ghosh
patch('fix_cpp.patch', when='@:1.10.3')
version('1.10.3', 'f6ef0554fa528ffa49d8eaee18a2b7b9')
version('1.10.0', '0ad9330ae8a511d25e2e26cb9bf02808')