1 | # -*- mode: cmake; -*- |
---|
2 | # |
---|
3 | # |
---|
4 | |
---|
5 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
---|
6 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
---|
7 | include_directories(${CMAKE_BINARY_DIR}) |
---|
8 | include_directories(${CMAKE_SOURCE_DIR}) |
---|
9 | |
---|
10 | #include_directories(${CMAKE_SOURCE_DIR}/factory) |
---|
11 | include_directories(${CMAKE_SOURCE_DIR}/ntl/include) |
---|
12 | |
---|
13 | add_subdirectory(LIB) |
---|
14 | include(SingularMacros) |
---|
15 | |
---|
16 | singular_mk_version(SINGULAR_VERSION_H) |
---|
17 | |
---|
18 | message(STATUS ">>DIST: '${MAKE_DISTRIBUTION}'") |
---|
19 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/distrib.h.in |
---|
20 | ${CMAKE_CURRENT_BINARY_DIR}/distrib.h ) |
---|
21 | |
---|
22 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") |
---|
23 | ################################################################# |
---|
24 | ### check for lex/flex and add parser files |
---|
25 | ### |
---|
26 | find_program(FLEX flex) |
---|
27 | |
---|
28 | include(LexMacros) |
---|
29 | check_lex_version(GEN_NEW_LEX) |
---|
30 | add_lex(SCANNER_CPP ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l "") |
---|
31 | add_lex(LIBPARSE_CPP ${CMAKE_CURRENT_SOURCE_DIR}/libparse.l "yylp") |
---|
32 | message(STATUS "Add lex ${SCANNER_CPP}") |
---|
33 | message(STATUS "Add lex ${LIBPARSE_CPP}") |
---|
34 | |
---|
35 | ################################################################# |
---|
36 | ### check for bison/yacc and grammar files |
---|
37 | ### |
---|
38 | include(BisonMacros) |
---|
39 | add_grammar(GRAMMAR_TARGET GRAMMAR_CPP GRAMMAR_H ${CMAKE_CURRENT_SOURCE_DIR}/grammar.y) |
---|
40 | |
---|
41 | ################################################################# |
---|
42 | ### |
---|
43 | ### |
---|
44 | set(_feopt_srcs feOpt.cc mod2.h) |
---|
45 | add_executable(feOpt ${_feopt_srcs}) |
---|
46 | set_target_properties(feOpt PROPERTIES |
---|
47 | COMPILE_DEFINITIONS "${ADD_DEFS};GENERATE_OPTION_INDEX") |
---|
48 | add_dependencies(feOpt omalloc) |
---|
49 | #singular_generate_incfile(FEOPT_TARGET FEOPT_FILE_INC |
---|
50 | singular_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 | ### |
---|
62 | add_executable(feOptES ${_feopt_srcs}) |
---|
63 | set_target_properties(feOptES PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS};GENERATE_OPTION_INDEX -DESINGULAR") |
---|
64 | add_dependencies(feOptES omalloc) |
---|
65 | singular_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 | ### |
---|
72 | add_executable(feOptTS ${_feopt_srcs}) |
---|
73 | set_target_properties(feOptTS PROPERTIES COMPILE_DEFINITIONS "${ADD_DEFS};GENERATE_OPTION_INDEX -DTSINGULAR") |
---|
74 | add_dependencies(feOptTS omalloc) |
---|
75 | singular_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 |
---|
84 | set(static_sources slInit_Static.cc) |
---|
85 | |
---|
86 | set(_iparith_inc_srcs iparith.cc tesths.cc tok.h mpsr_Tok.cc mod2.h) |
---|
87 | add_executable(gentable ${_iparith_inc_srcs} claptmpl.cc ${static_sources}) |
---|
88 | add_dependencies(gentable omalloc) |
---|
89 | set_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) |
---|
96 | target_link_libraries(gentable sing-main) |
---|
97 | target_link_libraries(gentable kernel) |
---|
98 | target_link_libraries(gentable singfac) |
---|
99 | target_link_libraries(gentable singcf) |
---|
100 | target_link_libraries(gentable ${NTL_LIBRARY}) |
---|
101 | target_link_libraries(gentable omalloc ) |
---|
102 | |
---|
103 | target_link_libraries(gentable gmp) |
---|
104 | target_link_libraries(gentable readline) |
---|
105 | target_link_libraries(gentable ncurses) |
---|
106 | target_link_libraries(gentable m) |
---|
107 | |
---|
108 | singular_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}) |
---|
112 | message(STATUS "====== '${IPARITH_INC}' ====") |
---|
113 | |
---|
114 | ########## |
---|
115 | # |
---|
116 | # normal C++ source files |
---|
117 | set(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 |
---|
142 | set(dl_kernel_sources slInit_Dynamic.cc ) |
---|
143 | |
---|
144 | # C++ sources which are used for dynamic libraries if part of the kernel is |
---|
145 | # dynamically linked |
---|
146 | set(dl_lib_sources "") |
---|
147 | |
---|
148 | # stuff for dbm |
---|
149 | set(dbmsr_sources ndbm.cc sing_dbm.cc) |
---|
150 | |
---|
151 | ### |
---|
152 | if( ${GEN_NEW_LEX} EQUAL 1) |
---|
153 | set(FLEXFLAGS ";NEW_FLEX") |
---|
154 | else( ${GEN_NEW_LEX} EQUAL 1) |
---|
155 | set(FLEXFLAGS "") |
---|
156 | endif( ${GEN_NEW_LEX} EQUAL 1) |
---|
157 | add_library(sing-main ${cxxsources} ${dbmsr_sources}) |
---|
158 | set_target_properties(sing-main PROPERTIES |
---|
159 | COMPILE_DEFINITIONS "${ADD_DEFS}${FLEXFLAGS}") |
---|
160 | set_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 | # |
---|
168 | message("Grammar creates ${GRAMMAR_CPP}...") |
---|
169 | message("Grammar creates ${GRAMMAR_H}...") |
---|
170 | |
---|
171 | # stuff for MP |
---|
172 | set(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 |
---|
177 | set(CSOURCES "") |
---|
178 | |
---|
179 | # C++ sources for which both, shared and static object files are needed |
---|
180 | set(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 |
---|
184 | set(esources ${IPARITH_INC} iparith.cc ${common_sources} |
---|
185 | ${dl_kernel_sources} ${dl_lib_sources} ${static_sources} ) # |
---|
186 | set_source_files_properties(iparith.cc PROPERTIES OBJECT_DEPENDS ${IPARITH_INC}) |
---|
187 | |
---|
188 | set(sources ${csources} ${cxxsources} |
---|
189 | grammar.y scanner.l libparse.l |
---|
190 | utils.cc utils.h |
---|
191 | tesths.cc mpsr_Tok.cc claptmpl.cc ) |
---|
192 | |
---|
193 | set(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 | 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 | static.h |
---|
208 | omSingularConfig.h) |
---|
209 | |
---|
210 | add_executable(Singular-static |
---|
211 | tesths.cc iparith.cc mpsr_Tok.cc claptmpl.cc ${static_sources}) |
---|
212 | set_target_properties(Singular-static PROPERTIES |
---|
213 | COMPILE_DEFINITIONS "${ADD_DEFS}") |
---|
214 | |
---|
215 | set_target_properties(Singular-static PROPERTIES COMPILE_DEFINIIONS "${ADD_DEFS}") |
---|
216 | target_link_libraries(Singular-static sing-main) |
---|
217 | target_link_libraries(Singular-static kernel) |
---|
218 | target_link_libraries(Singular-static singfac) |
---|
219 | target_link_libraries(Singular-static singcf) |
---|
220 | target_link_libraries(Singular-static ${NTL_LIBRARY}) |
---|
221 | target_link_libraries(Singular-static omalloc) |
---|
222 | |
---|
223 | target_link_libraries(Singular-static gmp) |
---|
224 | target_link_libraries(Singular-static readline) |
---|
225 | target_link_libraries(Singular-static tinfo) |
---|
226 | |
---|
227 | #add_dependencies(Singular-static ${OMALLOC_TARGET}) |
---|
228 | add_dependencies(Singular-static gen-omalloc-h) |
---|
229 | add_dependencies(Singular-static omalloc) |
---|
230 | ### add_dependencies(Singular-static iparith_target) |
---|
231 | install(TARGETS Singular-static DESTINATION bin) |
---|
232 | |
---|
233 | # build libparse |
---|
234 | set(libparse_srcs ${LIBPARSE_CPP} utils.cc) |
---|
235 | add_executable(libparse ${libparse_srcs}) |
---|
236 | set_target_properties(libparse PROPERTIES |
---|
237 | COMPILE_DEFINITIONS "${ADD_DEFS};STANDALONE_PARSER${FLEXFLAGS}") |
---|
238 | target_link_libraries(libparse sg-fegetopt) |
---|
239 | target_link_libraries(libparse omalloc_ndebug) |
---|
240 | add_dependencies(libparse omalloc) |
---|
241 | install(TARGETS libparse DESTINATION bin) |
---|
242 | |
---|
243 | file(GLOB LIB_srcs LIB/*lib) |
---|
244 | install(FILES ${LIB_srcs} DESTINATION lib/LIB) |
---|
245 | |
---|
246 | #set(libsingular_srcs ${SCANNER_CPP} ${LIBPARSE_CPP} ${IPARITH_INC} ${static_sources} |
---|
247 | set(libsingular_srcs iparith.cc tesths.cc claptmpl.cc mpsr_Tok.cc ) |
---|
248 | |
---|
249 | # mod2.h SINGULAR_VERSION_H |
---|
250 | #target_link_libraries(singular sing-main kernel singfac singcf ntl readline gmp omalloc htmlhelp) |
---|
251 | |
---|
252 | install(FILES libsingular.h DESTINATION include) |
---|
253 | |
---|
254 | ##merge_libraries(singfac singcf ntl readline gmp omalloc) |
---|
255 | add_library(singular_ndebug ${libsingular_srcs}) |
---|
256 | set_target_properties(singular_ndebug PROPERTIES |
---|
257 | COMPILE_DEFINITIONS "${ADD_DEFS};LIBSINGULAR") |
---|
258 | ##merge_libraries(SINGULARLIB_TARGET GEN_LIB_A singular_ndebug kernel singfac singcf omalloc_ndebug) |
---|
259 | ##message(STATUS "Merge-Target: '${SINGULARLIB_TARGET}'") |
---|
260 | ##add_dependencies(singular_ndebug ${SINGULARLIB_TARGET}) |
---|
261 | ##add_dependencies(${SINGULARLIB_TARGET} ${OMALLOC_TARGET} ${IPARITH_TARGET}) |
---|
262 | ##add_dependencies(${SINGULARLIB_TARGET} singular_main kernel singfac singcf omalloc_ndebug) |
---|
263 | |
---|
264 | install(TARGETS ${GEN_TARGET} DESTINATION lib) |
---|
265 | #libparse.cc scanner.cc |
---|
266 | |
---|
267 | |
---|
268 | #add_library(Singularg STATIC |
---|
269 | # ${IPARITH_INC} |
---|
270 | # tesths.cc iparith.cc mpsr_Tok.cc claptmpl.cc) |
---|
271 | #set_target_properties(Singularg PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG}) |
---|
272 | #target_link_libraries(Singular-static sing-main kernel_g gmp fac singcf ntl omalloc) |
---|
273 | |
---|
274 | #add_library(Singularp STATIC ${IPARITH_INC} |
---|
275 | # tesths.cc iparith.cc mpsr_Tok.cc claptmpl.cc) |
---|
276 | #set_target_properties(Singularp PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_PROFILE}) |
---|
277 | #target_link_libraries(Singular-static sing-main kernel_p gmp fac singcf ntl omalloc_p) |
---|
278 | |
---|
279 | #add_dependencies(extra.o feopt_target) |
---|
280 | #set_source_files_properties(extra.cc PROPERTIES OBJECT_DEPENDS ${FEOPT_FILE_INC}) |
---|
281 | set_source_files_properties(${FEOPT_FILE_INC} PROPERTIES GENERATED true) |
---|
282 | #set_source_files_properties(feopt.h PROPERTIES OBJECT_DEPENDS feopt_target) |
---|
283 | #cntrlc.cc |
---|
284 | #extra.cc |
---|
285 | #fehelp.cc |
---|
286 | #feOpt.cc |
---|
287 | #mpsr_sl.cc |
---|
288 | #tesths.cc |
---|