Skip to content

Commit

Permalink
Make it possible to run tests when configuring with -Dgnuinstall:BOOL=ON
Browse files Browse the repository at this point in the history
  • Loading branch information
ellert committed Jan 9, 2016
1 parent b01f9e2 commit 6f634f9
Show file tree
Hide file tree
Showing 75 changed files with 643 additions and 924 deletions.
59 changes: 32 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 200,23 @@ add_custom_command(OUTPUT etc/dictpch/allLinkDefs.h
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/unix/makepchinput.py ${CMAKE_SOURCE_DIR} . ${__clingetcpch} -- ${CMAKE_CXX_FLAGS_SEPARATE}
DEPENDS ${CMAKE_SOURCE_DIR}/build/unix/makepchinput.py ${__allFiles})

add_custom_command(OUTPUT etc/allDict.cxx.pch
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py etc/allDict.cxx.pch -I${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}
DEPENDS ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py
etc/dictpch/allLinkDefs.h
etc/dictpch/allHeaders.h
etc/dictpch/allCppflags.txt
rootcling)
if (WIN32)
add_custom_command(OUTPUT etc/allDict.cxx.pch
COMMAND set ROOTIGNOREPREFIX=1 && ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py etc/allDict.cxx.pch -I${CMAKE_BINARY_DIR}/include
DEPENDS ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py
etc/dictpch/allLinkDefs.h
etc/dictpch/allHeaders.h
etc/dictpch/allCppflags.txt
rootcling)
else()
add_custom_command(OUTPUT etc/allDict.cxx.pch
COMMAND ROOTIGNOREPREFIX=1 ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py etc/allDict.cxx.pch -I${CMAKE_BINARY_DIR}/include
DEPENDS ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py
etc/dictpch/allLinkDefs.h
etc/dictpch/allHeaders.h
etc/dictpch/allCppflags.txt
rootcling)
endif()
add_custom_target(onepcm ALL DEPENDS etc/allDict.cxx.pch)
set_source_files_properties(${__allFiles} PROPERTIES GENERATED TRUE)
add_dependencies(onepcm ${__allTargets})
Expand All @@ -222,24 232,22 @@ if(cxxmodules)
endif(cxxmodules)

#---hsimple.root---------(use the executable for clearer dependencies and proper return code)---
if(NOT gnuinstall) # TODO hsimple.root for gnuinstall
add_custom_target(hsimple ALL DEPENDS tutorials/hsimple.root)
add_dependencies(hsimple onepcm)
ROOT_EXECUTABLE(hsimple.exe test/hsimple.cxx NOINSTALL LIBRARIES RIO Tree Hist)
if(WIN32)
add_custom_command(OUTPUT tutorials/hsimple.root
DEPENDS move_artifacts
COMMAND set PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && $<TARGET_FILE:hsimple.exe>
WORKING_DIRECTORY tutorials DEPENDS Cling)
else()
add_custom_command(OUTPUT tutorials/hsimple.root
DEPENDS move_artifacts
COMMAND ${ld_library_path}=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$ENV{${ld_library_path}}
$<TARGET_FILE:hsimple.exe>
WORKING_DIRECTORY tutorials DEPENDS Cling)
endif()
install(FILES ${CMAKE_BINARY_DIR}/tutorials/hsimple.root DESTINATION ${CMAKE_INSTALL_TUTDIR} COMPONENT tests)
add_custom_target(hsimple ALL DEPENDS tutorials/hsimple.root)
add_dependencies(hsimple onepcm)
ROOT_EXECUTABLE(hsimple.exe test/hsimple.cxx NOINSTALL LIBRARIES RIO Tree Hist)
set_target_properties(hsimple.exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY test)
if(WIN32)
add_custom_command(OUTPUT tutorials/hsimple.root
DEPENDS move_artifacts
COMMAND set PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && set ROOTIGNOREPREFIX=1 && $<TARGET_FILE:hsimple.exe>
WORKING_DIRECTORY tutorials DEPENDS Cling)
else()
add_custom_command(OUTPUT tutorials/hsimple.root
DEPENDS move_artifacts
COMMAND ${ld_library_path}=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ROOTIGNOREPREFIX=1 $<TARGET_FILE:hsimple.exe>
WORKING_DIRECTORY tutorials DEPENDS Cling)
endif()
install(FILES ${CMAKE_BINARY_DIR}/tutorials/hsimple.root DESTINATION ${CMAKE_INSTALL_TUTDIR} COMPONENT tests)

#---version--------------------------------------------------------------------------------------
add_custom_target(version COMMAND ${CMAKE_SOURCE_DIR}/build/unix/makeversion.sh ${CMAKE_BINARY_DIR}
Expand Down Expand Up @@ -277,9 285,6 @@ endif()
#---Configure Testing using CTest----------------------------------------------------------------
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/CTestCustom.cmake ${CMAKE_BINARY_DIR} COPYONLY)
if(testing)
if(gnuinstall)
message(FATAL_ERROR "You cannot enable to run the tests in the build directory (testing=ON) and at the same time select a GNU style installation (gnuinstall=ON). This is because the code is built with the final installation location (CMAKE_INSTALL_PREFIX) for many ancillary files (tutorials, etc, icons, macros, etc.) and these are not available before installation. Tests can be run against the installation once is completed. See the instructions in the web")
endif()
include(RootCTest)
if(roottest)
find_package(Git REQUIRED)
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -697,11 697,9 @@ ifneq ($(findstring map, $(MAKECMDGOALS)),)
.NOTPARALLEL:
endif

ifeq ($(USECONFIG),FALSE)
all: tutorials/hsimple.root
tutorials/hsimple.root: rootexecs postbin
@(cd tutorials; ! ../bin/root -l -q -b -n -x hsimple.C)
endif
@(cd tutorials; ! ROOTIGNOREPREFIX=1 ../bin/root -l -q -b -n -x hsimple.C)

all: rootexecs postbin
@echo " "
Expand Down Expand Up @@ -1134,7 1132,7 @@ endif

$(ROOTPCH): $(MAKEPCH) $(ROOTCLINGSTAGE1DEP) $(ALLHDRS) $(CLINGETCPCH) $(ORDER_) $(ALLLIBS)
@$(MAKEPCHINPUT) $(ROOT_SRCDIR) "$(MODULES)" $(CLINGETCPCH) -- $(ROOTCLING_CXXFLAGS)
@$(MAKEPCH) $@
@ROOTIGNOREPREFIX=1 $(MAKEPCH) $@

$(MAKEPCH): $(ROOT_SRCDIR)/$(MAKEPCH)
@mkdir -p $(dir $@)
Expand Down Expand Up @@ -1239,8 1237,6 @@ install: all
$(INSTALLDATA) build/misc/root-help.el $(DESTDIR)$(ELISPDIR); \
echo "Installing GDML conversion scripts in $(DESTDIR)$(LIBDIR)"; \
$(INSTALLDATA) $(ROOT_SRCDIR)/geom/gdml/*.py $(DESTDIR)$(LIBDIR); \
(cd $(DESTDIR)$(TUTDIR); \
! LD_LIBRARY_PATH=$(DESTDIR)$(LIBDIR):$$LD_LIBRARY_PATH $(DESTDIR)$(BINDIR)/root -l -b -q -n -x hsimple.C); \
fi

uninstall:
Expand Down
2 changes: 1 addition & 1 deletion bindings/pyroot/ROOT.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 506,7 @@ def __finalSetup( self ):

# system logon, user logon, and local logon (skip Rint.Logon)
name = '.rootlogon.C'
logons = [ os.path.join( str(self.gRootDir), 'etc', 'system' name ),
logons = [ os.path.join( self.TROOT.GetEtcDir().Data(), 'system' name ),
os.path.expanduser( os.path.join( '~', name ) ) ]
if logons[-1] != os.path.join( os.getcwd(), name ):
logons.append( name )
Expand Down
13 changes: 12 additions & 1 deletion cmake/modules/RootNewMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 325,15 @@ function(ROOT_GENERATE_DICTIONARY dictionary)
set(pcm_name)
else()
if(CMAKE_PROJECT_NAME STREQUAL ROOT)
set(command rootcling -rootbuild)
if(gnuinstall)
if(WIN32)
set(command set ROOTIGNOREPREFIX=1 && $<TARGET_FILE:rootcling> -rootbuild)
else()
set(command ROOTIGNOREPREFIX=1 $<TARGET_FILE:rootcling> -rootbuild)
endif()
else()
set(command rootcling -rootbuild)
endif()
set(ROOTCINTDEP rootcling)
else()
set(command rootcling)
Expand Down Expand Up @@ -845,6 853,9 @@ function(ROOT_ADD_TEST test)
set_property(TEST ${test} PROPERTY ENVIRONMENT ROOT_DIR=${CMAKE_BINARY_DIR})
else()
add_test(NAME ${test} COMMAND ${_command})
if (gnuinstall)
set_property(TEST ${test} PROPERTY ENVIRONMENT ROOTIGNOREPREFIX=1)
endif()
endif()

#- Handle TIMOUT and DEPENDS arguments
Expand Down
3 changes: 2 additions & 1 deletion config/RConfigure.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 14,11 @@
#define ROOTTUTDIR "@tutdir@"
#define ROOTSRCDIR "@srcdir@"
#define ROOTICONPATH "@iconpath@"
#define EXTRAICONPATH "@extraiconpath@"
#define TTFFONTDIR "@ttffontdir@"
#endif

#define EXTRAICONPATH "@extraiconpath@"

#@setresuid@ R__HAS_SETRESUID /**/
#@hasmathmore@ R__HAS_MATHMORE /**/
#@haspthread@ R__HAS_PTHREAD /**/
Expand Down
17 changes: 9 additions & 8 deletions config/rootrc.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 9,24 @@
# and to PATH on Windows.
# Paths are different for Unix and Windows. The example shows the defaults
# for all ROOT applications for either Unix or Windows.
Unix.*.Root.DynamicPath: .:@libdir@:
WinNT.*.Root.DynamicPath: .;@bindir@;
#Unix.*.Root.DynamicPath: .:@libdir@
#WinNT.*.Root.DynamicPath: .;@bindir@

# Path used to find macros.
# Paths are different for Unix and Windows. The example shows the defaults
# for all ROOT applications for either Unix or Windows.
Unix.*.Root.MacroPath: .:@macrodir@:
WinNT.*.Root.MacroPath: .;@macrodir@;
#Unix.*.Root.MacroPath: .:@macrodir@
#WinNT.*.Root.MacroPath: .;@macrodir@

# Path used to find plugin macros.
# Paths are different for Unix and Windows. The example shows the defaults
# for all ROOT applications for either Unix or Windows.
Unix.*.Root.PluginPath: :@plugindir@:
WinNT.*.Root.PluginPath: ;@plugindir@;
#Unix.*.Root.PluginPath: @plugindir@
#WinNT.*.Root.PluginPath: @plugindir@

# Path where to look for TrueType fonts.
Unix.*.Root.UseTTFonts: true
*.*.Root.TTFontPath: @ttffontdir@
#*.*.Root.TTFontPath: @ttffontdir@

# Use Net* API functions.
WinNT.UseNetAPI: true
Expand Down Expand Up @@ -222,7 222,8 @@ Gui.DocumentBackgroundColor: white
Gui.DocumentForegroundColor: black
Gui.TooltipBackgroundColor: LightYellow
Gui.TooltipForegroundColor: black
Gui.IconPath: $(HOME)/icons:@iconpath@:.
#Unix.*.Gui.IconPath: .:$(HOME)/icons:@iconpath@:@extraiconpath@
#WinNT.*.Gui.IconPath: .;$(HOME)/icons;@iconpath@;@extraiconpath@
Gui.MimeTypeFile: $(HOME)/.root.mimes
# If above does not exists defaults to this:
#Gui.MimeTypeFile: @etcdir@/root.mimes
Expand Down
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -8089,6 8089,7 @@ sed -e "s|@libdir@|$libdir|" \
-e "s|@bindir@|$bindir|" \
-e "s|@etcdir@|$etcdir|" \
-e "s|@ttffontdir@|$fontdir|" \
-e "s|@extraiconpath@|$extraiconpath|" \
-e "s|@iconpath@|$iconpath|" \
-e "s|@hasxrd@|$hasxrd|" \
-e "s|@hasnotxrd@|$hasnotxrd|" \
Expand Down
14 changes: 13 additions & 1 deletion core/base/inc/TROOT.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 329,19 @@ friend TROOT *ROOT::Internal::GetROOT2();
static Int_t ConvertVersionInt2Code(Int_t v);
static Int_t RootVersionCode();
static const char**&GetExtraInterpreterArgs();
static const char *GetTutorialsDir();

static const TString& GetRootSys();
static const TString& GetBinDir();
static const TString& GetLibDir();
static const TString& GetIncludeDir();
static const TString& GetEtcDir();
static const TString& GetDataDir();
static const TString& GetDocDir();
static const TString& GetMacroDir();
static const TString& GetTutorialsDir();
static const TString& GetSourceDir();
static const TString& GetIconPath();
static const TString& GetTTFFontDir();

ClassDef(TROOT,0) //Top level (or root) structure for all classes
};
Expand Down
28 changes: 7 additions & 21 deletions core/base/src/TApplication.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 268,7 @@ void TApplication::InitializeGraphics()
// mode and Root.UseTTFonts is true and Root.TTFontPath exists. Abort silently
// if libttf or libGX11TTF are not found in $ROOTSYS/lib or $ROOTSYS/ttf/lib.
const char *ttpath = gEnv->GetValue("Root.TTFontPath",
#ifdef TTFFONTDIR
TTFFONTDIR);
#else
"$(ROOTSYS)/fonts");
#endif
TROOT::GetTTFFontDir());
char *ttfont = gSystem->Which(ttpath, "arialbd.ttf", kReadPermission);
// Check for use of DFSG - fonts
if (!ttfont)
Expand Down Expand Up @@ -880,29 876,19 @@ Long_t TApplication::ProcessLine(const char *line, Bool_t sync, Int_t *err)
Error("ProcessLine", "Cannot show demos in batch mode!");
return 1;
}
#ifdef ROOTTUTDIR
ProcessLine(".x " ROOTTUTDIR "/demos.C");
#else
ProcessLine(".x $(ROOTSYS)/tutorials/demos.C");
#endif
ProcessLine(".x " TROOT::GetTutorialsDir() "/demos.C");
return 0;
}

if (!strncmp(line, ".license", 8)) {
#ifdef ROOTDOCDIR
return PrintFile(ROOTDOCDIR "/LICENSE");
#else
return PrintFile("$(ROOTSYS)/LICENSE");
#endif
return PrintFile(TROOT::GetDocDir() "/LICENSE");
}

if (!strncmp(line, ".credits", 8)) {
#ifdef ROOTDOCDIR
return PrintFile(ROOTDOCDIR "/CREDITS");
#else
return PrintFile("$(ROOTSYS)/README/CREDITS");
#endif

TString credits = TROOT::GetDocDir() "/CREDITS";
if (gSystem->AccessPathName(credits, kReadPermission))
credits = TROOT::GetDocDir() "/README/CREDITS";
return PrintFile(credits);
}

if (!strncmp(line, ".pwd", 4)) {
Expand Down
27 changes: 4 additions & 23 deletions core/base/src/TEnv.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -399,20 399,11 @@ TEnv::TEnv(const char *name)

TString sname = "system";
sname = name;
#ifdef ROOTETCDIR
char *s = gSystem->ConcatFileName(ROOTETCDIR, sname);
#else
TString etc = gRootDir;
#ifdef WIN32
etc = "\\etc";
#else
etc = "/etc";
#endif
#if defined(R__MACOSX) && (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
// on iOS etc does not exist and system<name> resides in $ROOTSYS
etc = gRootDir;
#endif
char *s = gSystem->ConcatFileName(etc, sname);
char *s = gSystem->ConcatFileName(TROOT::GetRootSys(), sname);
#else
char *s = gSystem->ConcatFileName(TROOT::GetEtcDir(), sname);
#endif
ReadFile(s, kEnvGlobal);
delete [] s;
Expand Down Expand Up @@ -683,17 674,7 @@ void TEnv::SaveLevel(EEnvLevel level)

TString sname = "system";
sname = fRcName;
#ifdef ROOTETCDIR
char *s = gSystem->ConcatFileName(ROOTETCDIR, sname);
#else
TString etc = gRootDir;
#ifdef WIN32
etc = "\\etc";
#else
etc = "/etc";
#endif
char *s = gSystem->ConcatFileName(etc, sname);
#endif
char *s = gSystem->ConcatFileName(TROOT::GetEtcDir(), sname);
rootrcdir = s;
delete [] s;
} else if (level == kEnvUser) {
Expand Down
4 changes: 4 additions & 0 deletions core/base/src/TPluginManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 451,10 @@ void TPluginManager::LoadHandlersFromPluginDirs(const char *base)
TPH__IsReadingDirs() = kTRUE;

TString plugindirs = gEnv->GetValue("Root.PluginPath", (char*)0);
if (plugindirs.Length() == 0) {
plugindirs = "plugins";
gSystem->PrependPathName(TROOT::GetEtcDir(), plugindirs);
}
#ifdef WIN32
dirs = plugindirs.Tokenize(";");
#else
Expand Down
Loading

0 comments on commit 6f634f9

Please sign in to comment.