From: Dawid Jagiela Date: Thu, 10 May 2012 11:45:30 +0000 (+0200) Subject: added 32/64-bit architecture detection X-Git-Tag: v.3.2~115^2~22 X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?p=unres.git;a=commitdiff_plain;h=55d75fc5211f284fc032dbb7fbb0fb6eff427a10 added 32/64-bit architecture detection --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 71105b2..a343543 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,10 +90,25 @@ if (MPIF_FOUND) message("MPIF_INCLUDE_DIRECTORIES=${MPIF_INCLUDE_DIRECTORIES}" ) endif(MPIF_FOUND) + + +#====================================== +# Detect system architecture +# + +if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) + set(architektura "32") +else (CMAKE_SIZEOF_VOID_P EQUAL 4) + set(architektura "64") +endif( CMAKE_SIZEOF_VOID_P EQUAL 4 ) + +message("Detected ${architektura}-bit architecture") + + #======================================= # Create diractories for build targets #======================================= -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/unres/MD ) +#execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/unres/MD ) #======================================= # Add source files diff --git a/source/unres/src_MD-M/CMakeLists.txt b/source/unres/src_MD-M/CMakeLists.txt index 5576b81..c1f570f 100644 --- a/source/unres/src_MD-M/CMakeLists.txt +++ b/source/unres/src_MD-M/CMakeLists.txt @@ -160,17 +160,17 @@ set(UNRES_MDM_PP_SRC # Set comipiler flags for different sourcefiles #================================================ if (Fortran_COMPILER_NAME STREQUAL "ifort") - set(FFLAGS0 "-c -ip -w" ) - set(FFLAGS1 "-c -w -g -d2 -CA -CB" ) - set(FFLAGS2 "-c -w -g -00 ") + set(FFLAGS0 "-ip -w" ) + set(FFLAGS1 "-w -g -d2 -CA -CB" ) + set(FFLAGS2 "-w -g -00 ") #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" ) - set(FFLAGS3 "-c -w -ipo " ) + set(FFLAGS3 "-w -ipo " ) elseif (Fortran_COMPILER_NAME STREQUAL "gfortran") - set(FFLAGS0 "-c -I. " ) - set(FFLAGS1 "-c -g -I. " ) - set(FFLAGS2 "-c -I. ") + set(FFLAGS0 "-I. " ) + set(FFLAGS1 "-g -I. " ) + set(FFLAGS2 "-I. ") #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" ) - set(FFLAGS3 "-c -I. " ) + set(FFLAGS3 "-I. " ) endif (Fortran_COMPILER_NAME STREQUAL "ifort") @@ -224,6 +224,14 @@ if (UNRES_WITH_MPI) set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI") endif(UNRES_WITH_MPI) + +# add 64-bit specific preprocessor flags +if (architektura STREQUAL "64") + set(CPPFLAGS "${CPPFLAGS} -DAMD64") +endif (architektura STREQUAL "64") + + + # Apply preprocesor flags to *.F files set_property(SOURCE ${UNRES_MDM_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} ) diff --git a/source/unres/src_MD/CMakeLists.txt b/source/unres/src_MD/CMakeLists.txt index bea362d..32d86c2 100644 --- a/source/unres/src_MD/CMakeLists.txt +++ b/source/unres/src_MD/CMakeLists.txt @@ -38,17 +38,17 @@ set(UNRES_MD_PP_SRC cartder.F chainbuild.F checkder_p.F compare_s1.F dihed_cons. # Set comipiler flags for different sourcefiles #================================================ if (Fortran_COMPILER_NAME STREQUAL "ifort") - set(FFLAGS0 "-c -ip -w" ) - set(FFLAGS1 "-c -w -g -d2 -CA -CB" ) - set(FFLAGS2 "-c -w -g -00 ") + set(FFLAGS0 "-ip -w" ) + set(FFLAGS1 "-w -g -d2 -CA -CB" ) + set(FFLAGS2 "-w -g -00 ") #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" ) - set(FFLAGS3 "-c -w -ipo " ) + set(FFLAGS3 "-w -ipo " ) elseif (Fortran_COMPILER_NAME STREQUAL "gfortran") - set(FFLAGS0 "-c -I. " ) - set(FFLAGS1 "-c -g -I. " ) - set(FFLAGS2 "-c -I. ") + set(FFLAGS0 "-I. " ) + set(FFLAGS1 "-g -I. " ) + set(FFLAGS2 "-I. ") #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" ) - set(FFLAGS3 "-c -I. " ) + set(FFLAGS3 "-I. " ) endif (Fortran_COMPILER_NAME STREQUAL "ifort")