author | koda |
Tue, 25 Dec 2012 05:15:49 +0100 | |
branch | webgl |
changeset 8332 | 9333216f2054 |
parent 8108 | 39d7a16ce60c |
child 8448 | 14f736ca7eb3 |
permissions | -rw-r--r-- |
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
1 |
#the usual set of dependencies |
8041 | 2 |
find_package(OpenGL REQUIRED) |
8004 | 3 |
find_package(GLEW REQUIRED) |
8029 | 4 |
find_package(SDL REQUIRED) |
5 |
find_package(SDL_mixer REQUIRED) |
|
6 |
find_package(SDL_net REQUIRED) |
|
7 |
find_package(SDL_image REQUIRED) |
|
8 |
find_package(SDL_ttf REQUIRED) |
|
8004 | 9 |
|
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
10 |
#compile our rtl implementation |
8047
25a4daa6473c
cleanup headers, remove -I . from rtl lib to save a few warnings
koda
parents:
8044
diff
changeset
|
11 |
add_subdirectory(rtl) |
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
12 |
include_directories("${GLEW_INCLUDE_PATH}") |
8044 | 13 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/rtl") |
7999 | 14 |
|
8044 | 15 |
configure_file(${CMAKE_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) |
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
16 |
|
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
17 |
#get the list of pas files that are going to be converted and compiled |
8044 | 18 |
file(GLOB engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/*.pas") |
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
19 |
#TODO: temporary until cmake can configure itself accordingly |
8044 | 20 |
list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/uWeb.pas") |
21 |
list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/uVideoRec.pas") |
|
22 |
list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/uTouch.pas") |
|
23 |
list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/PNGh.pas") |
|
24 |
list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/pas2cSystem.pas") |
|
25 |
list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/pas2cRedo.pas") |
|
26 |
list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/hwLibrary.pas") |
|
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
27 |
|
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
28 |
foreach(sourcefile ${engine_sources_pas}) |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
29 |
get_filename_component(sourcename ${sourcefile} NAME_WE) #drops .pas |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
30 |
set(engine_sources "${CMAKE_CURRENT_BINARY_DIR}/${sourcename}.c" ${engine_sources}) |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
31 |
endforeach() |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
32 |
|
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
33 |
#invoke pas2c on our pas files |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
34 |
add_custom_command(OUTPUT ${engine_sources} |
7999 | 35 |
COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}" |
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
36 |
ARGS -n "hwengine" |
8044 | 37 |
-i "${CMAKE_SOURCE_DIR}/hedgewars" |
8006 | 38 |
-o "${CMAKE_CURRENT_BINARY_DIR}" |
39 |
-a "${CMAKE_CURRENT_BINARY_DIR}" |
|
7999 | 40 |
DEPENDS pas2c |
8006 | 41 |
) |
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
42 |
add_custom_target(engine_c DEPENDS ${engine_sources}) |
7999 | 43 |
|
8006 | 44 |
|
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
45 |
#compile the c files |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
46 |
add_executable(hwengine WIN32 ${engine_sources}) |
8029 | 47 |
|
48 |
target_link_libraries(hwengine fpcrtl |
|
49 |
${LUA_LIBRARY} |
|
50 |
${OPENGL_LIBRARY} |
|
51 |
${SDL_LIBRARY} |
|
52 |
${SDLMIXER_LIBRARY} |
|
53 |
${SDLNET_LIBRARY} |
|
54 |
${SDLIMAGE_LIBRARY} |
|
55 |
${SDLTTF_LIBRARY} |
|
8038 | 56 |
#TODO: add other libraries |
8029 | 57 |
) |
58 |
||
8050 | 59 |
#TODO: move this away in its proper findxxx.cmake |
60 |
if(APPLE) |
|
61 |
#let's look for the installed sdlmain file; if it is not found, let's build our own |
|
62 |
find_package(SDL REQUIRED) |
|
63 |
#remove the ";-framework Cocoa" from the SDL_LIBRARY variable |
|
64 |
string(REGEX REPLACE "(.*);-.*" "\\1" sdl_dir "${SDL_LIBRARY}") |
|
65 |
#find libsdmain.a |
|
66 |
find_file(SDLMAIN_LIB libSDLMain.a PATHS ${sdl_dir}/Resources/) |
|
67 |
||
68 |
if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND") |
|
69 |
include_directories(${SDL_INCLUDE_DIR}) |
|
70 |
add_library (SDLmain STATIC ${CMAKE_SOURCE_DIR}/hedgewars/sdlmain_osx/SDLMain.m) |
|
71 |
#add a dependency to the hwengine target |
|
72 |
set(SDLMAIN_LIB "${LIBRARY_OUTPUT_PATH}/libSDLmain.a") |
|
73 |
endif() |
|
74 |
||
75 |
target_link_libraries(hwengine ${SDLMAIN_LIB}) |
|
76 |
endif(APPLE) |
|
77 |
||
78 |
||
8332
9333216f2054
fix hwc install and pas2c preprocessing (but not total conversion)
koda
parents:
8108
diff
changeset
|
79 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_binary_install_dir}) |
8038 | 80 |