An official mirror (for now...) of the FreeCAD project. Currently maintained in sync manually by Yorik. Please check https://www.freecadweb.org for issues and pull requests https://www.freecadweb.org
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.
 
 
 
 
 
 

90 lines
2.4 KiB

  1. ##!/usr/bin/env bash
  2. #
  3. # MacOS Build Script for FreeCAD using Conda.
  4. # This is intended for developer use.
  5. #
  6. # Copyright (c) 2020 by Jeffrey Zampieron. All rights reserved.
  7. #
  8. # License: LGPLv2.1
  9. #
  10. # References:
  11. # - Conda: https://conda.io/projects/conda/en/latest/user-guide/install/index.html
  12. # - Conda Build: https://docs.conda.io/projects/conda-build/en/latest/install-conda-build.html
  13. ###########################################################################
  14. # Script wide setup.
  15. ###########################################################################
  16. # The Conda environment name
  17. FCENV=freecad_dev
  18. # The cmake build directory
  19. HOST=$(uname)
  20. ###########################################################################
  21. # Env Checks
  22. ###########################################################################
  23. if [[ ${HOST} =~ "Linux" ]]; then
  24. # Linux specific checks here
  25. echo "Linux specific checks..."
  26. elif [[ ${HOST} =~ "Darwin" ]]; then
  27. # OSX specific checks here.
  28. echo "OS X specific checks..."
  29. which xcrun
  30. if [ $? != 0 ]; then
  31. echo "xcrun not found... install XCode command line tools..."
  32. echo "using: xcode-select --install"
  33. exit 1
  34. fi
  35. else
  36. echo "unknown host env... probably won't work. Aborting build."
  37. exit 1
  38. fi
  39. ###########################################################################
  40. # Conda Setup
  41. ###########################################################################
  42. which conda
  43. if [ $? != 0 ]; then
  44. echo "Failed to find conda executable. Please install."
  45. exit 1
  46. fi
  47. if [[ "${CONDA_DEFAULT_ENV}" =~ "${FCENV}" ]]; then
  48. echo "Already in env"
  49. elif [[ -z "${CONDA_DEFAULT_ENV}" ]]; then
  50. echo "Not in conda env... activating"
  51. conda activate ${FCENV}
  52. else
  53. # Assume we are in some other env.
  54. echo "In ${CONDA_DEFAULT_ENV}, attempting switch to ${FCENV}"
  55. conda deactivate
  56. conda activate ${FCENV}
  57. fi
  58. if [ $? != 0 ]; then
  59. echo "Failed to activate conda env: ${FCENV} ... creating"
  60. if [[ ${HOST} =~ "Linux" ]]; then
  61. echo "Linux"
  62. conda env create -f environment-linux.yml
  63. elif [[ ${HOST} =~ "Darwin" ]]; then
  64. echo "OS X"
  65. conda env create -f environment-osx.yml
  66. else
  67. echo "Unknown Host: ${HOST}"
  68. exit 1
  69. fi
  70. conda activate ${FCENV}
  71. if [ $? != 0 ]; then
  72. echo "Failed to create conda environment and activate it."
  73. exit 1
  74. fi
  75. fi
  76. if [ -z "${CONDA_PREFIX}" ]; then
  77. echo "Failed to find CONDA_PREFIX variable."
  78. exit 1
  79. fi
  80. PREFIX="${CONDA_PREFIX}" ./conda/build.sh