Make Dimacs a header only library
- Remove special case in Makefile rules
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
// Copyright 2010-2018 Google LLC
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "examples/cpp/parse_dimacs_assignment.h"
|
||||
|
||||
#include "ortools/base/commandlineflags.h"
|
||||
|
||||
DEFINE_bool(assignment_maximize_cost, false,
|
||||
"Negate costs so a max-cost assignment is found.");
|
||||
DEFINE_bool(assignment_optimize_layout, true,
|
||||
"Optimize graph layout for speed.");
|
||||
@@ -32,8 +32,10 @@
|
||||
#include "ortools/graph/ebert_graph.h"
|
||||
#include "ortools/graph/linear_assignment.h"
|
||||
|
||||
DECLARE_bool(assignment_maximize_cost);
|
||||
DECLARE_bool(assignment_optimize_layout);
|
||||
DEFINE_bool(assignment_maximize_cost, false,
|
||||
"Negate costs so a max-cost assignment is found.");
|
||||
DEFINE_bool(assignment_optimize_layout, true,
|
||||
"Optimize graph layout for speed.");
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
|
||||
@@ -292,36 +292,6 @@ endif
|
||||
##################################
|
||||
## CPP Tests/Examples/Samples ##
|
||||
##################################
|
||||
# DIMACS Assignment challenge problem format library
|
||||
DIMACS_LIBS = $(LIB_DIR)/$(LIB_PREFIX)dimacs.$L
|
||||
DIMACS_PATH = $(subst /,$S,$(DIMACS_LIBS))
|
||||
DIMACS_DEPS = \
|
||||
$(CC_EX_DIR)/parse_dimacs_assignment.h \
|
||||
$(CC_EX_DIR)/print_dimacs_assignment.h \
|
||||
$(GRAPH_DEPS)
|
||||
DIMACS_LNK = $(PRE_LIB)dimacs$(POST_LIB) $(OR_TOOLS_LNK)
|
||||
ifeq ($(PLATFORM),MACOSX)
|
||||
DIMACS_LDFLAGS = -install_name @rpath/$(LIB_PREFIX)dimacs.$L #
|
||||
endif
|
||||
dimacslibs: $(DIMACS_LIBS)
|
||||
|
||||
DIMACS_OBJS = $(OBJ_DIR)/parse_dimacs_assignment.$O $(OBJ_DIR)/print_dimacs_assignment.$O
|
||||
|
||||
$(DIMACS_LIBS): $(OR_TOOLS_LIBS) $(DIMACS_OBJS) | $(LIB_DIR)
|
||||
$(LINK_CMD) \
|
||||
$(DIMACS_LDFLAGS) \
|
||||
$(LD_OUT)$(LIB_DIR)$S$(LIB_PREFIX)dimacs.$L \
|
||||
$(DIMACS_OBJS) \
|
||||
$(OR_TOOLS_LNK) \
|
||||
$(OR_TOOLS_LDFLAGS)
|
||||
|
||||
# DIMACS examples
|
||||
$(OBJ_DIR)/dimacs_assignment.$O: $(CC_EX_DIR)/dimacs_assignment.cc $(OR_TOOLS_LIBS) | $(OBJ_DIR)
|
||||
$(CCC) $(CFLAGS) -c $(CC_EX_PATH)$Sdimacs_assignment.cc $(OBJ_OUT)$(OBJ_DIR)$Sdimacs_assignment.$O
|
||||
|
||||
$(BIN_DIR)/dimacs_assignment$E: $(OBJ_DIR)/dimacs_assignment.$O $(DIMACS_LIBS) | $(BIN_DIR)
|
||||
$(CCC) $(CFLAGS) $(OBJ_DIR)$Sdimacs_assignment.$O $(DIMACS_LNK) $(OR_TOOLS_LDFLAGS) $(EXE_OUT)$(BIN_DIR)$Sdimacs_assignment$E
|
||||
|
||||
# Frequency Assignment Problem (FAP) challenge problem format library
|
||||
FAP_LIBS = $(LIB_DIR)/$(LIB_PREFIX)fap.$L
|
||||
FAP_PATH = $(subst /,$S,$(FAP_LIBS))
|
||||
|
||||
@@ -69,7 +69,6 @@ ifeq ($(SYSTEM),unix)
|
||||
PRE_LIB = -Llib -Llib64
|
||||
CBC_LNK = -lCbcSolver -lCbc -lOsiCbc -lCgl -lClpSolver -lClp -lOsiClp -lOsi -lCoinUtils
|
||||
OR_TOOLS_LNK = $(PRE_LIB) -lprotobuf -lglog -lgflags $(CBC_LNK) -lortools
|
||||
DIMACS_LNK = $(PRE_LIB) -ldimacs -lglog -lgflags $(CBC_LNK) -lortools
|
||||
FAP_LNK = $(PRE_LIB) -lfap -lglog -lgflags $(CBC_LNK) -lortools
|
||||
OBJ_OUT = -o #
|
||||
EXE_OUT = -o #
|
||||
@@ -127,7 +126,6 @@ ifeq ($(SYSTEM),win)
|
||||
LDFLAGS = psapi.lib ws2_32.lib
|
||||
LIB_PREFIX =
|
||||
OR_TOOLS_LNK = lib\\ortools.lib
|
||||
DIMACS_LNK = lib\\dimacs.lib lib\\ortools.lib
|
||||
FAP_LNK = lib\\fap.lib lib\\ortools.lib
|
||||
OBJ_OUT = /Fo
|
||||
EXE_OUT = /Fe
|
||||
@@ -153,7 +151,6 @@ ifeq ($(SYSTEM),win)
|
||||
endif # SYSTEM == win
|
||||
|
||||
OR_TOOLS_LIBS = $(LIB_DIR)/$(LIB_PREFIX)ortools$L
|
||||
DIMACS_LIBS = $(LIB_DIR)/$(LIB_PREFIX)dimacs$L
|
||||
FAP_LIBS = $(LIB_DIR)/$(LIB_PREFIX)fap$L
|
||||
|
||||
.PHONY: all
|
||||
@@ -316,9 +313,6 @@ $(OBJ_DIR)/%$O: $(CPP_EX_DIR)/%.cc | $(OBJ_DIR)
|
||||
$(BIN_DIR)/%$E: $(OBJ_DIR)/%$O
|
||||
$(CXX) $(CXXFLAGS) $(OBJ_DIR)$S$*$O $(OR_TOOLS_LNK) $(LDFLAGS) $(EXE_OUT)$(BIN_DIR)$S$*$E
|
||||
|
||||
$(BIN_DIR)/dimacs_assignment$E: $(OBJ_DIR)/dimacs_assignment$O
|
||||
$(CXX) $(CXXFLAGS) $(OBJ_DIR)$Sdimacs_assignment$O $(DIMACS_LNK) $(LDFLAGS) $(EXE_OUT)$(BIN_DIR)$Sdimacs_assignment$E
|
||||
|
||||
$(BIN_DIR)/frequency_assignment_problem$E: $(OBJ_DIR)/frequency_assignment_problem$O
|
||||
$(CXX) $(CXXFLAGS) $(OBJ_DIR)$Sfrequency_assignment_problem$O $(FAP_LNK) $(LDFLAGS) $(EXE_OUT)$(BIN_DIR)$Sfrequency_assignment_problem$E
|
||||
|
||||
@@ -329,7 +323,6 @@ detect_cc:
|
||||
@echo CXXFLAGS = $(CXXFLAGS)
|
||||
@echo LDFLAGS = $(LDFLAGS)
|
||||
@echo OR_TOOLS_LNK = $(OR_TOOLS_LNK)
|
||||
@echo DIMACS_LNK = $(DIMACS_LNK)
|
||||
@echo FAP_LNK = $(FAP_LNK)
|
||||
ifeq ($(SYSTEM),win)
|
||||
@echo off & echo(
|
||||
|
||||
Reference in New Issue
Block a user