53 tunsetborder.inc |
53 tunsetborder.inc |
54 ) |
54 ) |
55 |
55 |
56 find_program(fpc_executable ${fpc_tryexe}) |
56 find_program(fpc_executable ${fpc_tryexe}) |
57 |
57 |
58 if (fpc_executable) |
58 if(fpc_executable) |
59 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output) |
59 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output) |
60 endif (fpc_executable) |
60 endif(fpc_executable) |
61 |
61 |
62 set (noexecstack_flags "-k-z" "-knoexecstack") |
62 set(noexecstack_flags "-k-z" "-knoexecstack") |
63 file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.") |
63 file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.") |
64 |
64 |
65 exec_program(${fpc_executable} ${EXECUTABLE_OUTPUT_PATH} |
65 exec_program(${fpc_executable} ${EXECUTABLE_OUTPUT_PATH} |
66 ARGS ${noexecstack_flags} checkstack.pas |
66 ARGS ${noexecstack_flags} checkstack.pas |
67 OUTPUT_VARIABLE noout |
67 OUTPUT_VARIABLE noout |
68 RETURN_VALUE testnoexecstack |
68 RETURN_VALUE testnoexecstack |
69 ) |
69 ) |
70 |
70 |
71 if (${testnoexecstack}) |
71 if(${testnoexecstack}) |
72 set (noexecstack_flags "") |
72 set (noexecstack_flags "") |
73 endif (${testnoexecstack}) |
73 endif(${testnoexecstack}) |
74 |
74 |
75 |
75 |
76 if(APPLE) |
76 if(APPLE) |
77 string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}") |
77 string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}") |
78 string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}") |
78 string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}") |
84 endif(APPLE) |
84 endif(APPLE) |
85 |
85 |
86 #PASCAL DETECTION SECTION |
86 #PASCAL DETECTION SECTION |
87 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}") |
87 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}") |
88 |
88 |
89 if (fpc_version) |
89 if(fpc_version) |
90 string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") |
90 string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") |
91 string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") |
91 string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") |
92 string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}") |
92 string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}") |
93 message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}.${fpc_vers_patch}") |
93 message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}.${fpc_vers_patch}") |
94 math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
94 math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") |
95 |
95 |
96 if (fpc_ver LESS "020200") |
96 if(fpc_ver LESS "020200") |
97 message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
97 message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") |
98 elseif (APPLE AND i386_build AND fpc_ver LESS "020400") |
98 elseif(APPLE AND i386_build AND fpc_ver LESS "020400") |
99 message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!") |
99 message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!") |
100 endif () |
100 endif() |
101 else() |
101 else() |
102 message(FATAL_ERROR "No Pascal compiler found!") |
102 message(FATAL_ERROR "No Pascal compiler found!") |
103 endif () |
103 endif() |
104 |
104 |
105 set(pascal_compiler ${fpc_executable}) |
105 set(pascal_compiler ${fpc_executable}) |
106 set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project}) |
106 set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project}) |
107 |
107 |
108 |
108 |
109 #DEPENDECIES AND EXECUTABLES SECTION |
109 #DEPENDECIES AND EXECUTABLES SECTION |
110 IF(APPLE) |
110 IF(APPLE) |
111 #let's build sdlmain, which is absent from the framework |
111 #let's build sdlmain, which is absent from the framework |
112 find_package(SDL REQUIRED) |
112 find_package(SDL REQUIRED) |
113 |
113 |
|
114 set(CMAKE_OSX_ARCHITECTURES "x86_64;i386;ppc7400") |
|
115 |
114 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
116 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
115 include_directories(${SDL_INCLUDE_DIR}) |
117 include_directories(${SDL_INCLUDE_DIR}) |
116 link_libraries(${SDL_LIBRARY}) |
118 link_libraries(${SDL_LIBRARY}) |
117 |
119 |
118 add_library (SDLmain STATIC SDLMain.m) |
120 add_library (SDLmain STATIC SDLMain.m) |