source: git/factory/CMakeLists.txt @ e4e36c

spielwiese
Last change on this file since e4e36c was 5fdf7a, checked in by Max Horn <max@…>, 11 years ago
Replace --no-{rtti,exceptions} by -fno-{rtti,exceptions} This improves compatibility with clang. Moreover, to the best of my knowledge, the --no-* variants are undocumented to start with. At least the GCC manuals for all versions from 2.95.3 till 4.7.2 only list the -fno-* variants, as far as I could tell.
  • Property mode set to 100644
File size: 10.3 KB
Line 
1# -*- mode: cmake; -*-
2cmake_minimum_required(VERSION 2.6)
3cmake_policy(VERSION 2.6)
4if(POLICY CMP0011)
5  cmake_policy(SET CMP0011 NEW)
6endif(POLICY CMP0011)
7
8message(STATUS "Header fac: '${OMALLOC_H}'")
9project(factory)
10string(TOUPPER ${PROJECT_NAME} UPPER_PROJECT_NAME)
11
12# have the full monty in makefiles
13set(CMAKE_VERBOSE_MAKEFILE true)
14
15set(FACTORY_VERSION_MAJOR 3)
16set(FACTORY_VERSION_MINOR 1)
17set(FACTORY_VERSION_PATCH 0)
18set(FACTORYVERSION "${FACTORY_VERSION_MAJOR}.${FACTORY_VERSION_MINOR}.${FACTORY_VERSION_PATCH}")
19set(FACTORYCONFIGURATION "xxx")
20set(GFTABLEDIR "share/factory/gftables")
21
22OPTION(WITH_OMALLOC   "omalloc memory managment" ON)
23OPTION(WITH_GMP       "specify where to find gmp library" On)
24##OPTION(WITH_SINGULAR  "build for use with Singular" Off)
25OPTION(WITH_NTL       "build for use with NTL." Off)
26##OPTION(WITH_SINGULARERROR "use error reporting from Singular" Off)
27OPTION(WITH_NOSTREAMIO    "do not require iostream include nor library" Off)
28OPTION(WITH_STREAMIO    "build Factory without stream IO" Off)
29
30OPTION(ENABLE_CF_INLINE "build Factory with \"configurable inline methods\" enabled." Off)
31OPTION(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)
34OPTION(ENABLE_ASSERTIONS "build Factory with assertions activated" Off)
35OPTION(ENABLE_TIMING     "build Factory so it will print timing information" Off)
36OPTION(ENABLE_DEBUGOUTPUT "build Factory so it will print debugging information" Off)
37OPTION(ENABLE_GMP
38  "together with --DWITH_SINGULAR means: installation in process, be graceful when there is no gmp.h" Off)
39
40set(HAVE_NTL 1)
41set(NOASSERT 1)
42set(SINGULAR 1)
43set(HAVE_OMALLOC 1)
44#set(NOSTREAMIO 1)
45
46include(BisonMacros)
47set(OMALLOC_TARGET gen-omalloc-h)
48#set(OMALLOC_TARGET omalloc)
49#set(ADD_DEFS "NOSTREAMIO;${_OSDEF};HAVE_CONFIG_H;SINGULAR")
50set(ADD_DEFS "${_OSDEF};HAVE_CONFIG_H;SINGULAR")
51
52###################################################################################################
53# No user settings below
54###################################################################################################
55check_headers(stdio.h stdlib.h string.h time.h math.h cstdio)
56if(ENABLE_STREAMIO)
57  check_headers(iostream.h strstream.h fstream.h iostream string fstream)
58endif(ENABLE_STREAMIO)
59check_headers(ctype.h)
60check_headers(stdarg.h signal.h errno.h unistd.h)
61# endif(ENABLE_STREAMIO)
62
63# if(ENABLE_TIMING)
64check_headers(sys/param.h sys/times.h)
65# endif(ENABLE_TIMING)
66
67check_headers(omalloc.h)
68message(STATUS "=== ${HAVE_STRING_H} ==")
69
70include(FactoryMacros)
71###################################################################################################
72if(${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")
93endif(${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
98include_directories(${CMAKE_CURRENT_BINARY_DIR})
99include_directories(${CMAKE_CURRENT_SOURCE_DIR})
100include_directories(${CMAKE_BINARY_DIR})
101include_directories(${CMAKE_SOURCE_DIR})
102
103configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in.cmake
104  ${CMAKE_CURRENT_BINARY_DIR}/config.h)
105
106factory_header(FACTORYCONF_H factoryconf.template)
107factory_header(FACTORY_H factory.template)
108factory_gen_gmp_header(FACTORY_TARGET CF_GMP_H)
109set(FACTORY_TARGET ${FACTORY_TARGET} PARENT_SCOPE)
110
111#add_definitions(-DNDEBUG -DOM_NDEBUG -Dx86_64_Linux -DHAVE_CONFIG_H)
112# factory source files
113set_source_files_properties(${OMALLOC_H} PROPERTIES GENERATED true )
114set(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)
185set(singfactory_srcs singext.cc)
186#set_source_files_properties(${basefactory_srcs} PROPERTIES OBJECT_DEPENDS
187#  ${FACTORYCONF_H} ${FACTORY_H} ${CF_GMP_H})
188set(FACTORYCONF_H ${FACTORYCONF_H} PARENT_SCOPE)
189
190add_grammar(READCF_TARGET READCF_CPP READCF_H ${CMAKE_CURRENT_SOURCE_DIR}/readcf.y)
191set(useiofactory_src parseutil.cc ${READCF_CPP})
192set(distfactory_src ${basefactory_srcs} ${singfactory_srcs} ${useiofactorysrc})
193
194set(doxy_src ${basefactory_srcs} parseutil.cc)
195
196# factory header files
197set(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
256set(singfactory_hdrs singext.h)
257set(useiofactory_hdrs parseutil.h)
258set(distfactory_hdrs ${basefactory_hdrs} ${singfactory_hdrs} ${useiofactory_hdrs})
259set(doxy_hdrs ${basefactory_hdrs} parseutil.h)
260
261# memory manager source files
262set(basememman_src newdelete.cc)
263set(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)
273set(oldmemman_src memutil.c)
274set(distmemman_src ${basememmansrc} ${newmemmansrc} ${oldmemmansrc})
275
276# memory manager header files
277set(newmemman_hdrs mmprivate.h memman.h)
278set(oldmemman_hdrs memutil.h)
279set(distmemman_hdrs ${newmemman_hdrs} ${oldmemman_hdrs})
280
281# factory template files
282set(template_src
283  ftmpl_array.cc
284  ftmpl_factor.cc
285  ftmpl_functions.h
286  ftmpl_list.cc
287  ftmpl_matrix.cc
288)
289set_source_files_properties(${template_srcs} PROPERTIES OBJECT_DEPENDS
290  ${FACTORYCONF_H} ${FACTORY_H} ${CF_GMP_H})
291set(template_hdrs
292                ftmpl_array.h
293                ftmpl_factor.h
294                ftmpl_list.h
295                ftmpl_matrix.h
296)
297
298# header templates
299set(hdrtempl_src factoryconf.template  factory.template)
300##set(hdrtempl_dep $(hdrtemplsrc:.template=.d)
301
302# FTE source files
303set(ftest_src   ftest_io.cc ftest_util.cc ntl_util.cc)
304
305# FTE header files
306set(ftest_hdrs  ftest_io.h ftest_util.h ntl_util.h)
307
308# define libraries
309#add_library(cf ${FACTORYCONF_H} ${basefactory_srcs})
310add_library(cf ${basefactory_srcs} ${singfactory_srcs})
311set_target_properties(cf PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS}")
312add_dependencies(cf ${OMALLOC_TARGET})
313add_dependencies(cf ${NTL_TARGET})
314
315#
316# libraries for Singular
317if( 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})
323else( WITH_SINGULAR )
324  message(STATUS "Disabled creation of libfactory.a")
325endif( WITH_SINGULAR )
326
327
328add_library(mem-old ${oldmemman_src})
329set_target_properties(mem-old PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS}")
330
331add_library(mem-new ${newmemman_src})
332set_target_properties(mem-new PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS}")
Note: See TracBrowser for help on using the repository browser.