hedgewars/CMakeLists.txt
changeset 2669 4eec706e86b0
parent 2666 2b8c8f16421e
child 2671 7e0f88013fe8
equal deleted inserted replaced
2668:d3a85891ae39 2669:4eec706e86b0
    80 	if(powerpc_build)
    80 	if(powerpc_build)
    81 		set(powerpc_build "powerpc")
    81 		set(powerpc_build "powerpc")
    82 	endif()
    82 	endif()
    83 endif(APPLE)
    83 endif(APPLE)
    84 
    84 
       
    85 
    85 #PASCAL DETECTION SECTION
    86 #PASCAL DETECTION SECTION
    86 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
    87 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
    87 
    88 
    88 if(fpc_version)
    89 if(fpc_version)
    89 	string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
    90 	string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
    92 	message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}.${fpc_vers_patch}")
    93 	message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}.${fpc_vers_patch}")
    93 	math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    94 	math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    94 
    95 
    95 	if(fpc_ver LESS "020200")
    96 	if(fpc_ver LESS "020200")
    96 		message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0")
    97 		message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0")
    97 	elseif(APPLE AND i386_build AND fpc_ver LESS "020400")
    98 	elseif(APPLE AND x86_64_build AND fpc_ver LESS "020400")
    98 		message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!")
    99 		message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!")
    99 	endif()
   100 	endif()
   100 else()
   101 else()
   101 	message(FATAL_ERROR "No Pascal compiler found!")
   102 	message(FATAL_ERROR "No Pascal compiler found!")
   102 endif()
   103 endif()
   104 set(pascal_compiler ${fpc_executable})
   105 set(pascal_compiler ${fpc_executable})
   105 set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project})
   106 set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project})
   106 
   107 
   107 
   108 
   108 #DEPENDECIES AND EXECUTABLES SECTION
   109 #DEPENDECIES AND EXECUTABLES SECTION
   109 IF(APPLE)
       
   110 #let's build sdlmain, which is absent from the framework
       
   111 	find_package(SDL REQUIRED)
       
   112 
       
   113 	set(CMAKE_OSX_ARCHITECTURES "x86_64;i386;ppc7400")	
       
   114 	
       
   115 	set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
       
   116 	include_directories(${SDL_INCLUDE_DIR})
       
   117 	link_libraries(${SDL_LIBRARY})
       
   118 
       
   119 	add_library (SDLmain STATIC SDLMain.m)
       
   120 ENDIF(APPLE)
       
   121 
       
   122 IF(NOT APPLE)
   110 IF(NOT APPLE)
   123 #here is the standard command for any system
   111 #here is the standard command for any system
   124 	add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
   112 	add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
   125 		COMMAND "${pascal_compiler}"
   113 		COMMAND "${pascal_compiler}"
   126 		ARGS ${pascal_compiler_flags}
   114 		ARGS ${pascal_compiler_flags}
   127 		MAIN_DEPENDENCY ${hwengine_project}
   115 		MAIN_DEPENDENCY ${hwengine_project}
   128 		DEPENDS ${engine_sources}
   116 		DEPENDS ${engine_sources}
   129 		)
   117 		)
   130 ELSE()
   118 ELSE()
       
   119 	#let's build sdlmain, which is absent from the framework
       
   120 	find_package(SDL REQUIRED)
       
   121 
       
   122 	set(CMAKE_OSX_ARCHITECTURES "x86_64;i386;ppc7400")	
       
   123 	set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
       
   124 	include_directories(${SDL_INCLUDE_DIR})
       
   125 
       
   126 	add_library (SDLmain STATIC SDLMain.m)
       
   127 #	set_target_properties(SDLmain PROPERTIES COMPILE_FLAGS "-mmacosx-version-min=${minimum_macosx} --sysroot=${CMAKE_OSX_SYSROOT} ")
       
   128 
   131 #these are the dependencies for building a universal binary on Mac OS X
   129 #these are the dependencies for building a universal binary on Mac OS X
   132 	foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
   130 	foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
   133 		set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list})
   131 		set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list})
   134 		add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
   132 		add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
   135 			COMMAND "${pascal_compiler}"
   133 			COMMAND "${pascal_compiler}"