Changeset 277 for trunk/Makefile


Ignore:
Timestamp:
Mar 16, 2006 2:18:04 PM (14 years ago)
Author:
lou
Message:

Revise cbc build process for better control of solvers included in build
(COIN_USE_XXX -> CBC_USE_XXX). Add CbcEventHandler? for independence from
clp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r173 r277  
    33# - Makefile.Cbc
    44
     5# Define variables here to select the solvers that you want to incorporate into
     6# the cbc build. Be sure that the solvers are available and that the
     7# information in Makefile.location is correct for all selected solvers.
     8# Check Makefile.Cbc to specify the optimisation level of the build.
     9
     10# Compile-time configuration for Cbc. There are basically two options:
     11# (1)
     12# Build cbc to use only clp as the underlying lp solver. This is the most
     13# efficient configuration if you wish to take full advantage of capabilities
     14# supported by clp but not available through the standard OSI interface, and
     15# you have no interest in experimenting with other solvers.
     16# (2)
     17# Build cbc so that it can use some mix of one or more OSI solvers, not
     18# necessarily including clp. Use this option if you want to experiment with
     19# other solvers.
     20
     21# To specify a solver, add the name to the list here. Use the name given in
     22# Makefile.location, without the COIN_lib prefix, e.g., Clp, Cpx, Dylp, Glpk,
     23# etc. The default build uses Clp only. To use Clp and Dylp, you would say
     24# CBC_SOLVERS := Clp Dylp
     25
     26CBC_SOLVERS := Clp
     27
     28# Regardless of the number of solvers specified, it's a good idea to set the
     29# default solver. (All right, the real reason is it'll take too long to explain
     30# what happens if you don't. Check the code in CbcMain if you must know.)
     31# This must match one of the solver names given above, but all in lower case
     32# letters (don't ask).
     33
     34cbcDefaultSolver := clp
     35
    536###############################################################################
     37
     38# Bring on the boilerplate. Makefile.coin will bring in Makefile.<O/S> and
     39# Makefile.location.
    640
    741export CoinDir := $(shell cd ..; pwd)
    842export MakefileDir := $(CoinDir)/Makefiles
    943include ${MakefileDir}/Makefile.coin
    10 include ${MakefileDir}/Makefile.location
     44
     45# First check that all solvers specified by the user have been configured in
     46# Makefile.location.
     47
     48cbcMissingSolvers := $(filter-out \
     49        $(patsubst COIN_libOsi%,%,$(CoinLibsDefined)),$(CBC_SOLVERS))
     50
     51ifneq ($(cbcMissingSolvers),)
     52  $(foreach solver,$(cbcMissingSolvers), \
     53    $(warning $(solver) is not configured in Makefiles/Makefile.location.) \
     54    $(warning Probably the line 'CoinLibsDefined += COIN_lib$(solver)' is \
     55      commented out))
     56  $(error Please correct Makefile.location and try again.)
     57endif
     58
     59# Figure out the configuration based on the value of CBC_SOLVERS. We need to
     60# generate appropriate defines for the compilation command.
     61
     62CBC_DEFINES :=
     63
     64ifeq ($(CBC_SOLVERS),Clp)
     65  CBC_ONLY_CLP := 1
     66  CBC_DEFINES := CBC_ONLY_CLP CBC_USE_CLP
     67else
     68  CBC_ONLY_CLP := 0
     69  CBC_DEFINES := $(foreach solver,$(CBC_SOLVERS), \
     70      $(patsubst COIN_HAS_%,CBC_USE_%,\
     71        $(filter COIN_HAS_%,$($(solver)Define))))
     72endif
     73CBC_DEFINES += CBC_DEFAULT_SOLVER="\"$(cbcDefaultSolver)\""
     74export CBC_ONLY_CLP
     75export CBC_DEFINES
     76export CBC_SOLVERS
     77
     78$(warning CBC_DEFINES is $(CBC_DEFINES))
     79
     80$(warning Building cbc with solvers $(CBC_SOLVERS))
     81
     82# Pull together the full dependency list for cbc. You can't build cbc without
     83# the Coin, Osi, and Cgl libraries. Add Coin and Osi later, for technical
     84# reasons.
     85
     86libTgts := Cgl
     87
     88# This makefile fronts for two main programs down in the Test directory, cbc
     89# and solve. solve will always want OsiClp and Vol (note: not OsiVol). Add them
     90# here, if they're not already in CBC_SOLVERS, and add the list from
     91# CBC_SOLVERS.
     92
     93libTgts += $(filter-out $(CBC_SOLVERS),Vol)
     94libTgts += $(patsubst %,Osi%,$(CBC_SOLVERS))
     95libTgts += $(filter-out $(libTgts),OsiClp)
     96
     97# Relocate the OsiXXX targets to the Osi directory, then prepend Coin and Osi.
     98
     99libTgts := Coin Osi $(patsubst Osi%,Osi/Osi%,$(libTgts))
     100
     101$(warning Complete dependency list is $(libTgts))
    11102
    12103###############################################################################
     
    14105.DELETE_ON_ERROR:
    15106
    16 .PHONY: default install clean library unitTest solver solve libdepend libCbc doc
     107.PHONY: default install clean library unitTest cbc solver solve \
     108        libdepend libCbc doc
    17109
    18110default: install
     
    21113libCbc: library
    22114
     115ifneq ($(filter COIN_libOsiCbc,$(CoinLibsDefined)),)
     116        (cd $(CoinDir)/Osi/OsiCbc && $(MAKE) -f Makefile.lightweight install)
     117endif
     118
    23119install library: libdepend
    24120        ${MAKE} -f Makefile.Cbc $@
    25121
    26 # Uncomment below to build OsiDylp
     122# Build the dependencies. OsiCbc is its own strange animal, pick it off
     123# separately.
    27124
    28125libdepend:
    29         (cd $(CoinDir)/Coin && $(MAKE) install)
    30         (cd $(CoinDir)/Clp && $(MAKE) install)
    31 ifeq ($(VolDefine),COIN_HAS_VOL)
    32         (cd $(CoinDir)/Vol && $(MAKE) install)
    33 endif
    34 ifneq ($(filter COIN_libOsiClp,$(CoinLibsDefined)),)
    35         (cd $(CoinDir)/Osi/OsiClp && $(MAKE) install)
    36 endif
     126        $(foreach tgt,$(libTgts),(cd $(CoinDir)/$(tgt) && $(MAKE) install) ; )
    37127ifneq ($(filter COIN_libOsiCbc,$(CoinLibsDefined)),)
    38128        (cd $(CoinDir)/Osi/OsiCbc && $(MAKE) -f Makefile.lightweight install)
    39129endif
    40 #       (cd $(CoinDir)/Osi/OsiDylp && $(MAKE) install)
    41         (cd $(CoinDir)/Cgl && $(MAKE) install)
    42130
    43 unitTest:
     131unitTest cbc:
    44132        (cd Test && ${MAKE} unitTest)
    45133
     
    58146        @rm -rf Test/dep
    59147        @rm -f cbc
     148        @rm -f solve
    60149
    61150doc:
Note: See TracChangeset for help on using the changeset viewer.