-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtexpp.mac.patch
302 lines (283 loc) · 9.54 KB
/
texpp.mac.patch
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
commit 7e8db99b93fd359df1b1978b277775800c7c4c3b
Author: Volodymyr Kuznetsov <ks.vladimir@gmail.com>
Date: Wed Apr 6 16:02:15 2011 +0200
Fixed build system to work on Mac
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e057fe8..5def362 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ include(CTest)
# Find boost libraries
set(Boost_USE_MULTITHREADED ON)
-find_package(Boost 1.34.0 COMPONENTS filesystem regex python REQUIRED)
+find_package(Boost 1.34.0 COMPONENTS system filesystem regex python REQUIRED)
# Find python interpreter
find_package(PythonInterp)
@@ -14,12 +14,11 @@ if(NOT PYTHONINTERP_FOUND)
message("python interpreter NOT found - tests/hrefkeywords will NOT be built.")
endif(NOT PYTHONINTERP_FOUND)
-# Find boost.python libraries
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
-find_package(BoostPython)
-if(NOT BOOST_PYTHON_FOUND)
- message("boost.python NOT found - texpy and hrefkeywords will NOT be built.")
-endif(NOT BOOST_PYTHON_FOUND)
+# Find python libraries
+find_package(PythonLibs)
+if(NOT PYTHONLIBS_FOUND)
+ message("python libraries NOT found - texpy and hrefkeywords will NOT be built.")
+endif(NOT PYTHONLIBS_FOUND)
# Find tex executable (required for tests/tex and tests/hrefkeywords)
find_program(TEX_EXECUTABLE "tex")
@@ -37,10 +36,10 @@ include_directories(${CMAKE_SOURCE_DIR})
# Subdirectories
add_subdirectory(texpp)
-if(BOOST_PYTHON_FOUND)
+if(Boost_PYTHON_FOUND)
add_subdirectory(texpy)
add_subdirectory(hrefkeywords)
-endif(BOOST_PYTHON_FOUND)
+endif(Boost_PYTHON_FOUND)
if(BUILD_TESTING)
add_subdirectory(tests)
diff --git a/FindBoostPython.cmake b/FindBoostPython.cmake
deleted file mode 100644
index 59ef69b..0000000
--- a/FindBoostPython.cmake
+++ /dev/null
@@ -1,134 +0,0 @@
-# - Try to find the a valid boost+python combination
-# Once done this will define
-#
-# BOOST_PYTHON_FOUND - system has a valid boost+python combination
-# BOOST_PYTHON_INCLUDES - the include directory for boost+python
-# BOOST_PYTHON_LIBS - the needed libs for boost+python
-
-# Copyright (c) 2006, Pino Toscano, <toscano.pino@tiscali.it>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-if(BOOST_PYTHON_INCLUDES AND BOOST_PYTHON_LIBS)
- # Already in cache, be silent
- set(BOOST_PYTHON_FIND_QUIETLY TRUE)
-endif(BOOST_PYTHON_INCLUDES AND BOOST_PYTHON_LIBS)
-
-# some needed includes
-include(CheckCXXSourceCompiles)
-include(CheckIncludeFileCXX)
-include(CheckLibraryExists)
-
-# reset vars
-set(BOOST_PYTHON_INCLUDES)
-set(BOOST_PYTHON_LIBS)
-
-# handy arrays
-set(PYTHON_VERSIONS "python;python2.6;python2.5;python2.4;python2.3;python2.2")
-set(PYTHON_INCLUDE_DIRS "/usr/include/$pyver;/usr/local/include/$pyver;/usr/$pyver/include;/usr/local/$pyver/include;$prefix/include/$pyver;$prefix/$pyver/include")
-set(PYTHON_LIBRARY_DIRS "/usr/lib${LIB_SUFFIX};/usr/local/lib${LIB_SUFFIX};/usr/lib${LIB_SUFFIX}/$pyver/config")
-set(PYTHON_LIBS "boost_python-gcc-mt;boost_python-mt;boost_python-gcc-mt-1_33;boost_python-gcc-mt-1_33_1;boost_python;boost_python-gcc-mt-1_32;boost_python")
-
-# 1st: check for boost/shared_ptr.hpp
-check_include_file_cxx(boost/shared_ptr.hpp HAVE_BOOST_SHARED_PTR_HPP)
-
-if(HAVE_BOOST_SHARED_PTR_HPP)
-
- set(_found FALSE)
-
- # save the old flags and setting the new ones
- set(_save_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
-
- foreach(_pyver ${PYTHON_VERSIONS})
- if(NOT _found)
- foreach(_pydir ${PYTHON_INCLUDE_DIRS})
-
- if(NOT _found)
- string(REPLACE "$pyver" "${_pyver}" _pydir ${_pydir})
- string(REPLACE "$prefix" "${CMAKE_INSTALL_PREFIX}" _pydir ${_pydir})
-
- if(EXISTS ${_pydir})
- if(EXISTS ${_pydir}/Python.h)
-
- foreach(_pylibdir ${PYTHON_LIBRARY_DIRS})
-
- if(NOT _found)
- string(REPLACE "$pyver" ${_pyver} _pylibdir ${_pylibdir})
-
- foreach(_pblib ${PYTHON_LIBS})
-
- if(NOT _found)
-
- set(CMAKE_REQUIRED_FLAGS "-L${_pylibdir}")
- set(CMAKE_REQUIRED_INCLUDES ${_pydir})
- set(CMAKE_REQUIRED_LIBRARIES ${_pblib} ${_pyver})
-
- check_cxx_source_compiles("
-#include <boost/python.hpp>
-const char* greet() { return \"Hello world!\"; }
-BOOST_PYTHON_MODULE(hello) { boost::python::def(\"greet\", greet); }
-
-int main() { return 0; }
-
-// some vars, in case of the compilation fail...
-// python include dir: ${_pydir}
-// python lib dir: ${_pylibdir}
-// boost python lib: ${_pblib}
-
-" boost_python_${_pylibdir}_${_pydir}_${_pblib}_compile )
-
- set(CMAKE_REQUIRED_FLAGS)
- set(CMAKE_REQUIRED_INCLUDES)
- set(CMAKE_REQUIRED_LIBRARIES)
-
- if(boost_python_${_pylibdir}_${_pydir}_${_pblib}_compile)
-
- set(_found TRUE)
-
- set(BOOST_PYTHON_INCLUDES ${_pydir})
- set(BOOST_PYTHON_LIBS "-l${_pyver} -L${_pylibdir} -l${_pblib}")
-
- endif(boost_python_${_pylibdir}_${_pydir}_${_pblib}_compile)
-
- endif(NOT _found)
-
- endforeach(_pblib ${PYTHON_LIBS})
-
- endif(NOT _found)
-
- endforeach(_pylibdir ${PYTHON_LIBRARY_DIRS})
-
- endif(EXISTS ${_pydir}/Python.h)
- endif(EXISTS ${_pydir})
-
- endif(NOT _found)
-
- endforeach(_pydir ${PYTHON_INCLUDE_DIRS})
-
- endif(NOT _found)
-
- endforeach(_pyver ${PYTHON_VERSIONS})
-
- set(CMAKE_CXX_FLAGS ${_save_CMAKE_CXX_FLAGS})
-
-endif(HAVE_BOOST_SHARED_PTR_HPP)
-
-if(BOOST_PYTHON_INCLUDES AND BOOST_PYTHON_LIBS)
- set(BOOST_PYTHON_FOUND TRUE)
-endif(BOOST_PYTHON_INCLUDES AND BOOST_PYTHON_LIBS)
-
-if(BOOST_PYTHON_FOUND)
- if(NOT BoostPython_FIND_QUIETLY)
- message(STATUS "Found Boost+Python: ${BOOST_PYTHON_LIBS}")
- endif(NOT BoostPython_FIND_QUIETLY)
- set(KIG_ENABLE_PYTHON_SCRIPTING 1)
-else (BOOST_PYTHON_FOUND)
- if (BoostPython_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find Boost+Python")
- endif(BoostPython_FIND_REQUIRED)
- set(KIG_ENABLE_PYTHON_SCRIPTING 0)
-endif(BOOST_PYTHON_FOUND)
-
-mark_as_advanced(BOOST_PYTHON_INCLUDES BOOST_PYTHON_LIBS)
diff --git a/hrefkeywords/CMakeLists.txt b/hrefkeywords/CMakeLists.txt
index 9e10bd2..464edef 100644
--- a/hrefkeywords/CMakeLists.txt
+++ b/hrefkeywords/CMakeLists.txt
@@ -9,10 +9,10 @@ set(_chrefliterals_SOURCES
)
include_directories(${Boost_INCLUDE_DIRS})
-include_directories(${BOOST_PYTHON_INCLUDES})
+include_directories(${PYTHON_INCLUDE_DIRS})
add_library(_chrefliterals SHARED ${_chrefliterals_SOURCES})
-target_link_libraries(_chrefliterals libtexpp ${BOOST_PYTHON_LIBS} ${Boost_FILESYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY})
+target_link_libraries(_chrefliterals libtexpp ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
set_target_properties(_chrefliterals PROPERTIES PREFIX "" OUTPUT_NAME "_chrefliterals")
install(TARGETS _chrefliterals LIBRARY DESTINATION bin)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 17d7f42..cf67107 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,3 +1,4 @@
+include_directories(${Boost_INCLUDE_DIR})
add_executable(texpp texpp.cc)
target_link_libraries(texpp libtexpp)
set(TEXPP_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/texpp)
diff --git a/tests/tex/CMakeLists.txt b/tests/tex/CMakeLists.txt
index a046f53..d14d22b 100644
--- a/tests/tex/CMakeLists.txt
+++ b/tests/tex/CMakeLists.txt
@@ -1,3 +1,5 @@
+include_directories(${Boost_INCLUDE_DIR})
+
add_executable(test_tex test_tex.cc)
add_executable(test_source test_source.cc)
diff --git a/texpp/CMakeLists.txt b/texpp/CMakeLists.txt
index d38f05b..b60643a 100644
--- a/texpp/CMakeLists.txt
+++ b/texpp/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${Boost_INCLUDE_DIRS})
+include_directories(${Boost_INCLUDE_DIR})
#add_definitions(-DBOOST_NO_EXCEPTIONS)
add_definitions(-fPIC)
@@ -30,7 +30,34 @@ set(libtexpp_SOURCES
base/base.cc
)
-add_library(libtexpp SHARED ${libtexpp_SOURCES})
+set(libtexpp_HEADERS
+ common.h
+ token.h
+ logger.h
+ lexer.h
+ parser.h
+ command.h
+ kpsewhich.h
+ base/conditional.h
+ base/miscmacros.h
+ base/misc.h
+ base/show.h
+ base/func.h
+ base/files.h
+ base/variable.h
+ base/integer.h
+ base/dimen.h
+ base/glue.h
+ base/toks.h
+ base/font.h
+ base/char.h
+ base/parshape.h
+ base/hyphenation.h
+ base/box.h
+ base/base.h
+)
+
+add_library(libtexpp SHARED ${libtexpp_SOURCES} ${libtexpp_HEADERS})
set_target_properties(libtexpp PROPERTIES OUTPUT_NAME texpp)
# Temporary hack
diff --git a/texpy/CMakeLists.txt b/texpy/CMakeLists.txt
index 1cece52..f466eb4 100644
--- a/texpy/CMakeLists.txt
+++ b/texpy/CMakeLists.txt
@@ -1,5 +1,5 @@
include_directories(${Boost_INCLUDE_DIRS})
-include_directories(${BOOST_PYTHON_INCLUDES})
+include_directories(${PYTHON_INCLUDE_DIRS})
set(libtexpy_SOURCES
python_file_stream.cc
@@ -13,10 +13,16 @@ set(libtexpy_SOURCES
texpy.cc
)
+set(libtexpy_HEADERS
+ python_file_stream.h
+ shared_ptr.h
+ std_pair.h
+)
+
add_definitions(-fPIC)
-add_library(libtexpy SHARED ${libtexpy_SOURCES})
-target_link_libraries(libtexpy libtexpp ${BOOST_PYTHON_LIBS})
+add_library(libtexpy SHARED ${libtexpy_SOURCES} ${libtexpy_HEADERS})
+target_link_libraries(libtexpy libtexpp ${Boost_PYTHON_LIBRARY} ${PYTHON_LIBRARIES})
set_target_properties(libtexpy PROPERTIES PREFIX "" OUTPUT_NAME texpy)
set(TEXPY_SO_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)