diff --git a/graf3d/CMakeLists.txt b/graf3d/CMakeLists.txt
index 7d0fe05b4efd7308845a1e07e9abdb5870f56a6e..a3eae439a8c1ddbc1def51ceae71b92faa877c74 100644
--- a/graf3d/CMakeLists.txt
+++ b/graf3d/CMakeLists.txt
@@ -10,6 +10,9 @@ add_subdirectory(g3d) # special CMakeLists.txt
 if(NOT WIN32 AND x11)
   add_subdirectory(x3d) # special CMakeLists.txt
 endif()
+
+add_subdirectory(csg) # special CMakeLists.txt
+
 if (opengl)
    add_subdirectory(eve) # special CMakeLists.txt
    add_subdirectory(gl) # special CMakeLists.txt
diff --git a/graf3d/csg/CMakeLists.txt b/graf3d/csg/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..570d261eff8af47a2c71e303f6ef923fd23c7454
--- /dev/null
+++ b/graf3d/csg/CMakeLists.txt
@@ -0,0 +1,8 @@
+ROOT_STANDARD_LIBRARY_PACKAGE(RCsg
+  HEADERS
+     inc/CsgOps.h
+  SOURCES
+     src/CsgOps.cxx
+  DEPENDENCIES
+     MathCore   
+)
diff --git a/graf3d/gl/inc/CsgOps.h b/graf3d/csg/inc/CsgOps.h
similarity index 92%
rename from graf3d/gl/inc/CsgOps.h
rename to graf3d/csg/inc/CsgOps.h
index fae48f287c5ff3911ca4a54972d5d1cb2f2a981e..3c13e85469273e647c6f613735c08cbafa439ca1 100644
--- a/graf3d/gl/inc/CsgOps.h
+++ b/graf3d/csg/inc/CsgOps.h
@@ -15,13 +15,15 @@ namespace RootCsg {
 
 class TBaseMesh {
 public:
+   TBaseMesh() = default;
+   virtual ~TBaseMesh() = default;
 
-   virtual ~TBaseMesh(){}
    virtual UInt_t NumberOfPolys()const = 0;
    virtual UInt_t NumberOfVertices()const = 0;
    virtual UInt_t SizeOfPoly(UInt_t polyIndex)const = 0;
    virtual const Double_t *GetVertex(UInt_t vertNum)const = 0;
-   virtual Int_t GetVertexIndex(UInt_t polyNum, UInt_t vertNum)const = 0; };
+   virtual Int_t GetVertexIndex(UInt_t polyNum, UInt_t vertNum)const = 0;
+};
 
    TBaseMesh *ConvertToMesh(const TBuffer3D &buff);
    TBaseMesh *BuildUnion(const TBaseMesh *leftOperand, const TBaseMesh *rightOperand);
diff --git a/graf3d/csg/inc/LinkDef.h b/graf3d/csg/inc/LinkDef.h
new file mode 100644
index 0000000000000000000000000000000000000000..11845afab77518c9291ce00fb98f423392b0af39
--- /dev/null
+++ b/graf3d/csg/inc/LinkDef.h
@@ -0,0 +1,21 @@
+// @(#)root/csg:$Id$
+
+/*************************************************************************
+ * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers.               *
+ * All rights reserved.                                                  *
+ *                                                                       *
+ * For the licensing terms see $ROOTSYS/LICENSE.                         *
+ * For the list of contributors see $ROOTSYS/README/CREDITS.             *
+ *************************************************************************/
+
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ namespace RootCsg;
+
+#pragma link C++ class RootCsg::TBaseMesh+;
+
+#endif
diff --git a/graf3d/gl/src/CsgOps.cxx b/graf3d/csg/src/CsgOps.cxx
similarity index 100%
rename from graf3d/gl/src/CsgOps.cxx
rename to graf3d/csg/src/CsgOps.cxx
diff --git a/graf3d/gl/CMakeLists.txt b/graf3d/gl/CMakeLists.txt
index 3a4c4d999e3e9c03012527a1548c0747185e26ff..341c0291602c2e7db04bc360abd19fd2629684fe 100644
--- a/graf3d/gl/CMakeLists.txt
+++ b/graf3d/gl/CMakeLists.txt
@@ -42,5 +42,5 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RGL
                               SOURCES ${sources}
                               DICTIONARY_OPTIONS "-writeEmptyRootPCM"
                               LIBRARIES ${gllibs} ${GL2PS_LIBRARIES} GLEW ${FTGL_LIBRARIES}
-                              DEPENDENCIES Hist Gui Ged
+                              DEPENDENCIES Hist Gui Ged RCsg
                               INSTALL_OPTIONS ${installoptions})