forked from github/server
use vcpkg packages on windows
make cmake files smarter
This commit is contained in:
parent
117edad7e4
commit
70ccef02ae
8 changed files with 17 additions and 185 deletions
|
@ -36,24 +36,14 @@ CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
|
|||
endif (HAVE_LIBBSD)
|
||||
endif (MSVC)
|
||||
|
||||
find_package (Readline)
|
||||
|
||||
if (ERESSEA_DB STREQUAL "db")
|
||||
find_package (BerkeleyDB REQUIRED QUIET)
|
||||
else()
|
||||
find_package (SQLite3 REQUIRED QUIET)
|
||||
endif()
|
||||
find_package (SQLite3 REQUIRED)
|
||||
|
||||
find_package(EXPAT REQUIRED)
|
||||
find_package (ToLua REQUIRED)
|
||||
if (TOLUA_FOUND)
|
||||
if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.3")
|
||||
find_package (Lua 5.3 REQUIRED)
|
||||
elseif (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2")
|
||||
if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2")
|
||||
find_package (Lua 5.2 REQUIRED)
|
||||
elseif (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.3")
|
||||
find_package ( Lua 5.3 REQUIRED)
|
||||
else ()
|
||||
else()
|
||||
find_package (Lua51 REQUIRED)
|
||||
endif()
|
||||
endif(TOLUA_FOUND)
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
# - Find BerkeleyDB
|
||||
# Find the BerkeleyDB includes and library
|
||||
# This module defines
|
||||
# DB_INCLUDE_DIR, where to find db.h, etc.
|
||||
# DB_LIBRARIES, the libraries needed to use BerkeleyDB.
|
||||
# DB_FOUND, If false, do not try to use BerkeleyDB.
|
||||
# also defined, but not for general use are
|
||||
# DB_LIBRARY, where to find the BerkeleyDB library.
|
||||
|
||||
FIND_PATH(DB_INCLUDE_DIR db.h
|
||||
/usr/local/include/db4
|
||||
/usr/local/include
|
||||
/usr/include/db4
|
||||
/usr/include
|
||||
)
|
||||
|
||||
SET(DB_NAMES ${DB_NAMES} db)
|
||||
FIND_LIBRARY(DB_LIBRARY
|
||||
NAMES ${DB_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
|
||||
IF (DB_LIBRARY AND DB_INCLUDE_DIR)
|
||||
SET(DB_LIBRARIES ${DB_LIBRARY})
|
||||
SET(DB_FOUND "YES")
|
||||
ELSE (DB_LIBRARY AND DB_INCLUDE_DIR)
|
||||
SET(DB_FOUND "NO")
|
||||
ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR)
|
||||
|
||||
|
||||
IF (DB_FOUND)
|
||||
IF (NOT DB_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found BerkeleyDB: ${DB_LIBRARIES}")
|
||||
ENDIF (NOT DB_FIND_QUIETLY)
|
||||
ELSE (DB_FOUND)
|
||||
IF (DB_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find BerkeleyDB library")
|
||||
ENDIF (DB_FIND_REQUIRED)
|
||||
ENDIF (DB_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
DB_LIBRARY
|
||||
DB_INCLUDE_DIR
|
||||
)
|
|
@ -1,47 +0,0 @@
|
|||
# - Try to find readline include dirs and libraries
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# find_package(Readline)
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour and need
|
||||
# to be set before calling find_package:
|
||||
#
|
||||
# READLINE_ROOT_DIR Set this variable to the root installation of
|
||||
# readline if the module has problems finding the
|
||||
# proper installation path.
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# READLINE_FOUND System has readline, include and lib dirs found
|
||||
# READLINE_INCLUDE_DIR The readline include directories.
|
||||
# READLINE_LIBRARY The readline library.
|
||||
|
||||
find_path(READLINE_ROOT_DIR
|
||||
NAMES include/readline/readline.h
|
||||
)
|
||||
|
||||
find_path(READLINE_INCLUDE_DIR
|
||||
NAMES readline/readline.h
|
||||
HINTS ${READLINE_ROOT_DIR}/include
|
||||
)
|
||||
|
||||
find_library(READLINE_LIBRARY
|
||||
NAMES readline
|
||||
HINTS ${READLINE_ROOT_DIR}/lib
|
||||
)
|
||||
|
||||
if(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND Ncurses_LIBRARY)
|
||||
set(READLINE_FOUND TRUE)
|
||||
else(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND Ncurses_LIBRARY)
|
||||
FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY )
|
||||
MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY)
|
||||
endif(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND Ncurses_LIBRARY)
|
||||
|
||||
mark_as_advanced(
|
||||
READLINE_ROOT_DIR
|
||||
READLINE_INCLUDE_DIR
|
||||
READLINE_LIBRARY
|
||||
)
|
|
@ -1,63 +0,0 @@
|
|||
# - Try to find the SQLite3 library
|
||||
# Once done this will define
|
||||
#
|
||||
# SQLITE3_FOUND - System has SQLite3
|
||||
# SQLITE3_INCLUDE_DIR - The SQLite3 include directory
|
||||
# SQLITE3_LIBRARIES - The libraries needed to use SQLite3
|
||||
# SQLITE3_DEFINITIONS - Compiler switches required for using SQLite3
|
||||
# SQLITE3_EXECUTABLE - The SQLite3 command line shell
|
||||
# SQLITE3_VERSION_STRING - the version of SQLite3 found (since CMake 2.8.8)
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2006-2009 Kitware, Inc.
|
||||
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.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.)
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the find_path() and find_library() calls
|
||||
find_package(PkgConfig QUIET)
|
||||
PKG_CHECK_MODULES(PC_SQLITE QUIET sqlite3)
|
||||
set(SQLITE3_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER})
|
||||
|
||||
find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h
|
||||
HINTS
|
||||
${PC_SQLITE_INCLUDEDIR}
|
||||
${PC_SQLITE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(SQLITE3_LIBRARIES NAMES sqlite3
|
||||
HINTS
|
||||
${PC_SQLITE_LIBDIR}
|
||||
${PC_SQLITE_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
find_program(SQLITE3_EXECUTABLE sqlite3)
|
||||
|
||||
if(PC_SQLITE_VERSION)
|
||||
set(SQLITE3_VERSION_STRING ${PC_SQLITE_VERSION})
|
||||
elseif(SQLITE3_INCLUDE_DIR AND EXISTS "${SQLITE3_INCLUDE_DIR}/sqlite3.h")
|
||||
file(STRINGS "${SQLITE3_INCLUDE_DIR}/sqlite3.h" sqlite3_version_str
|
||||
REGEX "^#define[\t ]+SQLITE_VERSION[\t ]+\".*\"")
|
||||
|
||||
string(REGEX REPLACE "^#define[\t ]+SQLITE_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
|
||||
SQLITE3_VERSION_STRING "${sqlite3_version_str}")
|
||||
unset(sqlite3_version_str)
|
||||
endif()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set SQLITE3_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLite3
|
||||
REQUIRED_VARS SQLITE3_LIBRARIES SQLITE3_INCLUDE_DIR
|
||||
VERSION_VAR SQLITE3_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARIES SQLITE3_EXECUTABLE)
|
|
@ -301,32 +301,32 @@ if (HAVE_LIBBSD)
|
|||
target_link_libraries(parser bsd)
|
||||
endif (HAVE_LIBBSD)
|
||||
|
||||
if (SQLITE3_FOUND)
|
||||
include_directories (${SQLITE3_INCLUDE_DIR})
|
||||
target_link_libraries(eressea ${SQLITE3_LIBRARIES})
|
||||
target_link_libraries(test_eressea ${SQLITE3_LIBRARIES})
|
||||
if (SQLite3_FOUND)
|
||||
target_include_directories (game PRIVATE ${SQLite3_INCLUDE_DIRS})
|
||||
target_link_libraries(eressea ${SQLite3_LIBRARIES})
|
||||
target_link_libraries(test_eressea ${SQLite3_LIBRARIES})
|
||||
add_definitions(-DUSE_SQLITE)
|
||||
elseif (DB_FOUND)
|
||||
include_directories (${DB_INCLUDE_DIR})
|
||||
#include_directories (${DB_INCLUDE_DIR})
|
||||
target_link_libraries(eressea ${DB_LIBRARIES})
|
||||
target_link_libraries(test_eressea ${DB_LIBRARIES})
|
||||
add_definitions(-DUSE_DB)
|
||||
endif(SQLITE3_FOUND)
|
||||
endif(SQLite3_FOUND)
|
||||
|
||||
if (READLINE_FOUND)
|
||||
include_directories (${READLINE_INCLUDE_DIR})
|
||||
#include_directories (${READLINE_INCLUDE_DIR})
|
||||
target_link_libraries(eressea ${READLINE_LIBRARY})
|
||||
add_definitions(-DUSE_READLINE)
|
||||
endif (READLINE_FOUND)
|
||||
|
||||
if (CURSES_FOUND)
|
||||
include_directories (${CURSES_INCLUDE_DIR})
|
||||
target_include_directories (eressea ${CURSES_INCLUDE_DIRS})
|
||||
target_link_libraries(eressea ${CURSES_LIBRARIES})
|
||||
add_definitions(-DUSE_CURSES)
|
||||
endif(CURSES_FOUND)
|
||||
|
||||
if (EXPAT_FOUND)
|
||||
include_directories (${EXPAT_INCLUDE_DIRS})
|
||||
target_include_directories (game PRIVATE ${EXPAT_INCLUDE_DIRS})
|
||||
target_link_libraries(eressea ${EXPAT_LIBRARIES})
|
||||
target_link_libraries(test_eressea ${EXPAT_LIBRARIES})
|
||||
endif (EXPAT_FOUND)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
** Lua binding: config
|
||||
*/
|
||||
|
||||
#include "tolua.h"
|
||||
#include <tolua.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
** Lua binding: eressea
|
||||
*/
|
||||
|
||||
#include "tolua.h"
|
||||
#include <tolua.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -8,6 +8,8 @@ REM CD ..
|
|||
REM SET ERESSEA=%CD%
|
||||
REM CD %SRCDIR%
|
||||
|
||||
SET CMAKE_MODULES="%CMAKE_ROOT%\share\cmake-3.19\Modules;%SRCDIR%\cmake\Modules"
|
||||
|
||||
IF exist build-vs%VSVERSION% goto HAVEDIR
|
||||
mkdir build-vs%VSVERSION%
|
||||
:HAVEDIR
|
||||
|
@ -15,5 +17,5 @@ cd build-vs%VSVERSION%
|
|||
IF NOT EXIST CMakeCache.txt GOTO NOCACHE
|
||||
DEL CMakeCache.txt
|
||||
:NOCACHE
|
||||
"%CMAKE_ROOT%\bin\cmake.exe" -A Win32 -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%LUA_DEV%;%WIN32_DEV%" -DCMAKE_MODULE_PATH="%SRCDIR%/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE ..
|
||||
"%CMAKE_ROOT%\bin\cmake.exe" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -A Win32 -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%LUA_DEV%;%WIN32_DEV%" -DCMAKE_MODULE_PATH="%CMAKE_MODULES%" -DCMAKE_SUPPRESS_REGENERATION=TRUE ..
|
||||
PAUSE
|
||||
|
|
Loading…
Reference in a new issue