Add OpenWatcom 2

This commit is contained in:
2021-10-19 13:12:18 +01:00
parent 4ac66a9913
commit fd0bc0fb65
14 changed files with 458 additions and 1 deletions

66
CMake-OpenWatcom2/.clang-format Executable file
View File

@@ -0,0 +1,66 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: DontAlign
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never

9
CMake-OpenWatcom2/.idea/.gitignore generated vendored Executable file
View File

@@ -0,0 +1,9 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
/deployment.xml

1
CMake-OpenWatcom2/.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
CMake-OpenWatcom2

2
CMake-OpenWatcom2/.idea/CMake-OpenWatcom2.iml generated Executable file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

7
CMake-OpenWatcom2/.idea/custom-compiler.xml generated Executable file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="com.jetbrains.cidr.lang.workspace.compiler.custom.CustomCompilerService">
<option name="definitionsFile" value="$PROJECT_DIR$/openwatcom2.yaml" />
<option name="enabled" value="true" />
</component>
</project>

4
CMake-OpenWatcom2/.idea/misc.xml generated Executable file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
CMake-OpenWatcom2/.idea/modules.xml generated Executable file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/CMake-OpenWatcom2.iml" filepath="$PROJECT_DIR$/.idea/CMake-OpenWatcom2.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.21)
project(CMake-OpenWatcom2 C)
set(CMAKE_C_STANDARD 90)
add_executable(CMake-OpenWatcom2 main.c)

View File

@@ -0,0 +1,66 @@
## Custom compiler definitions for CLion and OpenWatcom 2
This compiler definition allows you to use OpenWatcom 2 from Linux or Windows.
## Supported platforms
- Windows NT (x86)
- 16-bit OS/2
- 32-bit OS/2
- DOS
- 32-bit DOS (using DOS/4GW)
- Linux (x86)
## Unsupported platforms
- 16-bit Windows: don't know how to make it work, patches welcome
- Windows for MIPS, PowerPC or Alpha: the compilers are there, but the libraries are not made, contribute to [Open Watcom 2](https://github.com/open-watcom/open-watcom-v2) to make it possible
- QNX: headers and libraries are copyright of BlackBerry Limited, ping them for opensourcing them (as they were for QNX 2 and QNX 4 probably not of much interest to them anymore?)
- NetWare: libraries are there but headers need to be installed separately, ping Micro Focus International for opensourcing them (as they abandoned NetWare long ago)
- Others: Watcom supported many targets over the ages and I don't know which others may just need some care to make them work
## Instructions
The most important step is to ensure that Watcom binaries are in the path. This depends on your exact installation but usually on Windows it is `C:\WATCOM\BINNT64` and on Linux it is `/opt/watcom/binl64`. Until JetBrains allow to specify APPENDING path members for a specific toolchain (tried with Environment Variables, no go) this is a must.
After this is done you need to add the compilers in `Settings -> Build, Execution, Deployment -> Toolchains` and set up at least the C compiler and C++ compiler (they're the same) and at least in Windows (as there's no system `make` to make CLion happy) also select `wmake` (`wmake.exe`).
Compiler for 16-bit targets: `wcl` or `wcl.exe`
Compiler for 32-bit targets: `wcl386` or `wcl386.exe`
Compiler for Alpha targets: `wclaxp` or `wclaxp.exe` *DOESN'T INCLUDE C OR C++ LIBRARIES*
Compiler for MIPS targets: `wclmps` or `wclmps.exe` *DOESN'T INCLUDE C OR C++ LIBRARIES*
Compiler for PowerPC targets: `wclppc` or `wclppc.exe` *DOESN'T INCLUDE C OR C++ LIBRARIES*
Then, for the project, you need to go `Settings -> Build, Execution, Deployment -> CMake` and create the appropriate targets.
In each target set the following environment for Windows (change paths appropriately if installed in another location):
- `WATCOM=C:\WATCOM`
- `INCLUDE=C:\WATCOM\H\;C:\WATCOM\H\NT\;C:\WATCOM\H\NT\DIRECTX\;C:\WATCOM\H\NT\DDK\;%INCLUDE%`
or in Linux (change paths appropriately if installed in another location):
- `WATCOM=/opt/watcom`
- `INCLUDE=/opt/watcom/lh`
then in CMake options you need to set: `-DCMAKE_SYSTEM_NAME=<system> -DCMAKE_SYSTEM_PROCESSOR=<arch> -G "Watcom WMake"`
where `<system>` is:
- `DOS` for DOS
- `OS2` for OS/2
- `Windows` for Windows and Windows NT
- `Linux` for Linux
and `<arch>` is:
- `I86` for 16-bit
- `I386` for 32-bit
- none for 32-bit or the others *(untested)*
## Final notes
The preprocessor macros have been a bestguess and may be severely incomplete, patches welcome!
2021 - [Natalia Portillo](https://github.com/claunia)
Many thanks to [Jiří Malák](https://github.com/jmalak) for keeping OpenWatcom alive!

6
CMake-OpenWatcom2/main.c Executable file
View File

@@ -0,0 +1,6 @@
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}

View File

@@ -0,0 +1,105 @@
compilers:
- description: OpenWatcom 32-bit OS/2 target
match-args: "-bt=os2"
match-compiler-exe: "(.*/)?wcl386(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/os2"
defines-text: "
#define __X86__ 1
#define __386__ 1
#define M_I386 1
#define _M_I386 1
#define _M_IX86 500
#define __OS2__ 1
#define __FLAT__ 1
#define M_386FM 1
#define _M_386FM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom 32-bit DOS target
match-args: "-bt=dos"
match-compiler-exe: "(.*/)?wcl386(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/os2"
defines-text: "
#define __X86__ 1
#define __386__ 1
#define M_I386 1
#define _M_I386 1
#define _M_IX86 500
#define _DOS 1
#define MSDOS 1
#define __DOS__ 1
#define __FLAT__ 1
#define M_386FM 1
#define _M_386FM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom 32-bit Windows target
match-args: "-bt=nt"
match-compiler-exe: "(.*/)?wcl386(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/nt"
defines-text: "
#define __X86__ 1
#define __386__ 1
#define M_I386 1
#define _M_I386 1
#define _M_IX86 500
#define __NT__ 1
#define __WINDOWS_386__ 1
#define _WIN32 1
#define __FLAT__ 1
#define M_386FM 1
#define _M_386FM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom 16-bit OS/2 target
match-args: "-bt=os2"
match-compiler-exe: "(.*/)?wcl(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/os21x"
defines-text: "
#define __X86__ 1
#define __I86__ 1
#define M_I86 1
#define _M_I86 1
#define _M_IX86 0
#define __OS2__ 1
#define __LARGE__ 1
#define M_I86LM 1
#define _M_I86LM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom DOS target
match-args: "-bt=dos"
match-compiler-exe: "(.*/)?wcl(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h"
defines-text: "
#define __X86__ 1
#define __I86__ 1
#define M_I86 1
#define _M_I86 1
#define _M_IX86 0
#define __DOS__ 1
#define _DOS 1
#define MSDOS 1
#define __LARGE__ 1
#define M_I86LM 1
#define _M_I86LM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom 32-bit Linux target
match-args: "-bt=linux"
match-compiler-exe: "(.*/)?wcl386(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/nt"
defines-text: "
#define __X86__ 1
#define __386__ 1
#define M_I386 1
#define _M_I386 1
#define _M_IX86 500
#define __LINUX__ 1
#define __FLAT__ 1
#define M_386FM 1
#define _M_386FM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"

View File

@@ -24,4 +24,10 @@ This repository contains:
* Compiler definition file: [custom-compiler-sdcc-stm8.yaml](CCMake-SDCC/custom-compiler-sdcc-stm8.yaml)
* Host Platforms: Windows, Linux, Mac
* Target Platform: STM8 MCU
* [CMake-OpenWatcom2](CMake-OpenWatcom2)
* Build System: [CMake](https://cmake.org/)
* Compiler: [Open Watcom 2](https://github.com/open-watcom/open-watcom-v2)
* Compiler definition file: [openwatcom2.yaml](CMake-OpenWatcom2/openwatcom2.yaml)
* Host Platforms: Windows, Linux
* Target Platform: Windows NT, DOS, 32-bit DOS (DOS/4GW), 16-bit OS/2, 32-bit OS/2, Linux/x86
* Contributed by: [Natalia Portillo](https://github.com/claunia)

View File

@@ -0,0 +1,66 @@
## Custom compiler definitions for CLion and OpenWatcom 2
This compiler definition allows you to use OpenWatcom 2 from Linux or Windows.
## Supported platforms
- Windows NT (x86)
- 16-bit OS/2
- 32-bit OS/2
- DOS
- 32-bit DOS (using DOS/4GW)
- Linux (x86)
## Unsupported platforms
- 16-bit Windows: don't know how to make it work, patches welcome
- Windows for MIPS, PowerPC or Alpha: the compilers are there, but the libraries are not made, contribute to [Open Watcom 2](https://github.com/open-watcom/open-watcom-v2) to make it possible
- QNX: headers and libraries are copyright of BlackBerry Limited, ping them for opensourcing them (as they were for QNX 2 and QNX 4 probably not of much interest to them anymore?)
- NetWare: libraries are there but headers need to be installed separately, ping Micro Focus International for opensourcing them (as they abandoned NetWare long ago)
- Others: Watcom supported many targets over the ages and I don't know which others may just need some care to make them work
## Instructions
The most important step is to ensure that Watcom binaries are in the path. This depends on your exact installation but usually on Windows it is `C:\WATCOM\BINNT64` and on Linux it is `/opt/watcom/binl64`. Until JetBrains allow to specify APPENDING path members for a specific toolchain (tried with Environment Variables, no go) this is a must.
After this is done you need to add the compilers in `Settings -> Build, Execution, Deployment -> Toolchains` and set up at least the C compiler and C++ compiler (they're the same) and at least in Windows (as there's no system `make` to make CLion happy) also select `wmake` (`wmake.exe`).
Compiler for 16-bit targets: `wcl` or `wcl.exe`
Compiler for 32-bit targets: `wcl386` or `wcl386.exe`
Compiler for Alpha targets: `wclaxp` or `wclaxp.exe` *DOESN'T INCLUDE C OR C++ LIBRARIES*
Compiler for MIPS targets: `wclmps` or `wclmps.exe` *DOESN'T INCLUDE C OR C++ LIBRARIES*
Compiler for PowerPC targets: `wclppc` or `wclppc.exe` *DOESN'T INCLUDE C OR C++ LIBRARIES*
Then, for the project, you need to go `Settings -> Build, Execution, Deployment -> CMake` and create the appropriate targets.
In each target set the following environment for Windows (change paths appropriately if installed in another location):
- `WATCOM=C:\WATCOM`
- `INCLUDE=C:\WATCOM\H\;C:\WATCOM\H\NT\;C:\WATCOM\H\NT\DIRECTX\;C:\WATCOM\H\NT\DDK\;%INCLUDE%`
or in Linux (change paths appropriately if installed in another location):
- `WATCOM=/opt/watcom`
- `INCLUDE=/opt/watcom/lh`
then in CMake options you need to set: `-DCMAKE_SYSTEM_NAME=<system> -DCMAKE_SYSTEM_PROCESSOR=<arch> -G "Watcom WMake"`
where `<system>` is:
- `DOS` for DOS
- `OS2` for OS/2
- `Windows` for Windows and Windows NT
- `Linux` for Linux
and `<arch>` is:
- `I86` for 16-bit
- `I386` for 32-bit
- none for 32-bit or the others *(untested)*
## Final notes
The preprocessor macros have been a bestguess and may be severely incomplete, patches welcome!
2021 - [Natalia Portillo](https://github.com/claunia)
Many thanks to [Jiří Malák](https://github.com/jmalak) for keeping OpenWatcom alive!

View File

@@ -0,0 +1,105 @@
compilers:
- description: OpenWatcom 32-bit OS/2 target
match-args: "-bt=os2"
match-compiler-exe: "(.*/)?wcl386(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/os2"
defines-text: "
#define __X86__ 1
#define __386__ 1
#define M_I386 1
#define _M_I386 1
#define _M_IX86 500
#define __OS2__ 1
#define __FLAT__ 1
#define M_386FM 1
#define _M_386FM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom 32-bit DOS target
match-args: "-bt=dos"
match-compiler-exe: "(.*/)?wcl386(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/os2"
defines-text: "
#define __X86__ 1
#define __386__ 1
#define M_I386 1
#define _M_I386 1
#define _M_IX86 500
#define _DOS 1
#define MSDOS 1
#define __DOS__ 1
#define __FLAT__ 1
#define M_386FM 1
#define _M_386FM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom 32-bit Windows target
match-args: "-bt=nt"
match-compiler-exe: "(.*/)?wcl386(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/nt"
defines-text: "
#define __X86__ 1
#define __386__ 1
#define M_I386 1
#define _M_I386 1
#define _M_IX86 500
#define __NT__ 1
#define __WINDOWS_386__ 1
#define _WIN32 1
#define __FLAT__ 1
#define M_386FM 1
#define _M_386FM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom 16-bit OS/2 target
match-args: "-bt=os2"
match-compiler-exe: "(.*/)?wcl(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/os21x"
defines-text: "
#define __X86__ 1
#define __I86__ 1
#define M_I86 1
#define _M_I86 1
#define _M_IX86 0
#define __OS2__ 1
#define __LARGE__ 1
#define M_I86LM 1
#define _M_I86LM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom DOS target
match-args: "-bt=dos"
match-compiler-exe: "(.*/)?wcl(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h"
defines-text: "
#define __X86__ 1
#define __I86__ 1
#define M_I86 1
#define _M_I86 1
#define _M_IX86 0
#define __DOS__ 1
#define _DOS 1
#define MSDOS 1
#define __LARGE__ 1
#define M_I86LM 1
#define _M_I86LM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"
- description: OpenWatcom 32-bit Linux target
match-args: "-bt=linux"
match-compiler-exe: "(.*/)?wcl386(\\.exe)?"
include-dirs: "${compiler-exe-dir}/../h ${compiler-exe-dir}/../h/nt"
defines-text: "
#define __X86__ 1
#define __386__ 1
#define M_I386 1
#define _M_I386 1
#define _M_IX86 500
#define __LINUX__ 1
#define __FLAT__ 1
#define M_386FM 1
#define _M_386FM 1
#define __WATCOMC__ 1280
#define _INTEGRAL_MAX_BITS 64"