Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Copy the values of {C,CXX,F}FLAGS into smpi{cc,cxx,ff,f90}.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 16 May 2019 20:52:28 +0000 (22:52 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 16 May 2019 21:21:43 +0000 (23:21 +0200)
The goal is to be able to give compiler flags at cmake time, and to have
them used later by the smpi script.
For example, it can be used to pass "-m64" and build a 64bit simgrid
when it's 32it by default (e.g. on Solaris).

The goal is, for example, to be able to set the variable

CMakeLists.txt
src/smpi/smpicc.in
src/smpi/smpicxx.in

index 9c1da7a..50075e0 100644 (file)
@@ -4,6 +4,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_HOME_DIRECTORY}/tools/cmake/M
 
 project(SimGrid C CXX)
 
 
 project(SimGrid C CXX)
 
+## Save compiler flags preset with environment variables CFLAGS or CXXFLAGS;
+## they will used within smpicc, smpicxx.
+## Do it early so that we get their genuine values. The same will be done later for Fortran.
+set(SMPI_C_FLAGS "${CMAKE_C_FLAGS}")
+set(SMPI_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 #     Check for the compiler        #
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 #     Check for the compiler        #
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -22,7 +28,6 @@ CHECK_C_COMPILER_FLAG(-fstack-cleaner HAVE_C_STACK_CLEANER)
 ## Request full debugging flags
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
 ## Request full debugging flags
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
-set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g")
 
 if (CMAKE_COMPILER_IS_GNUCC)    
   if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
 
 if (CMAKE_COMPILER_IS_GNUCC)    
   if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
@@ -80,6 +85,10 @@ if ((NOT DEFINED enable_smpi) OR enable_smpi)
       set(SMPI_Fortran_LIBS "")
       set(SMPI_FLANG 1)
     endif()
       set(SMPI_Fortran_LIBS "")
       set(SMPI_FLANG 1)
     endif()
+    set(SMPI_Fortran_FLAGS "${SMPI_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS}")
+
+    ## Request debugging flags for Fortran too
+    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g")
 
     set(SMPI_FORTRAN 1)
   endif(CMAKE_Fortran_COMPILER)
 
     set(SMPI_FORTRAN 1)
   endif(CMAKE_Fortran_COMPILER)
index 3cc7a6a..9098f97 100755 (executable)
@@ -23,7 +23,7 @@ else
     LINKER_UNDEFINED_ERROR="1"
 fi
 
     LINKER_UNDEFINED_ERROR="1"
 fi
 
-list_set CFLAGS
+list_set CFLAGS @SMPI_C_FLAGS@
 list_set LINKARGS "-lm"
 if [ "x@WIN32@" = "x1" ]; then
     list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
 list_set LINKARGS "-lm"
 if [ "x@WIN32@" = "x1" ]; then
     list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
index 9b45519..9d2a2c8 100755 (executable)
@@ -16,7 +16,7 @@ CMAKE_LINKARGS="-L@libdir@"
 
 @SMPITOOLS_SH@
 
 
 @SMPITOOLS_SH@
 
-list_set CXXFLAGS "-std=gnu++11"
+list_set CXXFLAGS "-std=gnu++11" @SMPI_CXX_FLAGS@
 list_set LINKARGS
 if [ "@WIN32@" != "1" ]; then
     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"
 list_set LINKARGS
 if [ "@WIN32@" != "1" ]; then
     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_helpers.h"