ppisa commented on code in PR #3624:
URL: https://github.com/apache/nuttx-apps/pull/3624#discussion_r3660470846


##########
graphics/microwindows/Makefile:
##########
@@ -0,0 +1,142 @@
+############################################################################
+# apps/graphics/microwindows/Makefile
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(APPDIR)/Make.defs
+
+# Microwindows graphic library
+
+MICROWINDOWS_DIR = .
+MICROWINDOWS_DIR_NAME = microwindows
+
+# Set up build configuration and environment
+
+WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
+
+MICROWINDOWS_COMMIT_HASH := 1f269127b991d01dea5784eacee321a23e34d3d5
+
+CONFIG_GRAPH_MICROWINDOWS_URL ?= 
https://codeload.github.com/ghaerr/microwindows/zip/$(MICROWINDOWS_COMMIT_HASH)
+
+MICROWINDOWS_TARBALL := microwindows-$(MICROWINDOWS_COMMIT_HASH).zip
+
+MICROWINDOWS_UNPACKNAME = microwindows
+UNPACK ?= unzip -o $(if $(V),,-q)
+CURL ?= curl -L $(if $(V),,-Ss)
+
+MICROWINDOWS_UNPACKDIR =  $(WD)/$(MICROWINDOWS_UNPACKNAME)
+
+$(MICROWINDOWS_TARBALL):
+       $(ECHO_BEGIN)"Downloading: $(MICROWINDOWS_TARBALL)"
+       $(Q) $(CURL) -o $(MICROWINDOWS_TARBALL) $(CONFIG_GRAPH_MICROWINDOWS_URL)
+       $(ECHO_END)
+
+$(MICROWINDOWS_UNPACKNAME): $(MICROWINDOWS_TARBALL)
+       $(ECHO_BEGIN)"Unpacking: $(MICROWINDOWS_TARBALL) -> 
$(MICROWINDOWS_UNPACKNAME)"
+       $(Q) $(UNPACK) $(MICROWINDOWS_TARBALL)
+       $(Q) mv microwindows-$(MICROWINDOWS_COMMIT_HASH) 
$(MICROWINDOWS_UNPACKNAME)
+       $(Q) touch $(MICROWINDOWS_UNPACKNAME)
+       $(ECHO_END)
+
+# Download and unpack tarball if no git repo found
+ifeq ($(wildcard $(MICROWINDOWS_UNPACKNAME)/.git),)
+context:: $(MICROWINDOWS_UNPACKNAME)
+
+distclean::
+       $(call DELDIR, $(MICROWINDOWS_UNPACKNAME))
+       $(call DELFILE, $(MICROWINDOWS_TARBALL))
+endif
+
+CFLAGS += -DRTEMS=0 -DPSP=0 -D__ECOS=0 -D__MINGW32__=0
+CFLAGS += -DELKS=0 -D_MINIX=0 -DMSDOS=0 -DLINUX=0
+CFLAGS += -DMACOSX=0 -DTRIMEDIA=0
+
+CFLAGS += -Wno-undef
+CFLAGS += -Wno-shadow
+
+MW_DIR_OBJ = $(WD)/$(MICROWINDOWS_DIR_NAME)/src
+
+# Select NuttX drivers via Microwindows Objects.rules
+ARCH = NUTTX
+
+ifeq ($(CONFIG_MICROWINDOWS_KBD_EVENT),y)
+KEYBOARD = NUTTXKBD
+else ifeq ($(CONFIG_MICROWINDOWS_KBD_RAW),y)
+KEYBOARD = NUTTXRAWKBD
+else ifeq ($(CONFIG_MICROWINDOWS_KBD_NONE),y)
+KEYBOARD = NOKBD
+else ifeq ($(CONFIG_MICROWINDOWS_KBD_CUSTOM),y)
+KEYBOARD = CUSTOM
+endif
+
+ifeq ($(CONFIG_MICROWINDOWS_MOUSE_RELATIVE),y)
+MOUSE = NUTTXMOUSE
+else ifeq ($(CONFIG_MICROWINDOWS_MOUSE_TS),y)
+MOUSE = NUTTXTOUCH
+else ifeq ($(CONFIG_MICROWINDOWS_MOUSE_NONE),y)
+MOUSE = NOMOUSE
+else ifeq ($(CONFIG_MICROWINDOWS_MOUSE_CUSTOM),y)
+MOUSE = CUSTOM
+endif
+
+-include microwindows/src/engine/Objects.rules
+-include microwindows/src/drivers/Objects.rules
+-include microwindows/src/fonts/Objects.rules
+
+CSRCS += $(MW_CORE_OBJS:%.o=%.c)
+
+ifneq ($(CONFIG_EXAMPLES_MICROWINDOWS),)

Review Comment:
   Microwidows is APIs providing library. So if it is build then elsewhere in 
the source tree can be application which uses Microwindows and combines it with 
something else, some real value program.
   
   For example, we have used low level GDI API which allowed us to run medical 
syringe pump firmware build against RTEMS and RETMS Microwindows port on real 
hardware with all the check functions and communication with another MCU which 
control delivery. [Related RTEMS 
page](https://www.rtems.org/applications/hardware/amv_technic_i/) and our 
[page](https://www.pikron.com/pages/devel/medinst.html). The same complex 
application source code with out upper level libraries 
[SuiTk](https://gitlab.com/pikron/sw-base/suitk/-/wikis/home) could be run 
against Microwidows library compiled for Linux X11 in window emulating target 
screen, in this case with stubs for syringe motor, etc., and we have even run 
same code on Linux framebuffer directly. Same libraries could be ran even 
against Microwidows on the Cortex-M without operating system, in this case 
limited to single thread.
   
   So if you build Microwidows without its included application then it can 
still be used on NuttX. My personal preferred NuttX applications build is to 
export NuttX and use it as library for our applications. Then application from 
same sources can be build for GNU/Linux and linked with GLibc and other 
libraries, but with switch of rules to build for NuttX and linked with it into 
firmware image or build against RTEMS development environment and BSPs 
installation and I obtain RTEMS system firmware image. Our OMK build system 
even allows to have source tree with multiple applications which are built as 
separate executables for GNU/Linux and build together into single NuttX image 
and registered as builtins aromatically or even compiled as loadable ELF files 
to be loaded and linked into NuttX dynamically.
   
   I expect that there could be even more configuration options which select 
which Microwidows programs (in NuttX without MMU builtins) should be provided, 
i.e., request to build Nano-X X11 like server, separate applications and demos.
   
   At least this is my idea and where I see value of Microwidows. Ability to 
write portable POSIX applications which can even use single graphic API on more 
operating systems.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to