1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
---|
2 | |
---|
3 | SET(PROJECT_NAME "LEMON") |
---|
4 | PROJECT(${PROJECT_NAME}) |
---|
5 | |
---|
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 ./scripts/chg-len.py |
---|
13 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
---|
14 | OUTPUT_VARIABLE HG_REVISION_PATH |
---|
15 | ERROR_QUIET |
---|
16 | OUTPUT_STRIP_TRAILING_WHITESPACE |
---|
17 | ) |
---|
18 | EXECUTE_PROCESS( |
---|
19 | COMMAND hg id -i |
---|
20 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
---|
21 | OUTPUT_VARIABLE HG_REVISION |
---|
22 | ERROR_QUIET |
---|
23 | OUTPUT_STRIP_TRAILING_WHITESPACE |
---|
24 | ) |
---|
25 | IF(HG_REVISION STREQUAL "") |
---|
26 | SET(HG_REVISION_ID "hg-tip") |
---|
27 | ELSE() |
---|
28 | SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION}) |
---|
29 | ENDIF() |
---|
30 | SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.") |
---|
31 | ENDIF() |
---|
32 | |
---|
33 | SET(PROJECT_VERSION ${LEMON_VERSION}) |
---|
34 | |
---|
35 | SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) |
---|
36 | |
---|
37 | FIND_PACKAGE(Doxygen) |
---|
38 | FIND_PACKAGE(Ghostscript) |
---|
39 | FIND_PACKAGE(GLPK 4.33) |
---|
40 | FIND_PACKAGE(CPLEX) |
---|
41 | FIND_PACKAGE(COIN) |
---|
42 | |
---|
43 | INCLUDE(CheckTypeSize) |
---|
44 | CHECK_TYPE_SIZE("long long" LONG_LONG) |
---|
45 | SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) |
---|
46 | |
---|
47 | INCLUDE(FindPythonInterp) |
---|
48 | |
---|
49 | ENABLE_TESTING() |
---|
50 | |
---|
51 | ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) |
---|
52 | |
---|
53 | ADD_SUBDIRECTORY(lemon) |
---|
54 | IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) |
---|
55 | ADD_SUBDIRECTORY(demo) |
---|
56 | ADD_SUBDIRECTORY(tools) |
---|
57 | ADD_SUBDIRECTORY(doc) |
---|
58 | ADD_SUBDIRECTORY(test) |
---|
59 | ENDIF() |
---|
60 | |
---|
61 | CONFIGURE_FILE( |
---|
62 | ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in |
---|
63 | ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake |
---|
64 | @ONLY |
---|
65 | ) |
---|
66 | IF(UNIX) |
---|
67 | INSTALL( |
---|
68 | FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake |
---|
69 | DESTINATION share/lemon/cmake |
---|
70 | ) |
---|
71 | ELSEIF(WIN32) |
---|
72 | INSTALL( |
---|
73 | FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake |
---|
74 | DESTINATION cmake |
---|
75 | ) |
---|
76 | ENDIF() |
---|
77 | |
---|
78 | IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32) |
---|
79 | SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) |
---|
80 | SET(CPACK_PACKAGE_VENDOR "EGRES") |
---|
81 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY |
---|
82 | "LEMON - Library for Efficient Modeling and Optimization in Networks") |
---|
83 | SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") |
---|
84 | |
---|
85 | SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
---|
86 | |
---|
87 | SET(CPACK_PACKAGE_INSTALL_DIRECTORY |
---|
88 | "${PROJECT_NAME} ${PROJECT_VERSION}") |
---|
89 | SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY |
---|
90 | "${PROJECT_NAME} ${PROJECT_VERSION}") |
---|
91 | |
---|
92 | SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) |
---|
93 | |
---|
94 | SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") |
---|
95 | SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") |
---|
96 | SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") |
---|
97 | SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") |
---|
98 | |
---|
99 | SET(CPACK_COMPONENT_HEADERS_DESCRIPTION |
---|
100 | "C++ header files") |
---|
101 | SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION |
---|
102 | "DLL and import library") |
---|
103 | SET(CPACK_COMPONENT_BIN_DESCRIPTION |
---|
104 | "Command line utilities") |
---|
105 | SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION |
---|
106 | "Doxygen generated documentation") |
---|
107 | |
---|
108 | SET(CPACK_COMPONENT_HEADERS_DEPENDS library) |
---|
109 | |
---|
110 | SET(CPACK_COMPONENT_HEADERS_GROUP "Development") |
---|
111 | SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") |
---|
112 | SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") |
---|
113 | |
---|
114 | SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION |
---|
115 | "Components needed to develop software using LEMON") |
---|
116 | SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION |
---|
117 | "Documentation of LEMON") |
---|
118 | |
---|
119 | SET(CPACK_ALL_INSTALL_TYPES Full Developer) |
---|
120 | |
---|
121 | SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) |
---|
122 | SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) |
---|
123 | SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) |
---|
124 | |
---|
125 | SET(CPACK_GENERATOR "NSIS") |
---|
126 | SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") |
---|
127 | SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") |
---|
128 | #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") |
---|
129 | SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") |
---|
130 | SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") |
---|
131 | SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") |
---|
132 | SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") |
---|
133 | SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") |
---|
134 | SET(CPACK_NSIS_CREATE_ICONS_EXTRA " |
---|
135 | CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" |
---|
136 | ") |
---|
137 | SET(CPACK_NSIS_DELETE_ICONS_EXTRA " |
---|
138 | !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP |
---|
139 | Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" |
---|
140 | ") |
---|
141 | |
---|
142 | INCLUDE(CPack) |
---|
143 | ENDIF() |
---|