#watt32 #Static library offering a TCP/IP stack for large memory model DOS programs. #Compiles with the OpenWatcom C compiler and the accompanying WASM assembler. cmake_minimum_required(VERSION 3.15) #CMAKE_USER_MAKE_RULES_OVERRIDE works better with this and later versions of CMake #Declare the CMake compilation rules BEFORE the project() statement. #The compilation rules tell CMake how the compiler and linker should be #invoked for the various tasks like compiling object files and linking them #together. The compiler rules do not concern themselves with compiler #executable paths, but rather which flags to use when invoking the compiler. #Absolute paths of compiler executables are stored in the CMake toolchain #file. A separate file containing the compilation rules allows multiple CMake #projects to share the same CMake toolchain file but use different compilation #flags. set (CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/CompilerRules.cmake") project(freedos NONE) #Enable no languages yet - we do so below with enable_language() in the correct language order. #Per advice from gvanem@yahoo.no on 19aug19, we rely on the wasm assembler, #which will be invoked by the Watcom compiler driver for all source files with the .asm #file extension as long as we take care to enable_language(ASM). This is #opposed to enable_language(ASM_NASM), which will bypass the compiler driver #and pass the file directly to the NASM assembler as long as we enable #ASM_NASM before C. enable_language (ASM) enable_language (C) #These object files (which are based on assembler source files) will go into a #separate library so we can optionally use a different assembler than the #Watcom assembler as outlined above. Using a separate library allows the #optional assembler to use a different command line syntax than the C compiler #driver. add_library (watt32_asm STATIC asmpkt.asm chksum0.asm cpumodel.asm ) add_library (watt32 STATIC) target_link_libraries (watt32 PUBLIC watt32_asm) #The directory containing the public header files which must be used by any #networkable DOS application in order to statically link to the watt32 #protocol stack. target_include_directories (watt32 PUBLIC $ $ PRIVATE ${CMAKE_SOURCE_DIR} ) target_compile_definitions (watt32 PRIVATE WATT32_BUILD) #CORE_SOURCE target_sources (watt32 PRIVATE bsdname.c btree.c chksum.c country.c crc.c dynip.c echo.c fortify.c getopt.c gettod.c highc.c idna.c ip4_frag.c ip4_in.c ip4_out.c ip6_in.c ip6_out.c language.c lookup.c loopback.c misc.c netback.c oldstuff.c packet32.c pc_cbrk.c pcarp.c pcbootp.c pcbuf.c pcconfig.c pcdbug.c pcdhcp.c pcdns.c pcicmp.c pcicmp6.c pcigmp.c pcintr.c pcping.c pcpkt.c pcpkt32.c pcqueue.c pcrarp.c pcrecv.c pcsed.c pcstat.c pctcp.c ports.c powerpak.c ppp.c pppoe.c profile.c punycode.c qmsg.c rs232.c run.c settod.c sock_dbu.c sock_in.c sock_ini.c sock_io.c sock_prn.c sock_scn.c sock_sel.c split.c strings.c swsvpkt.c tcp_fsm.c tcp_md5.c tftp.c timer.c udp_rev.c version.c wdpmi.c win_dll.c winadinf.c winmisc.c winpkt.c x32vm.c ) #BSD_SOURCE target_sources (watt32 PRIVATE accept.c bind.c bsddbug.c close.c connect.c fcntl.c fsext.c get_ai.c get_ip.c get_ni.c get_xbyr.c geteth.c gethost.c gethost6.c getname.c getnet.c getprot.c getput.c getserv.c ioctl.c linkaddr.c listen.c netaddr.c neterr.c nettime.c nsapaddr.c poll.c presaddr.c printk.c receive.c select.c shutdown.c signal.c socket.c sockopt.c stream.c syslog.c syslog2.c transmit.c ) #BIND_SOURCE target_sources (watt32 PRIVATE res_comp.c res_data.c res_debu.c res_init.c res_loc.c res_mkqu.c res_quer.c res_send.c ) #ZLIB_SOURCE target_sources (watt32 PRIVATE zadler32.c zcompres.c zcrc32.c zgzio.c zuncompr.c zdeflate.c ztrees.c zutil.c zinflate.c zinfback.c zinftree.c zinffast.c ) target_compile_options (watt32 PUBLIC -ml) #Large memory model target_compile_options (watt32 PUBLIC -fpi) #emulate 8087 target_compile_options (watt32 PRIVATE -0) #Use 8086 instructions only target_compile_options (watt32 PRIVATE -os) #optimization flags target_compile_options (watt32 PRIVATE -zc) #place const data into the code segment target_compile_options (watt32 PRIVATE -s) #favour code size over execution time target_compile_options (watt32 PRIVATE -zq) #operate quietly target_compile_options (watt32 PRIVATE -fr=nul) #error file target_compile_options (watt32 PRIVATE -wx) #warning level #TARGET = ..\lib\wattcpwl.lib #MAKEFIL = watcom_l.mak #LIBARG = $(OBJDIR)\wlib.arg #LINKARG = $(OBJDIR)\wlink.arg #C_ARGS = $(OBJDIR)\$(CC).arg install (TARGETS watt32_asm watt32 EXPORT watt32-config ARCHIVE DESTINATION lib) #The large memory model flag will be included in the EXPORT below so that any #client of this library will automatically be compiled with the large memory #model and also the same floating point 8087 support. install (EXPORT watt32-config DESTINATION cmake) #Install the public header files install (DIRECTORY ${CMAKE_SOURCE_DIR}/../inc DESTINATION include)