-
Notifications
You must be signed in to change notification settings - Fork 468
/
Copy pathCMakeLists.txt
122 lines (106 loc) · 3.78 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
# Our project is called 'codelite' this is how it will be called in visual studio, and in our makefiles.
project(libcodelite)
# wxWidgets include (this will do all the magic to configure everything)
include("${wxWidgets_USE_FILE}")
if(UNIX AND NOT APPLE)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
list(PREPEND CMAKE_INSTALL_RPATH "${PLUGINS_DIR}")
endif(UNIX AND NOT APPLE)
# Flex files
flex_target(CxxFlex "${CMAKE_SOURCE_DIR}/CodeLite/Cxx/CxxScanner.l" "${CMAKE_CURRENT_BINARY_DIR}/CxxScanner.cpp"
COMPILE_FLAGS "--noline --yylineno --batch")
flex_target(IncludeFinderFlex "${CMAKE_SOURCE_DIR}/CodeLite/Cxx/include_finder.l"
"${CMAKE_CURRENT_BINARY_DIR}/include_finder.cpp" COMPILE_FLAGS "-Pinclf_ --noline --yylineno --batch")
flex_target(PhpFlex "${CMAKE_SOURCE_DIR}/CodeLite/PHP/PhpLexer.l" "${CMAKE_CURRENT_BINARY_DIR}/PhpLexer.cpp"
COMPILE_FLAGS "-Pphp --noline --yylineno --batch")
flex_target(XmlFlex "${CMAKE_SOURCE_DIR}/CodeLite/XML/XMLLexer.l" "${CMAKE_CURRENT_BINARY_DIR}/XmlLexer.cpp"
COMPILE_FLAGS "-Pxml --noline --yylineno --batch")
set(FlexSrcs "${FLEX_CxxFlex_OUTPUTS}" "${FLEX_IncludeFinderFlex_OUTPUTS}" "${FLEX_PhpFlex_OUTPUTS}"
"${FLEX_XmlFlex_OUTPUTS}")
file(GLOB_RECURSE SRCS "*.cpp" "*.h" "*.hpp")
add_library(libcodelite SHARED ${SRCS} ${FlexSrcs})
# Include paths
target_include_directories(
libcodelite
PUBLIC "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite" "${CL_SRC_ROOT}/CodeLite/ssh"
"${CL_SRC_ROOT}/PCH"
PRIVATE "${CL_SRC_ROOT}/submodules/asio/asio/include" "${CL_SRC_ROOT}/submodules/websocketpp")
# Macros
if(WIN32)
target_compile_definitions(
libcodelite
PRIVATE WXMAKINGDLL_CL
INTERFACE WXUSINGDLL_CL)
target_compile_definitions(libcodelite PUBLIC WXUSINGDLL_WXSQLITE3)
endif()
if(USE_PCH AND NOT MINGW)
add_definitions(-include "${CL_PCH_FILE}")
add_definitions(-Winvalid-pch)
endif()
# Add RPATH
if(NOT MINGW AND WXC_APP)
string(REPLACE "codelite" "wxcrafter" WXC_LIBS_DIR ${PLUGINS_DIR})
set(LINKER_OPTIONS -Wl,-rpath,"${WXC_LIBS_DIR}")
message("-- libcodelite.so is using RPATH set to ${WXC_LIBS_DIR}")
endif()
# Define GTK libraries
if(GTK2_FOUND)
set(GTK_LIBS "${GTK2_LIBRARIES}")
elseif(GTK3_FOUND)
set(GTK_LIBS "${GTK3_LIBRARIES}")
else()
set(GTK_LIBS "")
endif()
set(ADDITIONAL_LIBRARIES "")
if(UNIX)
if(IS_FREEBSD)
set(ADDITIONAL_LIBRARIES "-lkvm -lutil")
elseif(IS_NETBSD)
set(ADDTIONAL_LIBRARIES "-lutil")
elseif(UNIX AND NOT APPLE)
set(ADDITIONAL_LIBRARIES "-ldl -lutil")
endif()
else(UNIX)
set(ADDITIONAL_LIBRARIES "-lws2_32")
endif(UNIX)
if(UNIX OR APPLE)
set_target_properties(libcodelite PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_link_libraries(
libcodelite
${LINKER_OPTIONS}
-L"${CL_LIBPATH}"
${SQLite3_LIBRARIES}
libCxxParser
wxsqlite3
${LIBSSH_LIB}
${GTK_LIBS}
${ADDITIONAL_LIBRARIES}
${LIBUCHARDET_LIB}
cJSON)
if(MINGW)
set_target_properties(
libcodelite
PROPERTIES PREFIX ""
OUTPUT_NAME libcodelite
RUNTIME_OUTPUT_NAME codelite
ARCHIVE_OUTPUT_NAME codelite)
endif()
if(USE_PCH)
codelite_add_pch(libcodelite)
endif()
if(NOT MINGW)
if(APPLE)
install(TARGETS libcodelite DESTINATION ${CMAKE_BINARY_DIR}/codelite.app/Contents/MacOS/)
else()
install(TARGETS libcodelite DESTINATION ${PLUGINS_DIR})
endif()
else()
install(
TARGETS libcodelite
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif()