From 44555a58bfd73dc59c42a3d7f232e4697dda9aae Mon Sep 17 00:00:00 2001
From: Walter Van Herck <w.van.herck@fz-juelich.de>
Date: Mon, 10 Jun 2013 16:48:41 +0200
Subject: [PATCH] Added root locations to windows build

---
 BornAgain.pro |  7 ++++-
 Fit/Fit.pro   |  4 +--
 shared.pri    | 74 +++++++++++++++++++++++++++++++--------------------
 3 files changed, 53 insertions(+), 32 deletions(-)

diff --git a/BornAgain.pro b/BornAgain.pro
index b3a29233113..8ce8d27797d 100644
--- a/BornAgain.pro
+++ b/BornAgain.pro
@@ -4,7 +4,12 @@ include($$PWD/shared.pri)
 
 SUBDIRS += Core ThirdParty/gtest
 
-ROOT = $$system(root-config --prefix)
+macx|unix {
+  ROOT = $$system(root-config --prefix)
+}
+win32 {
+  ROOT = "C:/root"
+}
 isEmpty(ROOT) {
     message("No ROOT installation found. libBornAgainFit and App" will not be compiled.)
 }
diff --git a/Fit/Fit.pro b/Fit/Fit.pro
index 36f668546c3..39ed29362ed 100644
--- a/Fit/Fit.pro
+++ b/Fit/Fit.pro
@@ -5,7 +5,7 @@ TARGET   = BornAgainFit
 TEMPLATE = lib
 CONFIG  += plugin # to remove versions from file name
 QT      -= core gui
-QMAKE_EXTENSION_SHLIB = so # making standard *.so extension
+#QMAKE_EXTENSION_SHLIB = so # making standard *.so extension
 #CONFIG  += BORNAGAIN_PYTHON
 CONFIG  += BORNAGAIN_ROOT
 
@@ -50,7 +50,7 @@ contains(CONFIG, BORNAGAIN_PYTHON) {
 # -----------------------------------------------------------------------------
 # additional libraries
 # -----------------------------------------------------------------------------
-LIBS += $$PWD/../lib/libBornAgainCore.so
+LIBS += $$PWD/../lib/libBornAgainCore.$${SONAME}
 
 # -----------------------------------------------------------------------------
 # Installing library into dedicated directory at the end of compilation
diff --git a/shared.pri b/shared.pri
index bb55d6cb3fb..8932c475d28 100644
--- a/shared.pri
+++ b/shared.pri
@@ -182,39 +182,55 @@ CONFIG(PEDANTIC) {
 # add ROOT libraries
 # -----------------------------------------------------------------------------
 CONFIG(BORNAGAIN_ROOT) {
+  macx|unix {
     MYROOT = $$system(root-config --prefix)
-    isEmpty(MYROOT): error("Could not run root-config. Install ROOT, and set PATH to include ROOTSYS/bin.")
-    message("Found ROOT under directory " $${MYROOT})
+    LIBEXT = so
+  }
+  win32 {
+    MYROOT = "C:/root"
+    LIBEXT = lib
+  }
+  isEmpty(MYROOT): error("Could not run root-config. Install ROOT, and set PATH to include ROOTSYS/bin.")
+  message("Found ROOT under directory " $${MYROOT})
 
+  macx|unix {
     INCLUDEPATH += $$system(root-config --incdir)
-    MYROOTCINT = $${MYROOT}/bin/rootcint
+  }
+  win32 {
+    INCLUDEPATH += "C:/root/include"
+  }
+  MYROOTCINT = $${MYROOT}/bin/rootcint
+  macx|unix {
     ROOTLIBDIR = $$system(root-config --libdir)
-    LIBS += -L$${ROOTLIBDIR}
-    #REQUIRED_ROOT_LIBS = Cint Core EG Eve FTGL Ged Geom Graf Graf3d Gpad Gui Hist MathCore MathMore Matrix Minuit2 Physics Postscript RGL Rint RIO Thread Tree TreePlayer
-    REQUIRED_ROOT_LIBS = Gui Core Cint RIO Hist Graf Graf3d Gpad Tree Rint Postscript Matrix MathCore MathMore Minuit2 Thread
-
-    # check existence of required ROOT libraries
-    for(x, REQUIRED_ROOT_LIBS) {
-        libfile = $${ROOTLIBDIR}/lib$${x}.so
-        !exists($${libfile}) : MISSED_ROOT_LIBRARIES += $${libfile}
-        LIBS += -l$${x}
-    }
-    !isEmpty(MISSED_ROOT_LIBRARIES): error( "The following libraries are missing in $${ROOTLIBDIR}: $${MISSED_ROOT_LIBRARIES}.")
-
-    LIBS += -lpthread -lm -ldl
-
-    # generation of ROOT dictionaries
-    !isEmpty(BORNAGAIN_ROOT_DICT_FOR_CLASSES) {
-        ROOT_CINT_TARGET = $${TARGET}
-        SOURCES *= src/$${ROOT_CINT_TARGET}Dict.cpp
-        rootcint.target = src/$${ROOT_CINT_TARGET}Dict.cpp
-        rootcint.commands += $$MYROOTCINT
-        rootcint.commands +=  -f $$rootcint.target  -c  -I$$BORNAGAIN_ROOT_DICT_INCLUDES $$BORNAGAIN_ROOT_DICT_FOR_CLASSES
-        rootcint.depends = $$BORNAGAIN_ROOT_DICT_FOR_CLASSES
-        rootcintecho.commands = @echo "Generating dictionary $$rootcint.target for $$BORNAGAIN_ROOT_DICT_FOR_CLASSES classes"
-        QMAKE_EXTRA_TARGETS += rootcintecho rootcint
-        QMAKE_CLEAN +=  src/$${ROOT_CINT_TARGET}Dict.cpp src/$${ROOT_CINT_TARGET}Dict.h
-    }
+  }
+  win32 {
+    ROOTLIBDIR = "C:/root/lib"
+  }
+  LIBS += -L$${ROOTLIBDIR}
+  REQUIRED_ROOT_LIBS = Gui Core Cint RIO Hist Graf Graf3d Gpad Tree Rint Postscript Matrix MathCore Minuit2 Thread
+
+  # check existence of required ROOT libraries
+  for(x, REQUIRED_ROOT_LIBS) {
+    libfile = $${ROOTLIBDIR}/lib$${x}.$${LIBEXT}
+    !exists($${libfile}) : MISSED_ROOT_LIBRARIES += $${libfile}
+    LIBS += $${libfile}
+  }
+  !isEmpty(MISSED_ROOT_LIBRARIES): error( "The following libraries are missing in $${ROOTLIBDIR}: $${MISSED_ROOT_LIBRARIES}.")
+
+  LIBS += -lpthread -lm #-ldl
+
+  # generation of ROOT dictionaries
+  !isEmpty(BORNAGAIN_ROOT_DICT_FOR_CLASSES) {
+    ROOT_CINT_TARGET = $${TARGET}
+    SOURCES *= src/$${ROOT_CINT_TARGET}Dict.cpp
+    rootcint.target = src/$${ROOT_CINT_TARGET}Dict.cpp
+    rootcint.commands += $$MYROOTCINT
+    rootcint.commands +=  -f $$rootcint.target  -c  -I$$BORNAGAIN_ROOT_DICT_INCLUDES $$BORNAGAIN_ROOT_DICT_FOR_CLASSES
+    rootcint.depends = $$BORNAGAIN_ROOT_DICT_FOR_CLASSES
+    rootcintecho.commands = @echo "Generating dictionary $$rootcint.target for $$BORNAGAIN_ROOT_DICT_FOR_CLASSES classes"
+    QMAKE_EXTRA_TARGETS += rootcintecho rootcint
+    QMAKE_CLEAN +=  src/$${ROOT_CINT_TARGET}Dict.cpp src/$${ROOT_CINT_TARGET}Dict.h
+  }
 }
 
 
-- 
GitLab