Commit d4555a55 authored by Roel Aaij's avatar Roel Aaij
Browse files

Allow building in a conda venv

parent 3040be47
Pipeline #162 failed with stages
......@@ -6,6 +6,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # for find_package
option(ENABLE_PYTHON "Enable python bindings" TRUE)
option(ENABLE_VC "Enable usage of VC library" TRUE)
option(ENABLE_TESTS "Enable tests" TRUE)
option(ENABLE_ROOT "Enable test with ROOT" TRUE)
include(ExternalProject)
include(FindPackageHandleStandardArgs)
......
......@@ -56,6 +56,13 @@ class CMakeBuild(build_ext):
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
build_args += ['--', '-j1']
if 'CONDA_EXE' in os.environ:
# Building in a conda environment, use the special
# toolchain file, ROOT doesn't seem to work
cmake_args += ['-DENABLE_ROOT=OFF',
'-DCMAKE_INSTALL_PREFIX={}'.format(os.environ['CONDA_PREFIX']),
'-DCMAKE_TOOLCHAIN_FILE={}/anaconda-toolchain.cmake'.format(ext.sourcedir)]
env = os.environ.copy()
env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(
env.get('CXXFLAGS', ''),
......@@ -100,7 +107,7 @@ setup(
version=__version__,
author='Roel Aaij',
author_email='roelaaij@nikhef.nl',
url='https://sikkel.nikhef.nl/roelaaij/k40gen',
url='https://gitlab.nikhef.nl/roelaaij/k40gen',
description='standalone background generator for KM3NeT',
long_description='',
ext_modules=ext_modules,
......
......@@ -45,7 +45,11 @@ target_link_libraries(test_k40gen PRIVATE generate test_functions)
add_test(TestK40 test_k40gen)
# Optional test binary based on ROOT
find_package(ROOT QUIET COMPONENTS Core Cling Hist Gpad)
if (ENABLE_ROOT)
find_package(ROOT QUIET COMPONENTS Core Cling Hist Gpad)
else()
set(ROOT_FOUND FALSE)
endif()
if (ROOT_FOUND)
add_executable(test_k40gen_root
src/test_rates_root.cpp)
......
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