Commit 31352187 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

ENH: Example c++ project/recipe

parent dfa7e96f
include ${FSLCONFDIR}/default.mk
# All projects must specify a name. The
# source code for every project is
# installed into $FSLDIR/src/${PROJNAME}
PROJNAME = example_cpp_project
# All shared library dependencies required
# for linking a library or executable must
# be added to LIBS.
LIBS = -lfsl-newimage -lfsl-NewNifti -lfsl-znz
# The following variables can be populated
# with custom preprocessing, compilation,
# and linking flags, although in general
# this shouldn't be necessary. Do not set
# CPPFLAGS, CFLAGS, CXXFLAGS or LDFLAGS
# directly.
#
# - USRCPPFLAGS - C preprocessor flags
# - USRCFLAGS - C compiler flags
# - USRCXXFLAGS - C++ compiler flags
# - USRLDFLAGS - Linker flags
# Shared libraries that are provided by
# this project must be added to SOFILES.
# These files are installed into
# $FSLDIR/lib/.
SOFILES = libfsl-example_cpp_lib.so
# Executables that are provided by this
# project must be added to XFILES. These
# files are installed into $FSLDIR/bin/.
XFILES = example_cpp_exe
# The following variables can be populated
# to specify other outputs that are provided
# by your project:
# - AFILES - Static library files, installed
# into $FSLDIR/lib/
# - HFILES - Header files, installed into
# $FSLDIR/include/${PROJNAME}
# (defaults to *.h)
# - SCRIPTS - Executable scripts are installed
# into $FSLDIR/bin/.
# - DATAFILES - Data files are installed into
# $FSLDIR/data/${PROJNAME}
all: ${XFILES} ${SOFILES}
libfsl-example_cpp_lib.so: example_cpp_lib.o
${CXX} ${CXXFLAGS} -shared -o $@ $^ ${LDFLAGS}
example_cpp_exe: example_cpp_exe.o libfsl-example_cpp_lib.so
${CXX} ${CXXFLAGS} -o $@ $< -lfsl-example_cpp_lib ${LDFLAGS}
#include <iostream>
#include "example_cpp_lib.h"
int main(int argc, char *argv[]) {
if (argc < 2) {
std::cout << "Usage: example_cpp_exe name" << std::endl;
return 1;
}
helloworld(argv[1]);
return 0;
}
#include <string>
#include <iostream>
#include "example_cpp_lib.h"
void helloworld(std::string s) {
std::cout << "Hello, " << s << std::endl;
}
#ifndef EXAMPLE_CPP_LIB_H
#define EXAMPLE_CPP_LIB_H
#include <string>
#include <iostream>
void helloworld(std::string s);
#endif
#!/usr/bin/env bash
export FSLDIR=$PREFIX
export FSLDEVDIR=$PREFIX
mkdir -p $PREFIX/src/
cp -r $(pwd) $PREFIX/src/$PKG_NAME
. $FSLDIR/etc/fslconf/fsl-devel.sh
make
make install
# This is a FSL conda recipe for: example_cpp_project
# The project git repository is: https://git.fmrib.ox.ac.uk/fsl/example_cpp_project
# The git repository for this conda recipe is: https://git.fmrib.ox.ac.uk/fsl/conda/fsl-example_cpp_project
{% set name = fsl-example_cpp_project %}
{% set version = 0.0.1 %}
{% set repository = https://git.fmrib.ox.ac.uk/fsl/example_cpp_project %}
{% set build = '0' %}
package:
name: {{ name }}
version: {{ version }}
source:
# the FSLCONDA_REPOSITORY and FSLCONDA_REVISION
# environment variables can be used to override
# the repository/revision for development purposes.
git_url: {{ '{{ os.environ.get("FSLCONDA_REPOSITORY", repository) }}' }}
git_rev: {{ '{{ os.environ.get("FSLCONDA_REVISION", version) }}' }}
build:
number: {{ build }}
run_exports:
strong:
- {{ name }}
requirements:
host:
- {{ compiler("cxx") }}
- fsl-base >=2012.0
- fsl-newnifti >=3.0.6
- fsl-newimage >=2011.0
if [ -e ${FSLDIR}/share/fsl/sbin/createFSLWrapper ]; then
${FSLDIR}/share/fsl/sbin/createFSLWrapper example_cpp_exe
fi
if [ -e ${FSLDIR}/share/fsl/sbin/removeFSLWrapper ]; then
${FSLDIR}/share/fsl/sbin/removeFSLWrapper example_cpp_exe
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment