CMakeLists.txt
branchphysfslayer
changeset 8544 d610e692e2f6
parent 8540 cf808329bb6f
child 8549 af104e59ea8e
equal deleted inserted replaced
8542:dc511bf91aa0 8544:d610e692e2f6
   265     #linking with liblua.a requires system readline
   265     #linking with liblua.a requires system readline
   266     list(APPEND pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline")
   266     list(APPEND pascal_flags "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a" "-k-lreadline")
   267 endif()
   267 endif()
   268 
   268 
   269 
   269 
   270 #physfs library and its layer
   270 #physfs discovery
   271 if(NOT DEFINED PHYSFS_BUNDLE)
   271 set(PHYSFS_FOUND false)
       
   272 if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
   272     find_package(PhysFS)
   273     find_package(PhysFS)
   273 endif()
   274 endif()
   274 if(NOT PHYSFS_FOUND)
   275 
       
   276 #if they bundled one is discovered
       
   277 set(physfs_output_name "hw_physfs")
       
   278 get_filename_component(physfs_detected_name ${PHYSFS_LIBRARY} NAME_WE)
       
   279 #or if the found one is too old
       
   280 find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR})
       
   281 if(physfs_h)
       
   282     file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+")
       
   283     file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+")
       
   284     file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+")
       
   285     string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}")
       
   286     string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}")
       
   287     string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}")
       
   288     set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}")
       
   289     if(physfs_detected_ver VERSION_LESS "2.1.0")
       
   290         message(STATUS "PhysFS version is too old (dected ${physfs_detected_ver}, required 2.1.0)")
       
   291         set(physfs_too_old true)
       
   292     endif()
       
   293 endif()
       
   294 
       
   295 if(NOT ${PHYSFS_FOUND} OR physfs_too_old OR
       
   296    (${physfs_detected_name} MATCHES ${physfs_output_name}))
   275     message(STATUS "PhysFS will be provided by the bundled sources")
   297     message(STATUS "PhysFS will be provided by the bundled sources")
   276     set(physfs_output_name "hw_physfs")
       
   277     add_subdirectory(misc/libphysfs)
   298     add_subdirectory(misc/libphysfs)
       
   299     #-XLA is a 'beta' fpc flag that will rename libraries before passing them to the linker
   278     list(APPEND pascal_flags "-XLAphysfs=${physfs_output_name}")
   300     list(APPEND pascal_flags "-XLAphysfs=${physfs_output_name}")
   279 endif()
   301 endif()
   280 add_subdirectory(misc/libphyslayer)
   302 add_subdirectory(misc/libphyslayer)
   281 
   303 
   282 #main engine
   304 #main engine