101 if(CMAKE_OSX_ARCHITECTURES) |
101 if(CMAKE_OSX_ARCHITECTURES) |
102 #parse this system variable and adjust only the powerpc syntax to be compatible with -P |
102 #parse this system variable and adjust only the powerpc syntax to be compatible with -P |
103 string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}") |
103 string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}") |
104 string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}") |
104 string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}") |
105 string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}") |
105 string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}") |
106 if(powerpc_build) |
106 if(x86_64_build) |
107 set(powerpc_build "powerpc") |
107 add_flag_prepend(CMAKE_Pascal_FLAGS -Px86_64) |
|
108 elseif(i386_build) |
|
109 add_flag_prepend(CMAKE_Pascal_FLAGS -Pi386) |
|
110 elseif(powerpc_build) |
|
111 add_flag_prepend(CMAKE_Pascal_FLAGS -Ppowerpc) |
|
112 else() |
|
113 message(FATAL_ERROR "Unknown architecture present in CMAKE_OSX_ARCHITECTURES (${CMAKE_OSX_ARCHITECTURES})") |
|
114 endif() |
|
115 list(LENGTH CMAKE_OSX_ARCHITECTURES num_of_archs) |
|
116 if(num_of_archs GREATER 1) |
|
117 message(${WARNING} "Only one architecture in CMAKE_OSX_ARCHITECTURES is currently supported, picking the first one") |
108 endif() |
118 endif() |
109 elseif(CMAKE_SIZEOF_VOID_P MATCHES "8") |
119 elseif(CMAKE_SIZEOF_VOID_P MATCHES "8") |
110 #if that variable is not set check if we are on x86_64 and if so force it, else use default |
120 #if that variable is not set check if we are on x86_64 and if so force it, else use default |
111 add_flag_append(CMAKE_Pascal_FLAGS -Px86_64) |
121 add_flag_prepend(CMAKE_Pascal_FLAGS -Px86_64) |
112 endif() |
122 endif() |
113 |
123 |
114 #on OSX we need to provide the SDL_main() function when building as executable |
124 #on OSX we need to provide the SDL_main() function when building as executable |
115 if(NOT BUILD_ENGINE_LIBRARY) |
125 if(NOT BUILD_ENGINE_LIBRARY) |
116 add_subdirectory(sdlmain) |
126 add_subdirectory(sdlmain) |
182 set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}") |
192 set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}") |
183 set(destination_dir ${target_binary_install_dir}) |
193 set(destination_dir ${target_binary_install_dir}) |
184 add_executable(hwengine ${engine_sources}) |
194 add_executable(hwengine ${engine_sources}) |
185 endif() |
195 endif() |
186 |
196 |
|
197 #even though not actually used, this will trigger relink if any lib changes |
187 target_link_libraries(hwengine ${HW_LINK_LIBS}) |
198 target_link_libraries(hwengine ${HW_LINK_LIBS}) |
188 |
199 |
189 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" DESTINATION ${destination_dir}) |
200 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" DESTINATION ${destination_dir}) |