CMakeLists.txt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #FuzzyLite uses MSVC pragmas in headers, so, we need to disable -Wunknown-pragmas
  10. if(MINGW)
  11. add_compile_options(-Wno-unknown-pragmas)
  12. endif()
  13. if(NOT FORCE_BUNDLED_FL)
  14. find_package(fuzzylite)
  15. else()
  16. set(fuzzylite_FOUND FALSE)
  17. endif()
  18. if(TARGET fuzzylite::fuzzylite AND MSVC)
  19. install_vcpkg_imported_tgt(fuzzylite::fuzzylite)
  20. endif()
  21. if(NOT fuzzylite_FOUND)
  22. set(FL_BUILD_BINARY OFF CACHE BOOL "")
  23. set(FL_BUILD_SHARED OFF CACHE BOOL "")
  24. set(FL_BUILD_TESTS OFF CACHE BOOL "")
  25. if(ANDROID)
  26. set(FL_BACKTRACE OFF CACHE BOOL "" FORCE)
  27. endif()
  28. #It is for compiling FuzzyLite, it will not compile without it on GCC
  29. if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
  30. add_compile_options(-Wno-error=deprecated-declarations)
  31. endif()
  32. add_subdirectory(FuzzyLite/fuzzylite EXCLUDE_FROM_ALL)
  33. set_property(TARGET fl-static PROPERTY CXX_STANDARD 14) # doesn't compile under 17 due to using removed symbol(s)
  34. add_library(fuzzylite::fuzzylite ALIAS fl-static)
  35. target_include_directories(fl-static PUBLIC ${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite/fuzzylite)
  36. endif()
  37. #######################################
  38. # Add subdirectories #
  39. #######################################
  40. add_subdirectory(BattleAI)
  41. add_subdirectory(VCAI)
  42. add_subdirectory(StupidAI)
  43. add_subdirectory(EmptyAI)
  44. if(ENABLE_NULLKILLER_AI)
  45. add_subdirectory(Nullkiller)
  46. endif()