--- a/CMakeLists.txt Sun Nov 29 21:47:47 2009 +0000
+++ b/CMakeLists.txt Mon Nov 30 04:18:31 2009 +0000
@@ -43,20 +43,16 @@
#create universal binaries only when it's time to bundle the application
IF(BUNDLE)
if(current_macosx_version MATCHES "10.6")
- set(CMAKE_OSX_ARCHITECTURES "x86_64;i386;ppc7400")
- set(build_x86_64 TRUE)
- set(build_i386 TRUE)
- set(build_ppc TRUE)
+ set(CMAKE_OSX_ARCHITECTURES "x86_64;i386;ppc7400")
else()
set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400")
- set(build_i386 TRUE)
- set(build_ppc TRUE)
endif()
- ELSE()
- set(build_i386 TRUE)
+ ELSEIF(NOT CMAKE_OSX_ARCHITECTURES)
+ EXEC_PROGRAM("/usr/bin/uname" ARGS "-p" OUTPUT_VARIABLE ARCH_TYPE)
+ set(CMAKE_OSX_ARCHITECTURES "${ARCH_TYPE}")
ENDIF()
- message(STATUS "Target system: Mac OS X ${minimum_macosx} for ${CMAKE_OSX_ARCHITECTURES}")
+ message(STATUS "Target system: Mac OS X ${minimum_macosx} ${CMAKE_OSX_ARCHITECTURES}")
if(minimum_macosx MATCHES "10.4")
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
@@ -96,6 +92,10 @@
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Fl../bin/" "-Cs2000000" "-vwi")
+if(LOWRES)
+ set(pascal_compiler_flags_cmn "-dLOWRES" ${pascal_compiler_flags_cmn})
+ add_definitions(-DLOWRES)
+endif(LOWRES)
if(Optz)
set(pascal_compiler_flags_cmn "-O2" "-Xs" "-Si" ${pascal_compiler_flags_cmn})
@@ -108,9 +108,9 @@
if(DEFINED DATA_INSTALL_DIR)
set(SHAREPATH ${DATA_INSTALL_DIR}/hedgewars/)
-else(DEFINED DATA_INSTALL_DIR)
+else()
set(SHAREPATH share/hedgewars/)
-endif(DEFINED DATA_INSTALL_DIR)
+endif()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
--- a/QTfrontend/CMakeLists.txt Sun Nov 29 21:47:47 2009 +0000
+++ b/QTfrontend/CMakeLists.txt Mon Nov 30 04:18:31 2009 +0000
@@ -31,13 +31,13 @@
if(WIN32 AND NOT UNIX)
set(HEDGEWARS_BINDIR ".")
set(HEDGEWARS_DATADIR "../share/")
-else(WIN32 AND NOT UNIX)
+else()
set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
if(DEFINED DATA_INSTALL_DIR)
set(HEDGEWARS_DATADIR ${DATA_INSTALL_DIR})
- else(DEFINED DATA_INSTALL_DIR)
+ else()
set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/share/)
- endif(DEFINED DATA_INSTALL_DIR)
+ endif()
endif(WIN32 AND NOT UNIX)
@@ -140,22 +140,13 @@
bgwidget.h
)
-if(APPLE)
- find_package(Sparkle)
-
- set(hwfr_src ${hwfr_src} InstallController.cpp CocoaInitializer.mm M3Panel.mm M3InstallController.m NSWorkspace_RBAdditions.m)
- if(SPARKLE_FOUND)
- set(hwfr_src ${hwfr_src} AutoUpdater.cpp SparkleAutoUpdater.mm)
- endif()
-endif()
-
set( hwfr_hdrs
binds.h
ui_hwform.h
predefteams.h
KB.h
hwconsts.h
-)
+ )
set(hwfr_rez hedgewars.qrc)
@@ -163,6 +154,20 @@
qt4_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs})
+
+if(APPLE)
+ set(hwfr_src ${hwfr_src} InstallController.cpp CocoaInitializer.mm M3Panel.mm M3InstallController.m NSWorkspace_RBAdditions.m)
+ set(HW_LINK_LIBS IOKit)
+
+ find_package(Sparkle)
+ if(SPARKLE_FOUND)
+ add_definitions(-DSPARKLE_ENABLED)
+ set(hwfr_src ${hwfr_src} AutoUpdater.cpp SparkleAutoUpdater.mm)
+ set(HW_LINK_LIBS ${SPARKLE_LIBRARY} ${HW_LINK_LIBS})
+ endif()
+endif()
+
+
add_executable(hedgewars WIN32
${hwfr_src}
${hwfr_moc_srcs}
@@ -171,27 +176,19 @@
)
-set(HW_LINK_LIBS
+set( HW_LINK_LIBS
${QT_LIBRARIES}
${SDL_LIBRARY}
${SDLMIXER_LIBRARY}
+ ${HW_LINK_LIBS}
)
-if(APPLE)
- set(HW_LINK_LIBS IOKit ${HW_LINK_LIBS})
- if (SPARKLE_FOUND)
- set(HW_LINK_LIBS ${HW_LINK_LIBS} ${SPARKLE_LIBRARY})
- add_definitions(-DSPARKLE_ENABLED)
- endif()
-endif()
-
-
if(WIN32 AND NOT UNIX)
if(NOT SDL_LIBRARY)
set(HW_LINK_LIBS ${HW_LINK_LIBS} SDL)
endif(NOT SDL_LIBRARY)
- set(HW_LINK_LIBS
+ set( HW_LINK_LIBS
${HW_LINK_LIBS}
ole32
oleaut32
--- a/hedgewars/CMakeLists.txt Sun Nov 29 21:47:47 2009 +0000
+++ b/hedgewars/CMakeLists.txt Mon Nov 30 04:18:31 2009 +0000
@@ -73,6 +73,16 @@
endif (${testnoexecstack})
+if(APPLE)
+ string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}")
+ string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}")
+ string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}")
+
+ if(powerpc_build)
+ set(powerpc_build "powerpc")
+ endif()
+endif(APPLE)
+
#PASCAL DETECTION SECTION
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
@@ -82,27 +92,19 @@
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}.${fpc_vers_patch}")
math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
+
if (fpc_ver LESS "020200")
message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0")
- else()
- if (APPLE AND build_x86_64 AND fpc_ver LESS "020400")
- message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications")
- endif()
- set(pascal_compiler ${fpc_executable})
+ elseif (APPLE AND i386_build AND fpc_ver LESS "020400")
+ message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!")
endif ()
-endif (fpc_version)
+else()
+ message(FATAL_ERROR "No Pascal compiler found!")
+endif ()
-if (NOT pascal_compiler)
- message(FATAL_ERROR "No Pascal compiler found!")
-endif (NOT pascal_compiler)
-
-
+set(pascal_compiler ${fpc_executable})
set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project})
-if(LOWRES)
- set(pascal_compiler_flags "-dLOWRES" ${pascal_compiler_flags} ${hwengine_project})
-endif(LOWRES)
-
#DEPENDECIES AND EXECUTABLES SECTION
IF(APPLE)
@@ -114,7 +116,6 @@
link_libraries(${SDL_LIBRARY})
add_library (SDLmain STATIC SDLMain.m)
- set(engine_sources SDLmain ${engine_sources})
ENDIF(APPLE)
IF(NOT APPLE)
@@ -127,39 +128,16 @@
)
ELSE()
#these are the dependencies for building a universal binary on Mac OS X
- if(build_ppc)
- set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc" ${lipo_args_list})
- endif()
- if(build_i386)
- set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.386" ${lipo_args_list})
- endif()
- if(build_x86_64)
- set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.x64" ${lipo_args_list})
- endif()
-
- add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.386"
- COMMAND "${pascal_compiler}"
- ARGS ${pascal_compiler_flags} -ohwengine.386 -Pi386
- MAIN_DEPENDENCY ${hwengine_project}
- DEPENDS ${engine_sources}
- )
- add_custom_target(hwengine.386 ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.386")
-
- add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc"
- COMMAND "${pascal_compiler}"
- ARGS ${pascal_compiler_flags} -ohwengine.ppc -Ppowerpc
- MAIN_DEPENDENCY ${hwengine_project}
- DEPENDS ${engine_sources}
- )
- add_custom_target(hwengine.ppc ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.ppc")
-
- add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.x64"
- COMMAND "${pascal_compiler}"
- ARGS ${pascal_compiler_flags} -ohwengine.x64 -Px86_64
- MAIN_DEPENDENCY ${hwengine_project}
- DEPENDS ${engine_sources}
- )
- add_custom_target(hwengine.x64 ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.x64")
+ foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
+ set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list})
+ add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
+ COMMAND "${pascal_compiler}"
+ ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch}
+ MAIN_DEPENDENCY ${hwengine_project}
+ DEPENDS ${engine_sources}
+ )
+ add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
+ endforeach()
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine"
COMMAND "lipo"