cmake changes for cross compiling
This commit is contained in:
parent
7e7d16ee5f
commit
82439d6ca2
|
@ -1,6 +1,7 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
PROJECT(otclient)
|
||||
|
||||
# setup custom cmake modules path
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
|
||||
|
||||
# find needed packages
|
||||
|
@ -26,7 +27,6 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
|||
SET(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -ggdb -fno-inline")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wl,-s")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,--as-needed")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
|
@ -131,6 +131,6 @@ TARGET_LINK_LIBRARIES(otclient
|
|||
${LUA_LIBRARIES}
|
||||
${YAMLCPP_LIBRARY}
|
||||
${PHYSFS_LIBRARY}
|
||||
${GMP_LIBRARIES}
|
||||
${GMP_LIBRARY}
|
||||
${ZLIB_LIBRARY}
|
||||
${ADDITIONAL_LIBRARIES})
|
||||
|
|
|
@ -1,23 +1,10 @@
|
|||
# Try to find the GMP librairies
|
||||
# GMP_FOUND - system has GMP lib
|
||||
# GMP_FOUND - system has GMP
|
||||
# GMP_INCLUDE_DIR - the GMP include directory
|
||||
# GMP_LIBRARIES - Libraries needed to use GMP
|
||||
# GMP_LIBRARY - the GMP library
|
||||
|
||||
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
|
||||
if (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
set(GMP_FIND_QUIETLY TRUE)
|
||||
endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
|
||||
|
||||
find_path(GMP_INCLUDE_DIR NAMES gmp.h )
|
||||
find_library(GMP_LIBRARIES NAMES gmp libgmp)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES)
|
||||
|
||||
mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES)
|
||||
FIND_PATH(GMP_INCLUDE_DIR NAMES gmp.h)
|
||||
FIND_LIBRARY(GMP_LIBRARY NAMES libgmp.a gmp)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_LIBRARY GMP_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(GMP_LIBRARY GMP_INCLUDE_DIR)
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# Locate Lua library
|
||||
# This module defines
|
||||
# LUA51_FOUND, if false, do not try to link to Lua
|
||||
# LUA_LIBRARIES
|
||||
# LUA_INCLUDE_DIR, where to find lua.h
|
||||
#
|
||||
# Note that the expected include convention is
|
||||
# #include "lua.h"
|
||||
# and not
|
||||
# #include <lua/lua.h>
|
||||
# This is because, the lua location is not standardized and may exist
|
||||
# in locations other than lua/
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# 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.)
|
||||
|
||||
FIND_PATH(LUA_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES lua51 lua5.1)
|
||||
FIND_LIBRARY(LUA_LIBRARY NAMES liblua51.a liblua5.1.a liblua-5.1.a liblua.a lua51 lua5.1 lua-5.1 lua)
|
||||
|
||||
IF(LUA_LIBRARY)
|
||||
# include the math library for Unix
|
||||
IF(UNIX AND NOT APPLE)
|
||||
FIND_LIBRARY(LUA_MATH_LIBRARY m)
|
||||
SET( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||
# For Windows and Mac, don't need to explicitly include the math library
|
||||
ELSE(UNIX AND NOT APPLE)
|
||||
SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||
ENDIF(UNIX AND NOT APPLE)
|
||||
ENDIF(LUA_LIBRARY)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# Locate PhysFS library
|
||||
# This module defines
|
||||
# PHYSFS_LIBRARY, the name of the library to link against
|
||||
# PHYSFS_FOUND, if false, do not try to link to PHYSFS
|
||||
# PHYSFS_INCLUDE_DIR, where to find physfs.h
|
||||
#
|
||||
# $PHYSFSDIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$PHYSFSDIR
|
||||
# used in building PHYSFS.
|
||||
#
|
||||
# Created by Eric Wing.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
#
|
||||
# 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.)
|
||||
|
||||
FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h PATH_SUFFIXES physfs)
|
||||
FIND_LIBRARY(PHYSFS_LIBRARY NAMES libphysfs.a physfs)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR)
|
||||
|
|
@ -1,37 +1,10 @@
|
|||
# - Try to find yaml-cpp
|
||||
# Once done, this will define
|
||||
#
|
||||
# YAMLCPP_LIBRARY, link these to use yaml-cpp
|
||||
# YAMLCPP_FOUND - system has yaml-cpp
|
||||
# YAMLCPP_INCLUDE_DIR, the yaml-cpp include directories
|
||||
# Try to find yaml-cpp
|
||||
# YAMLCPP_FOUND - system has yaml-cpp
|
||||
# YAMLCPP_INCLUDE_DIR - the yaml-cpp include directory
|
||||
# YAMLCPP_LIBRARY - the yaml-cpp library
|
||||
|
||||
FIND_PATH(YAMLCPP_INCLUDE_DIR yaml-cpp/yaml.h
|
||||
HINTS
|
||||
PATH_SUFFIXES include/yaml-cpp include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(YAMLCPP_LIBRARY
|
||||
NAMES yaml-cpp
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
INCLUDE("${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake")
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(YamlCpp DEFAULT_MSG YAMLCPP_LIBRARY YAMLCPP_INCLUDE_DIR)
|
||||
FIND_PATH(YAMLCPP_INCLUDE_DIR NAMES yaml.h PATH_SUFFIXES yaml-cpp)
|
||||
FIND_LIBRARY(YAMLCPP_LIBRARY NAMES libyaml-cpp.a yaml-cpp)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(YamlCpp DEFAULT_MSG YAMLCPP_LIBRARY YAMLCPP_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(YAMLCPP_LIBRARY YAMLCPP_INCLUDE_DIR)
|
|
@ -5,4 +5,5 @@ SET(CMAKE_RC_COMPILER i486-mingw32-windres)
|
|||
SET(CMAKE_FIND_ROOT_PATH /usr/i486-mingw32)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -static-libgcc -static-libstdc++")
|
Loading…
Reference in New Issue