hedgewars/CMakeLists.txt
changeset 8312 9e8781faabab
parent 8311 bc18481dca8b
child 8314 7faceaca67d4
equal deleted inserted replaced
8311:bc18481dca8b 8312:9e8781faabab
     7 include(${CMAKE_SOURCE_DIR}/cmake_modules/FindSDL_Extras.cmake)
     7 include(${CMAKE_SOURCE_DIR}/cmake_modules/FindSDL_Extras.cmake)
     8 
     8 
     9 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
     9 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
    10 
    10 
    11 #SOURCE AND PROGRAMS SECTION
    11 #SOURCE AND PROGRAMS SECTION
    12 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
    12 if(${BUILD_ENGINE_LIBRARY})
    13 set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}")
    13     set(engine_output_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwLibrary${CMAKE_SHARED_LIBRARY_SUFFIX}")
       
    14     set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas)
       
    15 else()
       
    16     set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}")
       
    17     set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
       
    18 endif()
    14 
    19 
    15 if (APPLE)
    20 if (APPLE)
    16     set(required_fpc_version 2.6)
    21     set(required_fpc_version 2.6)
    17 else()
    22 else()
    18     set(required_fpc_version 2.2)
    23     set(required_fpc_version 2.2)
    85     ${CMAKE_CURRENT_BINARY_DIR}/config.inc
    90     ${CMAKE_CURRENT_BINARY_DIR}/config.inc
    86     )
    91     )
    87 
    92 
    88 if(BUILD_ENGINE_LIBRARY)
    93 if(BUILD_ENGINE_LIBRARY)
    89     message(WARNING "Engine will be built as library (experimental)")
    94     message(WARNING "Engine will be built as library (experimental)")
    90     set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas)
       
    91     set(pascal_flags "-dHWLIBRARY" ${pascal_flags})
    95     set(pascal_flags "-dHWLIBRARY" ${pascal_flags})
    92 
    96 
    93     # create position independent code, only required for x68_64 builds, similar to -fPIC
    97     # create position independent code, only required for x68_64 builds, similar to -fPIC
    94     if(CMAKE_SIZEOF_VOID_P MATCHES "8")
    98     if(CMAKE_SIZEOF_VOID_P MATCHES "8")
    95         set(pascal_flags "-Cg" ${pascal_flags})
    99         set(pascal_flags "-Cg" ${pascal_flags})
    97 
   101 
    98     # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
   102     # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
    99     if(APPLE AND current_macosx_version VERSION_GREATER "10.5")
   103     if(APPLE AND current_macosx_version VERSION_GREATER "10.5")
   100         set(pascal_flags "-k-no_order_inits" ${pascal_flags})
   104         set(pascal_flags "-k-no_order_inits" ${pascal_flags})
   101     endif()
   105     endif()
   102 
       
   103     if (WIN32)
       
   104         # windows is silly and takes the name specified in hwLibrary.pas
       
   105         set(engine_output_name "hwLibrary.dll")
       
   106         #set(pascal_flags "-D" "-Dv'${HEDGEWARS_VERSION}'" "-Dd'Hedgewars engine'" ${pascal_flags})
       
   107     elseif (WIN32)
       
   108         if (APPLE)
       
   109             set(engine_output_name "libhwengine.dylib")
       
   110         else (APPLE)
       
   111             set(engine_output_name "libhwengine.so")
       
   112         endif (APPLE)
       
   113     endif (WIN32)
       
   114 
       
   115 endif(BUILD_ENGINE_LIBRARY)
   106 endif(BUILD_ENGINE_LIBRARY)
   116 
   107 
   117 
   108 
   118 # Check Freepascal version
   109 # Check Freepascal version
   119 find_package(Freepascal)
   110 find_package(Freepascal)