project_files/Android-build/CMakeLists.txt
author Xeli
Thu, 14 Jul 2011 16:03:29 +0200
branchhedgeroid
changeset 5442 7c1e5a5f7f34
parent 5408 1c2f0dfbe759
child 5446 68f261c94a86
permissions -rw-r--r--
Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
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)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    16
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    17
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
    18
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    19
set(ANDROID_SDK_API_LVL 8)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    20
set(ANDROID_NDK_API_LVL 5)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    21
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    22
MESSAGE("Creating android scripts and configuration files")
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    23
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    24
configure_file(Templates/complete_build.sh .)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    25
configure_file(Templates/default.properties SDL-android-project/)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    26
configure_file(Templates/local.properties SDL-android-project/)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    27
configure_file(Templates/Makefile.android .)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    28
configure_file(Templates/pushToDevice.sh .)
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    29
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    30
if(SDL_DIR)
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
    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
    33
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    34
    set(DirsToCopy
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    35
        SDL
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    36
	SDL_image
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    37
	SDL_mixer
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    38
	SDL_ttf
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    39
	jpeg
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    40
	png
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    41
	mikmod
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    42
	tremor
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    43
	freetype
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    44
    )
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    45
    foreach(DIR ${DirsToCopy})
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    46
        EXECUTE_PROCESS( 
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    47
	    COMMAND ${CMAKE_COMMAND} 
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    48
	    -E copy_directory 
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    49
	    ${SDL_DIR}/jni/${DIR}
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    50
	    ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/${DIR}
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    51
	)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    52
    endforeach(DIR)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    53
    exec_program(${HGCOMMAND}
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    54
		ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/core/android/SDL_android.cpp
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    55
		)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    56
    exec_program(${HGCOMMAND}
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    57
		ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/main/android/SDL_android_main.cpp
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    58
		)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    59
else(SDL_DIR)
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    60
   MESSAGE("Android port of SDL not moved..")
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    61
endif(SDL_DIR)
5381
8f95038f3f75 Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
Xeli
parents:
diff changeset
    62
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    63
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
    64
    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
    65
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
    66
5442
7c1e5a5f7f34 Greatly simplifies the buildenvironment plus makes cmake a bit more vocal
Xeli
parents: 5408
diff changeset
    67