--- a/CMakeLists.txt Wed May 23 00:45:37 2012 +0200
+++ b/CMakeLists.txt Wed May 23 01:39:31 2012 +0200
@@ -108,8 +108,10 @@
#workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2)
if(current_macosx_version MATCHES "10.4")
find_package(SDL_mixer REQUIRED)
- set(pascal_compiler_flags_cmn "-k-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg" "-k-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod" ${pascal_compiler_flags_cmn})
- set(CMAKE_C_FLAGS "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg -dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
+ set(DYLIB_SMPEG "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg")
+ set(DYLIB_MIKMOD "-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
+ set(pascal_flags "-k${DYLIB_SMPEG}" "-k${DYLIB_MIKMOD}" ${pascal_flags})
+ set(CMAKE_C_FLAGS "${DYLIB_SMPEG}" "${DYLIB_MIKMOD}" ${CMAKE_C_FLAGS})
endif()
else()
STRING(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version})
@@ -117,9 +119,9 @@
endif()
#add user framework directory
- set(pascal_compiler_flags_cmn "-Ff~/Library/Frameworks" ${pascal_compiler_flags_cmn})
+ set(pascal_flags "-Ff~/Library/Frameworks" ${pascal_flags})
#set deployment target
- set(pascal_compiler_flags_cmn "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}" ${pascal_compiler_flags_cmn})
+ set(pascal_flags "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}" ${pascal_flags})
message(STATUS "Build system: Mac OS X ${current_macosx_version} with GCC:${CMAKE_C_COMPILER}")
message(STATUS "Target system: Mac OS X ${minimum_macosx_version} for architecture(s):${CMAKE_OSX_ARCHITECTURES}")
@@ -148,17 +150,17 @@
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
-separate_arguments(FPFLAGSINT UNIX_COMMAND ${FPFLAGS})
-set(pascal_compiler_flags_cmn ${FPFLAGSINT} "-B" "-FE../bin" "-Cs2000000" "-vewn" ${pascal_compiler_flags_cmn})
-set(haskell_compiler_flags_cmn "-O2" ${haskell_compiler_flags_cmn})
+separate_arguments(fpflags_full UNIX_COMMAND ${FPFLAGS})
+set(pascal_flags ${fpflags_full} "-B" "-FE../bin" "-Cs2000000" "-vewn" ${pascal_flags})
+set(haskell_flags "-O2" ${haskell_flags})
if(Optz)
-# set(pascal_compiler_flags_cmn "-O3" "-OpPENTIUM4" "-CfSSE3" "-Xs" "-Si" ${pascal_compiler_flags_cmn})
- set(pascal_compiler_flags_cmn "-Os" "-Ooregvar" "-Xs" "-Si" ${pascal_compiler_flags_cmn})
- set(haskell_compiler_flags_cmn "-w" "-fno-warn-unused-do-bind" ${haskell_compiler_flags_cmn})
+# set(pascal_flags "-O3" "-OpPENTIUM4" "-CfSSE3" "-Xs" "-Si" ${pascal_flags})
+ set(pascal_flags "-Os" "-Ooregvar" "-Xs" "-Si" ${pascal_flags})
+ set(haskell_flags "-w" "-fno-warn-unused-do-bind" ${haskell_flags})
else(Optz)
- set(pascal_compiler_flags_cmn "-O-" "-g" "-gl" "-gv" "-Ct" "-dDEBUGFILE" ${pascal_compiler_flags_cmn})
- set(haskell_compiler_flags_cmn "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind" ${haskell_compiler_flags_cmn})
+ set(pascal_flags "-O-" "-g" "-gl" "-gv" "-Ct" "-dDEBUGFILE" ${pascal_flags})
+ set(haskell_flags "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind" ${haskell_flags})
endif(Optz)
@@ -188,12 +190,12 @@
if(NOT ${LUA_FOUND})
message(STATUS "Lua library not found, building bundled dependency")
add_subdirectory(misc/liblua)
- #link with liblua.a (which requires readline)
- set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_compiler_flags_cmn})
+ #link with liblua.a (which requires system readline)
+ set(pascal_flags "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_flags})
endif()
add_subdirectory(hedgewars)
-#run cmake -DBUILD_ANDROID_PORT=1 to enable this
+#run cmake -DANDROID=1 to enable this
if(ANDROID)
add_subdirectory(project_files/Android-build)
endif()
--- a/gameServer/CMakeLists.txt Wed May 23 00:45:37 2012 +0200
+++ b/gameServer/CMakeLists.txt Wed May 23 01:39:31 2012 +0200
@@ -35,9 +35,8 @@
-i${hedgewars_SOURCE_DIR}/gameServer
-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
-odir ${CMAKE_CURRENT_BINARY_DIR}
- -hidir ${CMAKE_CURRENT_BINARY_DIR})
-
-set(ghc_flags ${haskell_compiler_flags_cmn} ${ghc_flags})
+ -hidir ${CMAKE_CURRENT_BINARY_DIR}
+ ${haskell_flags})
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
COMMAND "${ghc_executable}"
--- a/hedgewars/CMakeLists.txt Wed May 23 00:45:37 2012 +0200
+++ b/hedgewars/CMakeLists.txt Wed May 23 01:39:31 2012 +0200
@@ -72,17 +72,16 @@
if(BUILD_ENGINE_LIBRARY)
message(STATUS "Engine will be built as library (experimental)")
set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas)
- set(engine_sources ${hwengine_project} PascalExports.pas ${engine_sources})
- set(pascal_compiler_flags_cmn "-dHWLIBRARY" ${pascal_compiler_flags_cmn})
+ set(pascal_flags "-dHWLIBRARY" ${pascal_flags})
# create position independent code, only required for x68_64 builds, similar to -fPIC
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
- set(pascal_compiler_flags_cmn "-Cg" ${pascal_compiler_flags_cmn})
+ set(pascal_flags "-Cg" ${pascal_flags})
endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
- # due to compiling/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
+ # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
if(APPLE AND current_macosx_version GREATER "10.5")
- set(pascal_compiler_flags_cmn "-k-no_order_inits" ${pascal_compiler_flags_cmn})
+ set(pascal_flags "-k-no_order_inits" ${pascal_flags})
endif()
if (APPLE)
@@ -122,55 +121,7 @@
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}")
-
-if(fpc_version)
- string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
- string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
- string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
- message(STATUS "Freepascal version installed: ${fpc_vers_major}.${fpc_vers_minor}")
- 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")
- elseif(APPLE AND (fpc_ver LESS "020600"))
- message(FATAL_ERROR "Minimum required version of FreePascal is 2.6.0 on Mac OS X")
- endif()
-else()
- message(FATAL_ERROR "No FreePascal compiler found!")
-endif()
-
-
-#DEPENDECIES AND EXECUTABLES SECTION
-find_package(PNG)
-if(${PNG_FOUND})
- message(STATUS "PNG screenshots enabled (library found at ${PNG_LIBRARY})")
- set(pascal_compiler_flags_cmn "-dPNG_SCREENSHOTS" ${pascal_compiler_flags_cmn})
- if(APPLE) # need to explictly link with the static lib
- string(REGEX REPLACE "(.*)libpng.*" "\\1" PNG_LIBDIR "${PNG_LIBRARY}")
- set(pascal_compiler_flags_cmn "-k${PNG_LIBDIR}/libpng.a" ${pascal_compiler_flags_cmn})
- endif()
-else()
- message(STATUS "PNG library not found, switching to screenshots in BMP format")
-endif()
-
-set(pascal_compiler ${fpc_executable})
-set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project})
-
-
-IF(NOT APPLE)
- #here is the command for standard executables or for shared library
- add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"
- COMMAND "${pascal_compiler}"
- ARGS ${pascal_compiler_flags}
- MAIN_DEPENDENCY ${hwengine_project}
- DEPENDS ${engine_sources}
- )
-ELSE()
#on OSX we need to provide the main() function when building as executable
if(NOT BUILD_ENGINE_LIBRARY)
#let's look for the bundled sdlmain, if not found build our own
@@ -185,19 +136,66 @@
include_directories(${SDL_INCLUDE_DIR})
add_library (SDLmain STATIC SDLMain.m)
#add a dependency to the hwengine target
- set(engine_sources ${engine_sources} "SDLmain")
+ set(engine_sources ${engine_sources} SDLmain)
set(SDLMAIN_LIB "${CMAKE_BINARY_DIR}/bin/libSDLmain.a")
endif()
- set(pascal_compiler_flags "-k${SDLMAIN_LIB}" ${pascal_compiler_flags})
+ set(pascal_flags "-k${SDLMAIN_LIB}" ${pascal_flags})
+ endif()
+endif(APPLE)
+
+
+#PASCAL DETECTION SECTION
+string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
+
+if(fpc_version)
+ string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
+ string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
+ string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
+ message(STATUS "Freepascal version installed: ${fpc_vers_major}.${fpc_vers_minor}")
+ math(EXPR fpc_version "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
+
+ if(fpc_version LESS "020200")
+ message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0")
+ elseif(APPLE AND (fpc_version LESS "020600"))
+ message(FATAL_ERROR "Minimum required version of FreePascal is 2.6.0 on Mac OS X")
endif()
+else()
+ message(FATAL_ERROR "No FreePascal compiler found!")
+endif()
+
+#DEPENDECIES AND EXECUTABLES SECTION
+find_package(PNG)
+if(${PNG_FOUND})
+ message(STATUS "PNG screenshots enabled (library found at ${PNG_LIBRARY})")
+ set(pascal_flags "-dPNG_SCREENSHOTS" ${pascal_flags})
+ if(APPLE) # need to explictly link with the static lib
+ string(REGEX REPLACE "(.*)libpng.*" "\\1" PNG_LIBDIR "${PNG_LIBRARY}")
+ set(pascal_flags "-k${PNG_LIBDIR}/libpng.a" ${pascal_flags})
+ endif()
+else()
+ message(STATUS "PNG library not found, switching to screenshots in BMP format")
+endif()
+
+set(fpc_flags ${noexecstack_flags} ${pascal_flags} ${hwengine_project})
+
+
+IF(NOT APPLE)
+ #here is the command for standard executables or for shared library
+ add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"
+ COMMAND "${fpc_executable}"
+ ARGS ${fpc_flags}
+ MAIN_DEPENDENCY ${hwengine_project}
+ DEPENDS ${engine_sources}
+ )
+ELSE()
#these are the dependencies for building a universal binary on Mac OS X
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}
+ COMMAND "${fpc_executable}"
+ ARGS ${fpc_flags} -ohwengine.${build_arch} -P${build_arch}
MAIN_DEPENDENCY ${hwengine_project}
DEPENDS ${engine_sources}
)
--- a/tools/CMakeLists.txt Wed May 23 00:45:37 2012 +0200
+++ b/tools/CMakeLists.txt Wed May 23 01:39:31 2012 +0200
@@ -32,11 +32,11 @@
string(REGEX REPLACE "(.*);-.*" "\\1" sdl_dir "${SDL_LIBRARY}")
#this tool is present in qt 4.5 but only if you compile from sources; from qt 4.6 is present also in the binary version
- find_program(macdeployqt_EXE NAMES macdeployqt macdeployqt-mac PATHS ${qt_base_dir}/bin)
- if(NOT macdeployqt_EXE)
+ find_program(macdeployqt_executable NAMES macdeployqt macdeployqt-mac PATHS ${qt_base_dir}/bin)
+ if(NOT macdeployqt_executable)
message(FATAL_ERROR "The utility macdeployqt is required to create the bundle (seached: ${qt_base_dir})")
else()
- message(STATUS "macdeployqt found in ${macdeployqt_EXE}")
+ message(STATUS "macdeployqt found in ${macdeployqt_executable}")
endif()
#dummy target, we're interested in the postscript file
--- a/tools/CreateMacBundle.cmake.in Wed May 23 00:45:37 2012 +0200
+++ b/tools/CreateMacBundle.cmake.in Wed May 23 01:39:31 2012 +0200
@@ -3,7 +3,7 @@
execute_process(COMMAND ls ${frameworks_dir} RESULT_VARIABLE doBundle OUTPUT_QUIET ERROR_QUIET)
execute_process(COMMAND mkdir -p ${frameworks_dir})
-execute_process(COMMAND ${macdeployqt_EXE} ${CMAKE_BINARY_DIR}/${bundle_name} OUTPUT_QUIET ERROR_QUIET)
+execute_process(COMMAND ${macdeployqt_executable} ${CMAKE_BINARY_DIR}/${bundle_name} OUTPUT_QUIET ERROR_QUIET)
if(doBundle EQUAL 1)
execute_process(COMMAND cp -pPR ${sdl_dir} ${CMAKE_BINARY_DIR}/${frameworks_dir}/SDL.framework)