Last active
July 6, 2023 17:24
-
-
Save tlambert03/7607f6fd53d574a96401067a31a9d8fe to your computer and use it in GitHub Desktop.
This script will download micro-manager and build just the DemoCamera. Can be used on apple silicon (with home-brew installed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# output to the current directory if no argument is given | |
if [[ $# -eq 0 ]]; then | |
OUTPUT=$(pwd) | |
else | |
OUTPUT=$1 | |
fi | |
packages=("autoconf" "automake" "libtool" "boost") | |
for package in "${packages[@]}"; do | |
if brew ls --versions "$package" >/dev/null; then | |
echo "Package '$package' is already installed." | |
else | |
echo "Package '$package' is not installed. Installing..." | |
brew install "$package" | |
fi | |
done | |
REPO=_mmrepo | |
rm -rf $REPO | |
git clone https://github.com/micro-manager/micro-manager.git $REPO | |
cd $REPO | |
git submodule update --init --recursive | |
# Update config.ac and makefile.am | |
# To just build the demo camera | |
############################# | |
our_makefile=$(cat <<EOF | |
AUTOMAKE_OPTIONS = foreign | |
ACLOCAL_AMFLAGS = -I ../m4 | |
SUBDIRS = \ | |
DemoCamera \ | |
Utilities | |
EOF | |
) | |
echo "$our_makefile" > mmCoreAndDevices/DeviceAdapters/Makefile.am | |
our_config_ac=$(cat <<"EOF" | |
AC_PREREQ([2.69]) | |
AC_INIT([Micro-Manager], [2]) | |
AC_CONFIG_MACRO_DIR([../m4]) | |
AC_CONFIG_SRCDIR([DemoCamera/DemoCamera.cpp]) | |
AC_CANONICAL_HOST | |
AM_INIT_AUTOMAKE([foreign 1.11]) | |
LT_PREREQ([2.2.6]) | |
LT_INIT([disable-static]) | |
AC_PROG_CC([cc gcc clang]) | |
AC_PROG_CXX([c++ g++ clang++]) | |
AX_CXX_COMPILE_STDCXX([14], [noext]) | |
micromanager_cpp_path=${ac_pwd}/.. | |
micromanager_path=${micromanager_cpp_path}/.. | |
MMDEVAPI_CXXFLAGS="-I${micromanager_cpp_path}/MMDevice ${BOOST_CPPFLAGS}" | |
AC_SUBST(MMDEVAPI_CXXFLAGS) | |
MMDEVAPI_LIBADD="${micromanager_cpp_path}/MMDevice/libMMDevice.la" | |
AC_SUBST(MMDEVAPI_LIBADD) | |
MMDEVAPI_LDFLAGS="-module -avoid-version -shrext \"\$(MMSUFFIX)\"" | |
AC_SUBST(MMDEVAPI_LDFLAGS) | |
MM_INSTALL_DIRS | |
AC_MSG_CHECKING(library suffix) | |
AC_MSG_RESULT($MMSUFFIX) | |
AC_SUBST(MMSUFFIX) | |
AC_MSG_CHECKING(library prefix) | |
AC_MSG_RESULT($MMPREFIX) | |
AC_SUBST(MMPREFIX) | |
AC_CHECK_FUNCS([memset]) | |
m4_define([device_adapter_dirs], [m4_strip([ | |
DemoCamera | |
Utilities | |
])]) | |
AC_CONFIG_FILES(Makefile m4_map_args_w(device_adapter_dirs, [], [/Makefile], [ ])) | |
AC_OUTPUT | |
EOF | |
) | |
echo "$our_config_ac" > mmCoreAndDevices/DeviceAdapters/configure.ac | |
################## | |
export LDFLAGS="-L/opt/homebrew/lib/" | |
export CPPFLAGS="-I/opt/homebrew/include/" | |
./autogen.sh | |
./configure --prefix="$(pwd)" | |
make | |
make install | |
# grab the demo config | |
cp bindist/any-platform/MMConfig_demo.cfg lib/micro-manager | |
cd .. | |
mv $REPO/lib/micro-manager $OUTPUT | |
rm -rf $REPO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment