Skip to content
Snippets Groups Projects
Commit 88a16f82 authored by Vassil Vassilev's avatar Vassil Vassilev
Browse files

[cmake][make] Move -isystem flag at one place passing it to all compiler calls.

Moving from one header file per module to one module (and submodules) introduces
a few new restrictions. For instance, the module is built if any ot its headers
is included. This means that it will build the TGLIncludes.h-related modules
which in turn requires adjusting the -isystem path on OSX, allowing glew.h
to hooked before #include-ing system's gl.h (building system's OpenGL module).
parent ca144dfa
No related branches found
No related tags found
No related merge requests found
......@@ -601,10 +601,23 @@ CXXMODULES_MODULEMAP_CONTENTS :=
ALLHDRS := include/module.modulemap
ROOT_CXXMODULES_CXXFLAGS = -fmodules -fcxx-modules -fmodules-cache-path=$(ROOT_OBJDIR)/include/pcms/
ROOT_CXXMODULES_CFLAGS = -fmodules -fmodules-cache-path=$(ROOT_OBJDIR)/include/pcms/
# FIXME: OSX doesn't support -fmodules-local-submodule-visibility because its
# Frameworks' modulemaps predate the flag.
ifneq ($(PLATFORM),macosx)
ROOT_CXXMODULES_CXXFLAGS += -Xclang -fmodules-local-submodule-visibility
else
# FIXME: TGLIncludes and alike depend on glew.h doing special preprocessor
# trickery to override the contents of system's OpenGL.
# On OSX #include TGLIncludes.h will trigger the creation of the system
# OpenGL.pcm. Once it is built, glew cannot use preprocessor trickery to 'fix'
# the translation units which it needs to 'rewrite'. The translation units
# which need glew support are in graf3d. However, depending on the modulemap
# organization we could request it implicitly (eg. one big module for ROOT).
# In these cases we need to 'prepend' this include path to the compiler in order
# for glew.h to it its trick.
ROOT_CXXMODULES_CXXFLAGS += -isystem $(ROOT_SRCDIR)/graf3d/glew/isystem/
ROOT_CXXMODULES_CFLAGS += -isystem $(ROOT_SRCDIR)/graf3d/glew/isystem/
endif # not macos
CXXFLAGS += $(ROOT_CXXMODULES_CXXFLAGS)
......
......@@ -130,7 +130,19 @@ if(cxxmodules)
file(COPY ${CMAKE_SOURCE_DIR}/build/unix/module.modulemap DESTINATION ${ROOT_INCLUDE_DIR})
# This var is useful when we want to compile things without cxxmodules.
set(ROOT_CXXMODULES_CXXFLAGS "-fmodules -fcxx-modules -fmodules-cache-path=${CMAKE_BINARY_DIR}/include/pcms/")
if(NOT APPLE)
if(APPLE)
# FIXME: TGLIncludes and alike depend on glew.h doing special preprocessor
# trickery to override the contents of system's OpenGL.
# On OSX #include TGLIncludes.h will trigger the creation of the system
# OpenGL.pcm. Once it is built, glew cannot use preprocessor trickery to 'fix'
# the translation units which it needs to 'rewrite'. The translation units
# which need glew support are in graf3d. However, depending on the modulemap
# organization we could request it implicitly (eg. one big module for ROOT).
# In these cases we need to 'prepend' this include path to the compiler in order
# for glew.h to it its trick.
set(ROOT_CXXMODULES_CXXFLAGS "${ROOT_CXXMODULES_CFLAGS} -isystem ${CMAKE_SOURCE_DIR}/graf3d/glew/isystem ")
set(ROOT_CXXMODULES_CXXFLAGS "${ROOT_CXXMODULES_CXXFLAGS} -isystem ${CMAKE_SOURCE_DIR}/graf3d/glew/isystem ")
else()
set(ROOT_CXXMODULES_CXXFLAGS "${ROOT_CXXMODULES_CXXFLAGS} -Xclang -fmodules-local-submodule-visibility")
endif(NOT APPLE)
set(ROOT_CXXMODULES_CFLAGS "-fmodules -fmodules-cache-path=${CMAKE_BINARY_DIR}/include/pcms/")
......
......@@ -23,10 +23,6 @@ if(MACOSX_GLU_DEPRECATED)
add_definitions(-Wno-deprecated-declarations)
endif()
# We need to disallow the direct use of gl.h. This way people will see the error
# and the suggested fix. This happens by providing our own "fake" system gl.h.
set(CMAKE_CXX_FLAGS " -isystem ${CMAKE_CURRENT_SOURCE_DIR}/../glew/isystem ${CMAKE_CXX_FLAGS}")
ROOT_GENERATE_DICTIONARY(G__Eve ${headers1} ${headers2} MODULE Eve LINKDEF LinkDef.h)
ROOT_LINKER_LIBRARY(Eve *.cxx G__Eve.cxx LIBRARIES ${OPENGL_LIBRARIES} GLEW ${FTGL_LIBRARIES} Core DEPENDENCIES Geom Ged RGL Physics EG)
......
......@@ -106,10 +106,7 @@ distclean:: distclean-$(MODNAME)
ifeq ($(ARCH),win32)
$(EVEO) $(EVEDO): CXXFLAGS += $(OPENGLINCDIR:%=-I%) $(FTGLINCDIR:%=-I%) $(FTGLCPPFLAGS)
else
# We need to disallow the direct use of gl.h. This way people will see the error
# and the suggested fix. This happens by providing our own "fake" system gl.h.
$(EVEO) $(EVEDO): CXXFLAGS += -isystem $(ROOT_SRCDIR)/graf3d/glew/isystem/ \
$(OPENGLINCDIR:%=-I%) $(FTGLINCDIR:%=-I%) $(FTGLCPPFLAGS)
$(EVEO) $(EVEDO): CXXFLAGS += $(OPENGLINCDIR:%=-I%) $(FTGLINCDIR:%=-I%) $(FTGLCPPFLAGS)
$(EVEO): CXXFLAGS += $(GLEWINCDIR:%=-I%) $(GLEWCPPFLAGS)
endif
ifeq ($(MACOSX_GLU_DEPRECATED),yes)
......
......@@ -34,10 +34,6 @@ if(MACOSX_GLU_DEPRECATED)
add_definitions(-Wno-deprecated-declarations)
endif()
# We need to disallow the direct use of gl.h. This way people will see the error
# and the suggested fix. This happens by providing our own "fake" system gl.h.
set(CMAKE_CXX_FLAGS " -isystem ${CMAKE_CURRENT_SOURCE_DIR}/../glew/isystem ${CMAKE_CXX_FLAGS}")
set_source_files_properties(src/TGLFontManager.cxx PROPERTIES COMPILE_FLAGS "${FTGL_CFLAGS}")
set_source_files_properties(src/TGLText.cxx PROPERTIES COMPILE_FLAGS "${FTGL_CFLAGS}")
......
......@@ -128,9 +128,7 @@ $(GLO) $(GLDO): CXXFLAGS += $(OPENGLINCDIR:%=-I%) -I$(WIN32GDKDIR)/gdk/src \
$(GLDS): CINTFLAGS += $(OPENGLINCDIR:%=-I%) -I$(WIN32GDKDIR)/gdk/src \
$(GDKDIRI:%=-I%) $(GLIBDIRI:%=-I%) $(GL2PSFLAGS)
else
# We need to disallow the direct use of gl.h. This way people will see the error
# and the suggested fix. This happens by providing our own "fake" system gl.h.
$(GLO) $(GLDO): CXXFLAGS += -isystem $(ROOT_SRCDIR)/graf3d/glew/isystem/ $(OPENGLINCDIR:%=-I%) $(GL2PSFLAGS)
$(GLO) $(GLDO): CXXFLAGS += $(OPENGLINCDIR:%=-I%) $(GL2PSFLAGS)
$(GLDS): CINTFLAGS += $(OPENGLINCDIR:%=-I%) $(GL2PSFLAGS)
endif
......
......@@ -16,10 +16,6 @@
#include "TVirtualPS.h"
#include "TGLViewer.h"
#include "TSystem.h" // For gSystem
// FIXME: Some gl2ps.h versions (see ROOT-8219) rely on including gl.h, which
// in we shadow in our isystem/gl.h intentionally. Including TGLIncludes.h, will
// temporary workaround the issue.
#include "TGLIncludes.h"
#include "gl2ps.h"
#include "TError.h"
#include <assert.h>
......
......@@ -4,8 +4,5 @@
include_directories(${OPENGL_INCLUDE_DIR})
# We need to disallow the direct use of gl.h. This way people will see the error
# and the suggested fix. This happens by providing our own "fake" system gl.h.
set(CMAKE_C_FLAGS " -isystem ${CMAKE_CURRENT_SOURCE_DIR}/isystem ${GLEW_C_FLAGS}")
ROOT_LINKER_LIBRARY(GLEW *.c LIBRARIES ${OPENGL_LIBRARIES})
ROOT_INSTALL_HEADERS()
......@@ -67,6 +67,4 @@ distclean-$(MODNAME): clean-$(MODNAME)
distclean:: distclean-$(MODNAME)
##### extra rules ######
# We need to disallow the direct use of gl.h. This way people will see the error
# and the suggested fix. This happens by providing our own "fake" system gl.h
$(GLEWO): CFLAGS += -isystem $(GLEWDIR)/isystem $(OPENGLINCDIR:%=-I%)
$(GLEWO): CFLAGS += $(OPENGLINCDIR:%=-I%)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment