You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

linux-compile-eigen.pl 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/perl
  2. # Intended to be run from linux-install_dependencies.pl
  3. #
  4. # Variables are wrt that parent scope
  5. #
  6. # Installation of packages not available in the apt database or PPA
  7. # Eigen installation
  8. if (!$no_install && $distribution eq 'Ubuntu 16.04') {
  9. # Install eigen 3.2.9 from source if it is not already
  10. # This is because Ubuntu 16.04 has a beta version of the Eigen package by default
  11. # and it does not work
  12. if (-e "/usr/local/include/eigen3") {
  13. print STDERR "Warning: eigen3 is already installed in /usr/local\n";
  14. } else {
  15. my $old_dir = Cwd::getcwd();
  16. my $eigen_build_folder = $dependencies_dir . "/eigen-build";
  17. my $eigen_extracted_folder = $eigen_build_folder . "/eigen-eigen-dc6cfdf9bcec";
  18. if (! -e $dependencies_dir) {
  19. mkdir($dependencies_dir) or die("Failed to create directory [$dependencies_dir]");
  20. }
  21. if (! -e $eigen_build_folder) {
  22. mkdir($eigen_build_folder) or die("Failed to create directory [$eigen_build_folder]");
  23. }
  24. chdir $eigen_build_folder;
  25. if (! -e "3.2.9.tar.bz2") {
  26. system('wget "http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2"');
  27. ($CHILD_ERROR != 0) and die ("Could not download the Eigen sources [$CHILD_ERROR]");
  28. }
  29. if (! -e $eigen_extracted_folder) {
  30. system('tar -xjf "3.2.9.tar.bz2"');
  31. ($CHILD_ERROR != 0) and die ("Could not extract the eigen archive");
  32. }
  33. chdir $eigen_extracted_folder;
  34. mkdir $eigen_extracted_folder . "/build" or die ("Failed to create directory [$eigen_extracted_folder/build]");
  35. chdir $eigen_extracted_folder . "/build";
  36. system("cmake ..");
  37. ($CHILD_ERROR != 0) and die("Failed to run CMake for Eigen [$CHILD_ERROR]");
  38. system("sudo make install");
  39. ($CHILD_ERROR != 0) and die("Failed install Eigen [$CHILD_ERROR]");
  40. # Go back to the scripts folder
  41. chdir $old_dir;
  42. }
  43. }