Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: fix lib rule #25

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ project(minisat)
# Configurable options:

option(STATIC_BINARIES "Link binaries statically." ON)
option(BUILD_STATIC_LIBS "Build static library." ON)
option(USE_SORELEASE "Use SORELEASE in shared library filename." ON)

#--------------------------------------------------------------------------------------------------
Expand All @@ -23,6 +24,13 @@ else()
endif()
set(MINISAT_SOVERSION ${MINISAT_SOMAJOR})

# Reference specific library paths used during linking for install
if (POLICY CMP0042)
# Enable `MACOSX_RPATH` by default.
cmake_policy(SET CMP0042 NEW)
endif()
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

#--------------------------------------------------------------------------------------------------
# Dependencies:

Expand All @@ -44,11 +52,19 @@ set(MINISAT_LIB_SOURCES
minisat/core/Solver.cc
minisat/simp/SimpSolver.cc)

add_library(minisat-lib-static STATIC ${MINISAT_LIB_SOURCES})
add_library(minisat-lib-shared SHARED ${MINISAT_LIB_SOURCES})
if (BUILD_STATIC_LIBS OR STATIC_BINARIES)
add_library(minisat-lib-static STATIC ${MINISAT_LIB_SOURCES})
target_link_libraries(minisat-lib-static ${ZLIB_LIBRARY})
set_target_properties(minisat-lib-static PROPERTIES OUTPUT_NAME "minisat")
endif()

add_library(minisat-lib-shared SHARED ${MINISAT_LIB_SOURCES})
target_link_libraries(minisat-lib-shared ${ZLIB_LIBRARY})
target_link_libraries(minisat-lib-static ${ZLIB_LIBRARY})
set_target_properties(minisat-lib-shared
PROPERTIES
OUTPUT_NAME "minisat"
VERSION ${MINISAT_VERSION}
SOVERSION ${MINISAT_SOVERSION})

add_executable(minisat_core minisat/core/Main.cc)
add_executable(minisat_simp minisat/simp/Main.cc)
Expand All @@ -61,22 +77,22 @@ else()
target_link_libraries(minisat_simp 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})

set_target_properties(minisat_simp PROPERTIES OUTPUT_NAME "minisat")

#--------------------------------------------------------------------------------------------------
# Installation targets:

install(TARGETS minisat-lib-static minisat-lib-shared minisat_core minisat_simp
set(CMAKE_INSTALL_LIBDIR lib CACHE STRING "Output directory for libraries")

if (BUILD_STATIC_LIBS)
install(TARGETS minisat-lib-static
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

install(TARGETS minisat-lib-shared minisat_core minisat_simp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(DIRECTORY minisat/mtl minisat/utils minisat/core minisat/simp
DESTINATION include/minisat
Expand Down
92 changes: 92 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# branches to build
branches:
# whitelist
only:
- master
- appveyor_debug

# Operating system (build VM template)
os: Visual Studio 2015

# scripts that are called at very beginning, before repo cloning
init:
- git config --global core.autocrlf input


# clone directory
clone_folder: c:\projects\minisat

platform:
- x64
# - x86

environment:
global:
BOOST_ROOT: C:\projects\minisat\boost_1_59_0_install
ZLIB_ROOT: C:\projects\minisat\zlib\myinstall
BUILD_TYPE: Release
MSBUILD_FLAGS: /maxcpucount /nologo

configuration:
- Release

build_script:
#- IF "%PLATFORM%" == "x86" ( SET BOOST_LIBRARYDIR=C:/Libraries/boost_1_59_0/lib32-msvc-14.0)
- IF "%PLATFORM%" == "x86" ( SET CMAKE_GENERATOR="Visual Studio 14 2015")

#- IF "%PLATFORM%" == "x64" ( SET BOOST_LIBRARYDIR=C:/Libraries/boost_1_59_0/lib64-msvc-14.0)
- IF "%PLATFORM%" == "x64" ( SET CMAKE_GENERATOR="Visual Studio 14 2015 Win64")

- echo %PLATFORM%
- echo %BOOST_LIBRARYDIR%
- echo %CMAKE_GENERATOR%
- echo %configuration%
- echo %APPVEYOR_BUILD_FOLDER%
- echo %cd%

# zlib
# TODO check out http://stackoverflow.com/questions/10507893/libzip-with-visual-studio-2010
- cd C:\projects\minisat
- git clone https://github.com/madler/zlib
- cd zlib
- git checkout v1.2.8
- echo %cd%
- mkdir build
- mkdir myinstall
- cd build
- cmake -G %CMAKE_GENERATOR% -DCMAKE_INSTALL_PREFIX=%ZLIB_ROOT% ..
- if %PLATFORM%==x86 call msbuild %MSBUILD_FLAGS% /t:Build /p:Configuration=%CONFIGURATION% /p:Platform="x86" zlib.sln
- if %PLATFORM%==x64 call msbuild %MSBUILD_FLAGS% /t:Build /p:Configuration=%CONFIGURATION% /p:Platform="x64" zlib.sln
- msbuild %MSBUILD_FLAGS% INSTALL.vcxproj
- dir ..\myinstall\

# minisat
- cd C:\projects\minisat
- mkdir build
- mkdir myinstall
- cd build
- cmake -G %CMAKE_GENERATOR% -DCMAKE_INSTALL_PREFIX=%MINISAT_ROOT% -DZLIB_ROOT=%ZLIB_ROOT% ..
- cmake --build . --config %CONFIGURATION%
- dir ..\myinstall\


build:
# project: INSTALL.vcxproj # path to Visual Studio solution or project
parallel: true
verbosity: minimal


# scripts to run after build
after_build:
- 7z a c:\projects\minisat\minisat.zip %APPVEYOR_BUILD_FOLDER%\build -tzip
- cd c:\projects\minisat

artifacts:
- path: minisat.zip
name: minisat.zip

deploy_script:
#- cd c:\projects\minisat
#- curl -T minisat.zip --user %ACCOUNT% https://someplace/

test: off
10 changes: 5 additions & 5 deletions minisat/core/Solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -992,11 +992,11 @@ void Solver::printStats() const
{
double cpu_time = cpuTime();
double mem_used = memUsedPeak();
printf("restarts : %"PRIu64"\n", starts);
printf("conflicts : %-12"PRIu64" (%.0f /sec)\n", conflicts , conflicts /cpu_time);
printf("decisions : %-12"PRIu64" (%4.2f %% random) (%.0f /sec)\n", decisions, (float)rnd_decisions*100 / (float)decisions, decisions /cpu_time);
printf("propagations : %-12"PRIu64" (%.0f /sec)\n", propagations, propagations/cpu_time);
printf("conflict literals : %-12"PRIu64" (%4.2f %% deleted)\n", tot_literals, (max_literals - tot_literals)*100 / (double)max_literals);
printf("restarts : %lu\n", starts);
printf("conflicts : %-12lu (%.0f /sec)\n", conflicts , conflicts /cpu_time);
printf("decisions : %-12lu (%4.2f %% random) (%.0f /sec)\n", decisions, (float)rnd_decisions*100 / (float)decisions, decisions /cpu_time);
printf("propagations : %-12lu (%.0f /sec)\n", propagations, propagations/cpu_time);
printf("conflict literals : %-12lu (%4.2f %% deleted)\n", tot_literals, (max_literals - tot_literals)*100 / (double)max_literals);
if (mem_used != 0) printf("Memory used : %.2f MB\n", mem_used);
printf("CPU time : %g s\n", cpu_time);
}
Expand Down
4 changes: 2 additions & 2 deletions minisat/core/SolverTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ struct Lit {
int x;

// Use this as a constructor:
friend Lit mkLit(Var var, bool sign = false);
friend Lit mkLit(Var var, bool sign);

bool operator == (Lit p) const { return x == p.x; }
bool operator != (Lit p) const { return x != p.x; }
bool operator < (Lit p) const { return x < p.x; } // '<' makes p, ~p adjacent in the ordering.
};


inline Lit mkLit (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; }
inline Lit mkLit (Var var, bool sign = false) { Lit p; p.x = var + var + (int)sign; return p; }
inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; }
inline Lit operator ^(Lit p, bool b) { Lit q; q.x = p.x ^ (unsigned int)b; return q; }
inline bool sign (Lit p) { return p.x & 1; }
Expand Down
6 changes: 3 additions & 3 deletions minisat/utils/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ class Int64Option : public Option
if (range.begin == INT64_MIN)
fprintf(stderr, "imin");
else
fprintf(stderr, "%4"PRIi64, range.begin);
fprintf(stderr, "%4" PRIi64, range.begin);

fprintf(stderr, " .. ");
if (range.end == INT64_MAX)
fprintf(stderr, "imax");
else
fprintf(stderr, "%4"PRIi64, range.end);
fprintf(stderr, "%4" PRIi64, range.end);

fprintf(stderr, "] (default: %"PRIi64")\n", value);
fprintf(stderr, "] (default: %" PRIi64 ")\n", value);
if (verbose){
fprintf(stderr, "\n %s\n", description);
fprintf(stderr, "\n");
Expand Down
8 changes: 4 additions & 4 deletions minisat/utils/System.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ double Minisat::memUsed() {
struct rusage ru;
getrusage(RUSAGE_SELF, &ru);
return (double)ru.ru_maxrss / 1024; }
double Minisat::memUsedPeak() { return memUsed(); }
double Minisat::memUsedPeak(bool strictlyPeak) { return memUsed(); }


#elif defined(__APPLE__)
Expand All @@ -87,11 +87,11 @@ double Minisat::memUsed() {
malloc_statistics_t t;
malloc_zone_statistics(NULL, &t);
return (double)t.max_size_in_use / (1024*1024); }
double Minisat::memUsedPeak() { return memUsed(); }
double Minisat::memUsedPeak(bool strictlyPeak) { return memUsed(); }

#else
double Minisat::memUsed() { return 0; }
double Minisat::memUsedPeak() { return 0; }
double Minisat::memUsed() { return 0; }
double Minisat::memUsedPeak(bool strictlyPeak) { return 0; }
#endif


Expand Down