Skip to content

Commit

Permalink
Merge pull request #2365 from SCIInstitute/apple-silicon
Browse files Browse the repository at this point in the history
First changes from Apple silicon machine
  • Loading branch information
dcwhite committed Feb 3, 2022
2 parents f02ad9d + 0e3332d commit 39fa832
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v1
- uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 240 days with no activity. Remove the stale label or comment, or this will be closed in 60 days.'
Expand Down
16 changes: 8 additions & 8 deletions Superbuild/TetgenExternal.cmake
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# For more information, please see: http://software.sci.utah.edu
#
#
# The MIT License
#
#
# Copyright (c) 2015 Scientific Computing and Imaging Institute,
# University of Utah.
#
#
#
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
Expand All @@ -26,7 +26,7 @@

SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base})
ExternalProject_Add(Tetgen_external
URL "http://www.tetgen.org/1.5/src/tetgen1.5.1-beta1.tar.gz"
URL "https://github.com/CIBC-Internal/SCIRunTestData/releases/download/test/tetgen1.5.1-beta1.tar.gz"
PATCH_COMMAND ""
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS
Expand Down
148 changes: 16 additions & 132 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
#!/bin/bash
#
#
# For more information, please see: http://software.sci.utah.edu
#
#
# The MIT License
#
#
# Copyright (c) 2015 Scientific Computing and Imaging Institute,
# University of Utah.
#
#
# License for the specific language governing rights and limitations under
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
#

##########################################################################
# SCIRun build script
Expand All @@ -34,24 +34,10 @@
# By default, the CMake generator will be Unix Makefiles,
# in which case, the project will automatically be built using make.
#
# If an Xcode project is specified using the --xcode-build flag,
# the project will be built using the command line utility xcodebuild.
#
# Shortcuts for setting up the default OS X SDK build target and
# architecture are also available.
##########################################################################

CMAKE_MAJOR_VERSION=2
CMAKE_MINOR_VERSION=8
CMAKE_PATCH_VERSION=12
CMAKE_PATH_MINOR_VERSION=2
CMAKE_VERSION="${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}.${CMAKE_PATH_MINOR_VERSION}"
CMAKE="cmake-${CMAKE_VERSION}"

OSX_TARGET_VERSION="10.7"
OSX_TARGET_VERSION_SDK="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
OSX_TARGET_ARCH="x86_64"

##########################################################################
# Helper functions
##########################################################################
Expand Down Expand Up @@ -111,77 +97,10 @@ get_cmake_version() {
echo "$version"
}

# Try to find a version of cmake
find_cmake() {
if [[ ! -e $cmakebin ]]; then
cmakebin=`which cmake`
fi

download=0
#if it is not found
if [[ ! -e $cmakebin ]]; then
download=1
else
# see if cmake is up-to-date
version=$(get_cmake_version)
echo "$cmakebin version $version found"
major_version=${version:0:1}
minor_version=${version:2:1}
if [[ $major_version -le $CMAKE_MAJOR_VERSION && $minor_version -lt $CMAKE_MINOR_VERSION ]] ; then
download=1
fi
fi

if [[ $download -eq 1 ]]; then
# then look for our own copy made by this script previously
cmakebin=$DIR/cmake/local/bin/cmake
try mkdir -p $DIR/cmake/
try cd $DIR/cmake

if [[ -e $cmakebin ]]; then
# see if local cmake install is compatible
version=$(get_cmake_version)
echo "$cmakebin version $version found"
major_version=${version:0:1}
minor_version=${version:2:1}
if [[ $major_version -ge $CMAKE_MAJOR_VERSION && $minor_version -ge $CMAKE_MINOR_VERSION ]] ; then
download=0
fi
fi

if [[ $download -eq 1 ]]; then
# try to download and build our own copy in local
try $getcommand http://www.cmake.org/files/v${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/${CMAKE}.tar.gz
try tar xvzf ${CMAKE}.tar.gz
try cd $CMAKE
try ./bootstrap --prefix="${DIR}/cmake/local"
try make $makeflags
try make install
fi
fi

echo "cmakebin=$cmakebin"
ensure $cmakebin --version
}

##########################################################################
# Build configure functions
##########################################################################

# handle both types of OS X generators
configure_scirun_osx() {
local build_opts=$@

if [[ $setosxmin -eq 1 ]]; then
build_opts="${build_opts} -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${OSX_TARGET_VERSION} -DCMAKE_OSX_SYSROOT:PATH=${OSX_TARGET_VERSION_SDK} -DCMAKE_OSX_ARCHITECTURES:STRING=${OSX_TARGET_ARCH}"
fi

if [[ $xcodebuild -eq 1 ]]; then
try $cmakebin $DIR/Superbuild -G Xcode $build_opts $cmakeargs
else
configure_scirun_make $build_opts
fi
}

# generic Unix makefile build
configure_scirun_make() {
Expand All @@ -199,13 +118,9 @@ configure_scirun() {
fi
try cd $builddir

local COMMON_BUILD_OPTS="-DWITH_TETGEN:BOOL=$tetgenbuild -DBUILD_DOCUMENTATION:BOOL=$documentation"
local COMMON_BUILD_OPTS="-DBUILD_HEADLESS:BOOL=$headless -DWITH_TETGEN:BOOL=$tetgenbuild -DBUILD_DOCUMENTATION:BOOL=$documentation"

if [[ $osx -eq 1 ]]; then
configure_scirun_osx $COMMON_BUILD_OPTS
else
configure_scirun_make $COMMON_BUILD_OPTS
fi
configure_scirun_make $COMMON_BUILD_OPTS
}

##########################################################################
Expand All @@ -217,22 +132,13 @@ build_scirun_make() {
trybuild make $makeflags
}

build_scirun_xcode() {
echo "Building SCIRun using Xcode..."
trybuild xcodebuild -project SCIRun.xcodeproj -target ALL_BUILD -configuration $buildtype
}

build_scirun() {
local cwd=`pwd`
if [[ $builddir != $cwd ]]; then
try cd $builddir
fi

if [[ $xcodebuild -eq 1 ]]; then
build_scirun_xcode
else
build_scirun_make
fi
build_scirun_make
}

##########################################################################
Expand Down Expand Up @@ -262,7 +168,7 @@ fi
buildtype="Release"
makeflags=
cmakeflags=
cmakebin=
cmakebin="cmake"
cmakeargs=
setosxmin=0
verbosebuild="OFF"
Expand All @@ -271,6 +177,7 @@ xcodebuild=0
documentation="OFF"
# currently off by default
tetgenbuild="OFF"
headless="OFF"

echo "Parsing arguments..."
while [[ $1 != "" ]]; do
Expand All @@ -279,16 +186,8 @@ while [[ $1 != "" ]]; do
buildtype="Debug";;
--release)
buildtype="Release";;
--set-osx-version-min)
if [[ $osx -eq 1 ]]; then
setosxmin=1
else
echo "WARNING: Only OS X supports the --set-osx-version-min flag."
fi;;
--verbose)
verbosebuild="ON";;
--cmake=*)
cmakebin=`echo $1 | cut -c 9-`;;
--cmake-args=*)
cmakeargs=`echo $1 | cut -c 14-`;;
--custom-build-dir=*)
Expand All @@ -305,14 +204,10 @@ while [[ $1 != "" ]]; do
builddir="${DIR}/${dirarg}"
fi
fi;;
--xcode-build)
if [[ $osx -eq 1 ]]; then
xcodebuild=1
else
echo "WARNING: Only OS X supports the --xcode-build flag."
fi;;
--with-tetgen)
tetgenbuild="ON";;
--headless)
headless="ON";;
--documentation)
documentation="ON";;
-j*)
Expand All @@ -329,23 +224,12 @@ done

cmakeargs="${cmakeargs} ${cmakeflags}"

if [[ ! -z $cmakebin ]]; then
echo "Using CMake: $cmakebin"
fi
echo "CMake args: $cmakeargs"
echo "Make Flags: $makeflags"
if [[ $xcodebuild -eq 0 ]]; then
# ensure make is on the system
ensure make --version

echo "Build Type: $buildtype"
else
ensure xcodebuild -version

echo "Generating Xcode project"
fi
ensure make --version

find_cmake
echo "Build Type: $buildtype"

configure_scirun

Expand Down

0 comments on commit 39fa832

Please sign in to comment.