33 |
33 |
34 #process files .pas -> .c |
34 #process files .pas -> .c |
35 foreach(sourcefile ${engine_sources_pas}) |
35 foreach(sourcefile ${engine_sources_pas}) |
36 get_filename_component(sourcename ${sourcefile} NAME_WE) #drops .pas |
36 get_filename_component(sourcename ${sourcefile} NAME_WE) #drops .pas |
37 list(APPEND engine_sources "${CMAKE_CURRENT_BINARY_DIR}/${sourcename}.c") |
37 list(APPEND engine_sources "${CMAKE_CURRENT_BINARY_DIR}/${sourcename}.c") |
38 |
|
39 endforeach() |
38 endforeach() |
40 |
39 |
|
40 #add again files for external functions and for fpcrtl_ functions |
|
41 list(APPEND engine_sources_pas ${CMAKE_SOURCE_DIR}/hedgewars/pas2cSystem.pas) |
|
42 list(APPEND engine_sources_pas ${CMAKE_SOURCE_DIR}/hedgewars/pas2cRedo.pas) |
41 |
43 |
42 #invoke pas2c on each pas files |
44 |
43 add_custom_command(OUTPUT ${engine_sources} |
45 #invoke pas2c on main module, it will call all the others |
44 COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}" |
46 add_custom_command(OUTPUT ${engine_sources} |
45 ARGS -n "hwengine" |
47 COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}" |
46 -i "${CMAKE_SOURCE_DIR}/hedgewars" |
48 ARGS -n "hwengine" |
47 -o "${CMAKE_CURRENT_BINARY_DIR}" |
49 -i "${CMAKE_SOURCE_DIR}/hedgewars" |
48 -a "${CMAKE_CURRENT_BINARY_DIR}" |
50 -o "${CMAKE_CURRENT_BINARY_DIR}" |
49 DEPENDS pas2c #converter tool |
51 -a "${CMAKE_CURRENT_BINARY_DIR}" |
50 ${engine_sources_pas} #original pascal file |
52 DEPENDS pas2c #converter tool |
51 ${CMAKE_SOURCE_DIR}/hedgewars/pas2cSystem.pas #special, external functions |
53 ${engine_sources_pas} #original pascal file |
52 ${CMAKE_SOURCE_DIR}/hedgewars/pas2cRedo.pas #special, fpcrtl_ functions |
54 ) |
53 ) |
|
54 |
55 |
55 #wrap conversion for all source in this command |
56 #wrap conversion for all source in this command |
56 add_custom_target(engine_c DEPENDS ${engine_sources}) |
57 add_custom_target(engine_c DEPENDS ${engine_sources}) |
57 |
58 |
58 |
59 |