Skip to content

Commit 4668f15

Browse files
committed
add OW support
1 parent 51b7f2a commit 4668f15

File tree

16 files changed

+317
-91
lines changed

16 files changed

+317
-91
lines changed

.github/workflows/cmake.yml

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: CMake
2-
on: [push, pull_request]
2+
on: [push, pull_request, workflow_dispatch]
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
38
jobs:
49
ci-cmake:
510
name: ${{ matrix.name }}
@@ -54,36 +59,88 @@ jobs:
5459

5560
- name: macOS GCC
5661
os: macos-latest
57-
compiler: gcc-11
62+
compiler: gcc
63+
64+
- name: Open Watcom Win32
65+
os: windows-latest
66+
compiler: ow
67+
cmake-args: -G "Watcom WMake"
68+
69+
- name: Open Watcom Linux
70+
os: ubuntu-latest
71+
compiler: ow
72+
cmake-args: -G "Watcom WMake"
73+
74+
- name: Open Watcom OS/2
75+
os: ubuntu-latest
76+
compiler: ow-os2-32
77+
cmake-args: -G "Watcom WMake" -D CMAKE_SYSTEM_NAME=OS2 -D CMAKE_SYSTEM_PROCESSOR=x86
78+
79+
- name: Open Watcom OS/2 (16-bit)
80+
os: ubuntu-latest
81+
compiler: ow-os2-16
82+
cmake-args: -G "Watcom WMake" -D CMAKE_SYSTEM_NAME=OS2 -D CMAKE_SYSTEM_PROCESSOR=I86
83+
build-config: MinSizeRel
84+
85+
- name: Open Watcom DOS
86+
os: ubuntu-latest
87+
compiler: ow-dos
88+
cmake-args: -G "Watcom WMake" -D CMAKE_SYSTEM_NAME=DOS -D CMAKE_SYSTEM_PROCESSOR=x86
89+
90+
- name: Open Watcom DOS (16-bit)
91+
os: ubuntu-latest
92+
compiler: ow-dos-16
93+
cmake-args: -G "Watcom WMake" -D CMAKE_SYSTEM_NAME=DOS -D CMAKE_SYSTEM_PROCESSOR=I86
94+
build-config: MinSizeRel
95+
96+
- name: Open Watcom Windows
97+
os: ubuntu-latest
98+
compiler: ow-win-16
99+
cmake-args: -G "Watcom WMake" -D CMAKE_SYSTEM_NAME=Windows3x -D CMAKE_SYSTEM_PROCESSOR=I86
100+
build-config: MinSizeRel
58101

59102
steps:
60103
- name: Checkout repository
61-
uses: actions/checkout@v3
104+
uses: actions/checkout@v4
62105

63106
- name: Install packages (Windows)
64-
if: runner.os == 'Windows'
107+
if: ${{ runner.os == 'Windows' && ! startsWith( matrix.compiler, 'ow' ) }}
65108
run: |
66109
choco install --no-progress ninja ${{ matrix.packages }}
67110
111+
- name: Open Watcom setup
112+
if: startsWith( matrix.compiler, 'ow' )
113+
uses: open-watcom/setup-watcom@v0
114+
with:
115+
version: "2.0-64"
116+
68117
- name: Generate project files
69-
run: cmake -S ${{ matrix.src-dir || '.' }} -B ${{ matrix.build-dir || '.' }} ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }}
118+
if: ${{ ! startsWith( matrix.compiler, 'ow' ) }}
119+
run: |
120+
mkdir ${{ matrix.build-dir || 'build' }}
121+
cmake -S ${{ matrix.src-dir || '.' }} -B ${{ matrix.build-dir || 'build' }} ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }}
70122
env:
71123
CC: ${{ matrix.compiler }}
72124
CFLAGS: ${{ matrix.cflags }}
125+
126+
- name: Generate project files
127+
if: startsWith( matrix.compiler, 'ow' )
128+
run: |
129+
mkdir ${{ matrix.build-dir || 'build' }}
130+
cmake -S ${{ matrix.src-dir || '.' }} -B ${{ matrix.build-dir || 'build' }} ${{ matrix.cmake-args }} -D WATCOM_CFLAGS=${{ matrix.cflags || '' }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }}
73131
74132
- name: Compile source code
75-
run: cmake --build ${{ matrix.build-dir || '.' }} --config ${{ matrix.build-config || 'Release' }}
133+
run: cmake --build ${{ matrix.build-dir || 'build' }} --config ${{ matrix.build-config || 'Release' }}
76134

77135
- name: Run test cases
136+
if: ${{ ! startsWith( matrix.compiler, 'ow-' ) }}
78137
run: ctest -C Release --output-on-failure --max-width 120
79-
working-directory: ${{ matrix.build-dir || '.' }}
138+
working-directory: ${{ matrix.build-dir || 'build' }}
80139

81140
- name: Upload build errors
82-
uses: actions/upload-artifact@v3
83-
if: failure()
141+
if: failure() || startsWith( matrix.compiler, 'ow' )
142+
uses: actions/upload-artifact@v4
84143
with:
85-
name: ${{ matrix.name }} (cmake)
144+
name: ${{ matrix.compiler }}(${{ matrix.os }})
86145
path: |
87-
**/CMakeFiles/CMakeOutput.log
88-
**/CMakeFiles/CMakeError.log
89-
retention-days: 7
146+
${{ matrix.build-dir || 'build' }}/**

.github/workflows/configure.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: Configure
2-
on: [push, pull_request]
2+
on: [push, pull_request, workflow_dispatch]
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
38
jobs:
49
ci-configure:
510
name: ${{ matrix.name }}
@@ -85,7 +90,7 @@ jobs:
8590

8691
- name: macOS GCC
8792
os: macos-latest
88-
compiler: gcc-11
93+
compiler: gcc
8994
configure-args: --warn
9095

9196
- name: macOS Clang
@@ -95,7 +100,7 @@ jobs:
95100

96101
steps:
97102
- name: Checkout repository
98-
uses: actions/checkout@v3
103+
uses: actions/checkout@v4
99104

100105
- name: Install packages (Ubuntu)
101106
if: runner.os == 'Linux' && matrix.packages
@@ -127,7 +132,7 @@ jobs:
127132
QEMU_RUN: ${{ matrix.qemu-run }}
128133

129134
- name: Upload build errors
130-
uses: actions/upload-artifact@v3
135+
uses: actions/upload-artifact@v4
131136
if: failure()
132137
with:
133138
name: ${{ matrix.name }} (configure)

.github/workflows/delruns.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Delete Old (Workflow Runs)
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
days:
6+
description: 'Days-worth of runs to keep for each workflow'
7+
required: true
8+
default: '30'
9+
minimum_runs:
10+
description: 'Minimum runs to keep for each workflow'
11+
required: true
12+
default: '6'
13+
delete_workflow_pattern:
14+
description: 'Name or filename of the workflow (if not set, all workflows are targeted)'
15+
required: false
16+
delete_workflow_by_state_pattern:
17+
description: 'Filter workflows by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
18+
required: true
19+
default: "ALL"
20+
type: choice
21+
options:
22+
- "ALL"
23+
- active
24+
- deleted
25+
- disabled_inactivity
26+
- disabled_manually
27+
delete_run_by_conclusion_pattern:
28+
description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success'
29+
required: true
30+
default: "ALL"
31+
type: choice
32+
options:
33+
- "ALL"
34+
- "Unsuccessful: action_required,cancelled,failure,skipped"
35+
- action_required
36+
- cancelled
37+
- failure
38+
- skipped
39+
- success
40+
dry_run:
41+
description: 'Logs simulated changes, no deletions are performed'
42+
required: false
43+
44+
jobs:
45+
del_runs:
46+
runs-on: ubuntu-latest
47+
permissions:
48+
actions: write
49+
contents: read
50+
steps:
51+
- name: Delete workflow runs
52+
uses: Mattraks/delete-workflow-runs@v2
53+
with:
54+
token: ${{ github.token }}
55+
repository: ${{ github.repository }}
56+
retain_days: ${{ github.event.inputs.days }}
57+
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
58+
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
59+
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
60+
delete_run_by_conclusion_pattern: >-
61+
${{
62+
startsWith(github.event.inputs.delete_run_by_conclusion_pattern, 'Unsuccessful:')
63+
&& 'action_required,cancelled,failure,skipped'
64+
|| github.event.inputs.delete_run_by_conclusion_pattern
65+
}}
66+
dry_run: ${{ github.event.inputs.dry_run }}

.github/workflows/fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
dry-run: false
1919

2020
- name: Upload Crash
21-
uses: actions/upload-artifact@v3
21+
uses: actions/upload-artifact@v4
2222
if: failure()
2323
with:
2424
name: artifacts

CMakeLists.txt

Lines changed: 64 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
33

44
project(zlib C)
55

6+
set(CMAKE_VERBOSE_MAKEFILE ON)
7+
68
set(VERSION "1.3.1")
79

810
option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON)
@@ -84,7 +86,6 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
8486
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
8587
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
8688

87-
8889
#============================================================================
8990
# zlib
9091
#============================================================================
@@ -149,40 +150,66 @@ if(MINGW)
149150
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
150151
endif(MINGW)
151152

152-
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
153-
target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
154153
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
155154
target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
156-
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
157-
set_target_properties(zlib PROPERTIES SOVERSION 1)
158-
159-
if(NOT CYGWIN)
160-
# This property causes shared libraries on Linux to have the full version
161-
# encoded into their final filename. We disable this on Cygwin because
162-
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
163-
# seems to be the default.
164-
#
165-
# This has no effect with MSVC, on that platform the version info for
166-
# the DLL comes from the resource file win32/zlib1.rc
167-
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
155+
if(CMAKE_C_COMPILER_ID STREQUAL "OpenWatcom")
156+
# On Open Watcom platforms the library is always called libz
157+
set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME "zlib")
158+
elseif(UNIX)
159+
# On unix-like platforms the library is almost always called libz
160+
set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z)
168161
endif()
169162

170-
if(UNIX)
171-
# On unix-like platforms the library is almost always called libz
172-
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
173-
if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
174-
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
175-
endif()
176-
elseif(BUILD_SHARED_LIBS AND WIN32)
177-
# Creates zlib1.dll when building shared library version
178-
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
163+
set(ZLIB_BUILD_SHARED_LIB)
164+
if(NOT(CMAKE_C_COMPILER_ID STREQUAL "OpenWatcom") AND NOT() OR (CMAKE_SYSTEM_NAME MATCHES "Windows|OS2|Windows3x"))
165+
set(ZLIB_BUILD_SHARED_LIB 1)
166+
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
167+
target_include_directories(zlib PUBLIC
168+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
169+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
170+
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
171+
set_target_properties(zlib PROPERTIES SOVERSION 1)
172+
173+
if(CMAKE_C_COMPILER_ID STREQUAL "OpenWatcom")
174+
# Creates zlib1.dll when building shared library version
175+
set_target_properties(zlib PROPERTIES ARCHIVE_OUTPUT_NAME "zdll")
176+
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
177+
else()
178+
if(NOT CYGWIN)
179+
# This property causes shared libraries on Linux to have the full version
180+
# encoded into their final filename. We disable this on Cygwin because
181+
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
182+
# seems to be the default.
183+
#
184+
# This has no effect with MSVC, on that platform the version info for
185+
# the DLL comes from the resource file win32/zlib1.rc
186+
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
187+
endif()
188+
189+
if(UNIX)
190+
# On unix-like platforms the library is almost always called libz
191+
set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
192+
if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
193+
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
194+
endif()
195+
elseif(BUILD_SHARED_LIBS AND WIN32)
196+
# Creates zlib1.dll when building shared library version
197+
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
198+
endif()
199+
endif()
179200
endif()
180201

181202
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
182-
install(TARGETS zlib zlibstatic
203+
install(TARGETS zlibstatic
183204
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
184205
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
185206
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
207+
if(ZLIB_BUILD_SHARED_LIB)
208+
install(TARGETS zlib
209+
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
210+
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
211+
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
212+
endif()
186213
endif()
187214
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
188215
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
@@ -198,21 +225,29 @@ endif()
198225
# Example binaries
199226
#============================================================================
200227
if(ZLIB_BUILD_EXAMPLES)
228+
set(ZLIB_EXAMPLES_LINK_LIB zlibstatic)
229+
if(ZLIB_BUILD_SHARED_LIB)
230+
if(CMAKE_C_COMPILER_ID STREQUAL "OpenWatcom")
231+
set(ZLIB_EXAMPLES_LINK_LIB zdll)
232+
else()
233+
set(ZLIB_EXAMPLES_LINK_LIB zlib)
234+
endif()
235+
endif()
201236
add_executable(example test/example.c)
202-
target_link_libraries(example zlib)
237+
target_link_libraries(example ${ZLIB_EXAMPLES_LINK_LIB})
203238
add_test(example example)
204239

205240
add_executable(minigzip test/minigzip.c)
206-
target_link_libraries(minigzip zlib)
241+
target_link_libraries(minigzip ${ZLIB_EXAMPLES_LINK_LIB})
207242

208243
if(HAVE_OFF64_T)
209244
add_executable(example64 test/example.c)
210-
target_link_libraries(example64 zlib)
245+
target_link_libraries(example64 ${ZLIB_EXAMPLES_LINK_LIB})
211246
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
212247
add_test(example64 example64)
213248

214249
add_executable(minigzip64 test/minigzip.c)
215-
target_link_libraries(minigzip64 zlib)
250+
target_link_libraries(minigzip64 ${ZLIB_EXAMPLES_LINK_LIB})
216251
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
217252
endif()
218253
endif()

0 commit comments

Comments
 (0)