Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 84 lines (62 sloc) 2.784 kb
d5b3bf1 @niklasso Added new CMake build system.
niklasso authored
1 cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
2
3 project(minisat)
4
5 #--------------------------------------------------------------------------------------------------
6 # Configurable options:
7
8 option(STATIC_BINARIES "Link binaries statically." ON)
9 option(USE_SORELEASE "Use SORELEASE in shared library filename." ON)
10
11 #--------------------------------------------------------------------------------------------------
12 # Library version:
13
14 set(MINISAT_SOMAJOR 2)
15 set(MINISAT_SOMINOR 1)
16 set(MINISAT_SORELEASE 0)
17
18 # Compute VERSION and SOVERSION:
19 if (USE_SORELEASE)
20 set(MINISAT_VERSION ${MINISAT_SOMAJOR}.${MINISAT_SOMINOR}.${MINISAT_SORELEASE})
21 else()
22 set(MINISAT_VERSION ${MINISAT_SOMAJOR}.${MINISAT_SOMINOR})
23 endif()
24 set(MINISAT_SOVERSION ${MINISAT_SOMAJOR})
25
26 #--------------------------------------------------------------------------------------------------
27 # Dependencies:
28
29 find_package(ZLIB)
30 include_directories(${ZLIB_INCLUDE_DIR})
31 include_directories(${minisat_SOURCE_DIR})
32
33 #--------------------------------------------------------------------------------------------------
34 # Compile flags:
35
36 add_definitions(-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS)
37
38 #--------------------------------------------------------------------------------------------------
39 # Build Targets:
40
41 set(MINISAT_LIB_SOURCES
42 minisat/utils/Options.cc
43 minisat/utils/System.cc
44 minisat/core/Solver.cc
45 minisat/simp/SimpSolver.cc)
46
47 add_library(minisat-lib-static STATIC ${MINISAT_LIB_SOURCES})
48 add_library(minisat-lib-shared SHARED ${MINISAT_LIB_SOURCES})
49
50 target_link_libraries(minisat-lib-shared ${ZLIB_LIBRARY})
51 target_link_libraries(minisat-lib-static ${ZLIB_LIBRARY})
52
53 add_executable(minisat_core minisat/core/Main.cc)
54 add_executable(minisat_simp minisat/simp/Main.cc)
55
56 if(STATIC_BINARIES)
57 target_link_libraries(minisat_core minisat-lib-static)
58 target_link_libraries(minisat_simp minisat-lib-static)
59 else()
60 target_link_libraries(minisat_core minisat-lib-shared)
61 target_link_libraries(minisat_simp minisat-lib-shared)
62 endif()
63
64 set_target_properties(minisat-lib-static PROPERTIES OUTPUT_NAME "minisat")
65 set_target_properties(minisat-lib-shared
66 PROPERTIES
67 OUTPUT_NAME "minisat"
68 VERSION ${MINISAT_VERSION}
69 SOVERSION ${MINISAT_SOVERSION})
70
71 set_target_properties(minisat_simp PROPERTIES OUTPUT_NAME "minisat")
72
73 #--------------------------------------------------------------------------------------------------
74 # Installation targets:
75
76 install(TARGETS minisat-lib-static minisat-lib-shared minisat_core minisat_simp
77 RUNTIME DESTINATION bin
78 LIBRARY DESTINATION lib
79 ARCHIVE DESTINATION lib)
80
81 install(DIRECTORY minisat/mtl minisat/utils minisat/core minisat/simp
82 DESTINATION include/minisat
83 FILES_MATCHING PATTERN "*.h")
Something went wrong with that request. Please try again.