File: PythonLinkHelper.cmake

package info (click to toggle)
nmodl 0.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,992 kB
  • sloc: cpp: 28,492; javascript: 9,841; yacc: 2,804; python: 1,967; lex: 1,674; xml: 181; sh: 136; ansic: 37; makefile: 18; pascal: 7
file content (30 lines) | stat: -rw-r--r-- 1,104 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# =============================================================================
# Support for building NMODL without python library
# =============================================================================
# ~~~
# When NMODL is built under environment  (e.g. manylinux) without python-dev
# package i.e. libpython.so, we have to build extension and binaries by
# ignoring undefned symbols. The python library will be loaded later on target
# system.
# ~~~

# use same variable name as NEURON as it won't be user option
set(LINK_AGAINST_PYTHON
    TRUE
    CACHE BOOL "Disable linking to python library")

mark_as_advanced(LINK_AGAINST_PYTHON)

# Flags for ignoring undefined symbols for wheel
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  set(UNDEFINED_SYMBOLS_IGNORE_FLAG "-Wl,-undefined,dynamic_lookup")
else()
  set(UNDEFINED_SYMBOLS_IGNORE_FLAG "-Wl,--unresolved-symbols=ignore-all")
endif()

if(NOT LINK_AGAINST_PYTHON)
  string(APPEND CMAKE_EXE_LINKER_FLAGS " ${UNDEFINED_SYMBOLS_IGNORE_FLAG}")
  set(NMODL_WRAPPER_LIBS pyembed dl)
else()
  set(NMODL_WRAPPER_LIBS pyembed pywrapper dl)
endif()