Skip to content

Commit

Permalink
Make sure that we can build OpenCOR without Python support on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Nov 25, 2019
1 parent 358349c commit 7913c78
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions CMakeLists.txt
Expand Up @@ -994,10 +994,6 @@ if(USE_PREBUILT_QTWEBKIT_PACKAGE)
add_definitions(-DENABLE_TEST_PLUGINS)
endif()

# Let OpenCOR know that we want Python support

add_definitions(-DPYTHON_SUPPORT)

# Let OpenCOR know about the prebuilt version of our QtWebKit package
# being used

Expand All @@ -1023,10 +1019,13 @@ if(USE_PREBUILT_QTWEBKIT_PACKAGE)
endforeach()
endif()

# Keep track of whether we are building OpenCOR with Python support
# Keep track of whether we are building OpenCOR with Python support and, if so,
# let OpenCOR know about it

if(NOT "${PYTHON_SCRIPT_DIR}" STREQUAL "")
set(HAS_PYTHON_SUPPORT TRUE)
set(PYTHON_SUPPORT TRUE)

add_definitions(-DPYTHON_SUPPORT)

string(REPLACE "${PROJECT_BUILD_DIR}/" ""
RELATIVE_PYTHON_SCRIPT_DIR "${PYTHON_SCRIPT_DIR}")
Expand Down Expand Up @@ -1094,7 +1093,7 @@ endif()
# Note: this is because the lookup scope changes for DSOs that are loaded using
# dlopen() (see https://www.akkadia.org/drepper/dsohowto.pdf)...

if(NOT WIN32 AND NOT APPLE AND HAS_PYTHON_SUPPORT)
if(NOT WIN32 AND NOT APPLE AND PYTHON_SUPPORT)
include_directories(${PYTHON_INCLUDE_DIR})

target_link_libraries(${CMAKE_PROJECT_NAME}
Expand Down Expand Up @@ -1368,7 +1367,7 @@ if(WIN32)
# skip them in that case (see
# https://github.com/opencor/opencor/issues/1255#issuecomment-550605710)...

if(HAS_PYTHON_SUPPORT)
if(PYTHON_SUPPORT)
if(RELEASE_MODE)
copy_file_to_build_dir(DIRECT ${PLATFORM_DISTRIB_DIR} ${RELATIVE_PYTHON_SCRIPT_DIR} runjupyter.bat)
copy_file_to_build_dir(DIRECT ${PLATFORM_DISTRIB_DIR} ${RELATIVE_PYTHON_SCRIPT_DIR} start_jupyter.py)
Expand Down Expand Up @@ -1449,7 +1448,7 @@ elseif(APPLE)

# Shell scripts to setup and run Python and Jupyter

if(HAS_PYTHON_SUPPORT)
if(PYTHON_SUPPORT)
set(RUN_JUPYTER_FILENAME ${PYTHON_SCRIPT_DIR}/runjupyter)

configure_file(${PLATFORM_DISTRIB_DIR}/runjupyter.in ${RUN_JUPYTER_FILENAME} @ONLY)
Expand Down Expand Up @@ -1545,7 +1544,7 @@ else()

# Shell scripts to setup and run Python and Jupyter

if(HAS_PYTHON_SUPPORT)
if(PYTHON_SUPPORT)
copy_file_to_build_dir(DIRECT ${PLATFORM_DISTRIB_DIR} ${RELATIVE_PYTHON_SCRIPT_DIR} runjupyter)

install(FILES ${PLATFORM_DISTRIB_DIR}/runjupyter
Expand Down

0 comments on commit 7913c78

Please sign in to comment.