project_files/Android-build/CMakeLists.txt
author Xeli
Thu, 04 Aug 2011 17:34:21 +0200
branchhedgeroid
changeset 5467 88e25840f532
parent 5448 787cf66a7c39
child 5621 ea796c83ea47
permissions -rw-r--r--
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     1
###################################################################################
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     2
# Uncomment (remove the leading '#') and change the paths accordingly to your own 
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     3
# build environment, please do specify an absolute path (/home/richard/SoftDev    
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     4
# rather than ~/SoftDev).
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     5
# You only need to change the three lines below, after that you can run 'cmake .'
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     6
# from the hedgewars root directory
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     7
# 
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     8
# optionally you can specify SDL_DIR this will move the required SDL libraries to
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
     9
# the correct place
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    10
##################################################################################
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    11
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    12
set(ANDROID_NDK /home/richard/SoftDev/android/android-ndk-r5b)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    13
set(ANDROID_SDK /home/richard/SoftDev/android/android-sdk-linux_86)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    14
set(FPC_DIR /home/richard/SoftDev/fpc-2.4.4)
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    15
set(SDL_DIR /home/richard/Downloads/android-project)
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    16
set(LUA_DIR /home/richard/Downloads/lua.5.1.4)
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    17
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    18
if(ANDROID_NDK AND ANDROID_SDK AND FPC_DIR)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    19
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    20
    set(ANDROID_SDK_API_LVL 8)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    21
    set(ANDROID_NDK_API_LVL 5)
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    22
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    23
    MESSAGE("Creating android scripts and configuration files")
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    24
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    25
    configure_file(Templates/complete_build.sh .)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    26
    configure_file(Templates/default.properties SDL-android-project/)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    27
    configure_file(Templates/local.properties SDL-android-project/)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    28
    configure_file(Templates/Makefile.android .)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    29
    configure_file(Templates/pushToDevice.sh .)
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    30
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    31
    if(SDL_DIR)
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    32
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    33
        MESSAGE("Moving Android port of SDL to the proper directories")
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    34
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    35
        set(DirsToCopy
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    36
            SDL
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    37
	    SDL_image
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    38
            SDL_mixer
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    39
            SDL_ttf
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    40
	    jpeg
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    41
	    png
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    42
            mikmod
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    43
            tremor
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    44
            freetype
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    45
           ) 
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    46
         foreach(DIR ${DirsToCopy})
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    47
             EXECUTE_PROCESS( 
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    48
	        COMMAND ${CMAKE_COMMAND} 
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    49
                -E copy_directory 
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    50
	        ${SDL_DIR}/jni/${DIR}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    51
	        ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/${DIR}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    52
        	)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    53
         endforeach(DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    54
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    55
	            ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/core/android/SDL_android.cpp
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    56
		    )
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    57
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    58
		    ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/main/android/SDL_android_main.cpp
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    59
		    )
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    60
    else(SDL_DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    61
        MESSAGE("Android port of SDL not moved..")
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    62
    endif(SDL_DIR)
5446
68f261c94a86 Lua source modification revert aded
Xeli
parents: 5442
diff changeset
    63
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    64
    if(LUA_DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    65
        EXECUTE_PROCESS(
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    66
                        ${CMAKE_COMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    67
                        -E copy_directory
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    68
                        ${LUA_DIR}/src
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    69
                        ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/lua-5.1.4
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    70
                       )
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    71
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    72
		    ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/lua-5.1.4/Android.mk
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    73
		    )
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    74
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    75
		    ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/lua-5.1.4/llex.c
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    76
		    )
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    77
        MESSAGE("Lua has been moved.")
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    78
    else(LUA_DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    79
        MESSAGE("Lua hasn't been moved..")
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    80
    endif(LUA_DIR)
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    81
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    82
else(ANDROID_AND AND ANDROID_SDK AND FPC_DIR)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    83
    MESSAGE("Android port files not created, edit top of ${CMAKE_CURRENT_SOURCE_DIR}/CMakeList.txt to created android specific files")
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    84
endif(ANDROID_NDK AND ANDROID_SDK AND FPC_DIR)
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    85
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    86