-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sometimes, fiction was so powerful that it even had reverberations in…
… the real world
- Loading branch information
Showing
93 changed files
with
8,191 additions
and
56,616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.directory | ||
.idea/ | ||
cmake-build-* | ||
build/ | ||
*.aux | ||
*.log | ||
*.synctex.gz | ||
/.vs | ||
*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[submodule "libs/alice"] | ||
path = libs/alice | ||
url = https://github.com/marcelwa/alice.git | ||
[submodule "libs/lorina"] | ||
path = libs/lorina | ||
url = https://github.com/marcelwa/lorina.git | ||
[submodule "libs/cppitertools"] | ||
path = libs/cppitertools | ||
url = https://github.com/marcelwa/cppitertools.git | ||
[submodule "libs/z3"] | ||
path = libs/z3 | ||
url = https://github.com/marcelwa/z3.git | ||
[submodule "libs/mockturtle"] | ||
path = libs/mockturtle | ||
url = https://github.com/marcelwa/mockturtle.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,60 @@ | ||
language: cpp | ||
|
||
cache: # see https://docs.travis-ci.com/user/caching/ | ||
- directories: | ||
- $HOME/.cache | ||
|
||
before_install: | ||
# fix linkage error with clang | ||
- export LD_LIBRARY_PATH=/usr/local/clang/lib:$LD_LIBRARY_PATH | ||
|
||
before_script: | ||
# install boost libraries | ||
- sudo apt install -qq libboost-all-dev | ||
# activate all python versions | ||
- pyenv global $(pyenv whence 2to3) | ||
# hand-pick python3 | ||
- PY_CMD=python3 | ||
|
||
script: | ||
# create build folder | ||
- mkdir build | ||
- cd build | ||
# set compiler and python executable | ||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DPYTHON_EXECUTABLE=$(which $PY_CMD) .. | ||
# build z3 (takes some time) | ||
- travis_wait make -j2 z3 | ||
# restore cache if it exists | ||
- ([ ! -f $HOME/.cache/z3 ] || mv $HOME/.cache/z3 ./) | ||
# set compiler, python executable, and Z3 build verbosity | ||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DPYTHON_EXECUTABLE=$(which $PY_CMD) -DBUILD_Z3_VERBOSE=TRUE .. | ||
# build Z3 (takes some time) and cache it | ||
- make -j2 z3 | ||
- mkdir -p $HOME/.cache | ||
- mv z3/ $HOME/.cache/ | ||
# build fiction | ||
- make -j2 fiction | ||
# run integration tests | ||
- ./fiction -ef ../test/integration.fc -l log.json | ||
|
||
matrix: | ||
include: | ||
# ubuntu 16.04 gcc/g++7 | ||
# ubuntu 18.04 gcc/g++7 | ||
- os: linux | ||
dist: xenial | ||
dist: bionic | ||
sudo: required | ||
compiler: gcc | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
- boost-latest | ||
packages: | ||
- libboost-all-dev | ||
|
||
# ubuntu 18.04 clang/clang++7 | ||
- os: linux | ||
dist: bionic | ||
sudo: required | ||
compiler: clang | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
- boost-latest | ||
packages: | ||
- g++-7 | ||
env: COMPILER=g++-7 | ||
- libboost-all-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,117 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
project(fiction | ||
LANGUAGES CXX | ||
VERSION 0.2.1) | ||
VERSION 0.3.0) | ||
|
||
# C++14 | ||
set(CMAKE_CXX_STANDARD 14) | ||
# C++17 | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
# Set debug and release build options | ||
if (MSVC) | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /w /O2") | ||
else () | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-mismatched-tags -Wno-gnu-anonymous-struct -Wno-nested-anon-types -g") | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -w -O3") | ||
endif () | ||
|
||
# Set debug build options | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wpedantic") | ||
# Set release build options | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -w -O3") | ||
# Set release mode to default | ||
if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") | ||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) | ||
endif() | ||
endif () | ||
# Set the possible values of build type for cmake-gui | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") | ||
|
||
# Include header files | ||
include_directories(src/algo/ src/io/ src/tech/ src/topo/ src/util/) | ||
include_directories(src/algo/ src/io/ src/io/cmd/ src/tech/ src/topo/ src/util/) | ||
|
||
# Find source files | ||
file(GLOB_RECURSE SOURCES src/*.cpp src/*.h) | ||
# Add configuration file | ||
configure_file(src/util/version.h.in util/version.h) | ||
configure_file(src/util/version_info.h.in util/version_info.h) | ||
# Include configuration file | ||
include_directories(${PROJECT_BINARY_DIR}/util/) | ||
|
||
# Require Boost libraries | ||
find_package(Boost COMPONENTS system filesystem REQUIRED) | ||
if(Boost_FOUND) | ||
include_directories(${Boost_INCLUDE_DIRS}) | ||
link_directories(${Boost_LIBRARY_DIRS}) | ||
endif() | ||
find_package(Boost COMPONENTS system filesystem) | ||
if (Boost_FOUND) | ||
include_directories(${Boost_INCLUDE_DIRS}) | ||
link_directories(${Boost_LIBRARY_DIRS}) | ||
else () | ||
message(STATUS "Please configure Boost_CUSTOM_INCLUDE_DIRS and Boost_CUSTOM_LIBRARY_DIRS manually.") | ||
set(Boost_CUSTOM_INCLUDE_DIRS "" CACHE PATH "Boost include path") | ||
set(Boost_CUSTOM_LIBRARY_DIRS "" CACHE PATH "Boost library path") | ||
include_directories(${Boost_CUSTOM_INCLUDE_DIRS}) | ||
link_directories(${Boost_CUSTOM_LIBRARY_DIRS}) | ||
endif () | ||
|
||
# Custom install prefix for libraries | ||
set(LIB_PREFIX ${CMAKE_SOURCE_DIR}/libs) | ||
|
||
# Clone, build and locally install Z3 | ||
include(ExternalProject) | ||
# Set up a directory for Z3 solver | ||
set(Z3_DIR ${CMAKE_BINARY_DIR}/z3) | ||
ExternalProject_Add(z3 | ||
SOURCE_DIR ${LIB_PREFIX}/z3/ | ||
BUILD_IN_SOURCE 1 | ||
INSTALL_DIR ${Z3_DIR}/ | ||
CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} | ||
./configure -p <INSTALL_DIR> -b build --staticlib ${Z3_DEBUG} | ||
BUILD_COMMAND make -j3 -C build | ||
INSTALL_COMMAND make -C build install | ||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_LIST_FILE} | ||
LOG_CONFIGURE 1 | ||
LOG_INSTALL 1 | ||
LOG_BUILD 1) | ||
|
||
if (UNIX) | ||
# Require Python interpreter | ||
find_package(Python COMPONENTS Interpreter) | ||
# Add option to compile Z3 with verbose output | ||
option(BUILD_Z3_VERBOSE "Output status and warnings during Z3 build" OFF) | ||
# Use /dev/null to silence Z3. Not elegant but efficient | ||
if (NOT BUILD_Z3_VERBOSE) | ||
set(Z3_OUTPUT_CHANNEL > /dev/null) | ||
endif () | ||
|
||
# Add option to build Z3 as a static library | ||
option(BUILD_Z3_STATIC_LIB "Build Z3 solver as a static library to link against fiction" OFF) | ||
if (BUILD_Z3_STATIC_LIB) | ||
set(Z3_LIB_FLAG --staticlib) | ||
set(Z3_LINK_TARGET libz3.a) | ||
else () | ||
set(Z3_LINK_TARGET libz3.so) | ||
endif () | ||
|
||
# include and library paths | ||
set(Z3_INCLUDE_DIR ${Z3_DIR}/include) | ||
set(Z3_LIB_DIR ${Z3_DIR}/lib) | ||
|
||
# Build and locally install Z3 | ||
add_custom_command( | ||
OUTPUT ${Z3_LIB_DIR}/${Z3_LINK_TARGET} | ||
PRE_BUILD | ||
COMMAND ${Python_EXECUTABLE} scripts/mk_make.py -s --prefix=${Z3_DIR} ${Z3_LIB_FLAG} ${Z3_OUTPUT_CHANNEL} | ||
COMMAND $(MAKE) -C build ${Z3_OUTPUT_CHANNEL} | ||
COMMAND $(MAKE) -C build install ${Z3_OUTPUT_CHANNEL} | ||
WORKING_DIRECTORY ${LIB_PREFIX}/z3/) | ||
|
||
# Make sure Z3's custom build commands are actually being executed | ||
add_custom_target(z3 | ||
ALL | ||
DEPENDS ${Z3_LIB_DIR}/${Z3_LINK_TARGET}) | ||
|
||
elseif (WIN32) | ||
set(Z3_LINK_TARGET libz3.lib) | ||
set(Z3_INCLUDE_DIR "${LIB_PREFIX}/z3/src/api" CACHE PATH "Path to Z3's custom include directory") | ||
set(Z3_LIB_DIR "${LIB_PREFIX}/z3/build" CACHE PATH "Path to Z3's custom library directory") | ||
include_directories(${Z3_INCLUDE_DIR}/c++) | ||
endif () | ||
|
||
# Include Z3 | ||
include_directories(${Z3_DIR}/include/) | ||
include_directories(${Z3_INCLUDE_DIR}/) | ||
|
||
# Include cppitertools | ||
include_directories(${LIB_PREFIX}/cppitertools/) | ||
|
||
# Include alice | ||
add_subdirectory(${LIB_PREFIX}/alice/) | ||
|
||
# Include lorina | ||
add_subdirectory(${LIB_PREFIX}/lorina/) | ||
# Include mockturtle | ||
add_subdirectory(${LIB_PREFIX}/mockturtle/) | ||
|
||
# Build executable | ||
add_executable(fiction ${SOURCES}) | ||
add_dependencies(fiction z3) | ||
if (UNIX) | ||
add_dependencies(fiction z3) | ||
endif () | ||
|
||
# Link against Boost, Z3, alice, and lorina | ||
target_link_libraries(fiction ${Boost_LIBRARIES} ${Z3_DIR}/lib/libz3.so alice lorina) | ||
target_link_libraries(fiction ${Boost_LIBRARIES} ${Z3_LIB_DIR}/${Z3_LINK_TARGET} alice mockturtle) |
Oops, something went wrong.