source: git/Singular/CMakeLists.txt @ f17318

spielwiese
Last change on this file since f17318 was 44ca2f, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Update due to links separation
  • Property mode set to 100644
File size: 10.0 KB
Line 
1# -*- mode: cmake; -*-
2#
3#
4
5include_directories(${CMAKE_CURRENT_BINARY_DIR})
6include_directories(${CMAKE_CURRENT_SOURCE_DIR})
7include_directories(${CMAKE_BINARY_DIR})
8include_directories(${CMAKE_SOURCE_DIR})
9
10#include_directories(${CMAKE_SOURCE_DIR}/factory)
11include_directories(${CMAKE_SOURCE_DIR}/ntl/include)
12
13add_subdirectory(LIB)
14include(SingularMacros)
15
16singular_mk_version(SINGULAR_VERSION_H)
17
18message(STATUS ">>DIST: '${MAKE_DISTRIBUTION}'")
19configure_file(${CMAKE_CURRENT_SOURCE_DIR}/distrib.h.in
20  ${CMAKE_CURRENT_BINARY_DIR}/distrib.h )
21
22set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
23#################################################################
24###  check for lex/flex and add parser files
25###
26find_program(FLEX flex)
27
28include(LexMacros)
29check_lex_version(GEN_NEW_LEX)
30add_lex(SCANNER_CPP ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l "")
31add_lex(LIBPARSE_CPP ${CMAKE_CURRENT_SOURCE_DIR}/libparse.l "yylp")
32message(STATUS "Add lex ${SCANNER_CPP}")
33message(STATUS "Add lex ${LIBPARSE_CPP}")
34
35#################################################################
36###  check for bison/yacc and grammar files
37###
38include(BisonMacros)
39add_grammar(GRAMMAR_TARGET GRAMMAR_CPP GRAMMAR_H ${CMAKE_CURRENT_SOURCE_DIR}/grammar.y)
40
41#################################################################
42###
43###
44set(_feopt_srcs feOpt.cc mod2.h)
45add_executable(feOpt ${_feopt_srcs})
46set_target_properties(feOpt PROPERTIES
47  COMPILE_DEFINITIONS "${ADD_DEFS};GENERATE_OPTION_INDEX")
48add_dependencies(feOpt omalloc)
49#singular_generate_incfile(FEOPT_TARGET FEOPT_FILE_INC
50singular_generate_incfile(feopt_target FEOPT_FILE_INC
51  ${CMAKE_CURRENT_BINARY_DIR}/feOpt feOpt)
52#  add_custom_target(feopt_target DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/feOpt
53#    COMMAND ${CMAKE_CURRENT_BINARY_DIR}/feOpt
54#    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/feOpt
55#    COMMENT "Creating 'feopt.inc'....."
56#    )
57#add_index(FEOPT_FILE_INC ${CMAKE_CURRENT_BINARY_DIR}/feOpt feOpt)
58
59#################################################################
60###
61###
62add_executable(feOptES ${_feopt_srcs})
63set_target_properties(feOptES PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS};GENERATE_OPTION_INDEX -DESINGULAR")
64add_dependencies(feOptES omalloc)
65singular_generate_incfile(feOptES_target FEOPTES_FILE_INC
66  ${CMAKE_CURRENT_BINARY_DIR}/feOptES feOptES)
67#add_index(FEOPTES_FILE_INC ${CMAKE_CURRENT_BINARY_DIR}/feOptES feOptES)
68
69#################################################################
70###
71###
72add_executable(feOptTS ${_feopt_srcs})
73set_target_properties(feOptTS PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS};GENERATE_OPTION_INDEX -DTSINGULAR")
74add_dependencies(feOptTS omalloc)
75singular_generate_incfile(feoptsts_target FEOPTSTS_FILE_INC
76  ${CMAKE_CURRENT_BINARY_DIR}/feOptTS feOptTS)
77#add_index(FEOPTSTS_FILE_INC ${CMAKE_CURRENT_BINARY_DIR}/feOptTS feOptTS)
78
79#################################################################
80###  build gentable and create iparith.inc
81###
82
83# C++ sources which are used if no parts of the kernel are dynamically linked
84set(static_sources links/slInit_Static.cc)
85
86set(_iparith_inc_srcs  iparith.cc tesths.cc tok.h mpsr_Tok.cc mod2.h)
87add_executable(gentable ${_iparith_inc_srcs} claptmpl.cc ${static_sources})
88add_dependencies(gentable omalloc)
89set_target_properties(gentable PROPERTIES
90  COMPILE_DEFINITIONS "${ADD_DEFS};GENTABLE=1")
91
92#target_link_libraries(gentable omalloc_ndebug sing-main kernel gmp fac singcf sing-gentable ${NTL_LIBRARY} )
93#LIBS           = -lreadline -lhtmlhelp -Xlinker -Bdynamic -lgmp -lomalloc -lncurses
94
95#target_link_libraries(gentable sing-main omalloc_ndebug kernel_mmalloc)
96target_link_libraries(gentable sing-main)
97target_link_libraries(gentable kernel)
98target_link_libraries(gentable singfac)
99target_link_libraries(gentable singcf)
100target_link_libraries(gentable ${NTL_LIBRARY})
101target_link_libraries(gentable omalloc  )
102
103target_link_libraries(gentable gmp)
104target_link_libraries(gentable readline)
105target_link_libraries(gentable ncurses)
106target_link_libraries(gentable m)
107
108singular_generate_incfile(iparith_target IPARITH_INC
109  ${CMAKE_CURRENT_BINARY_DIR}/gentable iparith)
110#singular_gen_iparith(IPARITH_TARGET IPARITH_INC ${CMAKE_CURRENT_BINARY_DIR}/gentable
111#  ${_iparith_inc_srcs})
112message(STATUS "====== '${IPARITH_INC}' ====")
113
114##########
115#
116# normal C++ source files
117set(cxxsources ${GRAMMAR_CPP}  ${SCANNER_CPP} attrib.cc
118  ${LIBPARSE_CPP}
119  ${SINGULAR_VERSION_H}
120  ${FEOPT_FILE_INC}
121    eigenval_ip.cc
122    extra.cc fehelp.cc feOpt.cc
123    ipassign.cc ipconv.cc ipid.cc iplib.cc
124    ipprint.cc ipshell.cc
125    lists.cc
126    sdb.cc
127    fglm.cc interpolation.cc
128    silink.cc ssiLink.cc
129    subexpr.cc
130    janet.cc wrapper.cc
131    sing_win.cc
132    gms.cc pcv.cc maps_ip.cc
133    walk.cc walk_ip.cc
134    cntrlc.cc misc_ip.cc
135    calcSVD.cc pipeLink.cc
136    Minor.cc
137    MinorProcessor.cc
138    MinorInterface.cc
139)
140
141# C++ sources which are used if part of the kernel are dynamically linked
142set(dl_kernel_sources links/slInit_Dynamic.cc )
143
144# C++ sources which are used for dynamic libraries if part of the kernel is
145# dynamically linked
146set(dl_lib_sources "")
147
148# stuff for dbm
149set(dbmsr_sources ndbm.cc sing_dbm.cc)
150
151###
152if( ${GEN_NEW_LEX} EQUAL 1)
153  set(FLEXFLAGS ";NEW_FLEX")
154else( ${GEN_NEW_LEX} EQUAL 1)
155  set(FLEXFLAGS "")
156endif( ${GEN_NEW_LEX} EQUAL 1)
157add_library(sing-main ${cxxsources} ${dbmsr_sources})
158set_target_properties(sing-main PROPERTIES
159  COMPILE_DEFINITIONS "${ADD_DEFS}${FLEXFLAGS}")
160set_target_properties(sing-main PROPERTIES
161  COMPILE_FLAGS "-fno-implicit-templates")
162
163#message(STATUS "=== '${CMAKE_CXX_FLAGS_DEBUG}'")
164#add_library(sing-main_g ${cxxsources})
165#set_target_properties(sing-main_g PROPERTIES COMPILE_FLAGS
166#  "-fno-implicit-templates${CMAKE_CXX_FLAGS_DEBUG}")
167#
168message("Grammar creates ${GRAMMAR_CPP}...")
169message("Grammar creates ${GRAMMAR_H}...")
170
171# stuff for MP
172set(mpsr_sources mpsr_Put.cc mpsr_PutPoly.cc mpsr_GetPoly.cc mpsr_sl.cc
173        mpsr_Get.cc mpsr_GetMisc.cc mpsr_Error.cc )
174
175
176# normal C source files
177set(CSOURCES "")
178
179# C++ sources for which both, shared and static object files are needed
180set(common_sources ${mpsr_sources} ${dbmsr_sources} )
181
182# special C++ source files (need extra compiling and/or linking), for which
183# dependencies should be generated
184set(esources ${IPARITH_INC} iparith.cc ${common_sources}
185  ${dl_kernel_sources} ${dl_lib_sources} ${static_sources} ) #
186set_source_files_properties(iparith.cc PROPERTIES OBJECT_DEPENDS ${IPARITH_INC})
187
188set(sources ${csources} ${cxxsources}
189        grammar.y scanner.l libparse.l
190        utils.cc utils.h
191        tesths.cc mpsr_Tok.cc claptmpl.cc )
192
193set(headers lists.h attrib.h
194        mpsr_Tok.h
195        ipconv.h
196        subexpr.h ipid.h
197        cntrlc.h ipprint.h sdb.h
198        ipshell.h tok.h
199        links/silink.h
200        sing_dbm.h maps_ip.h interpolation.h
201        mpsr.h mpsr_sl.h
202        mpsr_Get.h janet.h
203        mpsr_Put.h walk.h
204        dbm_sl.h libparse.h
205        gms.h pcv.h eigenval_ip.h
206        walk.h
207        omSingularConfig.h)
208
209add_executable(Singular-static
210  tesths.cc iparith.cc mpsr_Tok.cc claptmpl.cc ${static_sources})
211set_target_properties(Singular-static PROPERTIES
212  COMPILE_DEFINITIONS "${ADD_DEFS}")
213
214set_target_properties(Singular-static PROPERTIES COMPILE_DEFINIIONS "${ADD_DEFS}")
215target_link_libraries(Singular-static sing-main)
216target_link_libraries(Singular-static kernel)
217target_link_libraries(Singular-static singfac)
218target_link_libraries(Singular-static singcf)
219target_link_libraries(Singular-static ${NTL_LIBRARY})
220target_link_libraries(Singular-static omalloc)
221
222target_link_libraries(Singular-static gmp)
223target_link_libraries(Singular-static readline)
224target_link_libraries(Singular-static tinfo)
225
226#add_dependencies(Singular-static ${OMALLOC_TARGET})
227add_dependencies(Singular-static gen-omalloc-h)
228add_dependencies(Singular-static omalloc)
229### add_dependencies(Singular-static iparith_target)
230install(TARGETS Singular-static DESTINATION bin)
231
232# build libparse
233set(libparse_srcs ${LIBPARSE_CPP} utils.cc)
234add_executable(libparse ${libparse_srcs})
235set_target_properties(libparse PROPERTIES
236  COMPILE_DEFINITIONS "${ADD_DEFS};STANDALONE_PARSER${FLEXFLAGS}")
237target_link_libraries(libparse sg-fegetopt)
238target_link_libraries(libparse omalloc_ndebug)
239add_dependencies(libparse omalloc)
240install(TARGETS libparse DESTINATION bin)
241
242file(GLOB LIB_srcs LIB/*lib)
243install(FILES ${LIB_srcs} DESTINATION lib/LIB)
244
245#set(libsingular_srcs ${SCANNER_CPP} ${LIBPARSE_CPP} ${IPARITH_INC}  ${static_sources}
246set(libsingular_srcs iparith.cc tesths.cc  claptmpl.cc mpsr_Tok.cc )
247
248# mod2.h SINGULAR_VERSION_H
249#target_link_libraries(singular sing-main kernel singfac singcf ntl readline gmp omalloc htmlhelp)
250
251install(FILES libsingular.h DESTINATION include)
252
253##merge_libraries(singfac singcf ntl readline gmp omalloc)
254add_library(singular_ndebug ${libsingular_srcs})
255set_target_properties(singular_ndebug PROPERTIES
256  COMPILE_DEFINITIONS "${ADD_DEFS};LIBSINGULAR")
257##merge_libraries(SINGULARLIB_TARGET GEN_LIB_A singular_ndebug kernel singfac singcf omalloc_ndebug)
258##message(STATUS "Merge-Target: '${SINGULARLIB_TARGET}'")
259##add_dependencies(singular_ndebug ${SINGULARLIB_TARGET})
260##add_dependencies(${SINGULARLIB_TARGET} ${OMALLOC_TARGET} ${IPARITH_TARGET})
261##add_dependencies(${SINGULARLIB_TARGET} singular_main kernel singfac singcf  omalloc_ndebug)
262
263install(TARGETS ${GEN_TARGET} DESTINATION lib)
264#libparse.cc scanner.cc
265
266
267#add_library(Singularg STATIC
268#  ${IPARITH_INC}
269#  tesths.cc iparith.cc mpsr_Tok.cc claptmpl.cc)
270#set_target_properties(Singularg PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
271#target_link_libraries(Singular-static sing-main kernel_g gmp fac singcf ntl omalloc)
272
273#add_library(Singularp STATIC ${IPARITH_INC}
274#  tesths.cc iparith.cc mpsr_Tok.cc claptmpl.cc)
275#set_target_properties(Singularp PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_PROFILE})
276#target_link_libraries(Singular-static sing-main kernel_p gmp fac singcf ntl omalloc_p)
277
278#add_dependencies(extra.o feopt_target)
279#set_source_files_properties(extra.cc PROPERTIES OBJECT_DEPENDS ${FEOPT_FILE_INC})
280set_source_files_properties(${FEOPT_FILE_INC} PROPERTIES GENERATED true)
281#set_source_files_properties(feopt.h PROPERTIES OBJECT_DEPENDS feopt_target)
282#cntrlc.cc
283#extra.cc
284#fehelp.cc
285#feOpt.cc
286#mpsr_sl.cc
287#tesths.cc
Note: See TracBrowser for help on using the repository browser.