Skip to content

Commit

Permalink
chg: dev: cleanup readme and xcode setup, use internal gtest for xcode
Browse files Browse the repository at this point in the history
* fix adhoc test command arg file path, remove redundant test
* remove previous test path hacks, set xcode to Debug
* update conda build step and environment file, add core gtest deps

Signed-off-by: Stephen L Arnold <[email protected]>
  • Loading branch information
sarnold committed Feb 22, 2025
1 parent fd0004e commit 4eb365c
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 62 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
ubuntu-24.04-gcc-13,
ubuntu-22.04-clang-14,
macOS-13-gcc,
macOS-14-clang,
macOS-13-clang,
]

include:
Expand Down Expand Up @@ -63,11 +63,11 @@ jobs:
version: "12"
toxcmd: abc,tests

- name: macOS-14-clang
os: macOS-14
- name: macOS-13-clang
os: macOS-13
compiler: xcode
version: "15.4"
toxcmd: "base -- Xcode"
version: "15.1"
toxcmd: "ctestwin -- Xcode"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -125,14 +125,16 @@ jobs:
- name: Install and setup MacOS packages
if: runner.os == 'macOS'
run: |
brew install googletest
if [ "${{ matrix.compiler }}" = gcc ]; then
brew update
#brew upgrade
if [ "${{ matrix.compiler }}" = xcode ]; then
sudo xcode-select -s /Applications/Xcode_${{ matrix.version }}.app/Contents/Developer
ls -ls /Applications/
else
brew install gcc@${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
ls -ls /Applications/
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
brew install googletest
fi
- name: Build and test MacOS
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/conda-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
build_type: 'RelWithDebInfo'
- os: 'macOS-14'
generator: 'Ninja'
build_type: 'Release'
build_type: 'Debug'
- os: 'windows-2019'
generator: 'Ninja'
build_type: 'Release'
Expand All @@ -51,7 +51,7 @@ jobs:
uses: actions/cache@v4
env:
# Increase this value to reset cache if environment.devenv.yml has not changed
CACHE_NUMBER: 0
CACHE_NUMBER: 1
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.devenv.yml') }}
Expand Down Expand Up @@ -79,13 +79,15 @@ jobs:
- name: Build and test
shell: bash -l {0}
env:
CMAKE_PREFIX_PATH: ${{ github.workspace }}
PY_VER: ${{ matrix.python-version }}
run: |
source activate abc-test
conda info --envs
ctest --build-generator "${{ matrix.generator }}" \
ctest --build-config "${{ matrix.build_type }}" \
--build-generator "${{ matrix.generator }}" \
--build-and-test . build \
--build-options ${CMAKE_ARGS} ${{ matrix.extra_args }} \
-DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
--test-command ctest --rerun-failed --output-on-failure -V
-DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME=ON -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
--test-command ctest -V \
--build-config "${{ matrix.build_type }}" \
--rerun-failed --output-on-failure
18 changes: 3 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ option(COVERAGE_BUILD "Enable source-based LLVM code coverage" OFF)
option(ABC_SKIP_EXE "Skip building executable (build libs only)" OFF)
option(VENDOR_GTEST "download googletest" OFF)

if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
exec_program(/usr/bin/uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val)
# If we aren't cross-compiling then the two are equal.
if(NOT CMAKE_CROSSCOMPILING)
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
endif()

add_library(abc_interface INTERFACE)

set(ABC_HEADERS
Expand Down Expand Up @@ -181,6 +173,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
"_CRT_SECURE_NO_WARNINGS"
"_XKEYCHECK_H"
)
set(CMAKE_DEBUG_POSTFIX d)
endif()
if(WIN32)
if(MINGW OR MSYS)
Expand Down Expand Up @@ -479,18 +472,13 @@ if(BUILD_TESTING)

enable_testing()
add_test(NAME base_test
COMMAND base_test i10.aig
WORKING_DIRECTORY "${abc_SOURCE_DIR}"
COMMAND base_test "${abc_SOURCE_DIR}/i10.aig"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

# Add source-based llvm code coverage targets.
# Note this requires recent clang/llvm tooling.
if(COVERAGE_BUILD)
add_test(NAME main_test
COMMAND abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec"
WORKING_DIRECTORY "${abc_SOURCE_DIR}"
)

include(coverage)
add_coverage(abc)
add_coverage(base_test)
Expand Down
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The source code is provided for research and evaluation only. For commercial usa

References:

[1] L. Fan and C. Wu, "FPGA technology mapping with adaptive gate decompostion", ACM/SIGDA FPGA International Symposium on FPGAs, 2023.
[1] L. Fan and C. Wu, "FPGA technology mapping with adaptive gate decompostion", ACM/SIGDA FPGA International Symposium on FPGAs, 2023.

Minimum desktop tools needed:

Expand Down Expand Up @@ -85,8 +85,8 @@ There are several `tox -e` environment commands available in the current tox fil
* `ctest` - build/run tests using ctest => static lib and "test" executable
* `grind` - run cmake Debug build with valgrind
* Misc utility commands:
* `clean` - clean the make build files
* `unbuild` - clean the cmake build/ directory/files
* `clean` - clean the automake/autoconf build byproducts
* `cclean` - clean the cmake build/ directory/files
* `lint` - run cpplint style checks

### Compiling manually:
Expand All @@ -96,10 +96,10 @@ To compile ABC as a static library, type `make libabc.a`.
To compile ABC as a shared library, type `make lib`.
To compile ABC as a shared library with soname, type `ABC_USE_SONAME=1 make lib`.

When ABC is used as a static library, two additional procedures, `Abc_Start()`
and `Abc_Stop()`, are provided for starting and quitting the ABC framework in
the calling application. A simple demo program (file src/demo.c) shows how to
create a stand-alone program performing DAG-aware AIG rewriting, by calling
When ABC is used as a static library, two additional procedures, `Abc_Start()`
and `Abc_Stop()`, are provided for starting and quitting the ABC framework in
the calling application. A simple demo program (file src/demo.c) shows how to
create a stand-alone program performing DAG-aware AIG rewriting, by calling
APIs of ABC compiled as a static library.

To build the demo program
Expand Down Expand Up @@ -138,15 +138,16 @@ or in the batch mode:
The current version of ABC can be compiled with C compiler or C++ compiler.

* To compile as C code (default): make sure that `CC=gcc` and `ABC_NAMESPACE` is not defined.
* To compile as C++ code without namespaces: make sure that `CC=g++` and `ABC_NAMESPACE` is not defined.
* To compile as C++ code without namespaces: make sure that `CC=g++` and `ABC_NAMESPACE` is not
defined (deprecated).
* To compile as C++ code with namespaces: make sure that `CC=g++` and `ABC_NAMESPACE` is set to
the name of the requested namespace. For example, add `-DABC_NAMESPACE=xxx` to OPTFLAGS.

## Building a shared library

* Compile the code as position-independent by adding `ABC_USE_PIC=1`.
* Build the `libabc.so` target:
* Build the `libabc.so` target:

make ABC_USE_PIC=1 lib

## Adding new source files
Expand All @@ -159,10 +160,10 @@ For each module with new sources:

## Bug reporting:

Please try to reproduce all the reported bugs and unexpected features using the latest
Please try to reproduce all the reported bugs and unexpected features using the latest
version of ABC available from https://github.com/berkeley-abc/abc

If the bug still persists, please provide the following information:
If the bug still persists, please provide the following information:

1. ABC version (when it was downloaded from GitHub)
1. Linux distribution and version (32-bit or 64-bit)
Expand All @@ -173,7 +174,7 @@ If the bug still persists, please provide the following information:

## Troubleshooting:

1. If compilation does not start because of the cyclic dependency check,
1. If compilation does not start because of the cyclic dependency check,
try touching all files as follows: `find ./ -type f -exec touch "{}" \;`
1. If compilation fails because readline is missing, install 'readline' library or
compile with `make ABC_USE_NO_READLINE=1`
Expand All @@ -188,19 +189,19 @@ compile with `make ABC_USE_NO_PTHREADS=1`

The following comment was added by Krish Sundaresan:

"I found that the code does compile correctly on Solaris if gcc is used (instead of
g++ that I was using for some reason). Also readline which is not available by default
on most Sol10 systems, needs to be installed. I downloaded the readline-5.2 package
from sunfreeware.com and installed it locally. Also modified CFLAGS to add the local
include files for readline and LIBS to add the local libreadline.a. Perhaps you can
"I found that the code does compile correctly on Solaris if gcc is used (instead of
g++ that I was using for some reason). Also readline which is not available by default
on most Sol10 systems, needs to be installed. I downloaded the readline-5.2 package
from sunfreeware.com and installed it locally. Also modified CFLAGS to add the local
include files for readline and LIBS to add the local libreadline.a. Perhaps you can
add these steps in the readme to help folks compiling this on Solaris."

The following tutorial is kindly offered by Ana Petkovska from EPFL:
https://www.dropbox.com/s/qrl9svlf0ylxy8p/ABC_GettingStarted.pdf

## Final remarks:

Unfortunately, there is no comprehensive regression test. Good luck!
Unfortunately, there is no comprehensive regression test. Good luck!

This system is maintained by Alan Mishchenko <[email protected]>. Consider also
This system is maintained by Alan Mishchenko <[email protected]>. Consider also
using ZZ framework developed by Niklas Een: https://bitbucket.org/niklaseen/abc-zz (or https://github.com/berkeley-abc/abc-zz)
10 changes: 5 additions & 5 deletions environment.devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ dependencies:
- libpng
- gtest
- gmock
- libpcap
- boost
- boost-cpp
- abseil-cpp
- re2
- lcov
- gcovr
- gcc_linux-64 # [linux]
- gxx_linux-64 # [linux]
- c-compiler
- cxx-compiler
- ccache # [unix]
- clcache # [win]
- six

environment:
CPATH:
Expand Down
2 changes: 1 addition & 1 deletion test/gia/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ target_link_libraries(gia_test PUBLIC
gtest_discover_tests(gia_test
# the traling directory below is a workaround for generators that append
# an extra directory name (build type) such as VS on windows
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
11 changes: 6 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ skipsdist = true
[base]
setenv =
CPUS={env:CPUS:8}
{abc,demo,soname,tests}: CFLAGS={env:CFLAGS:-march=native -O2 -g -DNDEBUG}
{abc,demo,soname,tests}: CXXFLAGS={env:CXXFLAGS:-march=native -O2 -g -DNDEBUG}
{abc,demo,soname,tests}: LDFLAGS={env:LDFLAGS:-march=native -O2 -g -DNDEBUG}
{abc,demo,soname,tests}: CFLAGS={env:CFLAGS:-O2 -g -DNDEBUG}
{abc,demo,soname,tests}: CXXFLAGS={env:CXXFLAGS:-O2 -g -DNDEBUG}
{abc,demo,soname,tests}: LDFLAGS={env:LDFLAGS:-O2 -g -DNDEBUG}
{base,libs,clang,ctest}: ABC_USE_NAMESPACE={env:ABC_USE_NAMESPACE:xxxx}
{base,libs,clang,ctest}: ABC_USE_SONAME={env:ABC_USE_SONAME:ON}
{base,libs,clang,ctest}: ABC_USE_PIC={env:ABC_USE_PIC:ON}
{base,libs,clang,ctest}: VENDOR_GTEST={env:VENDOR_GTEST:OFF}
BUILD_TYPE={env:BUILD_TYPE:Release}
{base,libs,clang}: BUILD_TYPE={env:BUILD_TYPE:Release}
{ctest,ctestwin}: BUILD_TYPE={env:BUILD_TYPE:Debug}
base: PREFIX={env:PREFIX:staging}
libs: PREFIX={env:PREFIX:../staging}

Expand Down Expand Up @@ -86,7 +87,7 @@ commands =
{base,libs}: cmake --build . --target install
{base,libs}: bash -c 'find $PREFIX/ -type f -name \*abc\* -o -name demo | xargs ls -lh'
ctest: ctest -j {env:CPUS} --build-generator {posargs:"Ninja"} --build-and-test . build --build-options -DABC_USE_NAMESPACE={env:ABC_USE_NAMESPACE} -DABC_SKIP_EXE=ON -DCMAKE_BUILD_TYPE={env:BUILD_TYPE} --test-command ctest --rerun-failed --output-on-failure -V
ctestwin: ctest --build-generator {posargs:"Visual Studio 16 2019"} --build-and-test . build --build-options -DVENDOR_GTEST=ON -DBUILD_SHARED_LIBS=ON -DABC_USE_NO_PTHREADS=ON -DABC_USE_NO_READLINE=ON -DCMAKE_BUILD_TYPE={env:BUILD_TYPE} --test-command ctest --rerun-failed --output-on-failure -V
ctestwin: ctest --build-generator {posargs:"Visual Studio 16 2019"} --build-and-test . build --build-options -DVENDOR_GTEST=ON -DBUILD_SHARED_LIBS=ON -DABC_USE_NO_PTHREADS=ON -DABC_USE_NO_READLINE=ON -DCMAKE_BUILD_TYPE={env:BUILD_TYPE} --test-command ctest -C {env:BUILD_TYPE} --rerun-failed --output-on-failure -V
ctest: bash -c 'ls -lh build/*abc* || true'
lint: bash -c 'cpplint --output=gsed {toxinidir}/src/base/main/* {toxinidir}/lib/*'
grind: bash -c 'cmake -G {posargs:"Ninja"} -S . -B build -DCMAKE_BUILD_TYPE=Debug'
Expand Down

0 comments on commit 4eb365c

Please sign in to comment.