Skip to content

Commit e04afc4

Browse files
author
Lee Newberg
committed
ENH: Add and use cmake flag DISABLE_PYTHON
Also, undo previous commit per discussion at #217
1 parent fe2dc40 commit e04afc4

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ option(ENABLE_TESTS "Enable build tests for EXP, pyEXP and helpers" ON)
6666
option(ENABLE_MINIMAL "Compile EXP support libraries only" OFF)
6767
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
6868
option(BUILD_DOCS "Build documentation" OFF)
69+
option(DISABLE_PYTHON "Disable the Python development environment" OFF)
6970

7071
# Metaflag for minimal build
7172

@@ -298,13 +299,15 @@ if(ENABLE_TESTS)
298299
add_subdirectory(tests)
299300
endif()
300301

301-
if(ENABLE_PYEXP)
302-
# try to find pybind11 and build wrapper python module
302+
# try to find pybind11 and build wrapper python module
303+
if (NOT DISABLE_PYTHON)
303304
find_package(Python3 COMPONENTS Interpreter Development)
304-
message(STATUS "python3 include dirs: ${Python3_INCLUDE_DIRS}")
305-
if(Python3_FOUND)
306-
set(HAVE_PYTHON3 TRUE)
307-
else()
305+
endif()
306+
message(STATUS "python3 include dirs: ${Python3_INCLUDE_DIRS}")
307+
if(Python3_FOUND)
308+
set(HAVE_PYTHON3 TRUE)
309+
else()
310+
if(ENABLE_PYEXP)
308311
message(FATAL_ERROR "You asked for pyEXP but I cannot find a Python3 environment. Please make Python3 available or disable pyEXP. CMake will exit." )
309312
endif()
310313
endif()

exputil/DiskDensityFunc.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <stdexcept>
21
#include "DiskDensityFunc.H"
32

43
#ifdef HAVE_PYTHON3

include/DiskDensityFunc.H

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
#define _DiskDensityFunc_H_
33

44
#include <functional>
5-
#include <string>
65

76
#include "config_exp.h"
87

9-
#ifdef HAVE_PYTHON3
108
#include <pybind11/pybind11.h>
119
#include <pybind11/embed.h>
1210

@@ -28,14 +26,12 @@
2826
a = 1.0 # Scale radius
2927
h = 0.2 # Scale height
3028
f = math.exp(-0.5*math.fabs(z)/h) # Prevent overflows
31-
sech = 2.0*f / (1.0 + f*f) #
29+
sech = 2.0*f / (1.0 + f*f) #
3230
return math.exp(-R/a)*sech*sech/(8*math.pi*h*a*a)
33-
31+
3432
--------------------------cut here--------------------------------
3533
3634
*/
37-
#endif
38-
3935
class __attribute__((visibility("default")))
4036
DiskDensityFunc
4137
{

0 commit comments

Comments
 (0)