99 set(engine_output_name "libhwengine.dylib") |
99 set(engine_output_name "libhwengine.dylib") |
100 endif (APPLE) |
100 endif (APPLE) |
101 endif(BUILD_ENGINE_LIBRARY) |
101 endif(BUILD_ENGINE_LIBRARY) |
102 |
102 |
103 |
103 |
|
104 #PASCAL DETECTION SECTION |
104 IF(FPC) |
105 IF(FPC) |
105 set(fpc_executable ${FPC}) |
106 set(fpc_executable ${FPC}) |
106 ELSE() |
107 ELSE() |
107 find_program(fpc_executable fpc) |
108 find_program(fpc_executable fpc) |
108 ENDIF() |
109 ENDIF() |
109 |
110 |
110 if(fpc_executable) |
111 if(fpc_executable) |
111 exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output) |
112 execute_process(COMMAND ${fpc_executable} -iV OUTPUT_VARIABLE fpc_output) |
112 endif(fpc_executable) |
113 endif(fpc_executable) |
|
114 |
|
115 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}") |
|
116 if(fpc_version) |
|
117 string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") |
|
118 string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") |
|
119 string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}") |
|
120 message(STATUS "Found Freepascal: ${fpc_executable} (version ${fpc_vers_major}.${fpc_vers_minor})") |
|
121 math(EXPR fpc_version "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
|
122 |
|
123 if(fpc_version LESS "020200") |
|
124 message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
|
125 elseif(APPLE AND (fpc_version LESS "020600")) |
|
126 message(FATAL_ERROR "Minimum required version of FreePascal is 2.6.0 on Mac OS X") |
|
127 endif() |
|
128 else() |
|
129 message(FATAL_ERROR "No FreePascal compiler found!") |
|
130 endif() |
113 |
131 |
114 set(noexecstack_flags "-k-z" "-knoexecstack") |
132 set(noexecstack_flags "-k-z" "-knoexecstack") |
115 file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.") |
133 file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.") |
116 |
134 |
117 exec_program(${fpc_executable} ${EXECUTABLE_OUTPUT_PATH} |
135 execute_process(COMMAND ${fpc_executable} ${noexecstack_flags} checkstack.pas |
118 ARGS ${noexecstack_flags} checkstack.pas |
136 WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} |
119 OUTPUT_VARIABLE noout |
137 RESULT_VARIABLE testnoexecstack |
120 RETURN_VALUE testnoexecstack |
138 OUTPUT_QUIET |
121 ) |
139 ) |
122 |
140 |
123 if(${testnoexecstack}) |
141 if(${testnoexecstack}) |
124 set (noexecstack_flags "") |
142 set (noexecstack_flags "") |
125 endif(${testnoexecstack}) |
143 endif(${testnoexecstack}) |
126 |
144 |
127 |
145 #DEPENDECIES AND EXECUTABLES SECTION |
128 if(APPLE) |
146 if(APPLE) |
129 string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}") |
147 string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}") |
130 string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}") |
148 string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}") |
131 string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}") |
149 string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}") |
132 |
150 |
154 set(pascal_flags "-k${SDLMAIN_LIB}" ${pascal_flags}) |
172 set(pascal_flags "-k${SDLMAIN_LIB}" ${pascal_flags}) |
155 endif() |
173 endif() |
156 set(pascal_flags "-k${LIBRARY_OUTPUT_PATH}/libphysfs.a" ${pascal_flags}) |
174 set(pascal_flags "-k${LIBRARY_OUTPUT_PATH}/libphysfs.a" ${pascal_flags}) |
157 endif(APPLE) |
175 endif(APPLE) |
158 |
176 |
159 |
|
160 #PASCAL DETECTION SECTION |
|
161 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}") |
|
162 |
|
163 if(fpc_version) |
|
164 string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") |
|
165 string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") |
|
166 string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}") |
|
167 message(STATUS "Found Freepascal: ${fpc_executable} (version ${fpc_vers_major}.${fpc_vers_minor})") |
|
168 math(EXPR fpc_version "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
|
169 |
|
170 if(fpc_version LESS "020200") |
|
171 message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
|
172 elseif(APPLE AND (fpc_version LESS "020600")) |
|
173 message(FATAL_ERROR "Minimum required version of FreePascal is 2.6.0 on Mac OS X") |
|
174 endif() |
|
175 else() |
|
176 message(FATAL_ERROR "No FreePascal compiler found!") |
|
177 endif() |
|
178 |
|
179 |
|
180 #DEPENDECIES AND EXECUTABLES SECTION |
|
181 if(NOT NOPNG) |
177 if(NOT NOPNG) |
182 find_package(PNG) |
178 find_package(PNG) |
183 if(${PNG_FOUND}) |
179 if(${PNG_FOUND}) |
184 set(pascal_flags "-dPNG_SCREENSHOTS" ${pascal_flags}) |
180 set(pascal_flags "-dPNG_SCREENSHOTS" ${pascal_flags}) |
185 if(APPLE) # fpc png unit doesn't pull the library (see bug 21833) |
181 if(APPLE) # fpc png unit doesn't pull the library (see bug 21833) |