Skip to content

Commit

Permalink
Use cmake to build leveldb
Browse files Browse the repository at this point in the history
  • Loading branch information
napodan committed Nov 15, 2014
1 parent c33cea0 commit d0a6242
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if(${CMAKE_VERSION} STREQUAL "2.8.2")
message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
endif(${CMAKE_VERSION} STREQUAL "2.8.2")

#set(CMAKE_VERBOSE_MAKEFILE ON)

SET(TOP_DIR $ENV{TOP})
SET(OUT_DIR $ENV{OUT})
SET(SRC_DIR $ENV{TOP}/minetest)
Expand All @@ -35,6 +37,9 @@ include(curl)
include(ogg)

include(irrlicht)
if(ENABLE_LEVELDB)
include(leveldb)
endif()

# Minetest itself
set(SAVE_CMAKE_SOURCE_DIR {CMAKE_SOURCE_DIR})
Expand Down
37 changes: 37 additions & 0 deletions cmake/leveldb.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
###############################################################################
# Minetest
# Copyright (C) 2010-2014 celeron55, Perttu Ahola <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This program 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
###############################################################################
include(ExternalProject)
ExternalProject_Add(leveldb
SOURCE_DIR "${TOP_DIR}/external/leveldb"
CONFIGURE_COMMAND cp -r <SOURCE_DIR> ${OUT_DIR}/_external/
COMMAND mkdir -p ${OUT_DIR}/_external/leveldb/bin
COMMAND mkdir -p ${OUT_DIR}/_external/leveldb/lib
BINARY_DIR "${OUT_DIR}/_external/leveldb"
BUILD_COMMAND TARGET_OS=OS_WINDOWS_CROSSCOMPILE make libleveldb.a libleveldb.dll
BUILD_IN_SOURCE 0
INSTALL_COMMAND mv libleveldb.a libleveldb.dll.a lib/
COMMAND mv libleveldb.dll bin/
TEST_COMMAND ""
LOG_BUILD OFF)

set(LEVELDB_INCLUDE_DIR ${OUT_DIR}/_external/leveldb/include)
set(LEVELDB_LIBRARY ${OUT_DIR}/_external/leveldb/lib/libleveldb.dll.a)
set(LEVELDB_DLL ${OUT_DIR}/_external/leveldb/bin/libleveldb.dll)

add_license_dir(${TOP_DIR}/external/leveldb/LICENSE leveldb)
18 changes: 0 additions & 18 deletions win64/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ fi
. $hostdir/env.sh

#Build dependancies
#leveldb
cd $OUT
if [ ! -f "_externals/leveldb/bin/libleveldb.dll" ]
then
mkdir -p _externals/leveldb/bin/
mkdir -p _externals/leveldb/lib/
cp -r $TOP/external/leveldb/* _externals/leveldb/
cd _externals/leveldb/
TARGET_OS=OS_WINDOWS_CROSSCOMPILE CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ AR=x86_64-w64-mingw32-ar \
make libleveldb.a libleveldb.dll
mv libleveldb.a libleveldb.dll.a lib/
mv libleveldb.dll bin/
fi

#LuaJIT
cd $OUT
if [ ! -f "_externals/luajit/src/lua51.dll" ]
Expand Down Expand Up @@ -115,10 +101,6 @@ cmake $TOP/build \
-DFREETYPE_LIBRARY=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libfreetype.dll.a \
-DFREETYPE_DLL=/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libfreetype-6.dll \
\
-DLEVELDB_INCLUDE_DIR=$OUT/_externals/leveldb/include \
-DLEVELDB_LIBRARY=$OUT/_externals/leveldb/lib/libleveldb.dll.a \
-DLEVELDB_DLL=$OUT/_externals/leveldb/bin/libleveldb.dll \
\
-DCUSTOM_GETTEXT_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw \
-DGETTEXT_MSGFMT=`which msgfmt` \
-DGETTEXT_DLL=/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libintl-8.dll \
Expand Down

0 comments on commit d0a6242

Please sign in to comment.