Removal of obsolete code
[WPS.git] / external / CMakeLists.txt
blobc3f031eba3a44f0994b21ed1d27a6e4a3f977db9
1 message( STATUS "Building external libraries. This may take awhile..." )
2 list(APPEND CMAKE_MESSAGE_INDENT "  ")
3 # Set up basic environment variables
5 set( ENV{CC}         ${CMAKE_C_COMPILER}       )
6 set( ENV{CXX}        ${CMAKE_CXX_COMPILER}     )
7 set( ENV{FC}         ${CMAKE_Fortran_COMPILER} )
8 set( ENV{FCFLAGS}    ${CMAKE_Fortran_FLAGS}    )
9 # set( ENV{F77}        gfortran                  )
10 set( ENV{FFLAGS}     ${CMAKE_Fortran_FLAGS}    )
11 # set( ENV{LDFLAGS}    -L$DIR/grib2/lib          )
12 # set( ENV{CPPFLAGS}   -I$DIR/grib2/include      )
14 ################################################################################
16 ## ZLib
18 ################################################################################
19 set( TARGET_FOLDER zlib-1.2.11 )
20 set( TAG_FILE      ${INTERNAL_GRIB2_PATH}/include/zlib.h )
21 if ( NOT EXISTS "${TAG_FILE}" )
22   set( LOG_FILE      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-configure.log )
23   message( STATUS "Configuring ${TARGET_FOLDER}...")
24   execute_process( 
25                   COMMAND 
26                     ./configure --prefix=${INTERNAL_GRIB2_PATH} --static
27                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER}
28                   OUTPUT_FILE       ${LOG_FILE}
29                   ERROR_FILE        ${LOG_FILE}
30                   # COMMAND_ECHO      STDOUT
31                   RESULT_VARIABLE   ${TARGET_FOLDER}_STATUS_CONF
32                   )
33   if ( ${TARGET_FOLDER}_STATUS_CONF AND NOT ${TARGET_FOLDER}_STATUS_CONF EQUAL 0 )
34     message( FATAL_ERROR "Failed to configure ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" )
35   else()
36     message( STATUS "Finished configuring ${TARGET_FOLDER}" )
37   endif()
39   set( LOG_FILE      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-build.log )
40   message( STATUS "Building ${TARGET_FOLDER}...")
41   execute_process(
42                   COMMAND 
43                     make install
44                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER}
45                   OUTPUT_FILE       ${LOG_FILE}
46                   ERROR_FILE        ${LOG_FILE}
47                   # COMMAND_ECHO      STDOUT
48                   RESULT_VARIABLE   ${TARGET_FOLDER}_STATUS
49                   )
50   if ( ${TARGET_FOLDER}_STATUS AND NOT ${TARGET_FOLDER}_STATUS EQUAL 0 AND NOT EXISTS "${TAG_FILE}" )
51     message( FATAL_ERROR "Failed to build ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" )
52   else()
53     message( STATUS "Finished building ${TARGET_FOLDER}" )
54   endif()
55 else()
56   message( STATUS "External ${TARGET_FOLDER} already built, skipping" )
57 endif()
59 ################################################################################
61 ## libPNG
63 ################################################################################
64 set( TARGET_FOLDER libpng-1.6.37 )
65 set( TAG_FILE      ${INTERNAL_GRIB2_PATH}/include/png.h )
66 if ( NOT EXISTS "${TAG_FILE}" )
67   set( LOG_FILE      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-configure.log )
68   message( STATUS "Configuring ${TARGET_FOLDER}...")
69   execute_process( 
70                   COMMAND 
71                     ./configure --prefix=${INTERNAL_GRIB2_PATH} --disable-shared --with-zlib-prefix=${INTERNAL_GRIB2_PATH}/
72                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER}
73                   OUTPUT_FILE       ${LOG_FILE}
74                   ERROR_FILE        ${LOG_FILE}
75                   # COMMAND_ECHO      STDOUT
76                   RESULT_VARIABLE   ${TARGET_FOLDER}_STATUS_CONF
77                   )
78   if ( ${TARGET_FOLDER}_STATUS_CONF AND NOT ${TARGET_FOLDER}_STATUS_CONF EQUAL 0 )
79     message( FATAL_ERROR "Failed to configure ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" )
80   else()
81     message( STATUS "Finished configuring ${TARGET_FOLDER}" )
82   endif()
84   set( LOG_FILE      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-build.log )
85   message( STATUS "Building ${TARGET_FOLDER}...")
86   execute_process(
87                   COMMAND
88                     make install
89                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER}
90                   OUTPUT_FILE       ${LOG_FILE}
91                   ERROR_FILE        ${LOG_FILE}
92                   # COMMAND_ECHO      STDOUT
93                   RESULT_VARIABLE   ${TARGET_FOLDER}_STATUS
94                   )
95   if ( ${TARGET_FOLDER}_STATUS AND NOT ${TARGET_FOLDER}_STATUS EQUAL 0 AND NOT EXISTS "${TAG_FILE}" )
96     message( FATAL_ERROR "Failed to build ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" )
97   else()
98     message( STATUS "Finished building ${TARGET_FOLDER}" )
99   endif()
100 else()
101   message( STATUS "External ${TARGET_FOLDER} already built, skipping" )
102 endif()
104 ################################################################################
106 ## Jasper
107 ##!TODO This is "failing" due to automake-1.14 missing. Make this a clean build
109 ################################################################################
110 set( TARGET_FOLDER jasper-1.900.29 )
111 set( TAG_FILE      ${INTERNAL_GRIB2_PATH}/include/jasper/jasper.h )
112 if ( NOT EXISTS "${TAG_FILE}" )
113   set( LOG_FILE      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-configure.log )
114   message( STATUS "Configuring ${TARGET_FOLDER}...")
115   execute_process( 
116                   COMMAND 
117                     ./configure --prefix=${INTERNAL_GRIB2_PATH} --disable-shared
118                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER}
119                   OUTPUT_FILE       ${LOG_FILE}
120                   ERROR_FILE        ${LOG_FILE}
121                   # COMMAND_ECHO      STDOUT
122                   RESULT_VARIABLE   ${TARGET_FOLDER}_STATUS_CONF
123                   )
124   if ( ${TARGET_FOLDER}_STATUS_CONF AND NOT ${TARGET_FOLDER}_STATUS_CONF EQUAL 0 )
125     message( FATAL_ERROR "Failed to configure ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" )
126   else()
127     message( STATUS "Finished configuring ${TARGET_FOLDER}" )
128   endif()
130   set( LOG_FILE      ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_FOLDER}-build.log )
131   message( STATUS "Building ${TARGET_FOLDER}...")
132   execute_process(
133                   COMMAND
134                     make -r -i install
135                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_FOLDER}
136                   OUTPUT_FILE       ${LOG_FILE}
137                   ERROR_FILE        ${LOG_FILE}
138                   # COMMAND_ECHO      STDOUT
139                   RESULT_VARIABLE   ${TARGET_FOLDER}_STATUS
140                   )
141   if ( ${TARGET_FOLDER}_STATUS AND NOT ${TARGET_FOLDER}_STATUS EQUAL 0 AND NOT EXISTS "${TAG_FILE}" )
142     message( FATAL_ERROR "Failed to build ${TARGET_FOLDER}, see log file ${LOG_FILE} for more details" )
143   else()
144     message( STATUS "Finished building ${TARGET_FOLDER}" )
145   endif()
146 else()
147   message( STATUS "External ${TARGET_FOLDER} already built, skipping" )
148 endif()
149 list(POP_BACK CMAKE_MESSAGE_INDENT)