[8cc501] | 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 | omSingularConfig.h) |
---|
| 208 | |
---|
| 209 | add_executable(Singular-static |
---|
| 210 | tesths.cc iparith.cc mpsr_Tok.cc claptmpl.cc ${static_sources}) |
---|
| 211 | set_target_properties(Singular-static PROPERTIES |
---|
| 212 | COMPILE_DEFINITIONS "${ADD_DEFS}") |
---|
| 213 | |
---|
| 214 | set_target_properties(Singular-static PROPERTIES COMPILE_DEFINIIONS "${ADD_DEFS}") |
---|
| 215 | target_link_libraries(Singular-static sing-main) |
---|
| 216 | target_link_libraries(Singular-static kernel) |
---|
| 217 | target_link_libraries(Singular-static singfac) |
---|
| 218 | target_link_libraries(Singular-static singcf) |
---|
| 219 | target_link_libraries(Singular-static ${NTL_LIBRARY}) |
---|
| 220 | target_link_libraries(Singular-static omalloc) |
---|
| 221 | |
---|
| 222 | target_link_libraries(Singular-static gmp) |
---|
| 223 | target_link_libraries(Singular-static readline) |
---|
| 224 | target_link_libraries(Singular-static tinfo) |
---|
| 225 | |
---|
| 226 | #add_dependencies(Singular-static ${OMALLOC_TARGET}) |
---|
| 227 | add_dependencies(Singular-static gen-omalloc-h) |
---|
| 228 | add_dependencies(Singular-static omalloc) |
---|
| 229 | ### add_dependencies(Singular-static iparith_target) |
---|
| 230 | install(TARGETS Singular-static DESTINATION bin) |
---|
| 231 | |
---|
| 232 | # build libparse |
---|
| 233 | set(libparse_srcs ${LIBPARSE_CPP} utils.cc) |
---|
| 234 | add_executable(libparse ${libparse_srcs}) |
---|
| 235 | set_target_properties(libparse PROPERTIES |
---|
| 236 | COMPILE_DEFINITIONS "${ADD_DEFS};STANDALONE_PARSER${FLEXFLAGS}") |
---|
| 237 | target_link_libraries(libparse sg-fegetopt) |
---|
| 238 | target_link_libraries(libparse omalloc_ndebug) |
---|
| 239 | add_dependencies(libparse omalloc) |
---|
| 240 | install(TARGETS libparse DESTINATION bin) |
---|
| 241 | |
---|
| 242 | file(GLOB LIB_srcs LIB/*lib) |
---|
| 243 | install(FILES ${LIB_srcs} DESTINATION lib/LIB) |
---|
| 244 | |
---|
| 245 | #set(libsingular_srcs ${SCANNER_CPP} ${LIBPARSE_CPP} ${IPARITH_INC} ${static_sources} |
---|
| 246 | set(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 | |
---|
| 251 | install(FILES libsingular.h DESTINATION include) |
---|
| 252 | |
---|
| 253 | ##merge_libraries(singfac singcf ntl readline gmp omalloc) |
---|
| 254 | add_library(singular_ndebug ${libsingular_srcs}) |
---|
| 255 | set_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 | |
---|
| 263 | install(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}) |
---|
| 280 | set_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 |
---|