project_files/Android-build/CMakeLists.txt
author Xeli
Mon, 22 Aug 2011 03:57:11 +0200
branchhedgeroid
changeset 5647 28ab6763da9d
parent 5621 ea796c83ea47
child 6039 d75329716a02
permissions -rw-r--r--
tiny tweak in how lua is moved + added two reverts
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5621
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     1
###################################################################################
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     2
# Hedgewars, a free turn based strategy game
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     3
# Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     4
#
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     5
# This program is free software; you can redistribute it and/or modify
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     6
# it under the terms of the GNU General Public License as published by
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     7
# the Free Software Foundation; version 2 of the License
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     8
#
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
     9
# This program is distributed in the hope that it will be useful,
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    12
# GNU General Public License for more details.
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    13
#
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    14
# You should have received a copy of the GNU General Public License
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    15
# along with this program; if not, write to the Free Software
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    16
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    17
###################################################################################
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    18
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    19
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    20
ea796c83ea47 added licenses
Xeli
parents: 5448
diff changeset
    21
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    22
###################################################################################
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    23
# 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
    24
# 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
    25
# rather than ~/SoftDev).
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    26
# 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
    27
# from the hedgewars root directory
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    28
# 
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    29
# 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
    30
# the correct place
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    31
##################################################################################
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    32
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    33
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
    34
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
    35
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
    36
set(SDL_DIR /home/richard/Downloads/android-project)
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    37
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
    38
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    39
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
    40
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    41
    set(ANDROID_SDK_API_LVL 8)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    42
    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
    43
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    44
    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
    45
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    46
    configure_file(Templates/complete_build.sh .)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    47
    configure_file(Templates/default.properties SDL-android-project/)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    48
    configure_file(Templates/local.properties SDL-android-project/)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    49
    configure_file(Templates/Makefile.android .)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    50
    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
    51
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    52
    if(SDL_DIR)
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    53
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    54
        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
    55
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    56
        set(DirsToCopy
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    57
            SDL
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    58
	    SDL_image
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    59
            SDL_mixer
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    60
            SDL_ttf
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    61
	    jpeg
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    62
	    png
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    63
            mikmod
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    64
            tremor
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    65
            freetype
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    66
           ) 
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    67
         foreach(DIR ${DirsToCopy})
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    68
             exec_program( 
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    69
	        ${CMAKE_COMMAND} 
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    70
                ARGS -E copy_directory 
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    71
	        ${SDL_DIR}/jni/${DIR}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    72
	        ${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
    73
        	)
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    74
             MESSAGE("Moved ${DIR}")
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    75
         endforeach(DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    76
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    77
	            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
    78
		    )
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    79
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    80
		    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
    81
		    )
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    82
        exec_program(${HGCOMMAND}
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    83
		    ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/video/android/SDL_androidtouch.c
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    84
		    )
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    85
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    86
        exec_program(${HGCOMMAND}
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    87
		    ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/video/android/SDL_androidtouch.h
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    88
		    )
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    89
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    90
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    91
    else(SDL_DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    92
        MESSAGE("Android port of SDL not moved..")
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    93
    endif(SDL_DIR)
5446
68f261c94a86 Lua source modification revert aded
Xeli
parents: 5442
diff changeset
    94
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    95
 
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    96
    if(LUA_DIR)
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    97
        MESSAGE("Moving Lua dir..") 
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    98
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    99
        exec_program(
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
   100
                ${CMAKE_COMMAND}
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
   101
                ARGS -E copy_directory
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
   102
                ${LUA_DIR}/src
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
   103
                ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/lua-5.1.4
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
   104
                )
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
   105
        MESSAGE("Lua has been moved.")
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
   106
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
   107
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
   108
		    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
   109
		    )
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
   110
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
   111
		    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
   112
		    )
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
   113
    else(LUA_DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
   114
        MESSAGE("Lua hasn't been moved..")
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
   115
    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
   116
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
   117
else(ANDROID_AND AND ANDROID_SDK AND FPC_DIR)
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
   118
    MESSAGE("Android port files not created, edit top of ${CMAKE_CURRENT_SOURCE_DIR}/CMakeList.txt to create android specific files")
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
   119
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
   120
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
   121