gravatar
ladanyi@tmit.bme.hu
ladanyi@tmit.bme.hu
Put the version string into config.h Also make it possible to set the version using the LEMON_VERSION environment variable, and use the hg revision as version string in case this variable is unset.
0 5 0
default
5 files changed with 25 insertions and 9 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
1 1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 2

	
3
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
4
  INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
5
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
6
  SET(PROJECT_NAME "LEMON")
7
  SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.")
8
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
3
SET(PROJECT_NAME "LEMON")
4
PROJECT(${PROJECT_NAME})
9 5

	
10
PROJECT(${PROJECT_NAME})
6
IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
7
  INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
8
ELSEIF(DEFINED ENV{LEMON_VERSION})
9
  SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
10
ELSE()
11
  EXECUTE_PROCESS(
12
    COMMAND hg id -i
13
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
14
    OUTPUT_VARIABLE HG_REVISION
15
    ERROR_QUIET
16
    OUTPUT_STRIP_TRAILING_WHITESPACE
17
  )
18
  SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
19
ENDIF()
20

	
21
SET(PROJECT_VERSION ${LEMON_VERSION})
11 22

	
12 23
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
13 24

	
14 25
INCLUDE(FindDoxygen)
15 26
INCLUDE(FindGhostscript)
16 27
FIND_PACKAGE(GLPK 4.33)
17 28
FIND_PACKAGE(CPLEX)
18 29
FIND_PACKAGE(COIN)
19 30

	
20 31
INCLUDE(CheckTypeSize)
21 32
CHECK_TYPE_SIZE("long long" LONG_LONG)
22 33
SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
23 34

	
24 35
ENABLE_TESTING()
25 36

	
26 37
ADD_SUBDIRECTORY(lemon)
27 38
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
28 39
  ADD_SUBDIRECTORY(demo)
29 40
  ADD_SUBDIRECTORY(tools)
30 41
  ADD_SUBDIRECTORY(doc)
31 42
  ADD_SUBDIRECTORY(test)
32 43
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
33 44

	
34 45
CONFIGURE_FILE(
35 46
  ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in
36 47
  ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
37 48
  @ONLY
38 49
)
39 50
IF(UNIX)
40 51
  INSTALL(
41 52
    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
42 53
    DESTINATION share/lemon/cmake
43 54
  )
44 55
ELSEIF(WIN32)
45 56
  INSTALL(
46 57
    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
47 58
    DESTINATION cmake
48 59
  )
49 60
ENDIF(UNIX)
50 61

	
51 62
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
52 63
  IF(WIN32)
53 64
    SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
54 65
    SET(CPACK_PACKAGE_VENDOR "EGRES")
55 66
    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
56 67
      "LEMON - Library for Efficient Modeling and Optimization in Networks")
57 68
    SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
58 69

	
59 70
    SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
60 71

	
61 72
    SET(CPACK_PACKAGE_INSTALL_DIRECTORY
62 73
      "${PROJECT_NAME} ${PROJECT_VERSION}")
63 74
    SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
64 75
      "${PROJECT_NAME} ${PROJECT_VERSION}")
65 76

	
66 77
    SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
67 78

	
68 79
    SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
69 80
    SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
70 81
    SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
71 82
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
72 83

	
73 84
    SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
74 85
      "C++ header files")
75 86
    SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
76 87
      "DLL and import library")
77 88
    SET(CPACK_COMPONENT_BIN_DESCRIPTION
78 89
      "Command line utilities")
79 90
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
80 91
      "Doxygen generated documentation")
81 92

	
82 93
    SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
83 94

	
84 95
    SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
85 96
    SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
86 97
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
87 98

	
88 99
    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
89 100
      "Components needed to develop software using LEMON")
90 101
    SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
91 102
      "Documentation of LEMON")
92 103

	
93 104
    SET(CPACK_ALL_INSTALL_TYPES Full Developer)
94 105

	
95 106
    SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
96 107
    SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
97 108
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
98 109

	
99 110
    SET(CPACK_GENERATOR "NSIS")
100 111
    SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
101 112
    SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
102 113
    #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
103 114
    SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
104 115
    SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
105 116
    SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
106 117
    SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
107 118
    SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
108 119
    SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
109 120
      CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
110 121
      ")
111 122
    SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
112 123
      !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
113 124
      Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
114 125
      ")
115 126

	
116 127
    INCLUDE(CPack)
117 128
  ENDIF(WIN32)
118 129
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
Ignore white space 3072 line context
1
SET(PROJECT_NAME "@PACKAGE_NAME@")
2
SET(PROJECT_VERSION "@PACKAGE_VERSION@" CACHE STRING "LEMON version string.")
1
SET(LEMON_VERSION "@PACKAGE_VERSION@" CACHE STRING "LEMON version string.")
Ignore white space 6 line context
1 1
dnl Process this file with autoconf to produce a configure script.
2 2

	
3 3
dnl Version information.
4 4
m4_define([lemon_version_number],
5 5
	[m4_normalize(esyscmd([echo ${LEMON_VERSION}]))])
6 6
dnl m4_define([lemon_version_number], [])
7 7
m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))])
8 8
m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))])
9 9
m4_define([lemon_version], [ifelse(lemon_version_number(),
10 10
			   [],
11 11
			   [lemon_hg_path().lemon_hg_revision()],
12 12
			   [lemon_version_number()])])
13 13

	
14 14
AC_PREREQ([2.59])
15 15
AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon])
16 16
AC_CONFIG_AUX_DIR([build-aux])
17 17
AC_CONFIG_MACRO_DIR([m4])
18 18
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc])
19 19
AC_CONFIG_SRCDIR([lemon/list_graph.h])
20 20
AC_CONFIG_HEADERS([config.h lemon/config.h])
21 21

	
22
AC_DEFINE([LEMON_VERSION], [lemon_version()], [The version string])
23

	
22 24
dnl Do compilation tests using the C++ compiler.
23 25
AC_LANG([C++])
24 26

	
25 27
dnl Check the existence of long long type.
26 28
AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
27 29
if test x"$long_long_found" = x"yes"; then
28 30
  AC_DEFINE([LEMON_HAVE_LONG_LONG], [1], [Define to 1 if you have long long.])
29 31
fi
30 32

	
31 33
dnl Checks for programs.
32 34
AC_PROG_CXX
33 35
AC_PROG_CXXCPP
34 36
AC_PROG_INSTALL
35 37
AC_DISABLE_SHARED
36 38
AC_PROG_LIBTOOL
37 39

	
38 40
AC_CHECK_PROG([doxygen_found],[doxygen],[yes],[no])
39 41
AC_CHECK_PROG([gs_found],[gs],[yes],[no])
40 42

	
41 43
dnl Detect Intel compiler.
42 44
AC_MSG_CHECKING([whether we are using the Intel C++ compiler])
43 45
AC_COMPILE_IFELSE([#ifndef __INTEL_COMPILER
44 46
choke me
45 47
#endif], [ICC=[yes]], [ICC=[no]])
46 48
if test x"$ICC" = x"yes"; then
47 49
  AC_MSG_RESULT([yes])
48 50
else
49 51
  AC_MSG_RESULT([no])
50 52
fi
51 53

	
52 54
dnl Set custom compiler flags when using g++.
53 55
if test "$GXX" = yes -a "$ICC" = no; then
54 56
  WARNINGCXXFLAGS="-Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
55 57
fi
56 58
AC_SUBST([WARNINGCXXFLAGS])
57 59

	
58 60
dnl Checks for libraries.
59 61
LX_CHECK_GLPK
60 62
LX_CHECK_CPLEX
61 63
LX_CHECK_SOPLEX
62 64
LX_CHECK_COIN
63 65

	
64 66
AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"])
65 67
AM_CONDITIONAL([HAVE_MIP], [test x"$lx_mip_found" = x"yes"])
66 68

	
67 69
dnl Disable/enable building the binary tools.
68 70
AC_ARG_ENABLE([tools],
69 71
AS_HELP_STRING([--enable-tools], [build additional tools @<:@default@:>@])
70 72
AS_HELP_STRING([--disable-tools], [do not build additional tools]),
71 73
              [], [enable_tools=yes])
72 74
AC_MSG_CHECKING([whether to build the additional tools])
73 75
if test x"$enable_tools" != x"no"; then
74 76
  AC_MSG_RESULT([yes])
75 77
else
76 78
  AC_MSG_RESULT([no])
77 79
fi
78 80
AM_CONDITIONAL([WANT_TOOLS], [test x"$enable_tools" != x"no"])
79 81

	
80 82
dnl Checks for header files.
81 83
AC_CHECK_HEADERS(limits.h sys/time.h sys/times.h unistd.h)
82 84

	
83 85
dnl Checks for typedefs, structures, and compiler characteristics.
84 86
AC_C_CONST
85 87
AC_C_INLINE
86 88
AC_TYPE_SIZE_T
87 89
AC_HEADER_TIME
88 90
AC_STRUCT_TM
89 91

	
90 92
dnl Checks for library functions.
91 93
AC_HEADER_STDC
92 94
AC_CHECK_FUNCS(gettimeofday times ctime_r)
93 95

	
94 96
dnl Add dependencies on files generated by configure.
95 97
AC_SUBST([CONFIG_STATUS_DEPENDENCIES],
96 98
  ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])
97 99

	
98 100
AC_CONFIG_FILES([
99 101
Makefile
100 102
demo/Makefile
101 103
cmake/version.cmake
102 104
doc/Doxyfile
103 105
lemon/lemon.pc
104 106
])
105 107

	
106 108
AC_OUTPUT
107 109

	
108 110
echo
109 111
echo '****************************** SUMMARY ******************************'
110 112
echo
111 113
echo Package version............... : $PACKAGE-$VERSION
112 114
echo
113 115
echo C++ compiler.................. : $CXX
114 116
echo C++ compiles flags............ : $WARNINGCXXFLAGS $CXXFLAGS
115 117
echo
116 118
echo Compiler supports long long... : $long_long_found
117 119
echo
118 120
echo GLPK support.................. : $lx_glpk_found
119 121
echo CPLEX support................. : $lx_cplex_found
120 122
echo SOPLEX support................ : $lx_soplex_found
121 123
echo CLP support................... : $lx_clp_found
122 124
echo CBC support................... : $lx_cbc_found
123 125
echo
124 126
echo Build additional tools........ : $enable_tools
125 127
echo
126 128
echo The packace will be installed in
127 129
echo -n '  '
128 130
echo $prefix.
129 131
echo
130 132
echo '*********************************************************************'
131 133

	
132 134
echo
133 135
echo Configure complete, now type \'make\' and then \'make install\'.
134 136
echo
Ignore white space 6 line context
1
#define LEMON_VERSION "@PROJECT_VERSION@"
1 2
#cmakedefine LEMON_HAVE_LONG_LONG 1
2 3
#cmakedefine LEMON_HAVE_LP 1
3 4
#cmakedefine LEMON_HAVE_MIP 1
4 5
#cmakedefine LEMON_HAVE_GLPK 1
5 6
#cmakedefine LEMON_HAVE_CPLEX 1
6 7
#cmakedefine LEMON_HAVE_CLP 1
7 8
#cmakedefine LEMON_HAVE_CBC 1
Ignore white space 6 line context
1
/* The version string */
2
#undef LEMON_VERSION
3

	
1 4
/* Define to 1 if you have long long */
2 5
#undef LEMON_HAVE_LONG_LONG
3 6

	
4 7
/* Define to 1 if you have any LP solver. */
5 8
#undef LEMON_HAVE_LP
6 9

	
7 10
/* Define to 1 if you have any MIP solver. */
8 11
#undef LEMON_HAVE_MIP
9 12

	
10 13
/* Define to 1 if you have CPLEX. */
11 14
#undef LEMON_HAVE_CPLEX
12 15

	
13 16
/* Define to 1 if you have GLPK. */
14 17
#undef LEMON_HAVE_GLPK
15 18

	
16 19
/* Define to 1 if you have SOPLEX */
17 20
#undef LEMON_HAVE_SOPLEX
18 21

	
19 22
/* Define to 1 if you have CLP */
20 23
#undef LEMON_HAVE_CLP
21 24

	
22 25
/* Define to 1 if you have CBC */
23 26
#undef LEMON_HAVE_CBC
0 comments (0 inline)