diff --git a/.gitignore b/.gitignore index ce9726d..2282d38 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,6 @@ _deps .ionide # End of https://www.toptal.com/developers/gitignore/api/c,c++,cmake,visualstudiocode + +build/* +.cache/* \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5a677f8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,72 @@ +cmake_minimum_required(VERSION 3.21 FATAL_ERROR) + +project(minisat) +set(CMAKE_CXX_STANDARD 11) + +#-------------------------------------------------------------------------------------------------- +# Configurable options: + +option(STATIC_BINARIES "Link binaries statically." ON) +option(USE_SORELEASE "Use SORELEASE in shared library filename." ON) + +#-------------------------------------------------------------------------------------------------- +# Library version: + +set(MINISAT_SOMAJOR 1) +set(MINISAT_SOMINOR 14) +set(MINISAT_SORELEASE "P") + +# Compute VERSION and SOVERSION: +if (USE_SORELEASE) + set(MINISAT_VERSION ${MINISAT_SOMAJOR}.${MINISAT_SOMINOR}.${MINISAT_SORELEASE}) +else() + set(MINISAT_VERSION ${MINISAT_SOMAJOR}.${MINISAT_SOMINOR}) +endif() +set(MINISAT_SOVERSION ${MINISAT_SOMAJOR}) + +#-------------------------------------------------------------------------------------------------- +# Dependencies: + +find_package(ZLIB) +include_directories(${ZLIB_INCLUDE_DIR}) +include_directories(${minisat_SOURCE_DIR}) + +#-------------------------------------------------------------------------------------------------- +# Compile flags: + +add_definitions(-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS) + +#-------------------------------------------------------------------------------------------------- +# Build Targets: + +add_subdirectory(src) + +target_link_libraries(minisat-lib-shared ${ZLIB_LIBRARY}) +target_link_libraries(minisat-lib-static ${ZLIB_LIBRARY}) + +add_executable(minisat_core src/Main.C) + +if(STATIC_BINARIES) + target_link_libraries(minisat_core minisat-lib-static) +else() + target_link_libraries(minisat_core minisat-lib-shared) +endif() + +set_target_properties(minisat-lib-static PROPERTIES OUTPUT_NAME "minisat") +set_target_properties(minisat-lib-shared + PROPERTIES + OUTPUT_NAME "minisat" + VERSION ${MINISAT_VERSION} + SOVERSION ${MINISAT_SOVERSION}) + +#-------------------------------------------------------------------------------------------------- +# Installation targets: + +install(TARGETS minisat-lib-static minisat-lib-shared minisat_core + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(DIRECTORY src + DESTINATION include/minisat + FILES_MATCHING PATTERN "*.h") \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..16b7e59 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,12 @@ +include_directories(./) +include_directories(../lib/minisat/minisat/core/) + +file( + GLOB MINISAT_LIB_SOURCES + "File.C" + "Proof.C" + "Solver.C" +) + +add_library(minisat-lib-static STATIC ${MINISAT_LIB_SOURCES}) +add_library(minisat-lib-shared SHARED ${MINISAT_LIB_SOURCES}) diff --git a/File.C b/src/File.C similarity index 100% rename from File.C rename to src/File.C diff --git a/File.h b/src/File.h similarity index 100% rename from File.h rename to src/File.h diff --git a/Global.h b/src/Global.h similarity index 100% rename from Global.h rename to src/Global.h diff --git a/Heap.h b/src/Heap.h similarity index 100% rename from Heap.h rename to src/Heap.h diff --git a/Main.C b/src/Main.C similarity index 100% rename from Main.C rename to src/Main.C diff --git a/Makefile b/src/Makefile similarity index 100% rename from Makefile rename to src/Makefile diff --git a/Proof.C b/src/Proof.C similarity index 100% rename from Proof.C rename to src/Proof.C diff --git a/Proof.h b/src/Proof.h similarity index 100% rename from Proof.h rename to src/Proof.h diff --git a/Solver.C b/src/Solver.C similarity index 100% rename from Solver.C rename to src/Solver.C diff --git a/Solver.h b/src/Solver.h similarity index 100% rename from Solver.h rename to src/Solver.h diff --git a/SolverTypes.h b/src/SolverTypes.h similarity index 100% rename from SolverTypes.h rename to src/SolverTypes.h diff --git a/Sort.h b/src/Sort.h similarity index 100% rename from Sort.h rename to src/Sort.h diff --git a/VarOrder.h b/src/VarOrder.h similarity index 100% rename from VarOrder.h rename to src/VarOrder.h