63 if (${testnoexecstack}) |
63 if (${testnoexecstack}) |
64 set (noexecstack_flags "") |
64 set (noexecstack_flags "") |
65 endif (${testnoexecstack}) |
65 endif (${testnoexecstack}) |
66 |
66 |
67 IF(APPLE) |
67 IF(APPLE) |
|
68 |
68 FIND_PACKAGE(SDL) |
69 FIND_PACKAGE(SDL) |
69 if(CMAKE_OSX_ARCHITECTURES) |
70 |
70 set (arch_to_build "-arch i386 -arch ppc7400") |
|
71 else(CMAKE_OSX_ARCHITECTURES) |
|
72 set (arch_to build "") |
|
73 endif(CMAKE_OSX_ARCHITECTURES) |
|
74 if (SDL_FOUND) |
71 if (SDL_FOUND) |
75 exec_program(gcc |
72 #removing previous version of library |
76 ARGS ${arch_to_build} -o ${EXECUTABLE_OUTPUT_PATH}/SDLMain.o -c ${hedgewars_SOURCE_DIR}/hedgewars/SDLMain.m -I ${SDL_INCLUDE_DIR}) |
73 exec_program(rm |
77 exec_program(${CMAKE_AR} |
74 ARGS -f ${EXECUTABLE_OUTPUT_PATH}/libSDLmain.a ${EXECUTABLE_OUTPUT_PATH}/SDLMain.o |
78 ARGS -r ${EXECUTABLE_OUTPUT_PATH}/libSDLmain.a ${EXECUTABLE_OUTPUT_PATH}/SDLMain.o) |
75 OUTPUT_VARIABLE noout |
|
76 RETURN_VALUE testnoexecstack |
|
77 ) |
|
78 |
|
79 #get what architectures to build |
|
80 if(universal_build MATCHES "1") |
|
81 set (arch_to_build "-arch i386 -arch ppc7400") |
|
82 else(universal_build MATCHES "1") |
|
83 set (arch_to_build "") |
|
84 endif(universal_build MATCHES "1") |
|
85 |
|
86 #build, archive and make lib |
|
87 exec_program(${CMAKE_C_COMPILER} |
|
88 ARGS ${arch_to_build} -o ${EXECUTABLE_OUTPUT_PATH}/SDLMain.o -c ${hedgewars_SOURCE_DIR}/hedgewars/SDLMain.m -I ${SDL_INCLUDE_DIR} -O2 |
|
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 ) |
79 exec_program(${CMAKE_RANLIB} |
95 exec_program(${CMAKE_RANLIB} |
80 ARGS ${EXECUTABLE_OUTPUT_PATH}/libSDLmain.a) |
96 ARGS ${EXECUTABLE_OUTPUT_PATH}/libSDLmain.a |
|
97 OUTPUT_VARIABLE noout |
|
98 ) |
81 else (SDL_FOUND) |
99 else (SDL_FOUND) |
82 message(FATAL_ERROR "No SDL framework found!") |
100 message(FATAL_ERROR "No SDL framework found!") |
83 endif (SDL_FOUND) |
101 endif (SDL_FOUND) |
84 |
102 |
85 ENDIF(APPLE) |
103 ENDIF(APPLE) |