author | koda |
Sun, 11 Nov 2012 19:11:47 +0100 | |
branch | webgl |
changeset 8035 | 68ec3138c16d |
parent 8029 | 7ba43d7e54e7 |
child 8038 | 625b628d55f3 |
permissions | -rw-r--r-- |
8004 | 1 |
|
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
2 |
#only Clang is supported |
8004 | 3 |
if(CLANG) |
4 |
set(clang_executable ${CLANG}) |
|
5 |
else() |
|
8023 | 6 |
find_program(clang_executable |
7 |
NAMES clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang |
|
8 |
PATHS /opt/local/bin /usr/local/bin /usr/bin) |
|
8004 | 9 |
endif() |
10 |
||
11 |
if (clang_executable) |
|
12 |
exec_program(${clang_executable} ARGS "-v" OUTPUT_VARIABLE clang_version_full) |
|
13 |
string(REGEX MATCH "[0-9]+\\.[0-9]+" clang_version_long "${clang_version_full}") |
|
14 |
string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" clang_version "${clang_version_long}") |
|
8008 | 15 |
#TODO: check version >= 3.0 |
8004 | 16 |
message(STATUS "Found CLANG: ${clang_executable} (version ${clang_version})") |
17 |
else() |
|
18 |
message(FATAL_ERROR "No LLVM/Clang compiler found (required for engine_c target)") |
|
19 |
endif() |
|
20 |
||
8006 | 21 |
set(CMAKE_C_COMPILER ${clang_executable}) |
22 |
||
8004 | 23 |
|
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
24 |
#the usual set of dependencies |
8029 | 25 |
find_package(OPENGL REQUIRED) |
8004 | 26 |
find_package(GLEW REQUIRED) |
8029 | 27 |
find_package(SDL REQUIRED) |
28 |
find_package(SDL_mixer REQUIRED) |
|
29 |
find_package(SDL_net REQUIRED) |
|
30 |
find_package(SDL_image REQUIRED) |
|
31 |
find_package(SDL_ttf REQUIRED) |
|
8004 | 32 |
|
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
33 |
#compile our rtl implementation |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
34 |
include_directories("${GLEW_INCLUDE_PATH}") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
35 |
include_directories(rtl) |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
36 |
add_subdirectory(rtl) |
7999 | 37 |
|
38 |
||
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
39 |
configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
40 |
|
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
41 |
#get the list of pas files that are going to be converted and compiled |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
42 |
file(GLOB engine_sources_pas "${hedgewars_SOURCE_DIR}/hedgewars/*.pas") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
43 |
#TODO: temporary until cmake can configure itself accordingly |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
44 |
list(REMOVE_ITEM engine_sources_pas "${hedgewars_SOURCE_DIR}/hedgewars/uWeb.pas") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
45 |
list(REMOVE_ITEM engine_sources_pas "${hedgewars_SOURCE_DIR}/hedgewars/uVideoRec.pas") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
46 |
list(REMOVE_ITEM engine_sources_pas "${hedgewars_SOURCE_DIR}/hedgewars/uTouch.pas") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
47 |
list(REMOVE_ITEM engine_sources_pas "${hedgewars_SOURCE_DIR}/hedgewars/PNGh.pas") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
48 |
list(REMOVE_ITEM engine_sources_pas "${hedgewars_SOURCE_DIR}/hedgewars/pas2cSystem.pas") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
49 |
list(REMOVE_ITEM engine_sources_pas "${hedgewars_SOURCE_DIR}/hedgewars/pas2cRedo.pas") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
50 |
list(REMOVE_ITEM engine_sources_pas "${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas") |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
51 |
|
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
52 |
foreach(sourcefile ${engine_sources_pas}) |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
53 |
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
|
54 |
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
|
55 |
endforeach() |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
56 |
|
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
57 |
#invoke pas2c on our pas files |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
58 |
add_custom_command(OUTPUT ${engine_sources} |
7999 | 59 |
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
|
60 |
ARGS -n "hwengine" |
8006 | 61 |
-i "${hedgewars_SOURCE_DIR}/hedgewars" |
62 |
-o "${CMAKE_CURRENT_BINARY_DIR}" |
|
63 |
-a "${CMAKE_CURRENT_BINARY_DIR}" |
|
7999 | 64 |
DEPENDS pas2c |
8006 | 65 |
) |
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
66 |
add_custom_target(engine_c DEPENDS ${engine_sources}) |
7999 | 67 |
|
8006 | 68 |
|
8035
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
69 |
#compile the c files |
68ec3138c16d
comments and runtime list of files to convert and compile
koda
parents:
8029
diff
changeset
|
70 |
add_executable(hwengine WIN32 ${engine_sources}) |
8029 | 71 |
|
72 |
target_link_libraries(hwengine fpcrtl |
|
73 |
${LUA_LIBRARY} |
|
74 |
${OPENGL_LIBRARY} |
|
75 |
${SDL_LIBRARY} |
|
76 |
${SDLMIXER_LIBRARY} |
|
77 |
${SDLNET_LIBRARY} |
|
78 |
${SDLIMAGE_LIBRARY} |
|
79 |
${SDLTTF_LIBRARY} |
|
80 |
) |
|
81 |