|
| 1 | +cmake_minimum_required( VERSION 2.8 ) |
| 2 | + |
| 3 | +project( Heinz ) |
| 4 | + |
| 5 | +set( BK_MaxFlow_Hdr |
| 6 | + src/externlib/maxflow-v3.01/graph.h |
| 7 | + src/externlib/maxflow-v3.01/block.h |
| 8 | +) |
| 9 | + |
| 10 | +set( Heinz_Hdr |
| 11 | + src/parser/parser.h |
| 12 | + src/parser/mwcsparser.h |
| 13 | + src/parser/stpparser.h |
| 14 | + src/parser/stppcstparser.h |
| 15 | + src/parser/identityparser.h |
| 16 | + src/parser/dimacsparser.h |
| 17 | + src/preprocessing/rule.h |
| 18 | + src/preprocessing/negdeg01.h |
| 19 | + src/preprocessing/negedge.h |
| 20 | + src/preprocessing/posedge.h |
| 21 | + src/preprocessing/negcircuit.h |
| 22 | + src/preprocessing/negdiamond.h |
| 23 | + src/preprocessing/negmirroredhubs.h |
| 24 | + src/preprocessing/negdominatedhubs.h |
| 25 | + src/preprocessing/posdeg01.h |
| 26 | + src/preprocessing/posdiamond.h |
| 27 | + src/preprocessing/shortestpath.h |
| 28 | + src/solver/spqrtree.h |
| 29 | + src/solver/blockcuttree.h |
| 30 | + src/mwcs.h |
| 31 | + src/analysis.h |
| 32 | + src/solver/enumsolverunrooted.h |
| 33 | + src/solver/impl/solverimpl.h |
| 34 | + src/solver/impl/solverunrootedimpl.h |
| 35 | + src/solver/impl/solverrootedimpl.h |
| 36 | + src/solver/solver.h |
| 37 | + src/solver/solverunrooted.h |
| 38 | + src/solver/solverrooted.h |
| 39 | + src/solver/impl/treesolverimpl.h |
| 40 | + src/solver/impl/treesolverunrootedimpl.h |
| 41 | + src/solver/impl/treesolverrootedimpl.h |
| 42 | + src/solver/impl/cplex_incumbent/incumbent.h |
| 43 | + src/solver/impl/cplex_incumbent/pcstincumbent.h |
| 44 | + src/solver/impl/cplex_cut/backoff.h |
| 45 | + src/solver/impl/cplex_cut/nodecut.h |
| 46 | + src/solver/impl/cplex_cut/nodecutuser.h |
| 47 | + src/solver/impl/cplex_cut/nodecutlazy.h |
| 48 | + src/solver/impl/cplex_cut/nodecutrooted.h |
| 49 | + src/solver/impl/cplex_cut/nodecutunrooted.h |
| 50 | + src/solver/impl/cplex_cut/bk_alg.h |
| 51 | + src/solver/impl/cplexsolverimpl.h |
| 52 | + src/solver/impl/cutsolverrootedimpl.h |
| 53 | + src/solver/impl/cutsolverunrootedimpl.h |
| 54 | + src/solver/impl/cplex_heuristic/heuristicrooted.h |
| 55 | + src/solver/impl/cplex_heuristic/heuristicunrooted.h |
| 56 | + src/solver/impl/cplex_branch/branch.h |
| 57 | + src/mwcsgraph.h |
| 58 | + src/mwcspreprocessedgraph.h |
| 59 | + src/utils.h |
| 60 | + src/mwcsgraphparser.h |
| 61 | +) |
| 62 | + |
| 63 | +set( Heinz_Src |
| 64 | + src/utils.cpp |
| 65 | +) |
| 66 | + |
| 67 | +set( Heinz_Monte_Carlo_Hdr |
| 68 | + src/solver/impl/treeheuristicsolverimpl.h |
| 69 | + src/solver/impl/treeheuristicsolverrootedimpl.h |
| 70 | + src/solver/impl/treeheuristicsolverunrootedimpl.h |
| 71 | +) |
| 72 | + |
| 73 | +set( Heinz_Monte_Carlo_Src |
| 74 | + src/utils.cpp |
| 75 | +) |
| 76 | + |
| 77 | +set( Heinz_Print_Graph_Src |
| 78 | + src/printgraph.cpp |
| 79 | + src/utils.cpp |
| 80 | + src/colorcoding/ColorCoding.cpp src/colorcoding/ColorCoding.h src/colorcoding/Vertex.cpp src/colorcoding/Vertex.h src/colorcoding/ColorSet.cpp src/colorcoding/ColorSet.h src/colorcoding/Vertices.cpp src/colorcoding/Vertices.h src/colorcoding/ColorCodingUnrooted.cpp src/colorcoding/ColorCodingUnrooted.h src/colorcoding/ColorCodingRooted.h src/colorcoding/ColorCodingRooted.cpp src/colorcoding/ColorCodingBlockCut.cpp src/colorcoding/ColorCodingBlockCut.h src/colorcoding/CcUnrooted.h src/colorcoding/CcAdapter.h src/colorcoding/CcRooted.h src/colorcoding/CcBlockcut.cpp src/colorcoding/CcBlockcut.h) |
| 81 | + |
| 82 | +set( GitCommand1 "symbolic-ref HEAD 2> /dev/null | cut -b 12-" ) |
| 83 | +execute_process( COMMAND git symbolic-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
| 84 | + COMMAND tail -c -7 COMMAND tr -d "\\n" OUTPUT_VARIABLE GitBranch ) |
| 85 | +set( GitCommand2 "log --pretty=format:\\\"%h\\\" -1" ) |
| 86 | +execute_process( COMMAND git log --pretty=format:%h WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
| 87 | + COMMAND head -n 1 COMMAND tr -d "\\n" OUTPUT_VARIABLE GitHashtag ) |
| 88 | +set( HEINZ_VERSION \"${GitBranch}-${GitHashtag}\" ) |
| 89 | + |
| 90 | +set( LIBOGDF_ROOT "$ENV{HOME}/ogdf" CACHE PATH "Additional search directory for OGDF library" ) |
| 91 | +set( LIBLEMON_ROOT "$ENV{HOME}/lemon/" CACHE PATH "Additional search directory for lemon library" ) |
| 92 | + |
| 93 | +set( MEMORY_LIMIT 10240 CACHE STRING "Memory limit in MB" ) |
| 94 | + |
| 95 | +if( NOT CPLEX_INC_DIR OR NOT CPLEX_LIB_DIR OR NOT CONCERT_INC_DIR OR NOT CONCERT_LIB_DIR ) |
| 96 | + set( CPLEX_AUTODETECTION_PREFIXES "$ENV{HOME}/ILOG;/opt/ibm/ILOG;$ENV{HOME}/Applications/IBM/ILOG" CACHE STRING "CPLEX automatic lookup directories" ) |
| 97 | + foreach( CplexInstallPrefix ${CPLEX_AUTODETECTION_PREFIXES} ) |
| 98 | + file( GLOB_RECURSE CplexLibraryPaths ${CplexInstallPrefix}/*/cplex/lib/*/libcplex.a ) |
| 99 | + if( CplexLibraryPaths ) |
| 100 | + list( LENGTH CplexLibraryPaths NumPath ) |
| 101 | + if( NumPath GREATER 1 ) |
| 102 | + message( WARNING "Found multiple CPLEX installations in ${CplexInstallPrefix}, automatically selecting the first one, please set {CPLEX|CONCERT}_{INC|LIB}_DIR manually if this is not the right selection" ) |
| 103 | + else() |
| 104 | + message( "Found CPLEX's installation in ${CPlexInstallPrefix}" ) |
| 105 | + endif() |
| 106 | + list( GET CplexLibraryPaths 0 CplexLibraryPath ) |
| 107 | + |
| 108 | + set( MyRegex "${CplexInstallPrefix}/(.*)/cplex/?/lib/(.*)/libcplex.a" ) |
| 109 | + string( REGEX MATCH "${MyRegex}" ValidatedCplexLibPath ${CplexLibraryPath} ) |
| 110 | + if( NOT ValidatedCplexLibPath ) |
| 111 | + message( WARNING "Unable to recognize ${CplexLibraryPath} as a valid CPLEX path" ) |
| 112 | + else() |
| 113 | + string( REGEX REPLACE "${MyRegex}" "\\1" CplexHome ${ValidatedCplexLibPath} ) |
| 114 | + string( REGEX REPLACE "${MyRegex}" "\\2" CplexArch ${ValidatedCplexLibPath} ) |
| 115 | + |
| 116 | + set( CPLEX_INC_DIR "${CplexInstallPrefix}/${CplexHome}/cplex/include" CACHE PATH "CPLEX's include dir" ) |
| 117 | + set( CPLEX_LIB_DIR "${CplexInstallPrefix}/${CplexHome}/cplex/lib/${CplexArch}" CACHE PATH "CPLEX's library dir" ) |
| 118 | + set( CONCERT_INC_DIR "${CplexInstallPrefix}/${CplexHome}/concert/include" CACHE PATH "Concert's include dir" ) |
| 119 | + set( CONCERT_LIB_DIR "${CplexInstallPrefix}/${CplexHome}/concert/lib/${CplexArch}" CACHE PATH "Concert's library dir" ) |
| 120 | + |
| 121 | + break() |
| 122 | + endif() |
| 123 | + else() |
| 124 | + message( "Unable to find CPLEX and Concert installation in ${CplexInstallPrefix}" ) |
| 125 | + endif() |
| 126 | + endforeach() |
| 127 | + |
| 128 | + if( NOT CPLEX_INC_DIR OR NOT CPLEX_LIB_DIR OR NOT CONCERT_INC_DIR OR NOT CONCERT_LIB_DIR ) |
| 129 | + message( "Unable to autodeted CPLEX's and Concert's installation directories, please set {CPLEX|CONCERT}_{INC|LIB}_DIR manually" ) |
| 130 | + else() |
| 131 | + message( "Autodetected CPLEX's include dir : ${CPLEX_INC_DIR}" ) |
| 132 | + message( "Autodetected CPLEX's library dir : ${CPLEX_LIB_DIR}" ) |
| 133 | + message( "Autodetected Concert's include dir : ${CONCERT_INC_DIR}" ) |
| 134 | + message( "Autodetected Concert's library dir : ${CONCERT_LIB_DIR}" ) |
| 135 | + endif() |
| 136 | +endif() |
| 137 | + |
| 138 | +if(NOT CMAKE_BUILD_TYPE) |
| 139 | + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: Debug Release Profile" FORCE) |
| 140 | +endif(NOT CMAKE_BUILD_TYPE) |
| 141 | + |
| 142 | +SET(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++") |
| 143 | +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Wno-unknown-pragmas -g -ggdb -O0 -DDEBUG -DVERBOSE") |
| 144 | +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wno-long-long -Wno-unused-parameter -Wno-unknown-pragmas -O3 -DNDEBUG") |
| 145 | +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Wno-unknown-pragmas -O3 -g -ggdb -DNDEBUG") |
| 146 | + |
| 147 | +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-write-strings -Wno-unused-variable" ) |
| 148 | +add_definitions( -DIL_STD ) |
| 149 | +configure_file( src/config.h.in ${PROJECT_SOURCE_DIR}/src/config.h ) |
| 150 | + |
| 151 | +if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) |
| 152 | + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ " ) |
| 153 | +endif() |
| 154 | + |
| 155 | + |
| 156 | +include_directories( ${CPLEX_INC_DIR} ${CONCERT_INC_DIR} "${LIBLEMON_ROOT}/include" "${LIBOGDF_ROOT}/include" "src" "src/externlib" ) |
| 157 | +link_directories( ${CPLEX_LIB_DIR} ${CONCERT_LIB_DIR} "${LIBLEMON_ROOT}/lib" "${LIBOGDF_ROOT}/lib" ) |
| 158 | + |
| 159 | +set( CommonLibs |
| 160 | + m |
| 161 | + ilocplex |
| 162 | + cplex |
| 163 | + concert |
| 164 | + pthread |
| 165 | + emon |
| 166 | + OGDF |
| 167 | +) |
| 168 | + |
| 169 | +add_executable( heinz-mc EXCLUDE_FROM_ALL src/mwcs-mc.cpp ${Heinz_Monte_Carlo_Src} ${Heinz_Monte_Carlo_Hdr} ${Heinz_Hdr} ) |
| 170 | +target_link_libraries( heinz-mc emon OGDF pthread ) |
| 171 | + |
| 172 | +add_executable( heinz src/mwcs.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 173 | +target_link_libraries( heinz ${CommonLibs} ) |
| 174 | + |
| 175 | +add_executable( heinz_mwcs_mc src/dimacs/heinz_mwcs_mc.cpp ${Heinz_Monte_Carlo_Src} ${Heinz_Monte_Carlo_Hdr} ${Heinz_Hdr} ) |
| 176 | +target_link_libraries( heinz_mwcs_mc emon OGDF pthread ) |
| 177 | + |
| 178 | +add_executable( heinz_mwcs_dc src/dimacs/heinz_mwcs_dc.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 179 | +target_link_libraries( heinz_mwcs_dc ${CommonLibs} ) |
| 180 | + |
| 181 | +add_executable( heinz_mwcs_no_dc src/dimacs/heinz_mwcs_no_dc.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 182 | +target_link_libraries( heinz_mwcs_no_dc ${CommonLibs} ) |
| 183 | + |
| 184 | +add_executable( heinz_mwcs_no_pre src/dimacs/heinz_mwcs_no_pre.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 185 | +target_link_libraries( heinz_mwcs_no_pre ${CommonLibs} ) |
| 186 | + |
| 187 | +add_executable( heinz_pcst_mc src/dimacs/heinz_pcst_mc.cpp ${Heinz_Monte_Carlo_Src} ${Heinz_Monte_Carlo_Hdr} ${Heinz_Hdr} ) |
| 188 | +target_link_libraries( heinz_pcst_mc emon OGDF pthread ) |
| 189 | + |
| 190 | +add_executable( heinz_pcst_dc src/dimacs/heinz_pcst_dc.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 191 | +target_link_libraries( heinz_pcst_dc ${CommonLibs} ) |
| 192 | + |
| 193 | +add_executable( heinz_pcst_no_dc src/dimacs/heinz_pcst_no_dc.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 194 | +target_link_libraries( heinz_pcst_no_dc ${CommonLibs} ) |
| 195 | + |
| 196 | +add_executable( heinz_pcst_no_pre src/dimacs/heinz_pcst_no_pre.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 197 | +target_link_libraries( heinz_pcst_no_pre ${CommonLibs} ) |
| 198 | + |
| 199 | +add_executable( heinz_rpcst_mc src/dimacs/heinz_rpcst_mc.cpp ${Heinz_Monte_Carlo_Src} ${Heinz_Monte_Carlo_Hdr} ${Heinz_Hdr} ) |
| 200 | +target_link_libraries( heinz_rpcst_mc emon OGDF pthread ) |
| 201 | + |
| 202 | +add_executable( heinz_rpcst_no_dc src/dimacs/heinz_rpcst_no_dc.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 203 | +target_link_libraries( heinz_rpcst_no_dc ${CommonLibs} ) |
| 204 | + |
| 205 | +add_executable( heinz_rpcst_no_pre src/dimacs/heinz_rpcst_no_pre.cpp ${Heinz_Src} ${Heinz_Hdr} ) |
| 206 | +target_link_libraries( heinz_rpcst_no_pre ${CommonLibs} ) |
| 207 | + |
| 208 | +add_executable( print EXCLUDE_FROM_ALL ${Heinz_Print_Graph_Src} ${Heinz_Hdr} ${CommonObjs} ) |
| 209 | +target_link_libraries( print emon OGDF pthread ) |
| 210 | + |
| 211 | +add_executable( check_mwcs_solution EXCLUDE_FROM_ALL src/dimacs/check_mwcs_solution.cpp src/utils.cpp ) |
| 212 | +target_link_libraries( check_mwcs_solution emon OGDF pthread ) |
| 213 | + |
| 214 | +add_executable( check_pcst_solution EXCLUDE_FROM_ALL src/dimacs/check_pcst_solution.cpp src/utils.cpp ) |
| 215 | +target_link_libraries( check_pcst_solution emon OGDF pthread ) |
| 216 | + |
| 217 | +enable_testing() |
| 218 | +add_test( heinz_mwcs_no_dc ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_mwcs_no_dc ./check_mwcs_solution ${PROJECT_SOURCE_DIR}/test/lymphoma.stp lymphoma.dimacs ) |
| 219 | +add_test( heinz_mwcs_dc ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_mwcs_dc ./check_mwcs_solution ${PROJECT_SOURCE_DIR}/test/lymphoma.stp lymphoma.dimacs ) |
| 220 | +add_test( heinz_mwcs_no_pre ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_mwcs_no_pre ./check_mwcs_solution ${PROJECT_SOURCE_DIR}/test/lymphoma.stp lymphoma.dimacs ) |
| 221 | +add_test( heinz_mwcs_mc ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_mwcs_mc ./check_mwcs_solution ${PROJECT_SOURCE_DIR}/test/lymphoma.stp lymphoma.dimacs ) |
| 222 | +add_test( heinz_pcst_no_dc ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_pcst_no_dc ./check_pcst_solution ${PROJECT_SOURCE_DIR}/test/i640-003.stp i640-003.dimacs ) |
| 223 | +add_test( heinz_pcst_dc ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_pcst_dc ./check_pcst_solution ${PROJECT_SOURCE_DIR}/test/i640-003.stp i640-003.dimacs ) |
| 224 | +add_test( heinz_pcst_no_pre ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_pcst_no_pre ./check_pcst_solution ${PROJECT_SOURCE_DIR}/test/i640-003.stp i640-003.dimacs ) |
| 225 | +add_test( heinz_pcst_mc ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_pcst_mc ./check_pcst_solution ${PROJECT_SOURCE_DIR}/test/i640-003.stp i640-003.dimacs ) |
| 226 | +add_test( heinz_rpcst_no_dc ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_rpcst_no_dc ./check_pcst_solution ${PROJECT_SOURCE_DIR}/test/i101M2.stp i101M2.dimacs ) |
| 227 | +add_test( heinz_rpcst_no_pre ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_rpcst_no_pre ./check_pcst_solution ${PROJECT_SOURCE_DIR}/test/i101M2.stp i101M2.dimacs ) |
| 228 | +add_test( heinz_rpcst_mc ${PROJECT_SOURCE_DIR}/test/run.py ./heinz_rpcst_mc ./check_pcst_solution ${PROJECT_SOURCE_DIR}/test/i101M2.stp i101M2.dimacs ) |
| 229 | +add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS |
| 230 | + check_mwcs_solution |
| 231 | + check_pcst_solution |
| 232 | + heinz_pcst_dc |
| 233 | + heinz_pcst_mc |
| 234 | + heinz_pcst_no_dc |
| 235 | + heinz_pcst_no_pre |
| 236 | + heinz_rpcst_mc |
| 237 | + heinz_rpcst_no_dc |
| 238 | + heinz_rpcst_no_pre |
| 239 | + heinz_mwcs_dc |
| 240 | + heinz_mwcs_mc |
| 241 | + heinz_mwcs_no_dc |
| 242 | + heinz_mwcs_no_pre |
| 243 | +) |
0 commit comments