67 IF(APPLE) |
67 IF(APPLE) |
68 |
68 |
69 FIND_PACKAGE(SDL) |
69 FIND_PACKAGE(SDL) |
70 |
70 |
71 if (SDL_FOUND) |
71 if (SDL_FOUND) |
72 #removing previous version of library |
|
73 exec_program(rm |
|
74 ARGS -f ${EXECUTABLE_OUTPUT_PATH}/libSDLmain.a ${EXECUTABLE_OUTPUT_PATH}/SDLMain.o |
|
75 OUTPUT_VARIABLE noout |
|
76 RETURN_VALUE testnoexecstack |
|
77 ) |
|
78 |
72 |
79 #get what architectures to build |
73 set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) |
80 if(universal_build MATCHES "1") |
74 include_directories(${SDL_INCLUDE_DIR}) |
81 set (arch_to_build "-arch i386 -arch ppc7400") |
75 link_libraries(${SDL_LIBRARY}) |
82 else(universal_build MATCHES "1") |
|
83 set (arch_to_build "") |
|
84 endif(universal_build MATCHES "1") |
|
85 |
76 |
86 #build, archive and make lib |
77 add_library (SDLmain STATIC SDLMain.m) |
87 exec_program(${CMAKE_C_COMPILER} |
78 set(engine_sources SDLmain ${engine_sources}) |
88 ARGS ${arch_to_build} -o ${EXECUTABLE_OUTPUT_PATH}/SDLMain.o -c ${hedgewars_SOURCE_DIR}/hedgewars/SDLMain.m -I ${SDL_INCLUDE_DIR} -O2 |
79 |
89 OUTPUT_VARIABLE noout |
|
90 ) |
|
91 exec_program(${CMAKE_AR} |
|
92 ARGS -rvu ${EXECUTABLE_OUTPUT_PATH}/libSDLmain.a ${EXECUTABLE_OUTPUT_PATH}/SDLMain.o |
|
93 OUTPUT_VARIABLE noout |
|
94 ) |
|
95 exec_program(${CMAKE_RANLIB} |
|
96 ARGS ${EXECUTABLE_OUTPUT_PATH}/libSDLmain.a |
|
97 OUTPUT_VARIABLE noout |
|
98 ) |
|
99 else (SDL_FOUND) |
80 else (SDL_FOUND) |
100 message(FATAL_ERROR "No SDL framework found!") |
81 message(FATAL_ERROR "No SDL framework found!") |
101 endif (SDL_FOUND) |
82 endif (SDL_FOUND) |
102 |
83 |
103 ENDIF(APPLE) |
84 ENDIF(APPLE) |
126 #here is the standard command for any system |
107 #here is the standard command for any system |
127 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" |
108 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" |
128 COMMAND "${pascal_compiler}" |
109 COMMAND "${pascal_compiler}" |
129 ARGS ${pascal_compiler_flags} |
110 ARGS ${pascal_compiler_flags} |
130 MAIN_DEPENDENCY ${hwengine_project} |
111 MAIN_DEPENDENCY ${hwengine_project} |
131 DEPENDS ${engine_sources} |
112 DEPENDS openalbridge ${engine_sources} |
132 ) |
113 ) |
133 |
114 |
134 ELSE(NOT APPLE OR NOT universal_build MATCHES "1") |
115 ELSE(NOT APPLE OR NOT universal_build MATCHES "1") |
135 |
116 |
136 #these are the two dependencies for building a universal binary on Mac OS X |
117 #these are the two dependencies for building a universal binary on Mac OS X |
137 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}.386" |
118 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}.386" |
138 COMMAND "ppc386" |
119 COMMAND "ppc386" |
139 ARGS ${pascal_compiler_flags} -ohwengine.386 |
120 ARGS ${pascal_compiler_flags} -ohwengine.386 |
140 MAIN_DEPENDENCY ${hwengine_project} |
121 MAIN_DEPENDENCY ${hwengine_project} |
141 DEPENDS ${engine_sources} |
122 DEPENDS openalbridge ${engine_sources} |
142 ) |
123 ) |
143 add_custom_target(hwengine.386 ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}.386") |
124 add_custom_target(hwengine.386 ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}.386") |
144 |
125 |
145 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}.ppc" |
126 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}.ppc" |
146 COMMAND "ppcppc" |
127 COMMAND "ppcppc" |
147 ARGS ${pascal_compiler_flags} -ohwengine.ppc |
128 ARGS ${pascal_compiler_flags} -ohwengine.ppc |
148 MAIN_DEPENDENCY ${hwengine_project} |
129 MAIN_DEPENDENCY ${hwengine_project} |
149 DEPENDS ${engine_sources} |
130 DEPENDS openalbridge ${engine_sources} |
150 ) |
131 ) |
151 add_custom_target(hwengine.ppc ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}.ppc") |
132 add_custom_target(hwengine.ppc ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}.ppc") |
152 |
133 |
153 #this is the command that bundles the two executables into one |
134 #this is the command that bundles the two executables into one |
154 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" |
135 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" |