hedgewars/CMakeLists.txt
changeset 2401 2a694ea2a437
parent 2326 0ddf641fddee
child 2404 8281eea32196
equal deleted inserted replaced
2400:2422ea85d100 2401:2a694ea2a437
     1 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in ${CMAKE_CURRENT_BINARY_DIR}/proto.inc)
     1 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in ${CMAKE_CURRENT_BINARY_DIR}/proto.inc)
       
     2 
       
     3 find_package(SDL REQUIRED)
       
     4 find_package(SDL_IMAGE REQUIRED)
       
     5 find_package(SDL_NET REQUIRED)
       
     6 find_package(SDL_TTF REQUIRED)
     2 
     7 
     3 set(fpc_tryexe fpc)
     8 set(fpc_tryexe fpc)
     4 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
     9 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
     5 
    10 
     6 set(engine_sources
    11 set(engine_sources
    62 if (${testnoexecstack})
    67 if (${testnoexecstack})
    63 set (noexecstack_flags "")
    68 set (noexecstack_flags "")
    64 endif (${testnoexecstack})
    69 endif (${testnoexecstack})
    65 
    70 
    66 IF(APPLE)
    71 IF(APPLE)
    67 	FIND_PACKAGE(SDL)
    72 #let's build sdlmain, which is absent from the framework
       
    73 	set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
       
    74 	include_directories(${SDL_INCLUDE_DIR})
       
    75 	link_libraries(${SDL_LIBRARY})
    68 
    76 
    69 	if (SDL_FOUND)
    77 	add_library (SDLmain STATIC SDLMain.m)
    70 		set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
    78 	set(engine_sources SDLmain ${engine_sources})
    71 		include_directories(${SDL_INCLUDE_DIR})
       
    72 		link_libraries(${SDL_LIBRARY})
       
    73 
       
    74 		add_library (SDLmain STATIC SDLMain.m)
       
    75 		set(engine_sources SDLmain ${engine_sources})
       
    76 	else (SDL_FOUND)
       
    77 		message(FATAL_ERROR "No SDL framework found!")
       
    78 	endif (SDL_FOUND)
       
    79 ENDIF(APPLE)
    79 ENDIF(APPLE)
    80 
    80 
    81 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
    81 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
       
    82 
    82 if (fpc_version)
    83 if (fpc_version)
    83 	string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
    84 	string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
    84 	string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
    85 	string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
    85 	string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
    86 	string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
    86 	math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    87 	math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    87 	if (fpc_ver LESS "020200")
    88 	if (fpc_ver LESS "020200")
    88 		message("Minimum required version of FreePascal is 2.2.0")
    89 		message(STATUS "Minimum required version of FreePascal is 2.2.0")
    89 	else (fpc_ver LESS "020200")
    90 	else (fpc_ver LESS "020200")
    90 		set(pascal_compiler ${fpc_executable})
    91 		set(pascal_compiler ${fpc_executable})
    91 		if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES "Release")
    92 		if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES "Release")
    92 			set(pascal_compiler_flags ${noexecstack_flags} "-B" "-FE../bin" "-Fl../bin/" "-Cs2000000" "-vwi" "-O2" "-Xs" ${hwengine_project})
    93 			set(pascal_compiler_flags ${noexecstack_flags} "-B" "-FE../bin" "-Fl../bin/" "-Cs2000000" "-vwi" "-O2" "-Xs" ${hwengine_project})
    93 		else()
    94 		else()