File: CMakeLists.txt

package info (click to toggle)
texworks 0.6.10%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 24,600 kB
  • sloc: cpp: 32,035; ansic: 8,252; javascript: 972; xml: 344; python: 208; sh: 157; makefile: 24
file content (51 lines) | stat: -rw-r--r-- 2,072 bytes parent folder | download
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Build Python Plugin
# ===================

SET(TWPYTHONPLUGIN_LIB_TYPE MODULE)
IF (NOT ${BUILD_SHARED_PLUGINS})
  SET(TWPYTHONPLUGIN_LIB_TYPE STATIC)
ENDIF()

if (BUILD_SHARED_PLUGINS)
  # For shared builds, we pull in scripting/Script.cpp so all references can be
  # resolved
  # This seems to be needed particularly when building dlls with MinGW on
  # Windows (as is done in the Appveyor CI build) as the dll linking stage
  # requires all symbols to be resolved
  # NB: This can lead to spurious "one definition rule (odr) violation" messages
  # with some sanitizers
  # TODO: Figure out of setting ENABLE_EXPORTS=TRUE on the TeXworks target and
  # subsequent linking to the TeXworks target can help "resolve" symbols by
  # telling the linker they can be found in the host program loading the dll
  set(TWSCRIPT_SRC "../../src/scripting/Script.cpp")
else ()
  # For static builds, scripting/Script.cpp is already included in the main app, so we
  # don't pull it in here to avoid multiple definitions of the Qt metaobject
  set(TWSCRIPT_SRC "")
endif ()

ADD_LIBRARY(TWPythonPlugin ${TWPYTHONPLUGIN_LIB_TYPE}
  PythonScriptInterface.cpp
  PythonScript.cpp
  ${TWSCRIPT_SRC}
  ${PYTHON_PLUGIN_MOC}
)
target_compile_options(TWPythonPlugin PRIVATE ${WARNING_OPTIONS})
if (NOT MSVC)
	# Don't warn about old-style casts as the Python headers are littered with
	# macros (which are handled as if copied into our code) using those
	target_compile_options(TWPythonPlugin PRIVATE -Wno-old-style-cast)
endif ()

target_include_directories(TWPythonPlugin SYSTEM PRIVATE ${Python_INCLUDE_DIRS})
target_include_directories(TWPythonPlugin PRIVATE ${TeXworks_SOURCE_DIR}/src)

# Specify link libraries even if the plugin is built statically so all the
# interface properties of the Qt targets (include directories, lib directories,
# etc.) are available
TARGET_LINK_LIBRARIES(TWPythonPlugin ${QT_LIBRARIES} ${Python_LIBRARIES} ${TEXWORKS_ADDITIONAL_LIBS})
IF (${BUILD_SHARED_PLUGINS})
  INSTALL(TARGETS TWPythonPlugin
    LIBRARY DESTINATION ${TeXworks_PLUGIN_DIR}
  )
ENDIF()