#   Copyright 2002-2020 CEA LIST
#
#   This file is part of LIMA.
#
#   LIMA is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   LIMA is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with LIMA.  If not, see <http://www.gnu.org/licenses/>
project(LimaLinguisticData)

cmake_minimum_required(VERSION 3.4.0)

if (ENVPATH)
  set(ENV{PATH} "${ENVPATH}:$ENV{PATH}")
endif()
if (ENVPERL5LIB)
  set(ENV{PERL5LIB} "${ENVPERL5LIB}:$ENV{PERL5LIB}")
endif()
message("lima_linguisticdata PERL5LIB=$ENV{PERL5LIB}")
message("lima_linguisticdata PATH=$ENV{PATH}")

# message("CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
# set(CMAKE_VERBOSE_MAKEFILE on)

#cmake_policy
# if(POLICY CMP0046)
# cmake_policy(SET CMP0046 OLD)
# endif()

enable_testing()

include(Languages.cmake)
include(cmake/LinguisticData.cmake)
# include(${CMAKE_SOURCE_DIR}/../SystemSpecificInformations.cmake)
# for add_component macro (require 2.8.5)
include(CPackComponent)

configure_file(LIMALDATAConfig-src.cmake LIMALDATAConfig.cmake @ONLY)

LIMA_GENERIC_CONFIGENV(eng)
# LIMA_GENERIC_CONFIGENV(eng.ud)
LIMA_GENERIC_CONFIGENV(fre)
# LIMA_GENERIC_CONFIGENV_UD(fre.ud)
LIMA_GENERIC_CONFIGENV(por)

add_custom_target(pretest-execEnv)

add_subdirectory(cmake)
add_subdirectory(scratch)
add_subdirectory(analysisDictionary)
add_subdirectory(disambiguisationMatrices)
add_subdirectory(rules-idiom)
add_subdirectory(SpecificEntities)
add_subdirectory(syntacticAnalysis)
add_subdirectory(SRLIntegration)

LIMA_PRETEST_CONFIGENV(eng)
# LIMA_PRETEST_CONFIGENV(eng.ud)
LIMA_PRETEST_CONFIGENV(fre)
#LIMA_PRETEST_CONFIGENV(fre.ud)
LIMA_PRETEST_CONFIGENV(por)

########### install files ###############
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LIMALDATAConfig.cmake DESTINATION share/apps/lima/cmake/Modules COMPONENT devel)

