Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .distro/plans/examples.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
summary:
Examples
discover+:
how: fmf
filter: "tag: examples"
path: example
execute:
how: tmt
1 change: 1 addition & 0 deletions .distro/plans/main.fmf.dist-git
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
discover:
how: fmf
dist-git-source: true
dist-git-extract: spglib-*/
8 changes: 8 additions & 0 deletions .distro/plans/package.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
summary:
Test importing package
discover+:
how: fmf
filter: "tag: package"
path: test
execute:
how: tmt
8 changes: 0 additions & 8 deletions .distro/plans/rpmlint.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ prepare:
- rpmlint
- rpminspect
- rpminspect-data-fedora
## TODO: Disabled because upstream failure
## https://github.com/packit/packit/issues/1978
#- name: Download the source rpm
# how: shell
# script: cd /tmp && curl -O ${PACKIT_SRPM_URL}
- name: Download rpm packages
how: shell
script: cd /tmp && dnf download ${PACKIT_COPR_RPMS}
discover+:
how: fmf
filter: "tag: rpmlint"
Expand Down
2 changes: 1 addition & 1 deletion .distro/plans/smoke.fmf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary:
Basic smoke tests
discover+:
discover:
how: fmf
filter: "tag: smoke"
execute:
Expand Down
8 changes: 3 additions & 5 deletions .distro/spglib.spec
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ develop applications with spglib Python3 bindings.
-DSPGLIB_SHARED_LIBS=ON \
-DSPGLIB_WITH_Fortran=ON \
-DSPGLIB_WITH_Python=OFF \
-DSPGLIB_WITH_TESTS=ON
-DSPGLIB_WITH_TESTS=ON \
-DCMAKE_INSTALL_MODULEDIR=%{_fmoddir}

%cmake_build
%pyproject_wheel
Expand Down Expand Up @@ -109,10 +110,7 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} %pytest -v
%files fortran-devel
%{_libdir}/libspglib_f08.so
%{_includedir}/spglib_f08.F90
# TODO: Mod files should be in %%{_fmoddir} according to the guidelines
# Unclear how to proceed on cmake side to be general
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Fortran/
%{_includedir}/spglib_f08.mod
%{_fmoddir}/spglib_f08.mod
%{_libdir}/pkgconfig/spglib_f08.pc
%{_libdir}/cmake/Spglib/SpglibTargets_fortran*

Expand Down
4 changes: 2 additions & 2 deletions .distro/tests/rpmlint.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ path: /
# Define tests
/rpmlint:
summary: Rpmlint spec and rpmfiles
test: rpmlint -c packit.toml -r spglib.rpmlintrc ./*.spec /tmp/*.rpm
test: rpmlint -c packit.toml -r spglib.rpmlintrc ./*.spec /var/share/test-artifacts/*.rpm
/rpminspect-rpms:
summary: Rpminspect the rpms
test: ls /tmp/*.rpm | xargs -L1 rpminspect-fedora -E metadata,disttag
test: ls /var/share/test-artifacts/*.rpm | xargs -L1 rpminspect-fedora -E metadata,disttag
4 changes: 2 additions & 2 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ files_to_sync:
- src: .distro/plans/
dest: plans/
filters:
- "- .distro/plans/main.fmf.dist-git"
- "- .distro/plans/rpmlint.fmf"
- "- main.fmf.dist-git"
- "- rpmlint.fmf"
- src: .distro/plans/main.fmf.dist-git
dest: plans/main.fmf
upstream_package_name: spglib
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ mark_as_advanced(SPGLIB_DEBUG)
# Project configuration #
]==============================================================================================]

# Compatibilities
# TODO: Remove when requiring cmake >= 3.20
if (NOT COMMAND cmake_path)
# Note: This is not an actual replacement of cmake_path, just a minimal implementation for
# this project
include(cmake/compat/cmake_path.cmake)
endif ()

# Include basic tools
include(cmake/PackageCompsHelper.cmake)
include(FetchContent)
Expand Down
20 changes: 20 additions & 0 deletions cmake/compat/cmake_path.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Note: This is not an actual replacement of cmake_path, just a minimal implementation for
# spglib project
function(cmake_path operator path_var)
if (NOT ${operator} STREQUAL APPEND)
message(FATAL_ERROR Unsupported operator)
endif ()

set(ARGS_Options)
set(ARGS_OneValue "OUTPUT_VARIABLE")
set(ARGS_MultiValue)
cmake_parse_arguments(ARGS "${ARGS_Options}" "${ARGS_OneValue}" "${ARGS_MultiValue}" ${ARGN})

if(NOT DEFINED ARGS_OUTPUT_VARIABLE)
set(ARGS_OUTPUT_VARIABLE ${path_var})
endif ()
set(${ARGS_OUTPUT_VARIABLE} ${${path_var}})
foreach (path IN LISTS ARGS_UNPARSED_ARGUMENTS)
set(${ARGS_OUTPUT_VARIABLE} "${${ARGS_OUTPUT_VARIABLE}}/${path}")
endforeach ()
endfunction()
6 changes: 2 additions & 4 deletions cmake/spglib.pc.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
prefix=@CMAKE_INSTALL_PREFIX@

Name: @PROJECT_NAME@
Description: The spglib library
Version: @PROJECT_VERSION@
Libs: -L${prefix}/@CMAKE_INSTALL_LIBDIR@ -lsymspg
Cflags: -I${prefix}/include
Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lsymspg
Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@
1 change: 1 addition & 0 deletions example/.fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
27 changes: 10 additions & 17 deletions example/c_api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
cmake_minimum_required(VERSION 3.6)
project(example_spglib LANGUAGES C)

# Alternatively use pkg-config
find_package(Spglib)
if(NOT Spglib_FOUND)
find_package(PkgConfig)
pkg_check_modules(symspg REQUIRED IMPORTED_TARGET
spglib)
endif()
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)

add_executable(example_c example.c)
if(Spglib_FOUND)
# Linking using native cmake
target_link_libraries(example_c PUBLIC
Spglib::symspg)
else()
# Linking using pkg-config
target_link_libraries(example_c PUBLIC
PkgConfig::symspg)
endif()
find_package(Spglib REQUIRED)

add_executable(example example.c)
add_executable(example_full example_full.c)

target_link_libraries(example PRIVATE Spglib::symspg)
target_link_libraries(example_full PRIVATE Spglib::symspg)
Loading