1 | # -*- mode: cmake; -*- |
---|
2 | cmake_minimum_required(VERSION 2.6) |
---|
3 | cmake_policy(VERSION 2.6) |
---|
4 | if(POLICY CMP0011) |
---|
5 | cmake_policy(SET CMP0011 NEW) |
---|
6 | endif(POLICY CMP0011) |
---|
7 | |
---|
8 | message(STATUS "Header fac: '${OMALLOC_H}'") |
---|
9 | project(factory) |
---|
10 | string(TOUPPER ${PROJECT_NAME} UPPER_PROJECT_NAME) |
---|
11 | |
---|
12 | # have the full monty in makefiles |
---|
13 | set(CMAKE_VERBOSE_MAKEFILE true) |
---|
14 | |
---|
15 | set(FACTORY_VERSION_MAJOR 3) |
---|
16 | set(FACTORY_VERSION_MINOR 1) |
---|
17 | set(FACTORY_VERSION_PATCH 0) |
---|
18 | set(FACTORYVERSION "${FACTORY_VERSION_MAJOR}.${FACTORY_VERSION_MINOR}.${FACTORY_VERSION_PATCH}") |
---|
19 | set(FACTORYCONFIGURATION "xxx") |
---|
20 | set(GFTABLEDIR "share/factory/gftables") |
---|
21 | |
---|
22 | OPTION(WITH_OMALLOC "omalloc memory managment" ON) |
---|
23 | OPTION(WITH_GMP "specify where to find gmp library" On) |
---|
24 | ##OPTION(WITH_SINGULAR "build for use with Singular" Off) |
---|
25 | OPTION(WITH_NTL "build for use with NTL." Off) |
---|
26 | ##OPTION(WITH_SINGULARERROR "use error reporting from Singular" Off) |
---|
27 | OPTION(WITH_NOSTREAMIO "do not require iostream include nor library" Off) |
---|
28 | OPTION(WITH_STREAMIO "build Factory without stream IO" Off) |
---|
29 | |
---|
30 | OPTION(ENABLE_CF_INLINE "build Factory with \"configurable inline methods\" enabled." Off) |
---|
31 | OPTION(ENABLE_MEMDEBUG "switch on memory management debugging. Meaningful |
---|
32 | with --DWITH_MEMMAN=new' only. <level> may be either |
---|
33 | no (default), normal, or full" Off) |
---|
34 | OPTION(ENABLE_ASSERTIONS "build Factory with assertions activated" Off) |
---|
35 | OPTION(ENABLE_TIMING "build Factory so it will print timing information" Off) |
---|
36 | OPTION(ENABLE_DEBUGOUTPUT "build Factory so it will print debugging information" Off) |
---|
37 | OPTION(ENABLE_GMP |
---|
38 | "together with --DWITH_SINGULAR means: installation in process, be graceful when there is no gmp.h" Off) |
---|
39 | |
---|
40 | set(HAVE_NTL 1) |
---|
41 | set(NOASSERT 1) |
---|
42 | set(SINGULAR 1) |
---|
43 | set(HAVE_OMALLOC 1) |
---|
44 | #set(NOSTREAMIO 1) |
---|
45 | |
---|
46 | include(BisonMacros) |
---|
47 | set(OMALLOC_TARGET gen-omalloc-h) |
---|
48 | #set(OMALLOC_TARGET omalloc) |
---|
49 | #set(ADD_DEFS "NOSTREAMIO;${_OSDEF};HAVE_CONFIG_H;SINGULAR") |
---|
50 | set(ADD_DEFS "${_OSDEF};HAVE_CONFIG_H;SINGULAR") |
---|
51 | |
---|
52 | ################################################################################################### |
---|
53 | # No user settings below |
---|
54 | ################################################################################################### |
---|
55 | check_headers(stdio.h stdlib.h string.h time.h math.h cstdio) |
---|
56 | if(ENABLE_STREAMIO) |
---|
57 | check_headers(iostream.h strstream.h fstream.h iostream string fstream) |
---|
58 | endif(ENABLE_STREAMIO) |
---|
59 | check_headers(ctype.h) |
---|
60 | check_headers(stdarg.h signal.h errno.h unistd.h) |
---|
61 | # endif(ENABLE_STREAMIO) |
---|
62 | |
---|
63 | # if(ENABLE_TIMING) |
---|
64 | check_headers(sys/param.h sys/times.h) |
---|
65 | # endif(ENABLE_TIMING) |
---|
66 | |
---|
67 | check_headers(omalloc.h) |
---|
68 | message(STATUS "=== ${HAVE_STRING_H} ==") |
---|
69 | |
---|
70 | include(FactoryMacros) |
---|
71 | ################################################################################################### |
---|
72 | if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) |
---|
73 | message(STATUS "Have compiler: '${CMAKE_CXX_COMPILER_ID}'") |
---|
74 | if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") |
---|
75 | |
---|
76 | #set(CMAKE_CXX_FLAGS "-W -Wall -Wextra -Winline -Wno-non-virtual-dtor") |
---|
77 | set(CMAKE_CXX_FLAGS "-w -fno-rtti -pipe ") |
---|
78 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-implicit-templates") |
---|
79 | #add_definitions(-DNDEBUG -DOM_NDEBUG -Dx86_64_Linux -DHAVE_CONFIG_H) |
---|
80 | |
---|
81 | set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fomit-frame-pointer -DNDEBUG") |
---|
82 | |
---|
83 | set(CMAKE_CXX_FLAGS_DEBUG "-Werror -O0 -g -ggdb -Wreturn-type -fno-omit-frame-pointer") |
---|
84 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wunused-variable -Wunused-parameter") |
---|
85 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wunused-function -Wunused") |
---|
86 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Woverloaded-virtual -Wno-system-headers") |
---|
87 | |
---|
88 | # gprof and gcov support |
---|
89 | set(CMAKE_CXX_FLAGS_PROFILE "-O0 -g -ggdb -Wreturn-type -Woverloaded-virtual") |
---|
90 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -Wno-system-headers -pg") |
---|
91 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -fprofile-arcs -ftest-coverage") |
---|
92 | endif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") |
---|
93 | endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) |
---|
94 | |
---|
95 | ########################################################### |
---|
96 | # Where are the additional libraries installed? Note: provide includes |
---|
97 | # path here, subsequent checks will resolve everything else |
---|
98 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
---|
99 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
---|
100 | include_directories(${CMAKE_BINARY_DIR}) |
---|
101 | include_directories(${CMAKE_SOURCE_DIR}) |
---|
102 | |
---|
103 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in.cmake |
---|
104 | ${CMAKE_CURRENT_BINARY_DIR}/config.h) |
---|
105 | |
---|
106 | factory_header(FACTORYCONF_H factoryconf.template) |
---|
107 | factory_header(FACTORY_H factory.template) |
---|
108 | factory_gen_gmp_header(FACTORY_TARGET CF_GMP_H) |
---|
109 | set(FACTORY_TARGET ${FACTORY_TARGET} PARENT_SCOPE) |
---|
110 | |
---|
111 | #add_definitions(-DNDEBUG -DOM_NDEBUG -Dx86_64_Linux -DHAVE_CONFIG_H) |
---|
112 | # factory source files |
---|
113 | set_source_files_properties(${OMALLOC_H} PROPERTIES GENERATED true ) |
---|
114 | set(basefactory_srcs |
---|
115 | ${OMALLOC_H} |
---|
116 | ${FACTORYCONF_H} ${FACTORY_H} ${CF_GMP_H} |
---|
117 | canonicalform.cc |
---|
118 | cf_algorithm.cc |
---|
119 | cf_binom.cc |
---|
120 | cf_char.cc |
---|
121 | cf_chinese.cc |
---|
122 | cf_cyclo.cc |
---|
123 | cf_eval.cc |
---|
124 | cf_factor.cc |
---|
125 | cf_factory.cc |
---|
126 | cf_gcd.cc |
---|
127 | cf_gcd_charp.cc |
---|
128 | cf_gcd_smallp.cc |
---|
129 | cf_generator.cc |
---|
130 | cf_globals.cc |
---|
131 | cf_hnf.cc |
---|
132 | cf_inline.cc |
---|
133 | cf_irred.cc |
---|
134 | cf_iter.cc |
---|
135 | cf_iter_inline.cc |
---|
136 | cf_linsys.cc |
---|
137 | cf_map.cc |
---|
138 | cf_map_ext.cc |
---|
139 | cf_ops.cc |
---|
140 | cf_primes.cc |
---|
141 | cf_random.cc |
---|
142 | cf_resultant.cc |
---|
143 | cf_reval.cc |
---|
144 | cf_switches.cc |
---|
145 | cf_util.cc |
---|
146 | debug.cc |
---|
147 | DegreePattern.cc |
---|
148 | ExtensionInfo.cc |
---|
149 | fac_berlekamp.cc |
---|
150 | fac_cantzass.cc |
---|
151 | fac_distrib.cc |
---|
152 | fac_ezgcd.cc |
---|
153 | fac_iterfor.cc |
---|
154 | fac_multihensel.cc |
---|
155 | fac_multivar.cc |
---|
156 | fac_sqrfree.cc |
---|
157 | fac_univar.cc |
---|
158 | fac_util.cc |
---|
159 | facFqBivar.cc |
---|
160 | facFqBivarUtil.cc |
---|
161 | facFqFactorize.cc |
---|
162 | facFqFactorizeUtil.cc |
---|
163 | facFqSquarefree.cc |
---|
164 | facHensel.cc |
---|
165 | fieldGCD.cc |
---|
166 | ffops.cc |
---|
167 | gf_tabutil.cc |
---|
168 | gfops.cc |
---|
169 | imm.cc |
---|
170 | initgmp.cc |
---|
171 | int_cf.cc |
---|
172 | int_int.cc |
---|
173 | int_intdiv.cc |
---|
174 | int_poly.cc |
---|
175 | int_pp.cc |
---|
176 | int_rat.cc |
---|
177 | sm_sparsemod.cc |
---|
178 | sm_util.cc |
---|
179 | variable.cc |
---|
180 | NTLconvert.cc |
---|
181 | abs_fac.cc |
---|
182 | bifac.cc |
---|
183 | lgs.cc |
---|
184 | ) |
---|
185 | set(singfactory_srcs singext.cc) |
---|
186 | #set_source_files_properties(${basefactory_srcs} PROPERTIES OBJECT_DEPENDS |
---|
187 | # ${FACTORYCONF_H} ${FACTORY_H} ${CF_GMP_H}) |
---|
188 | set(FACTORYCONF_H ${FACTORYCONF_H} PARENT_SCOPE) |
---|
189 | |
---|
190 | add_grammar(READCF_TARGET READCF_CPP READCF_H ${CMAKE_CURRENT_SOURCE_DIR}/readcf.y) |
---|
191 | set(useiofactory_src parseutil.cc ${READCF_CPP}) |
---|
192 | set(distfactory_src ${basefactory_srcs} ${singfactory_srcs} ${useiofactorysrc}) |
---|
193 | |
---|
194 | set(doxy_src ${basefactory_srcs} parseutil.cc) |
---|
195 | |
---|
196 | # factory header files |
---|
197 | set(basefactory_hdrs |
---|
198 | cf_assert.h |
---|
199 | canonicalform.h |
---|
200 | cf_algorithm.h |
---|
201 | cf_binom.h |
---|
202 | cf_defs.h |
---|
203 | cf_eval.h |
---|
204 | cf_factory.h |
---|
205 | cf_generator.h |
---|
206 | cf_globals.h |
---|
207 | cf_irred.h |
---|
208 | cf_iter.h |
---|
209 | cf_map.h |
---|
210 | cf_primes.h |
---|
211 | cf_primetab.h |
---|
212 | cf_random.h |
---|
213 | cf_reval.h |
---|
214 | cf_switches.h |
---|
215 | cf_util.h |
---|
216 | debug.h |
---|
217 | fac_berlekamp.h |
---|
218 | fac_cantzass.h |
---|
219 | fac_distrib.h |
---|
220 | fac_iterfor.h |
---|
221 | fac_multivar.h |
---|
222 | fac_sqrfree.h |
---|
223 | fac_univar.h |
---|
224 | fac_util.h |
---|
225 | fieldGCD.h |
---|
226 | ffops.h |
---|
227 | ffreval.h |
---|
228 | ftmpl_array.h |
---|
229 | ftmpl_factor.h |
---|
230 | ftmpl_functions.h |
---|
231 | ftmpl_list.h |
---|
232 | ftmpl_matrix.h |
---|
233 | gf_tabutil.h |
---|
234 | gfops.h |
---|
235 | gmpext.h |
---|
236 | imm.h |
---|
237 | int_cf.h |
---|
238 | int_int.h |
---|
239 | int_poly.h |
---|
240 | int_pp.h |
---|
241 | int_rat.h |
---|
242 | sm_sparsemod.h |
---|
243 | sm_util.h |
---|
244 | timing.h |
---|
245 | variable.h |
---|
246 | NTLconvert.h |
---|
247 | bifac.h |
---|
248 | bifacConfig.h |
---|
249 | lgs.h |
---|
250 | algext.h |
---|
251 | ) |
---|
252 | |
---|
253 | #SET_SOURCE_FILES_PROPERTIES(${basefactory_srcs} |
---|
254 | # OBJECT_DEPENDS ../omalloc/omalloc.h}) |
---|
255 | |
---|
256 | set(singfactory_hdrs singext.h) |
---|
257 | set(useiofactory_hdrs parseutil.h) |
---|
258 | set(distfactory_hdrs ${basefactory_hdrs} ${singfactory_hdrs} ${useiofactory_hdrs}) |
---|
259 | set(doxy_hdrs ${basefactory_hdrs} parseutil.h) |
---|
260 | |
---|
261 | # memory manager source files |
---|
262 | set(basememman_src newdelete.cc) |
---|
263 | set(newmemman_src |
---|
264 | mmalloc.c |
---|
265 | mmallocb.c |
---|
266 | mmallocs.c |
---|
267 | mmblock.c |
---|
268 | mmheap.c |
---|
269 | mminit.c |
---|
270 | mmspec.c |
---|
271 | mmutil.c |
---|
272 | ) |
---|
273 | set(oldmemman_src memutil.c) |
---|
274 | set(distmemman_src ${basememmansrc} ${newmemmansrc} ${oldmemmansrc}) |
---|
275 | |
---|
276 | # memory manager header files |
---|
277 | set(newmemman_hdrs mmprivate.h memman.h) |
---|
278 | set(oldmemman_hdrs memutil.h) |
---|
279 | set(distmemman_hdrs ${newmemman_hdrs} ${oldmemman_hdrs}) |
---|
280 | |
---|
281 | # factory template files |
---|
282 | set(template_src |
---|
283 | ftmpl_array.cc |
---|
284 | ftmpl_factor.cc |
---|
285 | ftmpl_functions.h |
---|
286 | ftmpl_list.cc |
---|
287 | ftmpl_matrix.cc |
---|
288 | ) |
---|
289 | set_source_files_properties(${template_srcs} PROPERTIES OBJECT_DEPENDS |
---|
290 | ${FACTORYCONF_H} ${FACTORY_H} ${CF_GMP_H}) |
---|
291 | set(template_hdrs |
---|
292 | ftmpl_array.h |
---|
293 | ftmpl_factor.h |
---|
294 | ftmpl_list.h |
---|
295 | ftmpl_matrix.h |
---|
296 | ) |
---|
297 | |
---|
298 | # header templates |
---|
299 | set(hdrtempl_src factoryconf.template factory.template) |
---|
300 | ##set(hdrtempl_dep $(hdrtemplsrc:.template=.d) |
---|
301 | |
---|
302 | # FTE source files |
---|
303 | set(ftest_src ftest_io.cc ftest_util.cc ntl_util.cc) |
---|
304 | |
---|
305 | # FTE header files |
---|
306 | set(ftest_hdrs ftest_io.h ftest_util.h ntl_util.h) |
---|
307 | |
---|
308 | # define libraries |
---|
309 | #add_library(cf ${FACTORYCONF_H} ${basefactory_srcs}) |
---|
310 | add_library(cf ${basefactory_srcs} ${singfactory_srcs}) |
---|
311 | set_target_properties(cf PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS}") |
---|
312 | add_dependencies(cf ${OMALLOC_TARGET}) |
---|
313 | add_dependencies(cf ${NTL_TARGET}) |
---|
314 | |
---|
315 | # |
---|
316 | # libraries for Singular |
---|
317 | if( WITH_SINGULAR ) |
---|
318 | # define libraries |
---|
319 | message(STATUS "Compiling factory for Singular: creating libfactory.a") |
---|
320 | add_library(singcf ${basefactory_srcs} ${singfactory_srcs}) |
---|
321 | set_target_properties(singcf PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS}") |
---|
322 | add_dependencies(singcf ${OMALLOC_TARGET} ${NTL_TARGET}) |
---|
323 | else( WITH_SINGULAR ) |
---|
324 | message(STATUS "Disabled creation of libfactory.a") |
---|
325 | endif( WITH_SINGULAR ) |
---|
326 | |
---|
327 | |
---|
328 | add_library(mem-old ${oldmemman_src}) |
---|
329 | set_target_properties(mem-old PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS}") |
---|
330 | |
---|
331 | add_library(mem-new ${newmemman_src}) |
---|
332 | set_target_properties(mem-new PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS}") |
---|