Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b545019

Browse files
committedMar 21, 2024
add DOS Watcom support
1 parent f2a1bf7 commit b545019

File tree

7 files changed

+119
-1
lines changed

7 files changed

+119
-1
lines changed
 

‎.github/workflows/ci.yml

+17
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,20 @@ jobs:
112112
with:
113113
name: binary-archive
114114
path: build/package
115+
116+
dos:
117+
timeout-minutes: 10
118+
runs-on: ubuntu-latest
119+
120+
steps:
121+
- uses: open-watcom/setup-watcom@v0
122+
with:
123+
version: "2.0"
124+
125+
- uses: actions/checkout@v2
126+
127+
- name: Configure
128+
run: cmake -Bbuild --toolchain cmake/dos.cmake
129+
130+
- name: Build
131+
run: cmake --build build

‎CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ elseif(WIN32)
7272
target_sources(pdcurses PRIVATE wincon/pdcclip.c wincon/pdcdisp.c wincon/pdcgetsc.c
7373
wincon/pdckbd.c wincon/pdcscrn.c wincon/pdcsetsc.c wincon/pdcutil.c wincon/pdcwin.h
7474
)
75+
elseif(CMAKE_SYSTEM_NAME STREQUAL "DOS")
76+
target_sources(pdcurses PRIVATE dos/pdcclip.c dos/pdcdisp.c dos/pdcgetsc.c
77+
dos/pdckbd.c dos/pdcscrn.c dos/pdcsetsc.c dos/pdcutil.c)
7578
else()
7679
check_include_file("DECkeySym.h" HAVE_DECKEYSYM_H)
7780
check_include_file("Sunkeysym.h" HAVE_SUNKEYSYM_H)

‎cmake/compilers.cmake

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,14 @@ $<$<BOOL:${HAVE_VSSCANF}>:HAVE_VSSCANF>
99
)
1010

1111
# --- compiler options
12-
add_compile_options(-Wall)
12+
13+
if(CMAKE_C_COMPILER_ID STREQUAL OpenWatcom)
14+
message(STATUS "OpenWatcom: $ENV{WATCOM}
15+
Host: ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION}
16+
Target: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}
17+
")
18+
# https://wiki.archlinux.org/title/Open_Watcom
19+
add_compile_options(-bt=dos -bcl=dos)
20+
else()
21+
add_compile_options(-Wall)
22+
endif()

‎cmake/dos.cmake

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
set(CMAKE_SYSTEM_NAME DOS)
2+
set(CMAKE_GENERATOR "Watcom WMake")
3+
4+
if(NOT DEFINED ENV{WATCOM})
5+
if(WIN32)
6+
set(scr ${CMAKE_CURRENT_LIST_DIR}/dos.ps1)
7+
else()
8+
set(scr ${CMAKE_CURRENT_LIST_DIR}/dos.sh)
9+
endif()
10+
message(FATAL_ERROR "WATCOM environment variable not set. Try running ${scr} first.")
11+
endif()
12+
13+
file(TO_CMAKE_PATH "$ENV{WATCOM}" watcom_root)
14+
15+
set(CMAKE_SYSROOT ${watcom_root})
16+
17+
if(WIN32)
18+
set(bin ${watcom_root}/binnt64 ${watcom_root}/binnt)
19+
else()
20+
set(bin ${watcom_root}/binl64 ${watcom_root}/binl)
21+
endif()
22+
23+
find_program(CMAKE_C_COMPILER
24+
NAMES wcl386
25+
HINTS ${bin}
26+
NO_DEFAULT_PATH
27+
REQUIRED
28+
)

‎cmake/dos.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
$watcom = "$Env:SYSTEMDRIVE:\WATCOM"
2+
3+
if (!(Test-Path -Path $watcom)) {
4+
Throw "OpenWatcom not found at $watcom"
5+
}
6+
7+
$env:WATCOM = $watcom
8+
$env:EDPATH = "$watcom\EDDAT"
9+
$env:WHTMLHELP = "$watcom\BINNT\HELP"
10+
$env:WIPFC = "$watcom\WIPFC"
11+
12+
$env:LIBPATH = "$watcom\lib386\"
13+
$env:INCLUDE = "$watcom\H"
14+
15+
$env:Path += ";$watcom\BINNT64;$watcom\BINNT"

‎cmake/dos.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
watcom="/opt/watcom/"
4+
5+
if [ ! -d $watcom ]; then
6+
echo "OpenWatcom not found at $watcom" >&2
7+
exit 1
8+
fi
9+
10+
export WATCOM=$watcom
11+
export EDPATH="$watcom/eddat"
12+
export WIPFC="$watcom/wipfc"
13+
14+
export INCLUDE="$watcom/h"
15+
export PATH="$watcom/binl64:$watcom/binl:$PATH"

‎cmake/x11.cmake

+30
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ if(PKG_CONFIG_FOUND)
88

99
pkg_check_modules(_xt xt)
1010
pkg_check_modules(_x11 x11)
11+
pkg_check_modules(_xmu xmu)
12+
pkg_check_modules(_xpm xpm)
13+
pkg_check_modules(_xaw xaw7)
1114

1215
endif()
1316

@@ -27,8 +30,35 @@ PATH_SUFFIXES X11
2730
REQUIRED
2831
)
2932

33+
# macOS may need this
34+
find_path(_xmu_inc
35+
NAMES StdSel.h
36+
HINTS ${_xmu_INCLUDE_DIRS} ${X11_INCLUDE_DIR}
37+
PATH_SUFFIXES X11/Xmu
38+
REQUIRED
39+
)
40+
41+
# macOS may need this
42+
find_path(_xpm_inc
43+
NAMES xpm.h
44+
HINTS ${_xpm_INCLUDE_DIRS} ${X11_INCLUDE_DIR}
45+
PATH_SUFFIXES X11
46+
REQUIRED
47+
)
48+
49+
# macOS may need this
50+
find_path(_xaw_inc
51+
NAMES Box.h
52+
HINTS ${_xaw_INCLUDE_DIRS} ${X11_INCLUDE_DIR}
53+
PATH_SUFFIXES X11/Xaw
54+
REQUIRED
55+
)
56+
3057
list(APPEND X11_INCLUDE_DIR
3158
${_xt_inc} ${_xatom_inc}
59+
${_xmu_inc} ${_xmu_inc}/..
60+
${_xpm_inc}
61+
${_xaw_inc} ${_xaw_inc}/..
3262
)
3363

3464
message(STATUS "X11_INCLUDE_DIR: ${X11_INCLUDE_DIR}

0 commit comments

Comments
 (0)
Please sign in to comment.