about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/precice
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-04-01 15:50:50 +0000
committerAlyssa Ross <hi@alyssa.is>2020-04-01 15:50:50 +0000
commit75eafe97f7df0d653bec67f3962214d7c357831f (patch)
tree09f2cc901e0e637876cbb78d192dfe2fcfef8156 /nixpkgs/pkgs/development/libraries/precice
parenta53b121bf4331497da63df3b1b7f1a7897dad146 (diff)
parenta2e06fc3423c4be53181b15c28dfbe0bcf67dd73 (diff)
downloadnixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.gz
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.bz2
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.lz
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.xz
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.zst
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.zip
Merge commit 'a2e06fc3423c4be53181b15c28dfbe0bcf67dd73'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/precice')
-rw-r--r--nixpkgs/pkgs/development/libraries/precice/0001-Fix-the-install-target-dirs-to-use-the-CMAKE-flags.patch112
-rw-r--r--nixpkgs/pkgs/development/libraries/precice/default.nix34
2 files changed, 134 insertions, 12 deletions
diff --git a/nixpkgs/pkgs/development/libraries/precice/0001-Fix-the-install-target-dirs-to-use-the-CMAKE-flags.patch b/nixpkgs/pkgs/development/libraries/precice/0001-Fix-the-install-target-dirs-to-use-the-CMAKE-flags.patch
new file mode 100644
index 000000000000..52a4d0b5cccb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/precice/0001-Fix-the-install-target-dirs-to-use-the-CMAKE-flags.patch
@@ -0,0 +1,112 @@
+From 078cc28a3ece0dcc4033961090a6e5d6e63b3ec5 Mon Sep 17 00:00:00 2001
+From: Scriptkiddi <fritz@otlinghaus.it>
+Date: Sat, 4 Jan 2020 17:59:32 +0100
+Subject: [PATCH] Fix the install target dirs to use the CMAKE flags
+
+---
+ CMakeLists.txt | 27 ++++++++++++++-------------
+ 1 file changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 96b9d1b5..ff8191ae 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,7 +5,7 @@ project(preCICE VERSION 1.6.1 LANGUAGES CXX)
+ 
+ #
+ # Overview of this configuration
+-# 
++#
+ # PREAMBLE
+ # Setup Options
+ # Find Mandatory Dependencies
+@@ -30,6 +30,7 @@ include(CheckCXX11Library)
+ include(CopyTargetProperty)
+ include(XSDKMacros)
+ include(Validation)
++include(GNUInstallDirs)
+ 
+ # CMake Policies
+ 
+@@ -197,7 +198,7 @@ if(CMAKE_VERSION VERSION_LESS "3.11")
+   endif()
+ endif()
+ 
+-# Add precice as an empty target 
++# Add precice as an empty target
+ add_library(precice ${preCICE_DUMMY})
+ set_target_properties(precice PROPERTIES
+   # precice is a C++11 project
+@@ -267,7 +268,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/cmake/DetectGitRevision.cmake)
+ configure_file("${PROJECT_SOURCE_DIR}/src/precice/impl/versions.hpp.in" "${PROJECT_BINARY_DIR}/src/precice/impl/versions.hpp" @ONLY)
+ 
+ # Includes Configuration
+-target_include_directories(precice PUBLIC 
++target_include_directories(precice PUBLIC
+   $<BUILD_INTERFACE:${preCICE_SOURCE_DIR}/src>
+   $<BUILD_INTERFACE:${preCICE_BINARY_DIR}/src>
+   $<INSTALL_INTERFACE:include>
+@@ -282,7 +283,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/src/sources.cmake)
+ #
+ 
+ add_executable(binprecice "src/drivers/main.cpp")
+-target_link_libraries(binprecice 
++target_link_libraries(binprecice
+   PRIVATE
+   Threads::Threads
+   precice
+@@ -365,18 +366,18 @@ include(${CMAKE_CURRENT_LIST_DIR}/src/tests.cmake)
+ # binprecice - the precice binary
+ install(TARGETS precice binprecice
+   EXPORT preciceTargets
+-  LIBRARY DESTINATION lib
+-  ARCHIVE DESTINATION lib
+-  RUNTIME DESTINATION bin
+-  PUBLIC_HEADER DESTINATION include/precice
+-  INCLUDES DESTINATION include/precice
++  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static
++  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
++  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/precice
++  INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/precice
+   )
+ 
+ if(PRECICE_InstallTest)
+   # Install the testprecice target
+   install(TARGETS testprecice
+     EXPORT preciceTargets
+-    RUNTIME DESTINATION bin
++    RUNTIME DESTINATION  ${CMAKE_INSTALL_BINDIR}
+     )
+ 
+   # Install the resources necessary for the tests
+@@ -396,7 +397,7 @@ endif()
+ install(EXPORT preciceTargets
+   FILE preciceTargets.cmake
+   NAMESPACE precice::
+-  DESTINATION lib/cmake/precice
++  DESTINATION  ${CMAKE_INSTALL_LIBDIR}/cmake/precice
+   )
+ 
+ # Generate a Package Config File for precice
+@@ -408,7 +409,7 @@ write_basic_package_version_file("preciceConfigVersion.cmake"
+ 
+ # Install the Config and the ConfigVersion files
+ install(FILES "cmake/preciceConfig.cmake" "${preCICE_BINARY_DIR}/preciceConfigVersion.cmake"
+-  DESTINATION lib/cmake/precice
++  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/precice
+   )
+ 
+ # Setup the config in the build directory
+@@ -477,7 +478,7 @@ configure_file(
+   "lib/pkgconfig/libprecice.pc"
+   @ONLY
+   )
+-install(DIRECTORY "${preCICE_BINARY_DIR}/lib/pkgconfig" 
++install(DIRECTORY "${preCICE_BINARY_DIR}/lib/pkgconfig"
+   DESTINATION lib
+ )
+ 
+-- 
+2.23.1
+
diff --git a/nixpkgs/pkgs/development/libraries/precice/default.nix b/nixpkgs/pkgs/development/libraries/precice/default.nix
index cdce346fe792..a22df8c18e05 100644
--- a/nixpkgs/pkgs/development/libraries/precice/default.nix
+++ b/nixpkgs/pkgs/development/libraries/precice/default.nix
@@ -1,26 +1,35 @@
-{ lib, stdenv, fetchFromGitHub, cmake, gcc, boost, eigen, libxml2, openmpi, python2, python2Packages }:
+{ lib, stdenv, fetchFromGitHub, cmake, gcc, boost, eigen, libxml2, openmpi, python3, python3Packages }:
 
 stdenv.mkDerivation rec {
   pname = "precice";
-  version = "1.6.1";
+  version = "2020-01-20";
+  # Todo next release switch back to versioning but for python3 support master is needed
 
   src = fetchFromGitHub {
     owner = "precice";
     repo = pname;
-    rev = "v${version}";
-    sha256 = "00631zw6cpm67j35cwad04nwgfcvlxa8p660fwz30pgj2hzdx3d2";
+    rev = "9f778290416416255fc73a495e962def301648b0";
+    sha256 = "1ij43qjbf1aq3lh91gqpviajc8lyl7qkxfccmj5md5vwf88vjaip";
   };
 
-  preConfigure = ''
-    cmakeFlags="-DBUILD_SHARED_LIBS=ON -DPETSC=off"
-  '';
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DPETSC=off"
+    "-DPYTHON_LIBRARIES=${python3.libPrefix}"
+    "-DPYTHON_INCLUDE_DIR=${python3}/include/${python3.libPrefix}m"
+  ];
 
   nativeBuildInputs = [ cmake gcc ];
-  buildInputs = [ boost eigen libxml2 openmpi python2 python2Packages.numpy ];
-  installPhase = ''
-    mkdir -p $out/lib
-    cp libprecice.so libprecice.so.1.6.1 $out/lib/
-  '';
+  buildInputs = [ boost eigen libxml2 openmpi python3 python3Packages.numpy ];
+  patches = [
+    ./0001-Fix-the-install-target-dirs-to-use-the-CMAKE-flags.patch # CMake Packaging is not perfect upstream, after this PR it is https://github.com/precice/precice/pull/577/files
+  ];
+  enableParallelBuilding = true;
+
+  postInstall = ''
+      substituteInPlace "$out"/lib/cmake/precice/preciceTargets.cmake \
+      --replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include;' 'INTERFACE_INCLUDE_DIRECTORIES "'$out/include';'
+  ''; # Check if this can be removed after upstream PR 577
 
   meta = {
     description = "preCICE stands for Precise Code Interaction Coupling Environment";
@@ -31,3 +40,4 @@ stdenv.mkDerivation rec {
   };
 }
 
+