Skip to content

Commit 63e7aba

Browse files
author
Stephen L Arnold
committed
chg: dev: cleanup windows builds and sources, update workflows
* add win32 defines ABC_NO_DYNAMIC_LINKING, WIN32 * static_cast => uint returns in acbTest.c !refactor * check for win first, win/mingw definitions inside if(msys or mingw) * fix missing leading ddunder on mingw32__ * switch msys env for clang64, re-enable readline * cleanup cmake type checks and workflow env * mingw clang-64 thinks sizeof long is 4 * use abc typedefs instead of hard-coded types Signed-off-by: Stephen L Arnold <nerdboy@gentoo.org>
1 parent eb4f53d commit 63e7aba

File tree

21 files changed

+187
-99
lines changed

21 files changed

+187
-99
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,42 @@ jobs:
2626

2727
name: [
2828
ubuntu-20.04-gcc,
29+
ubuntu-20.04-clang,
2930
ubuntu-18.04-gcc,
3031
macOS-10.15-gcc,
32+
macOS-10.15-clang,
3133
]
3234

3335
include:
3436
- name: ubuntu-20.04-gcc
3537
os: ubuntu-20.04
3638
compiler: gcc
3739
version: "10"
40+
toxcmd: build
41+
42+
- name: ubuntu-20.04-clang
43+
os: ubuntu-20.04
44+
compiler: clang
45+
version: "10"
46+
toxcmd: clang
3847

3948
- name: ubuntu-18.04-gcc
4049
os: ubuntu-18.04
4150
compiler: gcc
4251
version: "9"
52+
toxcmd: abc,tests
4353

4454
- name: macOS-10.15-gcc
4555
os: macOS-10.15
4656
compiler: gcc
47-
version: "10"
57+
version: "11"
58+
toxcmd: ctest
59+
60+
- name: macOS-10.15-clang
61+
os: macOS-10.15
62+
compiler: xcode
63+
version: "12.3"
64+
toxcmd: clang
4865

4966
steps:
5067
- uses: actions/checkout@v2
@@ -81,7 +98,7 @@ jobs:
8198
CC: ${{ env.CC }}
8299
CXX: ${{ env.CXX }}
83100
run: |
84-
tox -e build
101+
tox -e ${{ matrix.toxcmd }}
85102
86103
- name: Install and setup MacOS packages
87104
if: runner.os == 'macOS'
@@ -103,4 +120,4 @@ jobs:
103120
CC: ${{ env.CC }}
104121
CXX: ${{ env.CXX }}
105122
run: |
106-
tox -e ctest
123+
tox -e ${{ matrix.toxcmd }}

.github/workflows/win.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: msystem
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
msys2-build:
12+
runs-on: windows-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include: [
17+
{ msystem: MINGW64, arch: x86_64 },
18+
{ msystem: CLANG64, arch: clang-x86_64 },
19+
{ msystem: MINGW32, arch: i686 },
20+
]
21+
defaults:
22+
run:
23+
shell: msys2 {0}
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- name: Setup MinGW native environment
28+
uses: msys2/setup-msys2@v2
29+
with:
30+
msystem: ${{ matrix.msystem }}
31+
update: false
32+
install: >-
33+
git
34+
make
35+
mingw-w64-${{ matrix.arch }}-toolchain
36+
mingw-w64-${{ matrix.arch }}-cmake
37+
mingw-w64-${{ matrix.arch }}-ninja
38+
mingw-w64-${{ matrix.arch }}-pkgconf
39+
mingw-w64-${{ matrix.arch }}-readline
40+
41+
- run: >-
42+
cmake
43+
-Wdev
44+
-B build
45+
-DBUILD_SHARED_LIBS=ON
46+
-DABC_USE_NAMESPACE=xxx
47+
-DCMAKE_BUILD_TYPE=Debug
48+
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
49+
50+
- name: CMake build
51+
run: |
52+
cmake --build build --parallel
53+
54+
- name: Test
55+
run: ctest --test-dir build --output-on-failure --parallel -V
56+
57+
- uses: actions/upload-artifact@v1
58+
if: failure()
59+
with:
60+
name: WindowsCMakeTestlog
61+
path: build/Testing/Temporary/LastTest.log
62+
63+
- name: Install project
64+
run: cmake --install build

CMakeLists.txt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,14 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
140140
)
141141
endif()
142142
if(WIN32)
143+
if(MINGW OR MSYS)
144+
add_definitions(-DWIN32 -D__MINGW32__)
145+
endif()
143146
target_compile_definitions(abc_interface
144147
INTERFACE
145148
$<$<BOOL:${BUILD_SHARED_LIBS}>:ABC_DLL=ABC_DLLEXPORT>
146149
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:WIN32_NO_DLL>
150+
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:ABC_NO_DYNAMIC_LINKING>
147151
)
148152
endif()
149153

@@ -155,18 +159,19 @@ else()
155159
endif()
156160

157161
include(CheckTypeSize)
158-
check_type_size("(void*)0" SIZEOF_VOID_P)
159162

160163
if(ABC_USE_STDINT_H)
164+
check_type_size("void*" SIZEOF_VOID_P LANGUAGE C)
161165
message(STATUS "Setting ABC_USE_STDINT_H ${ABC_USE_STDINT_H}")
162166
target_compile_definitions(abc_interface INTERFACE "ABC_USE_STDINT_H=1")
163167
else()
164-
check_type_size("(long)0" SIZEOF_LONG)
165-
check_type_size("(int)0" SIZEOF_INT)
166-
if(UNIX OR APPLE)
167-
set(ARCH_PREFIX "LIN")
168-
elseif(WIN32)
168+
check_type_size("void*" SIZEOF_VOID_P LANGUAGE CXX)
169+
check_type_size(long SIZEOF_LONG LANGUAGE CXX)
170+
check_type_size(int SIZEOF_INT LANGUAGE CXX)
171+
if(WIN32 OR MINGW OR MSYS)
169172
set(ARCH_PREFIX "NT")
173+
elseif(UNIX OR APPLE)
174+
set(ARCH_PREFIX "LIN")
170175
else()
171176
message(FATAL_ERROR "Unknown arch")
172177
endif()
@@ -184,6 +189,7 @@ else()
184189
"${ARCH_PREFIX}${ARCH_SUFFIX}"
185190
)
186191
endif()
192+
187193
if(CMAKE_SYSTEM_PROCESS STREQUAL "arm")
188194
target_compile_definitions(abc_interface INTERFACE
189195
ABC_MEMALIGN=4
@@ -260,7 +266,7 @@ if(NOT ABC_USE_NO_PTHREADS)
260266
set(THREADS_PREFER_PTHREAD_FLAG ON)
261267
find_package(Threads REQUIRED)
262268
target_link_libraries(abc_interface
263-
INTERFACE Threads::Threads
269+
INTERFACE ${CMAKE_THREAD_LIBS_INIT}
264270
)
265271
endif()
266272
endif()
@@ -286,7 +292,7 @@ define_property(GLOBAL
286292
define_property(GLOBAL
287293
PROPERTY ABC_SOURCES
288294
BRIEF_DOCS "Sources of executables of abc"
289-
FULL_DOCS "All source files of libabc"
295+
FULL_DOCS "All source files of abc"
290296
)
291297

292298
function(abc_libabc_add_sources)
@@ -342,6 +348,7 @@ if(BUILD_SHARED_LIBS)
342348
set_target_properties(
343349
libabc PROPERTIES VERSION ${LIBRARY_VERSION}
344350
SOVERSION ${LIBRARY_SOVERSION}
351+
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
345352
)
346353
endif()
347354

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ CXXFLAGS += $(CFLAGS)
167167
$(info $(MSG_PREFIX)Using CXXFLAGS=$(CXXFLAGS))
168168

169169
SRC :=
170-
GARBAGE := core core.* *.stackdump ./tags $(PROG) demo arch_flags
170+
GARBAGE := core core.* *.stackdump ./tags $(PROG) demo arch_flags result.blif
171171

172172
.PHONY: all default tags clean docs cmake_info
173173

src/aig/aig/aigPart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ Vec_Ptr_t * Aig_ManSupports( Aig_Man_t * pMan )
309309
{
310310
pPart0 = (Part_One_t *)Aig_ObjFanin0(pObj)->pData;
311311
vSupp = Part_ManTransferEntry(pPart0);
312-
Vec_IntPush( vSupp, (int)(long)pObj->pNext );
312+
Vec_IntPush( vSupp, (int)(ABC_PTRINT_T)pObj->pNext );
313313
Vec_PtrPush( vSupports, vSupp );
314314
assert( pPart0->nRefs > 0 );
315315
if ( --pPart0->nRefs == 0 )
@@ -321,7 +321,7 @@ Vec_Ptr_t * Aig_ManSupports( Aig_Man_t * pMan )
321321
if ( pObj->nRefs )
322322
{
323323
pPart0 = Part_ManFetchEntry( p, 1, pObj->nRefs );
324-
pPart0->pOuts[ pPart0->nOuts++ ] = (int)(long)pObj->pNext;
324+
pPart0->pOuts[ pPart0->nOuts++ ] = (int)(ABC_PTRINT_T)pObj->pNext;
325325
pObj->pData = pPart0;
326326
}
327327
continue;
@@ -972,7 +972,7 @@ Aig_Obj_t * Aig_ManDupPart_rec( Aig_Man_t * pNew, Aig_Man_t * pOld, Aig_Obj_t *
972972
if ( Aig_ObjIsCi(pObj) )
973973
{
974974
assert( Vec_IntSize(vSuppMap) == Aig_ManCiNum(pNew) );
975-
Vec_IntPush( vSuppMap, (int)(long)pObj->pNext );
975+
Vec_IntPush( vSuppMap, (int)(ABC_PTRINT_T)pObj->pNext );
976976
return (Aig_Obj_t *)(pObj->pData = Aig_ObjCreateCi(pNew));
977977
}
978978
assert( Aig_ObjIsNode(pObj) );

src/base/acb/acbTest.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void Gia_ManDualMux( Gia_Man_t * p, int LitC[2], int LitT[2], int LitE[2], int L
235235

236236
if ( fForceZero ) LitZ[0] = Gia_ManHashAnd( p, LitZ[0], Abc_LitNot(LitZ[1]) );
237237
}
238-
int Gia_ManDualCompare( Gia_Man_t * p, int LitF[2], int LitS[2] )
238+
int Gia_ManDualCompare( Gia_Man_t * p, unsigned int LitF[2], unsigned int LitS[2] )
239239
{
240240
int iMiter = Gia_ManHashXor( p, LitF[0], LitS[0] );
241241
iMiter = Gia_ManHashOr( p, LitF[1], iMiter );
@@ -421,8 +421,8 @@ Gia_Man_t * Acb_NtkGiaDeriveMiter( Gia_Man_t * pOne, Gia_Man_t * pTwo, int Type
421421
{
422422
for ( i = 0; i < Gia_ManCoNum(pOne); i += 2 )
423423
{
424-
int pLitsF[2] = { static_cast<int>(Gia_ManCo(pOne, i)->Value), static_cast<int>(Gia_ManCo(pOne, i+1)->Value) };
425-
int pLitsS[2] = { static_cast<int>(Gia_ManCo(pTwo, i)->Value), static_cast<int>(Gia_ManCo(pTwo, i+1)->Value) };
424+
unsigned int pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value };
425+
unsigned int pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value };
426426
Gia_ManAppendCo( pNew, pLitsF[0] );
427427
Gia_ManAppendCo( pNew, pLitsS[0] );
428428
}
@@ -431,8 +431,8 @@ Gia_Man_t * Acb_NtkGiaDeriveMiter( Gia_Man_t * pOne, Gia_Man_t * pTwo, int Type
431431
{
432432
for ( i = 0; i < Gia_ManCoNum(pOne); i += 2 )
433433
{
434-
int pLitsF[2] = { static_cast<int>(Gia_ManCo(pTwo, i)->Value), static_cast<int>(Gia_ManCo(pOne, i+1)->Value) };
435-
int pLitsS[2] = { static_cast<int>(Gia_ManCo(pTwo, i)->Value), static_cast<int>(Gia_ManCo(pTwo, i+1)->Value) };
434+
unsigned int pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value };
435+
unsigned int pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value };
436436
Gia_ManAppendCo( pNew, pLitsF[1] );
437437
Gia_ManAppendCo( pNew, pLitsS[1] );
438438
}
@@ -441,8 +441,8 @@ Gia_Man_t * Acb_NtkGiaDeriveMiter( Gia_Man_t * pOne, Gia_Man_t * pTwo, int Type
441441
{
442442
for ( i = 0; i < Gia_ManCoNum(pOne); i += 2 )
443443
{
444-
int pLitsF[2] = { static_cast<int>(Gia_ManCo(pOne, i)->Value), static_cast<int>(Gia_ManCo(pOne, i+1)->Value) };
445-
int pLitsS[2] = { static_cast<int>(Gia_ManCo(pTwo, i)->Value), static_cast<int>(Gia_ManCo(pTwo, i+1)->Value) };
444+
unsigned int pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value };
445+
unsigned int pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value };
446446
Gia_ManAppendCo( pNew, Gia_ManDualCompare( pNew, pLitsF, pLitsS ) );
447447
}
448448
}

0 commit comments

Comments
 (0)