# #OpenWatcom C compiler for producing 16-bit 8086 code #See ftp://openwatcom.org/archive/zips-1.0/_layout.txt #The compiler can be invoked as ${CMAKE_INSTALL_PREFIX}/binnt/wcl.exe #Invoke ${CMAKE_INSTALL_PREFIX}/binnt/wcl.exe to list the compiler options. # #WARNING WARNING WARNING # #The binaries installed here suffer from a weakness in the Microsoft CRT: #The tmpnam() function (declared in stdio.h) will return a filename in the #root of the current drive (a path without a drive letter!!!), causing the #compiler to fail with "access denied" as soon as it attempts to create a #temporary file. # #The temporary file is created in _P_tmpdir of the current drive. #In stdio.h, we have: #define _P_tmpdir "\\" # #So, the temporary file is created in the root directory of the current drive. #This usually means c:\, and will fail due to access rights restrictions if c: #is an NTFS drive (which is usually the case these days in 2019). The binaries #installed here may work if you take care to run them on a machine where your #C: drive is formatted with FAT32 because there are no access restrictions #enforced for directories on FAT32 drives. # #This CRT weakness was corrected by Microsoft in the "great CRT cleanup" #that shipped as part of Visual Studio 2015, but the Watcom binaries installed #here were compiled by a much earlier version of Visual Studio (VS 2008?), so #they have not been "cleaned up", and never will be. #See https://social.msdn.microsoft.com/Forums/en-US/259c9af3-0168-47cd-a99c-cc2a78ebe777/tmpnam-refers-to-c-instead-of-current-working-directory # if (WIN32) #Install for WIN32 host from the binary distribution ExternalProject_Add ( openwatcom_cm_core_all PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/cm_core_all.zip URL_MD5 048b96dc3c2218cddba4e5b61d27106e CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_cm_core_nt PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/cm_core_nt.zip URL_MD5 8419712b7289bcb70c73eecf33be0139 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_cm_clib_hdr PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/cm_clib_hdr.zip URL_MD5 37490344fd39549a6d3746296dff0a73 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_cm_clib_a16 PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/cm_clib_a16.zip URL_MD5 570b5a94790a4df080b7f6f08c9dcf7c CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_cm_clib_d16 PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/cm_clib_d16.zip URL_MD5 7d4cca532e082058834be4e4cdfbe933 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_core_all PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/core_all.zip URL_MD5 ea760ce5b2c18d9e4f1c24825f337591 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_core_nt PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/core_nt.zip URL_MD5 c42426910b4a7fa5dd69ed81d69b84d8 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_c_nt PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/c_nt.zip URL_MD5 7cc6257911c1734f519cec803cd6f035 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_clib_a16 PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/clib_a16.zip URL_MD5 90b16cd568748262301435d18bb54a21 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) ExternalProject_Add ( openwatcom_clib_d16 PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL ftp://ftp.openwatcom.org/archive/zips-1.0/clib_d16.zip URL_MD5 3976bc62b6549308907c27b5b4493176 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ) #Creates a compiler launcher in the form of a batch file. The batch file sets #up some required environment variables and launches the compiler in that #environment. ExternalProject_Add ( openwatcom_launcher PREFIX ${CMAKE_INSTALL_PREFIX} SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/launcher CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE:STRING=Release DEPENDS openwatcom_cm_core_all openwatcom_cm_core_nt openwatcom_cm_clib_hdr openwatcom_cm_clib_a16 openwatcom_cm_clib_d16 openwatcom_core_all openwatcom_core_nt openwatcom_c_nt openwatcom_clib_a16 openwatcom_clib_d16 ) #Creates a toolchain file containing the abolute path of the compiler launcher ExternalProject_Add ( openwatcom PREFIX ${CMAKE_INSTALL_PREFIX} SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE:STRING=Release -DTOOLCHAIN_SYSTEM_NAME:STRING=Windows -DTOOLCHAIN_SYSTEM_VERSION:STRING=1.0 -DTOOLCHAIN_SYSTEM_PROCESSOR:STRING=8086 DEPENDS openwatcom_launcher ) #Other OSD modules can specify -DCMAKE_TOOLCHAIN_FILE:PATH=${WATCOM_TOOLCHAIN_FILE} #in order to build using the Watcom toolchain. set (WATCOM_TOOLCHAIN_FILE "${CMAKE_INSTALL_PREFIX}/share/openwatcom-toolchain.txt" PARENT_SCOPE) endif (WIN32)