# HG changeset patch # User Alpar Juttner # Date 1291566923 -3600 # Node ID 4c8956a7bdf43c931183c022b181a2c2fc635702 # Parent c445c931472fc809a9c19902829d209a64ebca61 Set up CMAKE build environment diff -r c445c931472f -r 4c8956a7bdf4 CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Sun Dec 05 17:35:23 2010 +0100 @@ -0,0 +1,177 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(PROJECT_NAME "GLPK") +PROJECT(${PROJECT_NAME}) + +IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) + INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) +ELSEIF(DEFINED ENV{GLPK_VERSION}) + SET(GLPK_VERSION $ENV{GLPK_VERSION} CACHE STRING "GLPK version string.") +ELSE() + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE HG_REVISION_PATH + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + EXECUTE_PROCESS( + COMMAND hg id -i + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE HG_REVISION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF(HG_REVISION STREQUAL "") + SET(HG_REVISION_ID "hg-tip") + ELSE() + IF(HG_REVISION_PATH STREQUAL "") + SET(HG_REVISION_ID ${HG_REVISION}) + ELSE() + SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION}) + ENDIF() + ENDIF() + SET(GLPK_VERSION ${HG_REVISION_ID} CACHE STRING "GLPK version string.") +ENDIF() + +SET(PROJECT_VERSION ${GLPK_VERSION}) + +SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +IF(DEFINED ENV{GLPK_C_WARNING}) + SET(C_WARNING $ENV{GLPK_C_WARNING}) +ELSE() + IF(CMAKE_COMPILER_IS_GNUC) + SET(C_WARNING "-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") + SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") + SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") + ELSEIF(MSVC) + # SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996") + # # suppressed warnings: + # # C4250: 'class1' : inherits 'class2::member' via dominance + # # C4355: 'this' : used in base member initializer list + # # C4503: 'function' : decorated name length exceeded, name was truncated + # # C4800: 'type' : forcing value to bool 'true' or 'false' + # # (performance warning) + # # C4996: 'function': was declared deprecated + ELSE() + SET(C_WARNING "-Wall -W") + ENDIF() +ENDIF() +SET(GLPK_C_WARNING_FLAGS ${C_WARNING} CACHE STRING "GLPK warning flags.") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GLPK_C_WARNING_FLAGS}") + +SET(CMAKE_C_FLAGS_MAINTAINER "-ggdb" CACHE STRING + "Flags used by the C compiler during maintainer builds." + FORCE ) +SET(CMAKE_EXE_LINKER_FLAGS_MAINTAINER + "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING + "Flags used for linking binaries during maintainer builds." + FORCE ) +SET(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER + "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING + "Flags used by the shared libraries linker during maintainer builds." + FORCE ) +MARK_AS_ADVANCED( + CMAKE_C_FLAGS_MAINTAINER + CMAKE_EXE_LINKER_FLAGS_MAINTAINER + CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) + +IF(CMAKE_CONFIGURATION_TYPES) + LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer) + LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) + SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING + "Add the configurations that we need" + FORCE) + endif() + +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release") +ENDIF() + +SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING + "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer." + FORCE ) + + +INCLUDE(CheckTypeSize) +CHECK_TYPE_SIZE("long long" LONG_LONG) +SET(GLPK_HAVE_LONG_LONG ${HAVE_LONG_LONG}) + +ENABLE_TESTING() + +IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") + ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) +ELSE() + ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) +ENDIF() + +INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR}/include + ${PROJECT_SOURCE_DIR}/src +) + +INCLUDE(FindLATEX) + +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(include) +IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) + ADD_SUBDIRECTORY(examples) + ADD_SUBDIRECTORY(doc) +ENDIF() + +IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) + SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) + SET(CPACK_PACKAGE_VENDOR "GNU") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY + "GLPK - GNU Linear Programming Kit") + SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") + + SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + + SET(CPACK_PACKAGE_INSTALL_DIRECTORY + "${PROJECT_NAME} ${PROJECT_VERSION}") + SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY + "${PROJECT_NAME} ${PROJECT_VERSION}") + + INCLUDE(CPack) + + CPACK_ADD_INSTALL_TYPE(Full) + + CPACK_ADD_COMPONENT(headers + DISPLAY_NAME "C headers" + DESCRIPTION "C header files" + DEPENDS library + INSTALL_TYPES Full + ) + CPACK_ADD_COMPONENT(library + DISPLAY_NAME "Libraries" + DESCRIPTION "DLL and import library" + INSTALL_TYPES Full + ) + + CPACK_ADD_COMPONENT(bin + DISPLAY_NAME "Command line utilities" + DESCRIPTION "Command line utilities" + INSTALL_TYPES Full + ) + + SET(CPACK_GENERATOR "NSIS") + # SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/glpk.ico") + # SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") + # #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") + # SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\glpk.ico") + SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") + SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.gnu.org\\\\software\\\\glpk") + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.gnu.org\\\\software\\\\glpk") + SET(CPACK_NSIS_CONTACT "mao@gnu.org") + # SET(CPACK_NSIS_CREATE_ICONS_EXTRA " + # CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" + # ") + # SET(CPACK_NSIS_DELETE_ICONS_EXTRA " + # !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP + # Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" + # ") + +ENDIF() diff -r c445c931472f -r 4c8956a7bdf4 doc/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/CMakeLists.txt Sun Dec 05 17:35:23 2010 +0100 @@ -0,0 +1,35 @@ +IF(PDFLATEX_COMPILER) + ADD_CUSTOM_COMMAND(OUTPUT glpk.pdf + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk01.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk02.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk03.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk04.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk05.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk06.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk07.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk08.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk09.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk10.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk11.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/glpk12.tex ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PDFLATEX_COMPILER} -src \\\\nonstopmode\\\\input ${CMAKE_CURRENT_BINARY_DIR}/glpk.tex + COMMAND ${PDFLATEX_COMPILER} -src \\\\nonstopmode\\\\input ${CMAKE_CURRENT_BINARY_DIR}/glpk.tex + MAIN_DEPENDENCY glpk.tex + DEPENDS glpk01.tex glpk02.tex glpk03.tex glpk04.tex glpk05.tex + glpk06.tex glpk07.tex glpk08.tex glpk09.tex glpk10.tex glpk11.tex + glpk12.tex + ) + ADD_CUSTOM_COMMAND(OUTPUT graphs.pdf + COMMAND ${PDFLATEX_COMPILER} -src \\\\nonstopmode\\\\input ${CMAKE_CURRENT_SOURCE_DIR}/graphs.tex + COMMAND ${PDFLATEX_COMPILER} -src \\\\nonstopmode\\\\input ${CMAKE_CURRENT_SOURCE_DIR}/graphs.tex + MAIN_DEPENDENCY graphs.tex + ) + ADD_CUSTOM_COMMAND(OUTPUT gmpl.pdf + COMMAND ${PDFLATEX_COMPILER} -src \\\\nonstopmode\\\\input ${CMAKE_CURRENT_SOURCE_DIR}/gmpl.tex + COMMAND ${PDFLATEX_COMPILER} -src \\\\nonstopmode\\\\input ${CMAKE_CURRENT_SOURCE_DIR}/gmpl.tex + MAIN_DEPENDENCY gmpl.tex + ) + ADD_CUSTOM_TARGET(pdfdoc + DEPENDS glpk.pdf graphs.pdf gmpl.pdf) +ENDIF() \ No newline at end of file diff -r c445c931472f -r 4c8956a7bdf4 examples/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/CMakeLists.txt Sun Dec 05 17:35:23 2010 +0100 @@ -0,0 +1,20 @@ +ADD_EXECUTABLE(glpsol + glpsol.c) + +TARGET_LINK_LIBRARIES(glpsol glpk-static) +IF(UNIX) + TARGET_LINK_LIBRARIES(glpsol glpk-static m) +ENDIF() + +INSTALL( + TARGETS glpsol + RUNTIME DESTINATION bin + COMPONENT bin +) + +ADD_TEST(NAME glpsol-test-1 + COMMAND glpsol --version) +ADD_TEST(NAME glpsol-test-2 + COMMAND glpsol --mps ${CMAKE_CURRENT_SOURCE_DIR}/plan.mps) +ADD_DEPENDENCIES(check glpsol) + diff -r c445c931472f -r 4c8956a7bdf4 include/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/CMakeLists.txt Sun Dec 05 17:35:23 2010 +0100 @@ -0,0 +1,4 @@ +INSTALL(FILES glpk.h + DESTINATION include + COMPONENT headers +) diff -r c445c931472f -r 4c8956a7bdf4 scripts/chg-len.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/chg-len.py Sun Dec 05 17:35:23 2010 +0100 @@ -0,0 +1,46 @@ +#! /usr/bin/env python +# +# This file is a part of LEMON, a generic C++ optimization library. +# +# Copyright (C) 2003-2009 +# Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport +# (Egervary Research Group on Combinatorial Optimization, EGRES). +# +# Permission to use, modify and distribute this software is granted +# provided that this copyright notice appears in all copies. For +# precise terms see the accompanying LICENSE file. +# +# This software is provided "AS IS" with no warranty of any kind, +# express or implied, and with no claim as to its suitability for any +# purpose. + +import sys + +from mercurial import ui, hg +from mercurial import util + +util.rcpath = lambda : [] + +if len(sys.argv)>1 and sys.argv[1] in ["-h","--help"]: + print """ +This utility just prints the length of the longest path +in the revision graph from revison 0 to the current one. +""" + exit(0) + +u = ui.ui() +r = hg.repository(u, ".") +N = r.changectx(".").rev() +lengths=[0]*(N+1) +for i in range(N+1): + p=r.changectx(i).parents() + if p[0]: + p0=lengths[p[0].rev()] + else: + p0=-1 + if len(p)>1 and p[1]: + p1=lengths[p[1].rev()] + else: + p1=-1 + lengths[i]=max(p0,p1)+1 +print lengths[N] diff -r c445c931472f -r 4c8956a7bdf4 src/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CMakeLists.txt Sun Dec 05 17:35:23 2010 +0100 @@ -0,0 +1,170 @@ +SET(GLPK_LIB_SOURCES + glpapi01.c + glpapi02.c + glpapi03.c + glpapi04.c + glpapi05.c + glpapi06.c + glpapi07.c + glpapi08.c + glpapi09.c + glpapi10.c + glpapi11.c + glpapi12.c + glpapi13.c + glpapi14.c + glpapi15.c + glpapi16.c + glpapi17.c + glpapi18.c + glpapi19.c + glpapi.h + glpavl.c + glpavl.h + glpbfd.c + glpbfd.h + glpbfx.c + glpbfx.h + glpcpx.c + glpdmp.c + glpdmp.h + glpdmx.c + glpenv01.c + glpenv02.c + glpenv03.c + glpenv04.c + glpenv05.c + glpenv06.c + glpenv07.c + glpenv08.c + glpenv.h + glpfhv.c + glpfhv.h + glpgmp.c + glpgmp.h + glphbm.c + glphbm.h + glpini01.c + glpini02.c + glpios01.c + glpios02.c + glpios03.c + glpios04.c + glpios05.c + glpios06.c + glpios07.c + glpios08.c + glpios09.c + glpios10.c + glpios11.c + glpios12.c + glpios.h + glpipm.c + glpipm.h + glplib01.c + glplib02.c + glplib03.c + glplib.h + glplpf.c + glplpf.h + glplpx01.c + glplpx02.c + glplpx03.c + glpluf.c + glpluf.h + glplux.c + glplux.h + glpmat.c + glpmat.h + glpmpl01.c + glpmpl02.c + glpmpl03.c + glpmpl04.c + glpmpl05.c + glpmpl06.c + glpmpl.h + glpmps.c + glpnet01.c + glpnet02.c + glpnet03.c + glpnet04.c + glpnet05.c + glpnet06.c + glpnet07.c + glpnet08.c + glpnet09.c + glpnet.h + glpnpp01.c + glpnpp02.c + glpnpp03.c + glpnpp04.c + glpnpp05.c + glpnpp.h + glpqmd.c + glpqmd.h + glprgr.c + glprgr.h + glprng01.c + glprng02.c + glprng.h + glpscf.c + glpscf.h + glpscl.c + glpsdf.c + glpspm.c + glpspm.h + glpspx01.c + glpspx02.c + glpspx.h + glpsql.c + glpsql.h + glpssx01.c + glpssx02.c + glpssx.h + glpstd.h + glptsp.c + glptsp.h + amd/amd_1.c + amd/amd_2.c + amd/amd_aat.c + amd/amd_control.c + amd/amd_defaults.c + amd/amd_dump.c + amd/amd.h + amd/amd_info.c + amd/amd_internal.h + amd/amd_order.c + amd/amd_postorder.c + amd/amd_post_tree.c + amd/amd_preprocess.c + amd/amd_valid.c + colamd/colamd.c + colamd/colamd.h + ) + +IF(MSVC) + IF(CMAKE_CL_64) + SET(GLPK_LIB_SOURCES ${GLPK_LIB_SOURCES} + ${PROJECT_SOURCE_DIR}/w64/glpk_4_45.def) + ELSE() + SET(GLPK_LIB_SOURCES ${GLPK_LIB_SOURCES} + ${PROJECT_SOURCE_DIR}/w32/glpk_4_45.def) + ENDIF() +ENDIF() + +ADD_LIBRARY(glpk-shared SHARED ${GLPK_LIB_SOURCES}) +SET_TARGET_PROPERTIES(glpk-shared PROPERTIES OUTPUT_NAME glpk) +ADD_LIBRARY(glpk-static STATIC ${GLPK_LIB_SOURCES}) +SET_TARGET_PROPERTIES(glpk-static PROPERTIES OUTPUT_NAME glpk) +SET_TARGET_PROPERTIES(glpk-static PROPERTIES PREFIX "lib") + +SET_TARGET_PROPERTIES(glpk-shared PROPERTIES CLEAN_DIRECT_OUTPUT 1) +SET_TARGET_PROPERTIES(glpk-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) + + +INSTALL( + TARGETS glpk-shared glpk-static + RUNTIME DESTINATION bin COMPONENT library + ARCHIVE DESTINATION lib COMPONENT library + LIBRARY DESTINATION lib COMPONENT library +)