hedgewars/CMakeLists.txt
changeset 4930 5d59bb58c365
parent 4928 6ebbca960503
child 5019 e38d1720a0ff
equal deleted inserted replaced
4929:3dca560e6510 4930:5d59bb58c365
    32 endif()
    32 endif()
    33 
    33 
    34 #SOURCE AND PROGRAMS SECTION
    34 #SOURCE AND PROGRAMS SECTION
    35 set(fpc_tryexe fpc)
    35 set(fpc_tryexe fpc)
    36 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
    36 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
       
    37 set(engine_output_name "hwengine")
    37 
    38 
    38 set(engine_sources
    39 set(engine_sources
    39     ${hwengine_project}
    40     ${hwengine_project}
    40     SDLh.pas
    41     SDLh.pas
    41     uAI.pas
    42     uAI.pas
   102 
   103 
   103     # due to compiling/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
   104     # due to compiling/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
   104     if(APPLE AND current_macosx_version MATCHES "10.6")
   105     if(APPLE AND current_macosx_version MATCHES "10.6")
   105         set(pascal_compiler_flags_cmn "-k-no_order_inits" ${pascal_compiler_flags_cmn})
   106         set(pascal_compiler_flags_cmn "-k-no_order_inits" ${pascal_compiler_flags_cmn})
   106     endif(APPLE AND current_macosx_version MATCHES "10.6")
   107     endif(APPLE AND current_macosx_version MATCHES "10.6")
       
   108 
       
   109     if (APPLE)
       
   110         set(engine_output_name "hwengine.dylib")
       
   111     endif (APPLE)
   107 endif(BUILD_ENGINE_LIBRARY)
   112 endif(BUILD_ENGINE_LIBRARY)
   108 
   113 
   109 find_program(fpc_executable ${fpc_tryexe})
   114 find_program(fpc_executable ${fpc_tryexe})
   110 
   115 
   111 if(fpc_executable)
   116 if(fpc_executable)
   159 set(pascal_compiler ${fpc_executable})
   164 set(pascal_compiler ${fpc_executable})
   160 set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project})
   165 set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project})
   161 
   166 
   162 
   167 
   163 #DEPENDECIES AND EXECUTABLES SECTION
   168 #DEPENDECIES AND EXECUTABLES SECTION
   164 IF(NOT APPLE OR BUILD_ENGINE_LIBRARY)
   169 IF(NOT APPLE)
   165     #here is the command for standard executables or for shared library
   170     #here is the command for standard executables or for shared library
   166     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
   171     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"
   167         COMMAND "${pascal_compiler}"
   172         COMMAND "${pascal_compiler}"
   168         ARGS ${pascal_compiler_flags}
   173         ARGS ${pascal_compiler_flags}
   169         MAIN_DEPENDENCY ${hwengine_project}
   174         MAIN_DEPENDENCY ${hwengine_project}
   170         DEPENDS ${engine_sources}
   175         DEPENDS ${engine_sources}
   171         )
   176         )
   189             DEPENDS ${engine_sources} SDLmain lua
   194             DEPENDS ${engine_sources} SDLmain lua
   190             )
   195             )
   191         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
   196         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
   192     endforeach()
   197     endforeach()
   193 
   198 
   194     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine"
   199     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}"
   195         COMMAND "lipo"
   200         COMMAND "lipo"
   196         ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/hwengine
   201         ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}
   197         DEPENDS ${lipo_args_list}
   202         DEPENDS ${lipo_args_list}
   198         )
   203         )
   199 ENDIF()
   204 ENDIF()
   200 
   205 
   201 
   206 
   202 add_custom_target(hwengine ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
   207 add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}")
   203 
   208 
   204 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
   209 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
   205 
   210