source: git/factory/libfac/CMakeLists.txt @ 16055bd

jengelh-datetimespielwiese
Last change on this file since 16055bd was 16055bd, checked in by Martin Lee <martinlee84@…>, 11 years ago
chg: move libfac into factory
  • Property mode set to 100644
File size: 4.9 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
8project(libfac)
9string(TOUPPER ${PROJECT_NAME} UPPER_PROJECT_NAME)
10
11# have the full monty in makefiles
12set(CMAKE_VERBOSE_MAKEFILE true)
13
14set(LIBFAC_V_MAJOR 3)
15set(LIBFAC_V_MINOR 1)
16set(LIBFAC_V_PATCH 0)
17set(LIBFAC_NAME   "Factorization and characteristic sets library")
18set(LIBFAC_DATE   "Aug 2008")
19set(LIBFAC_AUTHOR "M. Messollen")
20
21#OPTION(WITH_SINGULAR "build for use with Singular" Off)
22#OPTION(WITH_SINGULARERROR "use error reporting from Singular" Off)
23OPTION(WITH_NOSTREAMIO    "do not require iostream include nor library" Off)
24set(ADD_DEFS "NOSTREAMIO;${_OSDEF};HAVE_CONFIG_H;SINGULAR")
25
26
27###################################################################################################
28# No user settings below
29###################################################################################################
30include(LibfacMacros)
31
32###################################################################################################
33if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
34  message(STATUS "Have compiler: '${CMAKE_CXX_COMPILER_ID}'")
35  if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
36
37    #set(CMAKE_CXX_FLAGS "-W -Wall -Wextra -Wno-non-virtual-dtor")
38    set(CMAKE_CXX_FLAGS "-w --no-rtti -pipe ")
39    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-implicit-templates")
40    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
41
42    set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fomit-frame-pointer -DNDEBUG")
43
44    set(CMAKE_CXX_FLAGS_DEBUG "-Werror -O0 -g -ggdb -Wreturn-type -fno-omit-frame-pointer")
45    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wunused-variable -Wunused-parameter")
46    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wunused-function -Wunused")
47    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Woverloaded-virtual -Wno-system-headers")
48
49    # gprof and gcov support
50    set(CMAKE_CXX_FLAGS_PROFILE "-O0 -g -ggdb -Wreturn-type -Woverloaded-virtual")
51    set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -Wno-system-headers -pg")
52    set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -fprofile-arcs -ftest-coverage")
53  endif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
54endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
55
56###########################################################
57# Where are the additional libraries installed? Note: provide includes
58# path here, subsequent checks will resolve everything else
59include_directories(${CMAKE_CURRENT_BINARY_DIR})
60include_directories(${CMAKE_CURRENT_SOURCE_DIR})
61include_directories(${CMAKE_CURRENT_SOURCE_DIR}/charset)
62include_directories(${CMAKE_CURRENT_SOURCE_DIR}/factor)
63include_directories(${CMAKE_BINARY_DIR})
64include_directories(${CMAKE_SOURCE_DIR})
65include_directories(${CMAKE_BINARY_DIR}/factory)
66include_directories(${CMAKE_SOURCE_DIR}/factory)
67
68libfac_mk_version(LIBFAC_VERSION_H)
69
70
71##
72## src and objects
73##
74
75set(FACTORSRC1  factor/SqrFree.cc factor/Factor.cc
76                factor/MVMultiHensel.cc factor/Truefactor.cc
77                factor/helpstuff.cc  factor/version.cc
78                factor/homogfactor.cc )
79set(FACTORSRC2  factor/tmpl_inst.cc)
80set(FACTORSRC   ${FACTORSRC2} ${FACTORSRC1})
81
82
83set(FACTORINCL  ${LIBFAC_VERSION_H}
84  factor/Factor.h factor/MVMultiHensel.h
85  factor/Truefactor.h factor/tmpl_inst.h factor/SqrFree.h
86  factor/helpstuff.h factor/debug.h factor/timing.h
87  factor/homogfactor.h     factor/interrupt.h)
88set(CHARSETINCL charset/csutil.h charset/charset.h charset/reorder.h
89  charset/alg_factor.h charset/algfactor.h)
90
91set(charset_srcs  charset/csutil.cc charset/charset.cc
92  charset/reorder.cc charset/alg_factor.cc charset/algfactor.cc
93)
94
95# define libraries
96add_library(fac ${LIBFAC_VERSION_H} ${FACTORSRC} ${CHARSETSRC})
97set_source_files_properties(${FACTORSRC} PROPERTIES OBJECT_DEPENDS
98  ${FACTORYCONF_H})
99#add_dependencies(fac ${FACTORY_TARGET})
100
101# debug library
102#add_library(fac_g ${LIBFAC_VERSION_H} ${FACTORSRC} ${CHARSETSRC})
103#set_target_properties(fac_g PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
104
105# profile library
106#add_library(fac_p ${LIBFAC_VERSION_H} ${FACTORSRC} ${CHARSETSRC})
107#set_target_properties(fac_p PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_PROFILE})
108
109#
110# libraries for Singular
111if( WITH_SINGULAR )
112  message(STATUS "Compiling libfac for Singular: creating libsingfac.a")
113  add_library(singfac ${LIBFAC_VERSION_H} ${FACTORSRC1} ${charset_srcs})
114  set_target_properties(singfac PROPERTIES
115    COMPILE_DEFINITION "${ADD_DEFS};SINGULAR")
116
117#  # debug library
118#  add_library(singfac_g ${LIBFAC_VERSION_H} ${FACTORSRC1} ${charset_srcs})
119#  set_target_properties(singfac_g PROPERTIES COMPILE_FLAGS "-DSINGULAR ${CMAKE_CXX_FLAGS_DEBUG}")
120
121#  # profile library
122#  add_library(singfac_p ${LIBFAC_VERSION_H} ${FACTORSRC1} ${charset_srcs})
123#  set_target_properties(singfac_p PROPERTIES COMPILE_FLAGS "-DSINGULAR ${CMAKE_CXX_FLAG_PROFILE}")
124endif( WITH_SINGULAR )
Note: See TracBrowser for help on using the repository browser.