From e021fcf50d937767128dd9bcd6ead6a5aa38b9a7 Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Thu, 29 Aug 2013 13:47:36 +0200
Subject: [PATCH] cmake fixes for libraries compilation under windows

---
 CMakeLists.txt                                | 11 +--
 Core/CMakeLists.txt                           | 22 +++---
 Core/Tools/src/IParameterized.cpp             |  1 +
 Core/Tools/src/Utils.cpp                      |  1 +
 Tests/FunctionalTests/CMakeLists.txt          |  6 +-
 Tests/FunctionalTests/TestCore/CMakeLists.txt |  7 ++
 Tests/FunctionalTests/TestFit/CMakeLists.txt  | 10 ++-
 Tests/UnitTests/TestCore/.lssrc               | 18 -----
 Tests/UnitTests/TestCore/CMakeLists.txt       | 12 ++-
 ThirdParty/RootMinimizers/CMakeLists.txt      | 17 ++---
 cmake/modules/FindFFTW.cmake                  | 54 +++++++++-----
 cmake/modules/FindGSL.cmake                   |  4 +-
 cmake/modules/FindNumpy.cmake                 |  5 +-
 cmake/modules/SearchInstalledSoftware.cmake   |  2 +
 cmake/modules/SetUpWindows.cmake              | 74 ++++++++++---------
 shared.pri                                    |  2 +-
 16 files changed, 138 insertions(+), 108 deletions(-)
 delete mode 100644 Tests/UnitTests/TestCore/.lssrc

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dea469b8be7..812b0bd7397 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ project(BornAgain)
 
 # --- General project settings ---
 if(NOT BORNAGAIN_PYTHON)
-    set(BORNAGAIN_PYTHON ON)
+#    set(BORNAGAIN_PYTHON ON)
 endif()
 set(BORNAGAIN_APP OFF)
 set(BORNAGAIN_GUI OFF)
@@ -26,19 +26,16 @@ add_subdirectory(Core)
 add_subdirectory(ThirdParty/gtest)
 add_subdirectory(Tests/UnitTests/TestCore)
 
-#if(NOT ROOT_FOUND)
 add_subdirectory(ThirdParty/RootMinimizers)
-#endif()
 
-#add_subdirectory(ThirdParty/RootMathMore)
 add_subdirectory(Fit)
 
 # functional tests (cmake; make check)
 add_subdirectory(Tests/FunctionalTests)
 
-if(ROOT_FOUND AND BORNAGAIN_APP)
-    add_subdirectory(App)
-endif()
+#if(ROOT_FOUND AND BORNAGAIN_APP)
+#    add_subdirectory(App)
+#endif()
 
 
 # packaging
diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt
index c7bb09db555..33bcebf4b4f 100644
--- a/Core/CMakeLists.txt
+++ b/Core/CMakeLists.txt
@@ -3,7 +3,7 @@
 ############################################################################
 set(library_name BornAgainCore)
 
-# directories to include
+# source and include files
 set(include_dirs
     ${CMAKE_CURRENT_SOURCE_DIR}/Algorithms/inc
     ${CMAKE_CURRENT_SOURCE_DIR}/FormFactors/inc
@@ -14,13 +14,12 @@ set(include_dirs
 )
 include_directories(${include_dirs})
 
-# files to have in library
 file(GLOB source_files
     "Algorithms/src/*.cpp"
     "FormFactors/src/*.cpp"
     "Geometry/src/*.cpp"
     "Samples/src/*.cpp"
-    "StandardSamples/*.cpp"
+    "StandardSamples/*.cpp" 
     "Tools/src/*.cpp"
 )
 
@@ -32,6 +31,10 @@ if(BORNAGAIN_PYTHON)
     )
 endif()
 
+if(WIN32)
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBA_CORE_BUILD_DLL")
+endif()
+
 # making library
 add_library(
     ${library_name}
@@ -41,6 +44,13 @@ add_library(
 set_Target_properties(${library_name} PROPERTIES PREFIX ${libprefix} SUFFIX ${libsuffix})
 set(${library_name}_LIBRARY_TYPE SHARED)
 
+# external dependencies
+include_directories(${Boost_INCLUDE_DIRS})
+target_link_libraries(${library_name} ${Boost_LIBRARIES}) 
+target_link_libraries(${library_name} ${FFTW_LIBRARY}) 
+target_link_libraries(${library_name} ${GSL_LIBRARIES}) 
+target_link_libraries(${library_name} ${PYTHON_LIBRARIES}) 
+
 # copying library into lib directory for functional tests
 execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/lib)
 ADD_CUSTOM_COMMAND(
@@ -51,12 +61,6 @@ ADD_CUSTOM_COMMAND(
     ${CMAKE_BINARY_DIR}/lib/
 )
 
-# dependencies
-target_link_libraries(${library_name} ${FFTW_LIBRARY}) 
-target_link_libraries(${library_name} ${Boost_LIBRARIES}) 
-target_link_libraries(${library_name} ${GSL_LIBRARIES}) 
-target_link_libraries(${library_name} ${PYTHON_LIBRARIES}) 
-
 # exposing library name and list of include directories outside
 set(${library_name}_INCLUDE_DIRS ${include_dirs} PARENT_SCOPE)
 set(${library_name}_LIBRARY ${library_name} PARENT_SCOPE)
diff --git a/Core/Tools/src/IParameterized.cpp b/Core/Tools/src/IParameterized.cpp
index 69e6df7f5aa..4772a2a042e 100644
--- a/Core/Tools/src/IParameterized.cpp
+++ b/Core/Tools/src/IParameterized.cpp
@@ -16,6 +16,7 @@
 
 #include "IParameterized.h"
 #include "Utils.h"
+#include <iostream>
 
 IParameterized& IParameterized::operator=(const IParameterized& other)
 {
diff --git a/Core/Tools/src/Utils.cpp b/Core/Tools/src/Utils.cpp
index 0c60e215f6d..a759dc3a8b4 100644
--- a/Core/Tools/src/Utils.cpp
+++ b/Core/Tools/src/Utils.cpp
@@ -15,6 +15,7 @@
 
 #include "Utils.h"
 #include "Exceptions.h"
+#include <iostream>
 #include <iomanip>
 #include <boost/regex.hpp>
 #include <boost/algorithm/string/replace.hpp>
diff --git a/Tests/FunctionalTests/CMakeLists.txt b/Tests/FunctionalTests/CMakeLists.txt
index 636a957d99b..b2ede58ccbb 100644
--- a/Tests/FunctionalTests/CMakeLists.txt
+++ b/Tests/FunctionalTests/CMakeLists.txt
@@ -16,8 +16,8 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/T
 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit)
 
 add_subdirectory(TestCore)
-add_subdirectory(TestPyCore)
-add_subdirectory(TestPyFit)
-add_subdirectory(TestFit)
+#add_subdirectory(TestPyCore)
+#add_subdirectory(TestFit)
+#add_subdirectory(TestPyFit)
 
 
diff --git a/Tests/FunctionalTests/TestCore/CMakeLists.txt b/Tests/FunctionalTests/TestCore/CMakeLists.txt
index 5452617a10d..681bd25e7fe 100644
--- a/Tests/FunctionalTests/TestCore/CMakeLists.txt
+++ b/Tests/FunctionalTests/TestCore/CMakeLists.txt
@@ -19,8 +19,15 @@ set(list_of_tests
 #    "MesoCrystal1"
 )
 
+include_directories(${Boost_INCLUDE_DIRS})
+#link_directories(${CMAKE_BINARY_DIR}/lib)
+
 foreach(_test ${list_of_tests})
     BORNAGAIN_EXECUTABLE(${_test} LOCATIONS ${_test} EXCLUDE_FROM_ALL LIBRARIES ${BornAgainCore_LIBRARY})
+    # to have executable in lib directory
+    #set_property(TARGET ${_test} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+    #BORNAGAIN_ADD_TEST(${CMAKE_BINARY_DIR}/lib/${_test} INPUT_DIR ${CMAKE_BINARY_DIR}/Tests/ReferenceData/BornAgain/)
+    set_property(TARGET ${_test} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
     BORNAGAIN_ADD_TEST(${_test} INPUT_DIR ${CMAKE_BINARY_DIR}/Tests/ReferenceData/BornAgain/)
 endforeach()
 
diff --git a/Tests/FunctionalTests/TestFit/CMakeLists.txt b/Tests/FunctionalTests/TestFit/CMakeLists.txt
index dd1182441a0..ddb5c2ac51a 100644
--- a/Tests/FunctionalTests/TestFit/CMakeLists.txt
+++ b/Tests/FunctionalTests/TestFit/CMakeLists.txt
@@ -9,7 +9,13 @@ set(list_of_tests
     "TestFit02"
 )
 
+include_directories(${Boost_INCLUDE_DIRS})
+
 foreach(_test ${list_of_tests})
-    BORNAGAIN_EXECUTABLE(${_test} LOCATIONS ${_test} EXCLUDE_FROM_ALL LIBRARIES ${BornAgainCore_LIBRARY} ${BornAgainFit_LIBRARY} ${RootMathMore_LIBRARY})
-    BORNAGAIN_ADD_TEST(${_test})
+    BORNAGAIN_EXECUTABLE(${_test} LOCATIONS ${_test} EXCLUDE_FROM_ALL LIBRARIES ${BornAgainCore_LIBRARY} ${BornAgainFit_LIBRARY})
+    # to have executable in lib directory
+    set_property(TARGET ${_test} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+    BORNAGAIN_ADD_TEST(${CMAKE_BINARY_DIR}/lib/${_test})
 endforeach()
+
+#set_property(TARGET *binary* PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
\ No newline at end of file
diff --git a/Tests/UnitTests/TestCore/.lssrc b/Tests/UnitTests/TestCore/.lssrc
deleted file mode 100644
index 8fe5703c03b..00000000000
--- a/Tests/UnitTests/TestCore/.lssrc
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- mode: python -*-
-
-# Include file for program lssrc.
-# Returns user-written source files.
-
-import glob, re
-
-def source_files(root):
-    fnames = []
-    # get all files with right extension from pwd
-    fnames += sorted( glob.glob( root+"*.h" ) )
-    fnames += sorted( glob.glob( root+"*.cpp" ) )
-    # remove files known to be machine generated
-    out = list(fnames)
-    for f in fnames:
-        if re.search( r'\.pypp\.', f ):
-            out.remove( f )
-    return out
diff --git a/Tests/UnitTests/TestCore/CMakeLists.txt b/Tests/UnitTests/TestCore/CMakeLists.txt
index 2e5001e6bed..5a93284f4eb 100644
--- a/Tests/UnitTests/TestCore/CMakeLists.txt
+++ b/Tests/UnitTests/TestCore/CMakeLists.txt
@@ -8,9 +8,19 @@ add_executable( TestCore main.cpp )
 
 # dependencies
 include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
+target_link_libraries(TestCore gtest)
+
 include_directories(${BornAgainCore_INCLUDE_DIRS})
 target_link_libraries(TestCore ${BornAgainCore_LIBRARY}) 
-target_link_libraries(TestCore gtest)
+
+include_directories(${Boost_INCLUDE_DIRS})
+target_link_libraries(TestCore ${Boost_LIBRARIES}) 
+
+# to pick up just compiled shared dll's
+#link_directories(${CMAKE_BINARY_DIR}/lib) # doesn't work
+
+# to build executable right in lib directory to not to have problems with finding libBornAgainCore.dll under Windows
+set_property(TARGET TestCore PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 
 add_test( TestCore TestCore) # TestName ExeName
 
diff --git a/ThirdParty/RootMinimizers/CMakeLists.txt b/ThirdParty/RootMinimizers/CMakeLists.txt
index 17640c6bc9e..46080733622 100644
--- a/ThirdParty/RootMinimizers/CMakeLists.txt
+++ b/ThirdParty/RootMinimizers/CMakeLists.txt
@@ -1,26 +1,22 @@
 ############################################################################
-# CMakeLists.txt file for building ROOT math/minuit2 package
+# CMakeLists.txt file for building libRootMinimizers package
 ############################################################################
 
 set(library_name RootMinimizers)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMATH_NO_PLUGIN_MANAGER -DHAS_MINUIT2 -DR__HAS_MATHMORE")
-
-# directories to include
+# source and include files
 set(include_dirs
     ${CMAKE_CURRENT_SOURCE_DIR}/inc
 )
 include_directories(${include_dirs})
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../RootMathMore/inc)
 
-# files to have in library
 file(GLOB source_files
     "src/Minuit2/*.cxx"
     "src/Math/*.cxx"
     "src/Fit/*.cxx"
 )
 
-include_directories(${RootMathMore_INCLUDE_DIRS})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMATH_NO_PLUGIN_MANAGER -DHAS_MINUIT2 -DR__HAS_MATHMORE")
 
 # making library
 add_library(
@@ -31,6 +27,10 @@ add_library(
 set_Target_properties(${library_name} PROPERTIES PREFIX ${libprefix} SUFFIX ${libsuffix})
 set(${library_name}_LIBRARY_TYPE SHARED)
 
+# external dependencies
+include_directories(${GSL_INCLUDE_DIRS})
+target_link_libraries(${library_name} ${GSL_LIBRARIES}) 
+
 # copying library into lib directory for functional tests
 ADD_CUSTOM_COMMAND(
     TARGET ${library_name}
@@ -44,9 +44,6 @@ ADD_CUSTOM_COMMAND(
 set(${library_name}_INCLUDE_DIRS ${include_dirs} PARENT_SCOPE)
 set(${library_name}_LIBRARY ${library_name} PARENT_SCOPE)
 
-# dependencies
-target_link_libraries(${library_name} ${GSL_LIBRARIES}) 
-
 # -----------------------------------------------
 # installation
 # -----------------------------------------------
diff --git a/cmake/modules/FindFFTW.cmake b/cmake/modules/FindFFTW.cmake
index d05ab5ba3c5..bbcc4d9632f 100644
--- a/cmake/modules/FindFFTW.cmake
+++ b/cmake/modules/FindFFTW.cmake
@@ -11,25 +11,41 @@ if(FFTW_LIBRARY AND FFTW_INCLUDE_DIR)
   set(FFTW_FIND_QUIETLY TRUE)
 endif()
 
-find_path(FFTW_INCLUDE_DIR fftw3.h
-  $ENV{FFTW_DIR}/include
-  $ENV{FFTW3} $ENV{FFTW3}/include $ENV{FFTW3}/api
-  /usr/local/include
-  /usr/include
-  /opt/fftw3/include
-  /opt/local/include
-  DOC "Specify the directory containing fftw3.h"
-)
-
-find_library(FFTW_LIBRARY NAMES fftw3 fftw3-3 PATHS
-  $ENV{FFTW_DIR}/lib
-  $ENV{FFTW3} $ENV{FFTW3}/lib $ENV{FFTW3}/.libs
-  /usr/local/lib
-  /usr/lib 
-  /opt/fftw3/lib
-  HINTS /opt/local/lib
-  DOC "Specify the fttw3 library here."
-)
+if(NOT WIN32)
+    find_path(FFTW_INCLUDE_DIR fftw3.h
+        $ENV{FFTW_DIR}/include
+        $ENV{FFTW3} $ENV{FFTW3}/include $ENV{FFTW3}/api
+        /usr/local/include
+        /usr/include
+        /opt/fftw3/include
+        /opt/local/include
+        DOC "Specify the directory containing fftw3.h"
+    )
+
+    find_library(FFTW_LIBRARY NAMES fftw3 fftw3-3 PATHS
+        $ENV{FFTW_DIR}/lib
+        $ENV{FFTW3} $ENV{FFTW3}/lib $ENV{FFTW3}/.libs
+        /usr/local/lib
+        /usr/lib 
+        /opt/fftw3/lib
+        HINTS /opt/local/lib
+        DOC "Specify the fttw3 library here."
+    )
+else()
+
+    find_path(FFTW_INCLUDE_DIR fftw3.h
+        $ENV{FFTW_DIR}/include
+        "C:/Program Files (x86)/Libraries/fftw-3.3.3-dll32/include"
+    )
+
+    find_library(FFTW_LIBRARY NAMES fftw3 fftw3-3
+#        $ENV{FFTW_DIR}/lib
+#        $ENV{FFTW3} $ENV{FFTW3}/lib $ENV{FFTW3}/.libs
+        HINTS "C:/Program Files (x86)/Libraries/fftw-3.3.3-dll32/lib"
+    )
+
+endif()
+
 
 if(FFTW_INCLUDE_DIR AND FFTW_LIBRARY)
   set(FFTW_FOUND 1 )
diff --git a/cmake/modules/FindGSL.cmake b/cmake/modules/FindGSL.cmake
index 2e8f881f5b0..c6c673089de 100644
--- a/cmake/modules/FindGSL.cmake
+++ b/cmake/modules/FindGSL.cmake
@@ -25,13 +25,13 @@ if( WIN32 AND NOT CYGWIN AND NOT MSYS )
   # look for headers
   find_path( GSL_INCLUDE_DIR
     NAMES gsl/gsl_cdf.h gsl/gsl_randist.h
-	PATHS $ENV{GSL_DIR}/include
+	PATHS $ENV{GSL_DIR}/include "C:/Program Files (x86)/GnuWin32/include"
     )
   if( GSL_INCLUDE_DIR )
     # look for gsl library
     find_library( GSL_LIBRARY
       NAMES gsl
-	  PATHS $ENV{GSL_DIR}/lib
+	  PATHS $ENV{GSL_DIR}/lib "C:/Program Files (x86)/GnuWin32/lib"
     )
     if( GSL_LIBRARY )
       set( GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} )
diff --git a/cmake/modules/FindNumpy.cmake b/cmake/modules/FindNumpy.cmake
index 39545faba2a..f695ba8c5f9 100644
--- a/cmake/modules/FindNumpy.cmake
+++ b/cmake/modules/FindNumpy.cmake
@@ -8,11 +8,12 @@ if (NUMPY_INCLUDE_DIR)
   set (Numpy_FIND_QUIETLY TRUE)
 endif (NUMPY_INCLUDE_DIR)
 
+if(NOT Numpy_FIND_QUIETLY)
 EXEC_PROGRAM ("${PYTHON_EXECUTABLE}"
-  ARGS "-c 'import numpy; print numpy.get_include()'"
+  ARGS "-c \"import numpy; print numpy.get_include()\""
   OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
   RETURN_VALUE NUMPY_NOT_FOUND)
-
+endif()
 
 if (NUMPY_INCLUDE_DIR MATCHES "Traceback")
     # Did not successfully include numpy
diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake
index efa89e98dee..42f38de3b89 100644
--- a/cmake/modules/SearchInstalledSoftware.cmake
+++ b/cmake/modules/SearchInstalledSoftware.cmake
@@ -20,6 +20,8 @@ if(BORNAGAIN_PYTHON)
     list(APPEND boost_libraries_required python)
 endif()
 find_package(Boost 1.48.0 COMPONENTS ${boost_libraries_required} REQUIRED)
+#message(STATUS "XXX ${Boost_INCLUDE_DIRS}")
+#message(STATUS "XXX ${Boost_LIBRARY_DIRS}")
 
 # --- GSL ---
 if(NOT BUILTIN_GSL)
diff --git a/cmake/modules/SetUpWindows.cmake b/cmake/modules/SetUpWindows.cmake
index 838080de002..8301270485a 100644
--- a/cmake/modules/SetUpWindows.cmake
+++ b/cmake/modules/SetUpWindows.cmake
@@ -1,46 +1,52 @@
 set(BORNAGAIN_ARCHITECTURE win32)
 set(ROOT_PLATFORM win32)
 
-math(EXPR VC_MAJOR "${MSVC_VERSION} / 100")
-math(EXPR VC_MINOR "${MSVC_VERSION} % 100")
+#math(EXPR VC_MAJOR "${MSVC_VERSION} / 100")
+#math(EXPR VC_MINOR "${MSVC_VERSION} % 100")
 
-set(SOEXT dll)
-set(EXEEXT exe)
+#set(SOEXT dll)
+#set(EXEEXT exe)
 
-set(SYSLIBS advapi32.lib)
-set(XLIBS)
-set(CILIBS)
-set(CRYPTLIBS)
+#set(SYSLIBS advapi32.lib)
+#set(XLIBS)
+#set(CILIBS)
+#set(CRYPTLIBS)
 
 #---Select compiler flags----------------------------------------------------------------
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -Z7")
-set(CMAKE_CXX_FLAGS_RELEASE        "-O2")
-set(CMAKE_CXX_FLAGS_DEBUG          "-Od -Z7")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -Z7")
-set(CMAKE_C_FLAGS_RELEASE          "-O2")
-set(CMAKE_C_FLAGS_DEBUG            "-Od -Z7")
-
-if(winrtdebug)
-  set(BLDCXXFLAGS "-MDd -GR")
-  set(BLDCFLAGS   "-MDd")
-else()
-  set(BLDCXXFLAGS "-MD -GR")
-  set(BLDCFLAGS   "-MD")
-endif()
-
-if(CMAKE_PROJECT_NAME STREQUAL ROOT)
-  set(CMAKE_CXX_FLAGS "-nologo -I${CMAKE_SOURCE_DIR}/build/win -FIw32pragma.h -FIsehmap.h ${BLDCXXFLAGS} -EHsc- -W3 -wd4244 -D_WIN32")
-  set(CMAKE_C_FLAGS   "-nologo -I${CMAKE_SOURCE_DIR}/build/win -FIw32pragma.h -FIsehmap.h ${BLDCFLAGS} -EHsc- -W3 -D_WIN32")
-  install(FILES ${CMAKE_SOURCE_DIR}/build/win/w32pragma.h  DESTINATION include COMPONENT headers)
-  install(FILES ${CMAKE_SOURCE_DIR}/build/win/sehmap.h  DESTINATION include COMPONENT headers)  
-else()
-  set(CMAKE_CXX_FLAGS "-nologo -FIw32pragma.h -FIsehmap.h ${BLDCXXFLAGS} -EHsc- -W3 -wd4244 -D_WIN32")
-  set(CMAKE_C_FLAGS   "-nologo -FIw32pragma.h -FIsehmap.h ${BLDCFLAGS} -EHsc- -W3 -D_WIN32")
-endif()
+#set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -Z7")
+#set(CMAKE_CXX_FLAGS_RELEASE        "-O2")
+#set(CMAKE_CXX_FLAGS_DEBUG          "-Od -Z7")
+#set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -Z7")
+#set(CMAKE_C_FLAGS_RELEASE          "-O2")
+#set(CMAKE_C_FLAGS_DEBUG            "-Od -Z7")
+
+#if(winrtdebug)
+#  set(BLDCXXFLAGS "-MDd -GR")
+#  set(BLDCFLAGS   "-MDd")
+#else()
+#  set(BLDCXXFLAGS "-MD -GR")
+#  set(BLDCFLAGS   "-MD")
+#endif()
+
+#if(CMAKE_PROJECT_NAME STREQUAL ROOT)
+#  set(CMAKE_CXX_FLAGS "-nologo -I${CMAKE_SOURCE_DIR}/build/win -FIw32pragma.h -FIsehmap.h ${BLDCXXFLAGS} -EHsc- -W3 -wd4244 -D_WIN32")
+#  set(CMAKE_C_FLAGS   "-nologo -I${CMAKE_SOURCE_DIR}/build/win -FIw32pragma.h -FIsehmap.h ${BLDCFLAGS} -EHsc- -W3 -D_WIN32")
+#  install(FILES ${CMAKE_SOURCE_DIR}/build/win/w32pragma.h  DESTINATION include COMPONENT headers)
+#  install(FILES ${CMAKE_SOURCE_DIR}/build/win/sehmap.h  DESTINATION include COMPONENT headers)  
+#else()
+#  set(CMAKE_CXX_FLAGS "-nologo -FIw32pragma.h -FIsehmap.h ${BLDCXXFLAGS} -EHsc- -W3 -wd4244 -D_WIN32")
+#  set(CMAKE_C_FLAGS   "-nologo -FIw32pragma.h -FIsehmap.h ${BLDCFLAGS} -EHsc- -W3 -D_WIN32")
+#endif()
+#set(CMAKE_CXX_FLAGS "-D_WIN32")
+#set(CMAKE_C_FLAGS   "-nologo -FIw32pragma.h -FIsehmap.h ${BLDCFLAGS} -EHsc- -W3 -D_WIN32")
 
 #---Set Linker flags----------------------------------------------------------------------
 #set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ignore:4049,4206,4217,4221 -incremental:no")
-set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ignore:4049,4206,4217,4221 -incremental:no")
+#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ignore:4049,4206,4217,4221 -incremental:no")
+#set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ignore:4049,4206,4217,4221 -incremental:no")
 
+#set(CMAKE_C_OUTPUT_EXTENSION ".o")
 
+
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Dmincoming-stack-boundary=2 -DWno-unused-local-typedefs -DWno-attributes")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mincoming-stack-boundary=2 -Wno-unused-local-typedefs -Wno-attributes")
diff --git a/shared.pri b/shared.pri
index 00f93c052cb..965f887b11c 100644
--- a/shared.pri
+++ b/shared.pri
@@ -307,7 +307,7 @@ CONFIG(BORNAGAIN_PYTHON) {
     #message(pythonvers : $$pythonvers)
     #message(pythoninc  : $$pythonsysincdir)
     #message(pythonlib  : $$pythonsyslibdir)
-    #message(pythonnumpy: $$pythonnumpy)
+    message(pythonnumpy: $$pythonnumpy)
     lessThan(pythonvers, 2.6): error("BornAgain requires python 2.6 or greater")
 
     INCLUDEPATH += $$pythonsysincdir
-- 
GitLab