-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
46 lines (37 loc) · 1.17 KB
/
CMakeLists.txt
File metadata and controls
46 lines (37 loc) · 1.17 KB
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
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
find_package(Boost REQUIRED COMPONENTS python)
include_directories(
include
${PROJECT_SOURCE_DIR}/model/include
${PROJECT_SOURCE_DIR}/util/include
${PROJECT_SOURCE_DIR}/parser/include
${PLUGIN_DIR}/model/include)
include_directories(SYSTEM
${Boost_INCLUDE_DIRS}
${Python3_INCLUDE_DIRS})
add_library(pythonparser SHARED
src/pythonparser.cpp)
target_link_libraries(pythonparser
model
pythonmodel
${Boost_LIBRARIES}
${Python3_LIBRARIES})
target_compile_options(pythonparser PUBLIC -Wno-unknown-pragmas)
set(VENV_DIR "${PLUGIN_DIR}/parser/venv/")
if(NOT EXISTS ${VENV_DIR})
message("Creating Python virtual environment: ${VENV_DIR}")
execute_process(
COMMAND python3 -m venv venv
WORKING_DIRECTORY ${PLUGIN_DIR}/parser/)
endif()
message("Installing Python dependencies...")
execute_process(
COMMAND venv/bin/pip install -r requirements.txt
WORKING_DIRECTORY ${PLUGIN_DIR}/parser/)
install(TARGETS pythonparser DESTINATION ${INSTALL_PARSER_DIR})
install(
DIRECTORY pyparser/
DESTINATION ${INSTALL_PYTHON_DIR}/pyparser)
install(
DIRECTORY venv/
DESTINATION ${INSTALL_PYTHON_DIR}/venv)