project_files/Android-build/CMakeLists.txt
author Xeli
Sat, 08 Oct 2011 14:55:13 +0200
branchhedgeroid
changeset 6039 d75329716a02
parent 5647 28ab6763da9d
child 6230 de1e43054017
permissions -rw-r--r--
Removed the need for duplicate libraries, the android build now uses lua, freetype and tremor from misc/
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)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    37
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    38
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
    39
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    40
    set(ANDROID_SDK_API_LVL 8)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    41
    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
    42
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    43
    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
    44
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    45
    configure_file(Templates/complete_build.sh .)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    46
    configure_file(Templates/default.properties SDL-android-project/)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    47
    configure_file(Templates/local.properties SDL-android-project/)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    48
    configure_file(Templates/Makefile.android .)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    49
    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
    50
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    51
    if(SDL_DIR)
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    52
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    53
        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
    54
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    55
        set(DirsToCopy
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    56
            SDL
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    57
	    SDL_image
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    58
            SDL_mixer
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    59
            SDL_ttf
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    60
	    jpeg
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    61
	    png
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    62
            mikmod
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    63
           ) 
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    64
         foreach(DIR ${DirsToCopy})
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    65
             exec_program( 
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    66
	        ${CMAKE_COMMAND} 
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    67
                ARGS -E copy_directory 
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    68
	        ${SDL_DIR}/jni/${DIR}
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/${DIR}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    70
        	)
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    71
             MESSAGE("Moved ${DIR}")
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    72
         endforeach(DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    73
        exec_program(${HGCOMMAND}
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    74
	            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
    75
		    )
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/main/android/SDL_android_main.cpp
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    78
		    )
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    79
        exec_program(${HGCOMMAND}
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    80
		    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
    81
		    )
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    82
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    83
        exec_program(${HGCOMMAND}
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    84
		    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
    85
		    )
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    86
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    87
5448
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    88
    else(SDL_DIR)
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    89
        MESSAGE("Android port of SDL not moved..")
787cf66a7c39 CMake now moves the proper lua files to the project
Xeli
parents: 5446
diff changeset
    90
    endif(SDL_DIR)
5446
68f261c94a86 Lua source modification revert aded
Xeli
parents: 5442
diff changeset
    91
5647
28ab6763da9d tiny tweak in how lua is moved + added two reverts
Xeli
parents: 5621
diff changeset
    92
 
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    93
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
    94
    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
    95
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
    96
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    97