From 4b9a12399d634d278f9034bbf013be896f121870 Mon Sep 17 00:00:00 2001 From: Mike Gorchak Date: Wed, 26 May 2021 15:33:35 -0400 Subject: [PATCH 1/2] Add QNX build infrastructure and environment. --- README.md | 7 ++++ build-qnx/Makefile | 1 + build-qnx/driver_stub/Makefile | 2 ++ build-qnx/driver_stub/common.mk | 33 +++++++++++++++++ build-qnx/driver_stub/nto/Makefile | 8 +++++ build-qnx/driver_stub/nto/aarch64/Makefile | 8 +++++ .../driver_stub/nto/aarch64/dll.le/Makefile | 1 + build-qnx/driver_stub/nto/arm/Makefile | 8 +++++ .../driver_stub/nto/arm/dll.le.v7/Makefile | 1 + build-qnx/driver_stub/nto/x86_64/Makefile | 8 +++++ build-qnx/driver_stub/nto/x86_64/dll/Makefile | 1 + build-qnx/icd/Makefile | 2 ++ build-qnx/icd/common.mk | 35 +++++++++++++++++++ build-qnx/icd/icd_cmake_config.h | 2 ++ build-qnx/icd/nto/Makefile | 8 +++++ build-qnx/icd/nto/aarch64/Makefile | 8 +++++ build-qnx/icd/nto/aarch64/so.le/Makefile | 1 + build-qnx/icd/nto/arm/Makefile | 8 +++++ build-qnx/icd/nto/arm/so.le.v7/Makefile | 1 + build-qnx/icd/nto/x86_64/Makefile | 8 +++++ build-qnx/icd/nto/x86_64/so/Makefile | 1 + build-qnx/icd_loader_test/Makefile | 2 ++ build-qnx/icd_loader_test/common.mk | 35 +++++++++++++++++++ build-qnx/icd_loader_test/icd_loader_test.use | 1 + build-qnx/icd_loader_test/nto/Makefile | 8 +++++ .../icd_loader_test/nto/aarch64/Makefile | 8 +++++ .../icd_loader_test/nto/aarch64/o.le/Makefile | 1 + build-qnx/icd_loader_test/nto/arm/Makefile | 8 +++++ .../icd_loader_test/nto/arm/o.le.v7/Makefile | 1 + build-qnx/icd_loader_test/nto/x86_64/Makefile | 8 +++++ .../icd_loader_test/nto/x86_64/o/Makefile | 1 + build-qnx/layer/Makefile | 2 ++ build-qnx/layer/common.mk | 35 +++++++++++++++++++ build-qnx/layer/nto/Makefile | 8 +++++ build-qnx/layer/nto/aarch64/Makefile | 8 +++++ build-qnx/layer/nto/aarch64/dll.le/Makefile | 1 + build-qnx/layer/nto/arm/Makefile | 8 +++++ build-qnx/layer/nto/arm/dll.le.v7/Makefile | 1 + build-qnx/layer/nto/x86_64/Makefile | 8 +++++ build-qnx/layer/nto/x86_64/dll/Makefile | 1 + 40 files changed, 297 insertions(+) create mode 100644 build-qnx/Makefile create mode 100644 build-qnx/driver_stub/Makefile create mode 100644 build-qnx/driver_stub/common.mk create mode 100644 build-qnx/driver_stub/nto/Makefile create mode 100644 build-qnx/driver_stub/nto/aarch64/Makefile create mode 100644 build-qnx/driver_stub/nto/aarch64/dll.le/Makefile create mode 100644 build-qnx/driver_stub/nto/arm/Makefile create mode 100644 build-qnx/driver_stub/nto/arm/dll.le.v7/Makefile create mode 100644 build-qnx/driver_stub/nto/x86_64/Makefile create mode 100644 build-qnx/driver_stub/nto/x86_64/dll/Makefile create mode 100644 build-qnx/icd/Makefile create mode 100644 build-qnx/icd/common.mk create mode 100644 build-qnx/icd/icd_cmake_config.h create mode 100644 build-qnx/icd/nto/Makefile create mode 100644 build-qnx/icd/nto/aarch64/Makefile create mode 100644 build-qnx/icd/nto/aarch64/so.le/Makefile create mode 100644 build-qnx/icd/nto/arm/Makefile create mode 100644 build-qnx/icd/nto/arm/so.le.v7/Makefile create mode 100644 build-qnx/icd/nto/x86_64/Makefile create mode 100644 build-qnx/icd/nto/x86_64/so/Makefile create mode 100644 build-qnx/icd_loader_test/Makefile create mode 100644 build-qnx/icd_loader_test/common.mk create mode 100644 build-qnx/icd_loader_test/icd_loader_test.use create mode 100644 build-qnx/icd_loader_test/nto/Makefile create mode 100644 build-qnx/icd_loader_test/nto/aarch64/Makefile create mode 100644 build-qnx/icd_loader_test/nto/aarch64/o.le/Makefile create mode 100644 build-qnx/icd_loader_test/nto/arm/Makefile create mode 100644 build-qnx/icd_loader_test/nto/arm/o.le.v7/Makefile create mode 100644 build-qnx/icd_loader_test/nto/x86_64/Makefile create mode 100644 build-qnx/icd_loader_test/nto/x86_64/o/Makefile create mode 100644 build-qnx/layer/Makefile create mode 100644 build-qnx/layer/common.mk create mode 100644 build-qnx/layer/nto/Makefile create mode 100644 build-qnx/layer/nto/aarch64/Makefile create mode 100644 build-qnx/layer/nto/aarch64/dll.le/Makefile create mode 100644 build-qnx/layer/nto/arm/Makefile create mode 100644 build-qnx/layer/nto/arm/dll.le.v7/Makefile create mode 100644 build-qnx/layer/nto/x86_64/Makefile create mode 100644 build-qnx/layer/nto/x86_64/dll/Makefile diff --git a/README.md b/README.md index 1c37d050..1f92e918 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,13 @@ Notes: * Some users may prefer to use a CMake GUI frontend, such as `cmake-gui` or `ccmake`, vs. the command-line CMake. +### Building on QNX + +QNX is using its own build system. The proper build environment must be set +under the QNX host development system (Linux, Win64, MacOS) by invoking +the shell/batch script provided with QNX installation. Current building environment +under the "build-qnx" supports QNX SDP 7.0, QNX SDP 7.1 and upcoming QNX SDP 7.2. + ## OpenCL ICD Loader Tests OpenCL ICD Loader Tests can be run using `ctest`, which is a companion to CMake. diff --git a/build-qnx/Makefile b/build-qnx/Makefile new file mode 100644 index 00000000..0405fe9f --- /dev/null +++ b/build-qnx/Makefile @@ -0,0 +1 @@ +include recurse.mk diff --git a/build-qnx/driver_stub/Makefile b/build-qnx/driver_stub/Makefile new file mode 100644 index 00000000..3beecfb7 --- /dev/null +++ b/build-qnx/driver_stub/Makefile @@ -0,0 +1,2 @@ +LIST=OS +include recurse.mk diff --git a/build-qnx/driver_stub/common.mk b/build-qnx/driver_stub/common.mk new file mode 100644 index 00000000..768a1bdb --- /dev/null +++ b/build-qnx/driver_stub/common.mk @@ -0,0 +1,33 @@ +ifndef QCONFIG +QCONFIG=qconfig.mk +endif +include $(QCONFIG) + +define PINFO +PINFO DESCRIPTION = "OpenCL Driver Stub" +endef + +ICD_ROOT=$(CURDIR)/../../../../.. + +EXTRA_INCVPATH+=$(ICD_ROOT)/inc +EXTRA_INCVPATH+=$(ICD_ROOT)/test/inc + +EXTRA_SRCVPATH+=$(ICD_ROOT)/test/driver_stub +EXTRA_SRCVPATH+=$(ICD_ROOT)/test/log + +NAME=libOpenCLDriverStub + +# Make the library + +SRCS = cl.c cl_ext.c cl_gl.c icd.c icd_test_log.c + +LDFLAGS += -Wl,--unresolved-symbols=report-all -Wl,--no-undefined -Wl,-fPIC + +include $(MKFILES_ROOT)/qtargets.mk + +CCFLAGS += -DCL_ENABLE_LAYERS -DCL_TARGET_OPENCL_VERSION=300 -DOpenCLDriverStub_EXPORTS +CCFLAGS += -fPIC -std=gnu99 + +CXXFLAGS += $(CCFLAGS) + +INSTALLDIR=usr/lib diff --git a/build-qnx/driver_stub/nto/Makefile b/build-qnx/driver_stub/nto/Makefile new file mode 100644 index 00000000..0cc5eae2 --- /dev/null +++ b/build-qnx/driver_stub/nto/Makefile @@ -0,0 +1,8 @@ +LIST=CPU +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/driver_stub/nto/aarch64/Makefile b/build-qnx/driver_stub/nto/aarch64/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/driver_stub/nto/aarch64/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/driver_stub/nto/aarch64/dll.le/Makefile b/build-qnx/driver_stub/nto/aarch64/dll.le/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/driver_stub/nto/aarch64/dll.le/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/driver_stub/nto/arm/Makefile b/build-qnx/driver_stub/nto/arm/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/driver_stub/nto/arm/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/driver_stub/nto/arm/dll.le.v7/Makefile b/build-qnx/driver_stub/nto/arm/dll.le.v7/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/driver_stub/nto/arm/dll.le.v7/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/driver_stub/nto/x86_64/Makefile b/build-qnx/driver_stub/nto/x86_64/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/driver_stub/nto/x86_64/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/driver_stub/nto/x86_64/dll/Makefile b/build-qnx/driver_stub/nto/x86_64/dll/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/driver_stub/nto/x86_64/dll/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/icd/Makefile b/build-qnx/icd/Makefile new file mode 100644 index 00000000..3beecfb7 --- /dev/null +++ b/build-qnx/icd/Makefile @@ -0,0 +1,2 @@ +LIST=OS +include recurse.mk diff --git a/build-qnx/icd/common.mk b/build-qnx/icd/common.mk new file mode 100644 index 00000000..351d918e --- /dev/null +++ b/build-qnx/icd/common.mk @@ -0,0 +1,35 @@ +ifndef QCONFIG +QCONFIG=qconfig.mk +endif +include $(QCONFIG) + +define PINFO +PINFO DESCRIPTION = "OpenCL ICD Loader" +endef + +ICD_ROOT=$(CURDIR)/../../../../.. + +EXTRA_INCVPATH+=$(ICD_ROOT)/build_qnx +EXTRA_INCVPATH+=$(ICD_ROOT)/inc + +EXTRA_SRCVPATH+=$(ICD_ROOT)/loader +EXTRA_SRCVPATH+=$(ICD_ROOT)/loader/linux + +SO_VERSION=1 +NAME=OpenCL + +# Make the library + +SRCS = icd.c icd_dispatch.c icd_dispatch_generated.c icd_linux.c icd_linux_envvars.c + +LDFLAGS += -Wl,--unresolved-symbols=report-all -Wl,--no-undefined -Wl,-fPIC +LDFLAGS += -Wl,--version-script -Wl,$(ICD_ROOT)/loader/linux/icd_exports.map + +include $(MKFILES_ROOT)/qtargets.mk + +CCFLAGS += -DCL_ENABLE_LAYERS -DCL_TARGET_OPENCL_VERSION=300 -DOpenCL_EXPORTS +CCFLAGS += -fPIC -std=gnu99 + +CXXFLAGS += $(CCFLAGS) + +INSTALLDIR=usr/lib diff --git a/build-qnx/icd/icd_cmake_config.h b/build-qnx/icd/icd_cmake_config.h new file mode 100644 index 00000000..5e7be4ee --- /dev/null +++ b/build-qnx/icd/icd_cmake_config.h @@ -0,0 +1,2 @@ +/* #undef HAVE_SECURE_GETENV */ +/* #undef HAVE___SECURE_GETENV */ diff --git a/build-qnx/icd/nto/Makefile b/build-qnx/icd/nto/Makefile new file mode 100644 index 00000000..0cc5eae2 --- /dev/null +++ b/build-qnx/icd/nto/Makefile @@ -0,0 +1,8 @@ +LIST=CPU +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/icd/nto/aarch64/Makefile b/build-qnx/icd/nto/aarch64/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/icd/nto/aarch64/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/icd/nto/aarch64/so.le/Makefile b/build-qnx/icd/nto/aarch64/so.le/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/icd/nto/aarch64/so.le/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/icd/nto/arm/Makefile b/build-qnx/icd/nto/arm/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/icd/nto/arm/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/icd/nto/arm/so.le.v7/Makefile b/build-qnx/icd/nto/arm/so.le.v7/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/icd/nto/arm/so.le.v7/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/icd/nto/x86_64/Makefile b/build-qnx/icd/nto/x86_64/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/icd/nto/x86_64/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/icd/nto/x86_64/so/Makefile b/build-qnx/icd/nto/x86_64/so/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/icd/nto/x86_64/so/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/icd_loader_test/Makefile b/build-qnx/icd_loader_test/Makefile new file mode 100644 index 00000000..3beecfb7 --- /dev/null +++ b/build-qnx/icd_loader_test/Makefile @@ -0,0 +1,2 @@ +LIST=OS +include recurse.mk diff --git a/build-qnx/icd_loader_test/common.mk b/build-qnx/icd_loader_test/common.mk new file mode 100644 index 00000000..826d3065 --- /dev/null +++ b/build-qnx/icd_loader_test/common.mk @@ -0,0 +1,35 @@ +ifndef QCONFIG +QCONFIG=qconfig.mk +endif +include $(QCONFIG) + +define PINFO +PINFO DESCRIPTION = "ICD Loader Test" +endef + +ICD_ROOT=$(CURDIR)/../../../../.. + +EXTRA_INCVPATH+=$(ICD_ROOT)/inc +EXTRA_INCVPATH+=$(ICD_ROOT)/test/inc + +EXTRA_SRCVPATH+=$(ICD_ROOT)/test/loader_test +EXTRA_SRCVPATH+=$(ICD_ROOT)/test/log + +NAME=icd_loader_test + +# Make the library + +SRCS = test_kernel.c main.c test_platforms.c icd_test_match.c test_program_objects.c \ + test_sampler_objects.c test_buffer_object.c test_cl_runtime.c callbacks.c \ + test_create_calls.c test_clgl.c test_image_objects.c icd_test_log.c + +include $(MKFILES_ROOT)/qtargets.mk + +CCFLAGS += -DCL_ENABLE_LAYERS -DCL_TARGET_OPENCL_VERSION=300 +CCFLAGS += -std=gnu99 + +CXXFLAGS += $(CCFLAGS) + +LIBS += OpenCL + +INSTALLDIR=usr/bin diff --git a/build-qnx/icd_loader_test/icd_loader_test.use b/build-qnx/icd_loader_test/icd_loader_test.use new file mode 100644 index 00000000..3cbb96de --- /dev/null +++ b/build-qnx/icd_loader_test/icd_loader_test.use @@ -0,0 +1 @@ +icd_loader_test - ICD Loader Test diff --git a/build-qnx/icd_loader_test/nto/Makefile b/build-qnx/icd_loader_test/nto/Makefile new file mode 100644 index 00000000..0cc5eae2 --- /dev/null +++ b/build-qnx/icd_loader_test/nto/Makefile @@ -0,0 +1,8 @@ +LIST=CPU +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/icd_loader_test/nto/aarch64/Makefile b/build-qnx/icd_loader_test/nto/aarch64/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/icd_loader_test/nto/aarch64/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/icd_loader_test/nto/aarch64/o.le/Makefile b/build-qnx/icd_loader_test/nto/aarch64/o.le/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/icd_loader_test/nto/aarch64/o.le/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/icd_loader_test/nto/arm/Makefile b/build-qnx/icd_loader_test/nto/arm/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/icd_loader_test/nto/arm/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/icd_loader_test/nto/arm/o.le.v7/Makefile b/build-qnx/icd_loader_test/nto/arm/o.le.v7/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/icd_loader_test/nto/arm/o.le.v7/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/icd_loader_test/nto/x86_64/Makefile b/build-qnx/icd_loader_test/nto/x86_64/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/icd_loader_test/nto/x86_64/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/icd_loader_test/nto/x86_64/o/Makefile b/build-qnx/icd_loader_test/nto/x86_64/o/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/icd_loader_test/nto/x86_64/o/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/layer/Makefile b/build-qnx/layer/Makefile new file mode 100644 index 00000000..3beecfb7 --- /dev/null +++ b/build-qnx/layer/Makefile @@ -0,0 +1,2 @@ +LIST=OS +include recurse.mk diff --git a/build-qnx/layer/common.mk b/build-qnx/layer/common.mk new file mode 100644 index 00000000..ca21c37a --- /dev/null +++ b/build-qnx/layer/common.mk @@ -0,0 +1,35 @@ +ifndef QCONFIG +QCONFIG=qconfig.mk +endif +include $(QCONFIG) + +define PINFO +PINFO DESCRIPTION = "OpenCL Layer Print Test" +endef + +ICD_ROOT=$(CURDIR)/../../../../.. + +EXTRA_INCVPATH+=$(ICD_ROOT)/inc +#EXTRA_INCVPATH+=$(ICD_ROOT)/test/inc + +EXTRA_SRCVPATH+=$(ICD_ROOT)/test/layer +#EXTRA_SRCVPATH+=$(ICD_ROOT)/test/log + +NAME=libPrintLayer + +# Make the library + +SRCS = icd_print_layer.c icd_print_layer_generated.c + +LDFLAGS += -Wl,--unresolved-symbols=report-all -Wl,--no-undefined -Wl,-fPIC +LDFLAGS += -Wl,--version-script -Wl,$(ICD_ROOT)/test/layer/icd_print_layer.map +LDFLAGS += -fvisibility=default + +include $(MKFILES_ROOT)/qtargets.mk + +CCFLAGS += -DCL_ENABLE_LAYERS -DCL_TARGET_OPENCL_VERSION=300 -DPrintLayer_EXPORTS +CCFLAGS += -fPIC -std=gnu99 + +CXXFLAGS += $(CCFLAGS) + +INSTALLDIR=usr/lib diff --git a/build-qnx/layer/nto/Makefile b/build-qnx/layer/nto/Makefile new file mode 100644 index 00000000..0cc5eae2 --- /dev/null +++ b/build-qnx/layer/nto/Makefile @@ -0,0 +1,8 @@ +LIST=CPU +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/layer/nto/aarch64/Makefile b/build-qnx/layer/nto/aarch64/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/layer/nto/aarch64/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/layer/nto/aarch64/dll.le/Makefile b/build-qnx/layer/nto/aarch64/dll.le/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/layer/nto/aarch64/dll.le/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/layer/nto/arm/Makefile b/build-qnx/layer/nto/arm/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/layer/nto/arm/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/layer/nto/arm/dll.le.v7/Makefile b/build-qnx/layer/nto/arm/dll.le.v7/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/layer/nto/arm/dll.le.v7/Makefile @@ -0,0 +1 @@ +include ../../../common.mk diff --git a/build-qnx/layer/nto/x86_64/Makefile b/build-qnx/layer/nto/x86_64/Makefile new file mode 100644 index 00000000..0e22650c --- /dev/null +++ b/build-qnx/layer/nto/x86_64/Makefile @@ -0,0 +1,8 @@ +LIST=VARIANT +ifndef QRECURSE +QRECURSE=recurse.mk +ifdef QCONFIG +QRDIR=$(dir $(QCONFIG)) +endif +endif +include $(QRDIR)$(QRECURSE) diff --git a/build-qnx/layer/nto/x86_64/dll/Makefile b/build-qnx/layer/nto/x86_64/dll/Makefile new file mode 100644 index 00000000..0f9d7b9a --- /dev/null +++ b/build-qnx/layer/nto/x86_64/dll/Makefile @@ -0,0 +1 @@ +include ../../../common.mk From 4c30e1b19c88916b8c8a272bd3cc7316245a4951 Mon Sep 17 00:00:00 2001 From: Mike Gorchak Date: Wed, 26 May 2021 15:34:05 -0400 Subject: [PATCH 2/2] Make Linux variant of platform functions more generic and more POSIX-like to make them work on variety POSIX-compatible platforms. --- loader/icd_platform.h | 2 +- loader/linux/icd_linux.c | 33 ++++++++++++++++++++++++++++++++ loader/linux/icd_linux_envvars.c | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/loader/icd_platform.h b/loader/icd_platform.h index f84f5195..4a017a3b 100644 --- a/loader/icd_platform.h +++ b/loader/icd_platform.h @@ -19,7 +19,7 @@ #ifndef _ICD_PLATFORM_H_ #define _ICD_PLATFORM_H_ -#if defined(__linux__) || defined(__APPLE__) +#if defined(__linux__) || defined(__APPLE__) || defined(__QNXNTO__) #define PATH_SEPARATOR ':' #define DIRECTORY_SYMBOL '/' diff --git a/loader/linux/icd_linux.c b/loader/linux/icd_linux.c index 4cc078b2..3e066e7d 100644 --- a/loader/linux/icd_linux.c +++ b/loader/linux/icd_linux.c @@ -27,6 +27,16 @@ #include #include +#if !defined(DT_REG) +/* Try universal POSIX way if DT_REG definition is not available */ +#if !defined(_POSIX_C_SOURCE) +#define _POSIX_C_SOURCE 1 +#endif /* _POSIX_C_SOURCE */ +/* For _POSIX_PATH_MAX */ +#include +#include +#endif /* !DT_REG */ + static pthread_once_t initialized = PTHREAD_ONCE_INIT; /* @@ -61,11 +71,34 @@ void khrIcdOsVendorsEnumerate(void) // attempt to load all files in the directory for (dirEntry = readdir(dir); dirEntry; dirEntry = readdir(dir) ) { +#if defined(DT_REG) switch(dirEntry->d_type) { case DT_UNKNOWN: case DT_REG: case DT_LNK: +#else + char vendor_filename[_POSIX_PATH_MAX]; + struct stat st; + + if (snprintf(vendor_filename, sizeof(vendor_filename), "%s/%s", vendorPath, + dirEntry->d_name) >= (int)sizeof(vendor_filename)) + { + KHR_ICD_TRACE("File path is too long %s/%s, skipping\n", vendorPath, dirEntry->d_name); + continue; + } + + if (stat(vendor_filename, &st) != 0) + { + KHR_ICD_TRACE("Cannot stat file name %s, skipping\n", vendor_filename); + continue; + } + + switch(st.st_mode & S_IFMT) + { + case S_IFREG: + case S_IFLNK: +#endif /* DT_REG */ { const char* extension = ".icd"; FILE *fin = NULL; diff --git a/loader/linux/icd_linux_envvars.c b/loader/linux/icd_linux_envvars.c index bfac87c2..d61dea4e 100644 --- a/loader/linux/icd_linux_envvars.c +++ b/loader/linux/icd_linux_envvars.c @@ -32,7 +32,7 @@ char *khrIcd_getenv(const char *name) { } char *khrIcd_secure_getenv(const char *name) { -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(__QNXNTO__) // Apple does not appear to have a secure getenv implementation. // The main difference between secure getenv and getenv is that secure getenv // returns NULL if the process is being run with elevated privileges by a normal user.