project_files/hwc/CMakeLists.txt
branchqmlfrontend
changeset 11704 83c40c1eb0e7
parent 11686 8fca9fd31357
child 11796 3127b0fece81
equal deleted inserted replaced
11639:0af93f018701 11704:83c40c1eb0e7
    55 #add again files for external functions and for fpcrtl_ functions
    55 #add again files for external functions and for fpcrtl_ functions
    56 list(APPEND engine_sources_pas ${CMAKE_SOURCE_DIR}/hedgewars/pas2cSystem.pas)
    56 list(APPEND engine_sources_pas ${CMAKE_SOURCE_DIR}/hedgewars/pas2cSystem.pas)
    57 list(APPEND engine_sources_pas ${CMAKE_SOURCE_DIR}/hedgewars/pas2cRedo.pas)
    57 list(APPEND engine_sources_pas ${CMAKE_SOURCE_DIR}/hedgewars/pas2cRedo.pas)
    58 
    58 
    59 
    59 
       
    60 set(pas2c_args -n hwengine
       
    61                -i ${CMAKE_SOURCE_DIR}/hedgewars
       
    62                -o ${CMAKE_CURRENT_BINARY_DIR}
       
    63                -a ${CMAKE_CURRENT_BINARY_DIR}
       
    64                -d ENDIAN_LITTLE
       
    65                -d DEBUGFILE)
       
    66 if(BUILD_ENGINE_JS)
       
    67     set(pas2c_args ${pas2c_args} -d WEBGL -d HWLIBRARY)
       
    68 endif()
       
    69 
    60 #invoke pas2c on main module, it will call all the others
    70 #invoke pas2c on main module, it will call all the others
    61 add_custom_command(OUTPUT ${engine_sources}
    71 add_custom_command(OUTPUT ${engine_sources}
    62                    COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}"
    72                    COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}"
    63                    ARGS -n "hwengine"
    73                    ARGS ${pas2c_args}
    64                         -i "${CMAKE_SOURCE_DIR}/hedgewars"
       
    65                         -o "${CMAKE_CURRENT_BINARY_DIR}"
       
    66                         -a "${CMAKE_CURRENT_BINARY_DIR}"
       
    67                         -d "ENDIAN_LITTLE"
       
    68                         -d "DEBUGFILE"
       
    69                    DEPENDS pas2c                     #converter tool
    74                    DEPENDS pas2c                     #converter tool
    70                            ${engine_sources_pas}     #original pascal file
    75                            ${engine_sources_pas}     #original pascal file
    71                   )
    76                   )
    72 
    77 
    73 #wrap conversion for all source in this command
    78 #wrap conversion for all source in this command
    74 add_custom_target(engine_c DEPENDS ${engine_sources})
    79 add_custom_target(engine_c DEPENDS ${engine_sources})
    75 
    80 
    76 
    81 
       
    82 if(BUILD_ENGINE_JS)
       
    83     add_flag_append(CMAKE_C_FLAGS "-s ABORTING_MALLOC=0")
       
    84 endif()
       
    85 
    77 #compile the c files
    86 #compile the c files
    78 add_definitions(-DPAS2C)
    87 add_definitions(-DPAS2C)
    79 add_definitions(-Werror=incompatible-pointer-types)
    88 add_definitions(-Werror=incompatible-pointer-types)
    80 
    89 
    81 add_executable(hwengine WIN32 ${engine_sources})
    90 add_executable(hwengine WIN32 ${engine_sources})
       
    91 
       
    92 if(BUILD_ENGINE_JS)
       
    93     set_target_properties(hwengine PROPERTIES SUFFIX ".html")
       
    94 endif()
    82 
    95 
    83 target_link_libraries(hwengine  fpcrtl
    96 target_link_libraries(hwengine  fpcrtl
    84                                 ${LUA_LIBRARY}
    97                                 ${LUA_LIBRARY}
    85                                 ${OPENGL_LIBRARY}
    98                                 ${OPENGL_LIBRARY}
    86                                 ${SDL2_LIBRARY}
    99                                 ${SDL2_LIBRARY}