From 6dd2cc808ef6bf95e967e1fbb38b187521fe55f0 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 17 Nov 2020 16:38:46 +0100
Subject: [PATCH] CONFIG: provisional cuda rule. Update naming for CGAL rules

---
 .../cellSizeAndAlignmentGrid/Make/options     |  2 +-
 .../conformalVoronoiMesh/Make/options         |  2 +-
 .../foamyMesh/foamyHexMesh/Make/options       |  2 +-
 .../foamyHexMeshBackgroundMesh/Make/options   |  2 +-
 .../foamyHexMeshSurfaceSimplify/Make/options  |  2 +-
 .../foamyMesh/foamyQuadMesh/Make/options      |  2 +-
 .../surfaceBooleanFeatures/Make/options       |  2 +-
 .../PolyhedronReader/Make/options             |  2 +-
 wmake/rules/General/CGAL                      | 70 +------------------
 wmake/rules/General/cgal                      | 69 ++++++++++++++++++
 wmake/rules/General/cuda                      | 26 +++++++
 wmake/rules/General/moc                       |  2 +-
 wmake/rules/darwin64Clang/{CGAL => cgal}      |  0
 13 files changed, 105 insertions(+), 78 deletions(-)
 create mode 100644 wmake/rules/General/cgal
 create mode 100644 wmake/rules/General/cuda
 rename wmake/rules/darwin64Clang/{CGAL => cgal} (100%)

diff --git a/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/Make/options b/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/Make/options
index 8059fdffa79..1cc0174df38 100644
--- a/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/Make/options
+++ b/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/Make/options
@@ -4,7 +4,7 @@ EXE_NDEBUG = -DNDEBUG
 CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/
 CGAL_INEXACT = -DCGAL_INEXACT
 
-include $(GENERAL_RULES)/CGAL
+include $(GENERAL_RULES)/cgal
 
 EXE_INC = \
     ${ROUNDING_MATH} \
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/Make/options b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/Make/options
index b65c905e0f3..afff9fbfad4 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/Make/options
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/Make/options
@@ -4,7 +4,7 @@ EXE_NDEBUG = -DNDEBUG
 CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/
 CGAL_INEXACT = -DCGAL_INEXACT
 
-include $(GENERAL_RULES)/CGAL
+include $(GENERAL_RULES)/cgal
 
 EXE_INC = \
     ${ROUNDING_MATH} \
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/Make/options
index 0155c4b209d..2591762d9a8 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/Make/options
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/Make/options
@@ -4,7 +4,7 @@ EXE_NDEBUG = -DNDEBUG
 CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/
 CGAL_INEXACT = -DCGAL_INEXACT
 
-include $(GENERAL_RULES)/CGAL
+include $(GENERAL_RULES)/cgal
 
 EXE_INC = \
     ${ROUNDING_MATH} \
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options
index e71aedddb0b..921245b6a9a 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options
@@ -1,7 +1,7 @@
 EXE_DEBUG = -DFULLDEBUG -g -O0
 EXE_NDEBUG = -DNDEBUG
 
-include $(GENERAL_RULES)/CGAL
+include $(GENERAL_RULES)/cgal
 
 EXE_INC = \
     ${ROUNDING_MATH} \
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options
index 67cd78a01af..23df4fe774a 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options
@@ -1,6 +1,6 @@
 MarchingCubes = fastdualoctree_sgp
 
-include $(GENERAL_RULES)/CGAL
+include $(GENERAL_RULES)/cgal
 
 EXE_INC = \
     -DUNIX \
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/Make/options
index 79052724447..c2720a1233c 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/Make/options
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/Make/options
@@ -1,7 +1,7 @@
 EXE_DEBUG = -DFULLDEBUG -g -O0
 EXE_NDEBUG = -DNDEBUG
 
-include $(GENERAL_RULES)/CGAL
+include $(GENERAL_RULES)/cgal
 
 EXE_INC = \
     ${ROUNDING_MATH} \
diff --git a/applications/utilities/surface/surfaceBooleanFeatures/Make/options b/applications/utilities/surface/surfaceBooleanFeatures/Make/options
index 39fd1175485..ef8abccf930 100644
--- a/applications/utilities/surface/surfaceBooleanFeatures/Make/options
+++ b/applications/utilities/surface/surfaceBooleanFeatures/Make/options
@@ -7,7 +7,7 @@ c++CGALWARN = -Wno-old-style-cast
 /*-- Define CGAL_INEXACT to use inexact CGAL constructions */
 
 ifeq (,$(findstring NO_CGAL,$(COMP_FLAGS)))
-include $(GENERAL_RULES)/CGAL
+include $(GENERAL_RULES)/cgal
 endif
 
 EXE_INC = \
diff --git a/applications/utilities/surface/surfaceBooleanFeatures/PolyhedronReader/Make/options b/applications/utilities/surface/surfaceBooleanFeatures/PolyhedronReader/Make/options
index 8321bcd0461..7a400a830df 100644
--- a/applications/utilities/surface/surfaceBooleanFeatures/PolyhedronReader/Make/options
+++ b/applications/utilities/surface/surfaceBooleanFeatures/PolyhedronReader/Make/options
@@ -5,7 +5,7 @@ c++CGALWARN = -Wno-old-style-cast
 
 /*-- Define CGAL_INEXACT to use inexact CGAL constructions */
 
-include $(GENERAL_RULES)/CGAL
+include $(GENERAL_RULES)/cgal
 
 EXE_INC = \
     ${ROUNDING_MATH} \
diff --git a/wmake/rules/General/CGAL b/wmake/rules/General/CGAL
index d68fc0d1fbf..98b266f76f7 100644
--- a/wmake/rules/General/CGAL
+++ b/wmake/rules/General/CGAL
@@ -1,69 +1 @@
-# ----------------------------------------------------------------------------
-# CGAL definitions - several possibilities
-#
-#  0. missing
-#  1. header-only
-#  2. library, no mpfr
-#  3. library, with mpfr (a likely default)
-#
-# Dispatch according to the defined 'CGAL_FLAVOUR'
-# - names may change [see wmake/scripts/have_cgal]
-# (no-cgal | cgal-header | cgal-no-mpfr | cgal-mpfr)
-
-cgal_subrule := cgal-mpfr
-ifneq (,$(findstring header,$(CGAL_FLAVOUR)))
-    cgal_subrule := cgal-header-only
-endif
-ifneq (,$(findstring no-mpfr,$(CGAL_FLAVOUR)))
-    cgal_subrule := cgal-no-mpfr
-endif
-
-# ----------------------------------------------------------------------------
-# BOOST include/library directories - synthesize from ARCH_PATH as required
-
-ifeq (,$(strip $(BOOST_INC_DIR)))
-ifneq (,$(strip $(BOOST_ARCH_PATH)))
-  BOOST_INC_DIR = $(BOOST_ARCH_PATH)/include
-  BOOST_LIB_DIR = $(BOOST_ARCH_PATH)/lib \
-    $(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
-endif
-endif
-
-# ----------------------------------------------------------------------------
-# CGAL include/library directories - synthesize from ARCH_PATH as required
-
-ifeq (,$(strip $(CGAL_INC_DIR)))
-ifneq (,$(strip $(CGAL_ARCH_PATH)))
-  CGAL_INC_DIR = $(CGAL_ARCH_PATH)/include
-  CGAL_LIB_DIR = $(CGAL_ARCH_PATH)/lib \
-    $(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
-endif
-endif
-
-# ----------------------------------------------------------------------------
-
-CGAL_INC  =
-CGAL_LIBS =
-
-include $(GENERAL_RULES)/$(cgal_subrule)
-
-# Override
-sinclude $(DEFAULT_RULES)/CGAL
-sinclude $(DEFAULT_RULES)/$(cgal_subrule)
-
-# DEBUG
-# -----
-
-## $(info CGAL_FLAVOUR $(CGAL_FLAVOUR))
-## $(info subrule $(cgal_subrule))
-
-## CGAL_INC += -Wp,-v
-## $(info CGAL_INC: $(CGAL_INC))
-## $(info CGAL_LIB: $(CGAL_LIBS))
-
-## $(info BOOST_INC_DIR: $(BOOST_INC_DIR))
-## $(info BOOST_LIB_DIR: $(BOOST_LIB_DIR))
-## $(info CGAL_INC_DIR: $(CGAL_INC_DIR))
-## $(info CGAL_LIB_DIR: $(CGAL_LIB_DIR))
-
-# ---------------------------------------------------------------------------
+include $(GENERAL_RULES)/cgal
diff --git a/wmake/rules/General/cgal b/wmake/rules/General/cgal
new file mode 100644
index 00000000000..7442d4071e6
--- /dev/null
+++ b/wmake/rules/General/cgal
@@ -0,0 +1,69 @@
+# ----------------------------------------------------------------------------
+# CGAL definitions - several possibilities
+#
+#  0. missing
+#  1. header-only
+#  2. library, no mpfr
+#  3. library, with mpfr (a likely default)
+#
+# Dispatch according to the defined 'CGAL_FLAVOUR'
+# - names may change [see wmake/scripts/have_cgal]
+# (no-cgal | cgal-header | cgal-no-mpfr | cgal-mpfr)
+
+cgal_subrule := cgal-mpfr
+ifneq (,$(findstring header,$(CGAL_FLAVOUR)))
+    cgal_subrule := cgal-header-only
+endif
+ifneq (,$(findstring no-mpfr,$(CGAL_FLAVOUR)))
+    cgal_subrule := cgal-no-mpfr
+endif
+
+# ----------------------------------------------------------------------------
+# BOOST include/library directories - synthesize from ARCH_PATH as required
+
+ifeq (,$(strip $(BOOST_INC_DIR)))
+ifneq (,$(strip $(BOOST_ARCH_PATH)))
+  BOOST_INC_DIR = $(BOOST_ARCH_PATH)/include
+  BOOST_LIB_DIR = $(BOOST_ARCH_PATH)/lib \
+    $(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
+endif
+endif
+
+# ----------------------------------------------------------------------------
+# CGAL include/library directories - synthesize from ARCH_PATH as required
+
+ifeq (,$(strip $(CGAL_INC_DIR)))
+ifneq (,$(strip $(CGAL_ARCH_PATH)))
+  CGAL_INC_DIR = $(CGAL_ARCH_PATH)/include
+  CGAL_LIB_DIR = $(CGAL_ARCH_PATH)/lib \
+    $(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
+endif
+endif
+
+# ----------------------------------------------------------------------------
+
+CGAL_INC  =
+CGAL_LIBS =
+
+include $(GENERAL_RULES)/$(cgal_subrule)
+
+# Override
+sinclude $(DEFAULT_RULES)/cgal
+sinclude $(DEFAULT_RULES)/$(cgal_subrule)
+
+# DEBUG
+# -----
+
+## $(info CGAL_FLAVOUR $(CGAL_FLAVOUR))
+## $(info subrule $(cgal_subrule))
+
+## CGAL_INC += -Wp,-v
+## $(info CGAL_INC: $(CGAL_INC))
+## $(info CGAL_LIB: $(CGAL_LIBS))
+
+## $(info BOOST_INC_DIR: $(BOOST_INC_DIR))
+## $(info BOOST_LIB_DIR: $(BOOST_LIB_DIR))
+## $(info CGAL_INC_DIR: $(CGAL_INC_DIR))
+## $(info CGAL_LIB_DIR: $(CGAL_LIB_DIR))
+
+# ---------------------------------------------------------------------------
diff --git a/wmake/rules/General/cuda b/wmake/rules/General/cuda
new file mode 100644
index 00000000000..5a30f6a6631
--- /dev/null
+++ b/wmake/rules/General/cuda
@@ -0,0 +1,26 @@
+#------------------------------------------------------------------------------
+# Additional rules for handling CUDA files
+
+SUFFIXES += .cu
+
+ifeq (,$(NVARCH))
+    NVARCH  = 70
+endif
+
+NVCC        = nvcc -std=c++14 --compiler-options='-fPIC'
+
+cuARCH      = -arch=sm_$(NVARCH)
+cuOPT       = -O3
+cuDBUG      =
+
+# Similar to c++FLAGS
+cuFLAGS     = $(GFLAGS) -DNoRepository $(cuARCH) $(cuOPT) $(cuDBUG) $(LIB_HEADER_DIRS)
+
+cutoo       = $(WM_SCHEDULER) $(NVCC) $(cuFLAGS) -c $< -o $@
+
+$(OBJECTS_DIR)/%.o : %.cu
+	$(cutoo)
+
+CUDA_LINKLIBSO  = $(NVCC) -shared
+
+#------------------------------------------------------------------------------
diff --git a/wmake/rules/General/moc b/wmake/rules/General/moc
index 1a0d4160cc6..ed1b508d77f 100644
--- a/wmake/rules/General/moc
+++ b/wmake/rules/General/moc
@@ -1,5 +1,5 @@
 SUFFIXES += .qt
 
 qttoo = $E $(call QUIET_MESSAGE,moc,$(<F)) \
-       $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< -o $(@D)/$(<F).C $(AND) \
+       $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< $< -o $(@D)/$(<F).C $(AND) \
        $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
diff --git a/wmake/rules/darwin64Clang/CGAL b/wmake/rules/darwin64Clang/cgal
similarity index 100%
rename from wmake/rules/darwin64Clang/CGAL
rename to wmake/rules/darwin64Clang/cgal
-- 
GitLab