From b3588f80c76fff4c1ce640eef27cac6ac4192e4a Mon Sep 17 00:00:00 2001 From: Jeffrey Zampieron Date: Tue, 1 Sep 2020 21:31:23 -0400 Subject: [PATCH] Setup scripts for developer env using conda --- build_unix_dev_conda.sh | 68 +++++++++++++++++++++++++++++++++++++++++ conda/build.sh | 11 +++++-- environment-linux.yml | 49 +++++++++++++++++++++++++++++ environment-osx.yml | 49 +++++++++++++++++++++++++++++ 4 files changed, 174 insertions(+), 3 deletions(-) create mode 100755 build_unix_dev_conda.sh create mode 100644 environment-linux.yml create mode 100644 environment-osx.yml diff --git a/build_unix_dev_conda.sh b/build_unix_dev_conda.sh new file mode 100755 index 0000000000..4b006438ec --- /dev/null +++ b/build_unix_dev_conda.sh @@ -0,0 +1,68 @@ +##!/usr/bin/env bash +# +# MacOS Build Script for FreeCAD using Conda. +# This is intended for developer use. +# +# Copyright (c) 2020 by Jeffrey Zampieron. All rights reserved. +# +# License: LGPLv2.1 +# +# References: +# - Conda: https://conda.io/projects/conda/en/latest/user-guide/install/index.html +# - Conda Build: https://docs.conda.io/projects/conda-build/en/latest/install-conda-build.html + +########################################################################### +# Script wide setup. +########################################################################### +# The Conda environment name +FCENV=freecad_dev +# The cmake build directory +HOST=$(uname) + +########################################################################### +# Env Checks +########################################################################### +which xcrun +if [ $? != 0 ]; then + echo "xcrun not found... install XCode command line tools..." + echo "using: xcode-select --install" + exit 1 +fi + +########################################################################### +# Conda Setup +########################################################################### +which conda +if [ $? != 0 ]; then + echo "Failed to find conda executable. Please install." + exit 1 +fi + +conda activate ${FCENV} +if [ $? != 0 ]; then + echo "Failed to activate conda env: ${FCENV} ... creating" + + if [[ ${HOST} =~ "Linux" ]]; then + echo "Linux" + conda env create -f environment-linux.yml + elif [[ ${HOST} =~ "Darwin" ]]; then + echo "OS X" + conda env create -f environment-osx.yml + else + echo "Unknown Host: ${HOST}" + exit 1 + fi + + conda activate ${FCENV} + if [ $? != 0 ]; then + echo "Failed to create conda environment and activate it." + exit 1 + fi +fi + +if [ -z "${CONDA_PREFIX}" ]; then + echo "Failed to find CONDA_PREFIX variable." + exit 1 +fi + +PREFIX="${CONDA_PREFIX}" ./conda/build.sh diff --git a/conda/build.sh b/conda/build.sh index 7a9c6ff374..7379c5e23c 100644 --- a/conda/build.sh +++ b/conda/build.sh @@ -5,9 +5,9 @@ mkdir -p build cd build if [[ ${FEATURE_DEBUG} = 1 ]]; then - BUILD_TYPE="Debug" + BUILD_TYPE="Debug" else - BUILD_TYPE="Release" + BUILD_TYPE="Release" fi declare -a CMAKE_PLATFORM_FLAGS @@ -73,9 +73,14 @@ cmake \ ${CMAKE_PLATFORM_FLAGS[@]} \ .. +if [ $? != 0 ]; then + echo "CMake failed to configure." + exit 1 +fi + echo "FREECAD_USE_3DCONNEXION=${FREECAD_USE_3DCONNEXION}" -ninja install +ninja install rm -r ${PREFIX}/share/doc/FreeCAD # smaller size of package! mv ${PREFIX}/bin/FreeCAD ${PREFIX}/bin/freecad mv ${PREFIX}/bin/FreeCADCmd ${PREFIX}/bin/freecadcmd diff --git a/environment-linux.yml b/environment-linux.yml new file mode 100644 index 0000000000..cbf2ff2181 --- /dev/null +++ b/environment-linux.yml @@ -0,0 +1,49 @@ +name: freecad_dev +channels: + - conda-forge + - defaults +dependencies: + - cxx-compiler + - cmake + - ninja + - git + - doxygen + - python + - qt + - boost-cpp + - xerces-c + - zlib + - vtk + - swig + - eigen + - occt + - pybind11 + - coin3d + - pivy + - smesh + - netgen=6.2.1808* + - hdf5 + - freetype + - pcl + - six + - ply + - tbb-devel + - pyside2 + - numpy + - six + - pyyaml + - libspnav + - libxcb + - xorg-libxt +# Linux ONLY items + - mesa-libgl-devel # [linux] + - mesa-dri-drivers # [linux] + - mesa-libegl-devel # [linux] + - libselinux # [linux] + - libxdamage # [linux] + - libxfixes # [linux] + - libxxf86vm # [linux] + - libxext # [linux] + - xorg-x11-server-xvfb # [linux] + - libxau # [linux] + - libxi-devel # [linux] diff --git a/environment-osx.yml b/environment-osx.yml new file mode 100644 index 0000000000..ff1846f00c --- /dev/null +++ b/environment-osx.yml @@ -0,0 +1,49 @@ +name: freecad_dev +channels: + - conda-forge + - defaults +dependencies: + - cxx-compiler + - cmake + - ninja + - git + - doxygen + - python + - qt + - boost-cpp + - xerces-c + - zlib + - vtk + - swig + - eigen + - occt + - pybind11 + - coin3d + - pivy + - smesh + - netgen=6.2.1808* + - hdf5 + - freetype + - pcl + - six + - ply + - tbb-devel + - pyside2 + - numpy + - six + - pyyaml + - libspnav + - libxcb + - xorg-libxt +# Linux ONLY items + # - mesa-libgl-devel # [linux] + # - mesa-dri-drivers # [linux] + # - mesa-libegl-devel # [linux] + # - libselinux # [linux] + # - libxdamage # [linux] + # - libxfixes # [linux] + # - libxxf86vm # [linux] + # - libxext # [linux] + # - xorg-x11-server-xvfb # [linux] + # - libxau # [linux] + # - libxi-devel # [linux]