-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
152 lines (136 loc) · 4.09 KB
/
CMakeLists.txt
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR)
project(expressPython LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wpedantic")
set(SOURCES
main.cpp
ANTLR/customtoken.cpp
UI/mainview.cpp
CodeEditor/antlrsyntaxhighlighter.cpp
CodeEditor/codeeditor.cpp
Features/snippets.cpp
PythonAccess/emb.cpp
PythonAccess/pythonworker.cpp
CodeEditor/codelineedit.cpp
Features/xquestion.cpp
Features/xtute.cpp
PythonAccess/jedi.cpp
ANTLR/Python3BaseListener.cpp
ANTLR/Python3Lexer.cpp
ANTLR/Python3Listener.cpp
ANTLR/Python3Parser.cpp
)
set(UI
UI/mainview.ui
)
set(HEADERS
UI/mainview.h
ANTLR/customtoken.h
CodeEditor/antlrsyntaxhighlighter.h
CodeEditor/codeeditor.h
Features/snippets.h
PythonAccess/emb.h
PythonAccess/pythonworker.h
CodeEditor/codelineedit.h
Features/xquestion.h
Features/xtute.h
PythonAccess/jedi.h
ANTLR/Python3BaseListener.h
ANTLR/Python3Lexer.h
ANTLR/Python3Listener.h
ANTLR/Python3Parser.h
)
set(RESOURCES
PyRunResources.qrc
)
qt5_add_resources(RESOURCES_WRAPPED ${RESOURCES})
qt5_wrap_ui(UI_WRAPPED ${UI})
qt5_wrap_cpp(SOURCES_MOC ${HEADERS})
add_executable(${PROJECT_NAME} ${SOURCES} ${SOURCES_MOC} ${UI_WRAPPED} ${RESOURCES_WRAPPED})
set(ANTLR_LIB_LOCATION $ENV{ANTLR_LIB_LOCATION})
set(ANTLR_INC_LOCATION $ENV{ANTLR_INC_LOCATION})
# WINDOWS SPECIFIC CONFIG
if(WIN32)
set(PYTHON3_LOCATION $ENV{PYTHON3_LIB_LOCATION})
set(RC_FILE WindowsResources/win_rsrc.rc)
set(LIBS
-L${PYTHON3_LOCATION}\\libs\\
-lpython37
)
set(INCLUDES
${PYTHON3_LOCATION}\\include
)
set_target_properties(${PROJECT_NAME} PROPERTIES
WIN32_EXECUTABLE YES
)
# MACOS SPECIFIC CONFIG
elseif(APPLE)
set(PYTHON3_LIB_LOCATION $ENV{PYTHON3_LIB_LOCATION})
set(PYTHON3_INC_LOCATION $ENV{PYTHON3_INC_LOCATION})
set(LIBS
${PYTHON3_LIB_LOCATION}
qtermwidget5
${CMAKE_SOURCE_DIR}/${ANTLR_LIB_LOCATION}
)
set(INCLUDES
${PYTHON3_INC_LOCATION}
${CMAKE_SOURCE_DIR}/${ANTLR_INC_LOCATION}
)
set(ICON Icons/PyRunImg.icns)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE YES
)
# UNIX specific config
elseif(UNIX)
set(PYTHON3_LIB_LOCATION $ENV{PYTHON3_LIB_LOCATION})
set(PYTHON3_INC_LOCATION $ENV{PYTHON3_INC_LOCATION})
set(QTERMWIDGET_LIB_LOCATION $ENV{QTERMWIDGET_LIB_LOCATION})
set(QTERMWIDGET_INC_LOCATION $ENV{QTERMWIDGET_INC_LOCATION})
set(LIBS
${PYTHON3_LIB_LOCATION}
${CMAKE_SOURCE_DIR}/${QTERMWIDGET_LIB_LOCATION}
${CMAKE_SOURCE_DIR}/${ANTLR_LIB_LOCATION}
)
set(INCLUDES
${PYTHON3_INC_LOCATION}
${CMAKE_SOURCE_DIR}/${QTERMWIDGET_INC_LOCATION}
${CMAKE_SOURCE_DIR}/${ANTLR_INC_LOCATION}
)
else()
message(SEND_ERROR "You are on an unsupported platform! (Not Win32, Mac OS X or Unix)")
endif(WIN32)
# LINKING EXTERNAL LIBRARIES
target_include_directories(${PROJECT_NAME} PUBLIC
${INCLUDES}
)
target_link_libraries(${PROJECT_NAME} PUBLIC
${LIBS}
Qt5::Core
Qt5::Gui
Qt5::Widgets
)
# CREATE DEBIAN PACKAGE
if(UNIX)
set(EXPRESSPYTHON_DESKTOP_DIR "/usr/share/applications/")
set(EXPRESSPYTHON_PIXMAPS_DIR "/usr/share/icons/")
install (FILES ${CMAKE_SOURCE_DIR}/share/expressPython.desktop
DESTINATION ${EXPRESSPYTHON_DESKTOP_DIR}
)
install (FILES ${CMAKE_SOURCE_DIR}/share/expressPython.png
DESTINATION ${EXPRESSPYTHON_PIXMAPS_DIR}
)
install(TARGETS expressPython
RUNTIME DESTINATION "/usr/bin/"
LIBRARY DESTINATION "/usr/bin/"
DESTINATION "/usr/bin/"
)
set(CPACK_GENERATOR "DEB")
# SET(CPACK_DEBIAN_PACKAGE_DEPENDS "build-essential qt5-default uuid-dev libglib2.0-dev ttools5-dev")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "LeopardsLab")
set(CPACK_PACKAGE_EXECUTABLES "expressPython" "expressPython")
include(CPack)
endif(UNIX)