CMakeLists.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #######################################
  2. # FuzzyLite support #
  3. #######################################
  4. if(NOT WIN32 AND NOT APPLE)
  5. option(FORCE_BUNDLED_FL "Force to use FuzzyLite included into VCMI's source tree" ON)
  6. else()
  7. option(FORCE_BUNDLED_FL "Force to use FuzzyLite included into VCMI's source tree" OFF)
  8. endif()
  9. if(TBB_FOUND AND MSVC)
  10. install_vcpkg_imported_tgt(TBB::tbb)
  11. endif()
  12. #FuzzyLite uses MSVC pragmas in headers, so, we need to disable -Wunknown-pragmas
  13. if(MINGW)
  14. add_compile_options(-Wno-unknown-pragmas)
  15. endif()
  16. if(NOT FORCE_BUNDLED_FL)
  17. find_package(fuzzylite)
  18. else()
  19. set(fuzzylite_FOUND FALSE)
  20. endif()
  21. if(TARGET fuzzylite::fuzzylite AND MSVC)
  22. install_vcpkg_imported_tgt(fuzzylite::fuzzylite)
  23. endif()
  24. if(NOT fuzzylite_FOUND)
  25. set(FL_BUILD_BINARY OFF CACHE BOOL "")
  26. set(FL_BUILD_SHARED OFF CACHE BOOL "")
  27. set(FL_BUILD_TESTS OFF CACHE BOOL "")
  28. if(ANDROID)
  29. set(FL_BACKTRACE OFF CACHE BOOL "" FORCE)
  30. endif()
  31. #It is for compiling FuzzyLite, it will not compile without it on GCC
  32. if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
  33. add_compile_options(-Wno-error=deprecated-declarations)
  34. endif()
  35. add_subdirectory(FuzzyLite/fuzzylite EXCLUDE_FROM_ALL)
  36. add_library(fuzzylite::fuzzylite ALIAS fl-static)
  37. target_include_directories(fl-static PUBLIC ${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite/fuzzylite)
  38. endif()
  39. #######################################
  40. # Add subdirectories #
  41. #######################################
  42. add_subdirectory(BattleAI)
  43. add_subdirectory(VCAI)
  44. if(NOT ANDROID)
  45. add_subdirectory(StupidAI)
  46. add_subdirectory(EmptyAI)
  47. endif()
  48. if(ENABLE_NULLKILLER_AI)
  49. add_subdirectory(Nullkiller)
  50. endif()