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-gtest.pl 983B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/perl
  2. # Intended to be run from linux-install_dependencies.pl
  3. #
  4. # Variables are wrt that parent scope
  5. #
  6. if (!$no_gtest) {
  7. my $old_dir = Cwd::getcwd();
  8. my $gtest_build_folder = $dependencies_dir . "/gtest-build";
  9. my $gtest_lib_folder = $dependencies_dir . "/libgtest/";
  10. if (! -e $dependencies_dir) {
  11. mkdir($dependencies_dir) or die("Failed to create directory [$dependencies_dir]");
  12. }
  13. if (! -e $gtest_build_folder) {
  14. mkdir($gtest_build_folder) or die("Failed to create directory [$gtest_build_folder]");
  15. }
  16. if (! -e $gtest_lib_folder) {
  17. mkdir($gtest_lib_folder) or die("Failed to create directory [$gtest_lib_folder]");
  18. }
  19. # build gtest
  20. chdir $gtest_build_folder;
  21. system("cmake -GNinja /usr/src/gtest");
  22. system("ninja all");
  23. system("rm CMakeCache.txt");
  24. my @lib_files = glob "*.a";
  25. foreach my $lib_cur (@lib_files) {
  26. copy($lib_cur, $gtest_lib_folder) or die "Could not copy lib $lib_cur $!\n";
  27. }
  28. chdir $old_dir;
  29. }