blob: a30ddb3f3f24137e39c867cdb39b1211337d8361 (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
cmake_minimum_required(VERSION 3.21)
project(symedit)
find_package(Qt5 COMPONENTS Widgets Quick REQUIRED)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
add_executable(symedit WIN32
icon.rc
locale.qrc
main.cpp
qml.qrc
symbol.cpp
symbol.h
symedit.cpp
symedit.h
)
target_compile_features(symedit PRIVATE cxx_std_11)
target_link_libraries(symedit PRIVATE Qt5::Widgets Qt5::Quick)
set_property(SOURCE symbol.cpp PROPERTY SKIP_AUTOMOC TRUE)
option(SYMEDIT_BUILD_HELP "Build the Symbol editor HTML help. Requires Python3.")
if(SYMEDIT_BUILD_HELP)
find_package(Python3 COMPONENTS Interpreter REQUIRED)
if(WIN32)
set(VENV_PYTHON "${CMAKE_CURRENT_BINARY_DIR}/venv/Scripts/python.exe")
set(SPHINX_BUILD "${CMAKE_CURRENT_BINARY_DIR}/venv/Scripts/sphinx-build.exe")
else()
set(VENV_PYTHON "${CMAKE_CURRENT_BINARY_DIR}/venv/bin/python")
set(SPHINX_BUILD "${CMAKE_CURRENT_BINARY_DIR}/venv/bin/sphinx-build")
endif()
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/venv/stamp"
COMMAND Python3::Interpreter -m venv "${CMAKE_CURRENT_BINARY_DIR}/venv"
COMMAND "${VENV_PYTHON}" -m pip install sphinx
COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/venv/stamp"
)
file(GLOB_RECURSE HELP_ENG_FILES LIST_DIRECTORIES FALSE help/eng/*.rst help/eng/*.py help/eng/*.png)
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/help/eng/html/index.html"
COMMAND "${SPHINX_BUILD}" -q -b html "${CMAKE_CURRENT_SOURCE_DIR}/help/eng" "${CMAKE_CURRENT_BINARY_DIR}/help/eng/html"
#COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/help/eng/html/index.html"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/venv/stamp" ${HELP_ENG_FILES}
)
file(GLOB_RECURSE HELP_FIN_FILES LIST_DIRECTORIES FALSE help/fin/*.rst help/fin/*.py help/fin/*.png)
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/help/fin/html/index.html"
COMMAND "${SPHINX_BUILD}" -q -b html "${CMAKE_CURRENT_SOURCE_DIR}/help/fin" "${CMAKE_CURRENT_BINARY_DIR}/help/fin/html"
#COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/help/fin/html/index.html"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/venv/stamp" ${HELP_FIN_FILES}
)
add_custom_target(build-help ALL
DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/help/eng/html/index.html"
"${CMAKE_CURRENT_BINARY_DIR}/help/fin/html/index.html"
)
endif()
install(TARGETS symedit RUNTIME DESTINATION $<CONFIG>)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/help/eng/html/ DESTINATION help/eng)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/help/fin/html/ DESTINATION help/fin)
|