]>
Commit | Line | Data |
---|---|---|
1 | # -*- mode: cmake -*- | |
2 | ||
3 | #--------------------------------------------------------------------------------# | |
4 | # Package File for # | |
5 | # Author : Johny Jose (johny.jose@cern.ch) # | |
6 | # Variables Defined : # | |
7 | # # | |
8 | # SRCS - C++ source files # | |
9 | # HDRS - C++ header files # | |
10 | # DHDR - ROOT Dictionary Linkdef header file # | |
11 | # CSRCS - C source files # | |
12 | # CHDRS - C header files # | |
13 | # EINCLUDE - Include directories # | |
14 | # EDEFINE - Compiler definitions # | |
15 | # ELIBS - Extra libraries to link # | |
16 | # ELIBSDIR - Extra library directories # | |
17 | # PACKFFLAGS - Fortran compiler flags for package # | |
18 | # PACKCXXFLAGS - C++ compiler flags for package # | |
19 | # PACKCFLAGS - C compiler flags for package # | |
20 | # PACKSOFLAGS - Shared library linking flags # | |
21 | # PACKLDFLAGS - Module linker flags # | |
22 | # PACKBLIBS - Libraries to link (Executables only) # | |
23 | # EXPORT - Header files to be exported # | |
24 | # CINTHDRS - Dictionary header files # | |
25 | # CINTAUTOLINK - Set automatic dictionary generation # | |
26 | # ARLIBS - Archive Libraries and objects for linking (Executables only) # | |
27 | # SHLIBS - Shared Libraries and objects for linking (Executables only) # | |
28 | #--------------------------------------------------------------------------------# | |
29 | ||
30 | execute_process (COMMAND sw_vers | sed -n 's/ProductVersion://p' | cut -d. -f1 | |
31 | OUTPUT_VARIABLE MACOSX_MAJOR | |
32 | OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
33 | execute_process (COMMAND sw_vers | sed -n 's/ProductVersion://p' | cut -d. -f2 | |
34 | OUTPUT_VARIABLE MACOSX_MINOR | |
35 | OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
36 | ||
37 | set(FINK_ROOT $ENV{FINK_ROOT}) | |
38 | if( NOT FINK_ROOT ) | |
39 | ||
40 | set ( FINK_ROOT /usr/local) | |
41 | ||
42 | endif( NOT FINK_ROOT ) | |
43 | ||
44 | # Global Optimization | |
45 | set ( OPT ) | |
46 | # ------- Setting optimization flags for default configuration ------- | |
47 | if((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "None")) | |
48 | set(DEFAULT_CXX_FLAGS "-O -g") | |
49 | set(OPT "${DEFAULT_CXX_FLAGS}") | |
50 | message("-- Setting compiler flags for default configuration: ${DEFAULT_CXX_FLAGS}") | |
51 | endif((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "None")) | |
52 | # -------------------------------------------------------------------- | |
53 | set ( NOOPT "-g") | |
54 | ||
55 | set ( CXXOPT ${OPT}) | |
56 | set ( CXXNOOPT ${NOOPT}) | |
57 | set ( COPT ${OPT}) | |
58 | ||
59 | if( F77 MATCHES "g95") | |
60 | ||
61 | set ( FOPT "${FOPT} -fbounds-check") | |
62 | ||
63 | endif( F77 MATCHES "g95") | |
64 | ||
65 | set ( CLIBDEFS "-DCERNLIB_LXIA64 -DCERNLIB_BLDLIB -DCERNLIB_CZ -DCERNLIB_PPC") | |
66 | set ( CLIBCXXOPTS ) | |
67 | set ( CLIBCOPT ) | |
68 | set ( CLIBFOPT ${CLIBDEFS}) | |
69 | ||
70 | set ( CXXWARN "-Wall -Wno-long-long -W -Weffc++ -Wshadow -Woverloaded-virtual -ansi") | |
71 | ||
72 | set ( CXXSTF "-pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -fno-default-inline -fno-inline -I/usr/X11R6/include -I${FINK_ROOT}/include") | |
73 | ||
74 | set ( CXXFLAGS "${CXXOPT} ${CXXSTF}") | |
75 | ||
76 | set ( CXXFLAGSNO "${CXXNOOPT} ${CXXSTF}") | |
77 | ||
78 | set ( CFLAGS "${COPT} -Wall -W -fno-common -pipe -I${FINK_ROOT}/include") | |
79 | ||
80 | if(F77 MATCHES "g95") | |
81 | ||
82 | set ( FFLAGS "${FFLAGS} -ftrace=full") | |
83 | set ( FFLAGS "${FFLAGS} -DFORTRAN_G95") | |
84 | ||
85 | else() | |
86 | ||
87 | set ( FFLAGS "${FFLAGS} -DFORTRAN_GFORTRAN") | |
88 | ||
89 | endif(F77 MATCHES "g95") | |
90 | ||
91 | set ( CINTFLAGS ) | |
92 | ||
93 | set ( LDFLAGS "${OPT} ${DICTLOAD}") | |
94 | ||
95 | set ( SOFLAGS "-m64 -dynamiclib -undefined dynamic_lookup -single_module") | |
96 | ||
97 | set ( ALLIB ) | |
98 | ||
99 | set ( SYSLIBS "-L/usr/X11R6/lib -lX11") | |
100 | ||
101 | ||
102 | set ( EXEFLAGS "-bind_at_load") | |
103 | ||
104 | if( F77 MATCHES "g95") | |
105 | ||
106 | execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --print-search-dirs | |
107 | OUTPUT_VARIABLE SYSLIBS | |
108 | OUTPUT_STRIP_TRAILING_WHITESPACE) | |
109 | string(REGEX MATCH "^.*install:[^\n]*" SYSLIBS ${SYSLIBS}) | |
110 | string(REGEX REPLACE "^.*install: " "" SYSLIBS ${SYSLIBS}) | |
111 | set(SYSLIBS "-L${SHLIB} -lf95") | |
112 | set(DYLIB ${SYSLIBS}) | |
113 | ||
114 | else() | |
115 | ||
116 | execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m64 -print-file-name=libgfortran.dylib | |
117 | OUTPUT_VARIABLE _shlib | |
118 | OUTPUT_STRIP_TRAILING_WHITESPACE) | |
119 | execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m64 -print-file-name=libgfortranbegin.a | |
120 | OUTPUT_VARIABLE _alib | |
121 | OUTPUT_STRIP_TRAILING_WHITESPACE) | |
122 | set( SYSLIBS "${SYSLIBS} -ldl ${_shlib} ${_alib}") | |
123 | ||
124 | endif(F77 MATCHES "g95") |