1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix AI and VCAI CMakeLists.txt

This commit is contained in:
Mikhail Paulyshka 2014-11-02 23:43:10 +03:00
parent a867faae1e
commit 941dcee0f5
3 changed files with 69 additions and 18 deletions

View File

@ -1,18 +1,14 @@
project(AI)
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
find_path(FUZZYLITE_INCLUDE_PATH NAMES fl/fuzzylite.h)
find_library(FUZZYLITE_LIB NAMES fuzzylite PATH_SUFFIXES dynamic)
mark_as_advanced(FUZZYLITE_INCLUDE_PATH FUZZYLITE_LIB)
find_package(Fuzzylite)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FUZZYLITE FUZZYLITE_INCLUDE_PATH FUZZYLITE_LIB)
if (FUZZYLITE_FOUND)
set (FUZZYLITE_LIBRARIES ${FUZZYLITE_LIB})
set (FUZZYLITE_INCLUDE_DIR ${FUZZYLITE_INCLUDE_PATH})
endif()
if (NOT FUZZYLITE_FOUND)
if (NOT FL_FOUND)
set(FL_BUILD_BINARY OFF CACHE BOOL "")
set(FL_BUILD_SHARED OFF CACHE BOOL "")
if(NOT MSVC)
set(FL_CPP11 ON CACHE BOOL "")
endif()
add_subdirectory(FuzzyLite/fuzzylite)
endif()
add_subdirectory(BattleAI)

View File

@ -1,10 +1,8 @@
project(VCAI)
cmake_minimum_required(VERSION 2.6)
add_definitions(-DFL_CPP11) #TODO: Find a better way to set this macro for fuzzylite
if (FUZZYLITE_FOUND)
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${FUZZYLITE_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${FL_INCLUDE_DIRS})
else()
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite/fuzzylite)
endif()
@ -19,8 +17,8 @@ set(VCAI_SRCS
)
add_library(VCAI SHARED ${VCAI_SRCS})
if (FUZZYLITE_FOUND)
target_link_libraries(VCAI ${FUZZYLITE_LIBRARIES} vcmi)
if (FL_FOUND)
target_link_libraries(VCAI ${FL_LIBRARIES} vcmi)
else()
target_link_libraries(VCAI fl-static vcmi)
endif()

View File

@ -0,0 +1,57 @@
#.rst:
# FindFuzzylite
# --------
#
# Locate Fuzzylite library
#
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
# Copyright 2014 Mikhail Paulyshka
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file kitware license.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(FL_INCLUDE_DIR
fl/fuzzylite.h
HINTS
ENV FLDIR
PATH_SUFFIXES
fl
include/fl
include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()
find_library(FL_LIBRARY
NAMES
fuzzylite
HINTS
ENV FLDIR
PATH_SUFFIXES
dynamic
lib
${VC_LIB_PATH_SUFFIX}
)
set(FL_LIBRARIES ${FL_LIBRARY})
set(FL_INCLUDE_DIRS ${FL_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FL
REQUIRED_VARS FL_LIBRARIES FL_INCLUDE_DIRS)
mark_as_advanced(FL_LIBRARY FL_INCLUDE_DIR)