Add libgit2 library, new mingw32 libraries will be uploaded soon

This commit is contained in:
Eduardo Bart 2012-08-18 14:08:05 -03:00
parent ef9a4c5d04
commit 5e3882f87a
23 changed files with 200 additions and 40 deletions

View File

@ -5,6 +5,7 @@ set(FRAMEWORK_SOUND ON)
set(FRAMEWORK_GRAPHICS ON) set(FRAMEWORK_GRAPHICS ON)
set(FRAMEWORK_XML ON) set(FRAMEWORK_XML ON)
set(FRAMEWORK_NET ON) set(FRAMEWORK_NET ON)
#set(FRAMEWORK_GIT ON)
include(src/framework/CMakeLists.txt) include(src/framework/CMakeLists.txt)
include(src/otclient/CMakeLists.txt) include(src/otclient/CMakeLists.txt)
@ -44,7 +45,7 @@ endif()
# installation # installation
set(DATA_INSTALL_DIR share/otclient) set(DATA_INSTALL_DIR share/otclient)
install(TARGETS otclient RUNTIME DESTINATION bin) install(TARGETS otclient RUNTIME DESTINATION bin)
install(FILES README.md TODO BUGS LICENSE AUTHORS init.lua otclientrc.lua DESTINATION ${DATA_INSTALL_DIR}) install(FILES README.md BUGS LICENSE AUTHORS init.lua otclientrc.lua DESTINATION ${DATA_INSTALL_DIR})
install(DIRECTORY modules DESTINATION ${DATA_INSTALL_DIR} PATTERN ".git" EXCLUDE) install(DIRECTORY modules DESTINATION ${DATA_INSTALL_DIR} PATTERN ".git" EXCLUDE)
# add "make run" # add "make run"

View File

@ -38,25 +38,21 @@ function UIResizeBorder:onMouseMove(mousePos, mouseMoved)
local delta = mousePos.y - self:getY() - self:getHeight()/2 local delta = mousePos.y - self:getY() - self:getHeight()/2
local parent = self:getParent() local parent = self:getParent()
local newsize = math.min(math.max(parent:getHeight() + delta, self.minimum), self.maximum) local newsize = math.min(math.max(parent:getHeight() + delta, self.minimum), self.maximum)
if newsize ~= currentMargin then self.newsize = newsize
self.newsize = newsize if not self.event or self.event:isExecuted() then
if not self.event or self.event:isExecuted() then self.event = addEvent(function()
self.event = addEvent(function() parent:setHeight(self.newsize)
parent:setHeight(self.newsize) end)
end)
end
end end
else else
local delta = mousePos.x - self:getX() - self:getWidth()/2 local delta = mousePos.x - self:getX() - self:getWidth()/2
local parent = self:getParent() local parent = self:getParent()
local newsize = math.min(math.max(parent:getWidth() + delta, self.minimum), self.maximum) local newsize = math.min(math.max(parent:getWidth() + delta, self.minimum), self.maximum)
if newsize ~= currentMargin then self.newsize = newsize
self.newsize = newsize if not self.event or self.event:isExecuted() then
if not self.event or self.event:isExecuted() then self.event = addEvent(function()
self.event = addEvent(function() parent:setWidth(self.newsize)
parent:setWidth(self.newsize) end)
end)
end
end end
end end
return true return true
@ -112,4 +108,4 @@ function UIResizeBorder:setMinimum(minimum)
end end
function UIResizeBorder:getMaximum() return self.maximum end function UIResizeBorder:getMaximum() return self.maximum end
function UIResizeBorder:getMinimum() return self.minimum end function UIResizeBorder:getMinimum() return self.minimum end

View File

@ -68,15 +68,17 @@ end
function loadMap() function loadMap()
local clientVersion = g_game.getClientVersion() local clientVersion = g_game.getClientVersion()
local minimapName = '/minimap_' .. clientVersion .. '.otcm' local minimapFile = '/minimap_' .. clientVersion .. '.otcm'
g_map.clean() if g_resources.fileExists(minimapFile) then
g_map.loadOtcm(minimapName) g_map.clean()
g_map.loadOtcm(minimapFile)
end
end end
function saveMap() function saveMap()
local clientVersion = g_game.getClientVersion() local clientVersion = g_game.getClientVersion()
local minimapName = '/minimap_' .. clientVersion .. '.otcm' local minimapFile = '/minimap_' .. clientVersion .. '.otcm'
g_map.saveOtcm(minimapName) g_map.saveOtcm(minimapFile)
end end
function toggle() function toggle()

View File

@ -176,7 +176,7 @@ if(WIN32)
set(REQUIRED_BOOST_COMPONENTS ${REQUIRED_BOOST_COMPONENTS} thread chrono) # mingw32 does not have std::thread set(REQUIRED_BOOST_COMPONENTS ${REQUIRED_BOOST_COMPONENTS} thread chrono) # mingw32 does not have std::thread
endif() endif()
set(Boost_USE_MULTITHREADED ON) set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ${USE_STATIC_LIBS})
find_package(Boost COMPONENTS ${REQUIRED_BOOST_COMPONENTS} REQUIRED) find_package(Boost COMPONENTS ${REQUIRED_BOOST_COMPONENTS} REQUIRED)
#find lua #find lua
@ -466,5 +466,19 @@ if(FRAMEWORK_SQL)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_SQL) set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_SQL)
endif() endif()
if(FRAMEWORK_GIT)
find_package(Git2 REQUIRED)
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${GIT2_INCLUDE_DIR})
set(framework_LIBRARIES ${GIT2_LIBRARY} ${framework_LIBRARIES})
set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/git/declarations.h
${CMAKE_CURRENT_LIST_DIR}/git/gitrepository.h
${CMAKE_CURRENT_LIST_DIR}/git/gitrepository.cpp
)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_GIT)
endif()
include_directories(${framework_INCLUDE_DIRS}) include_directories(${framework_INCLUDE_DIRS})
add_definitions(${framework_DEFINITIONS}) add_definitions(${framework_DEFINITIONS})

View File

@ -4,7 +4,7 @@
# EGL_LIBRARY - the EGL library # EGL_LIBRARY - the EGL library
FIND_PATH(EGL_INCLUDE_DIR NAMES EGL/egl.h) FIND_PATH(EGL_INCLUDE_DIR NAMES EGL/egl.h)
FIND_LIBRARY(EGL_LIBRARY NAMES EGL.dll EGL) FIND_LIBRARY(EGL_LIBRARY NAMES EGL)
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR)
MARK_AS_ADVANCED(EGL_LIBRARY EGL_INCLUDE_DIR) MARK_AS_ADVANCED(EGL_LIBRARY EGL_INCLUDE_DIR)

View File

@ -5,7 +5,7 @@
FIND_PATH(GLEW_INCLUDE_DIR NAMES GL/glew.h) FIND_PATH(GLEW_INCLUDE_DIR NAMES GL/glew.h)
SET(_GLEW_STATIC_LIBS libGLEW.a libglew32.a) SET(_GLEW_STATIC_LIBS libGLEW.a libglew32.a)
SET(_GLEW_SHARED_LIBS GLEW.dll glew32.dll GLEW glew32) SET(_GLEW_SHARED_LIBS libGLEW.dll.a libglew32.dll.a GLEW glew32)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(GLEW_LIBRARY NAMES ${_GLEW_STATIC_LIBS} ${_GLEW_SHARED_LIBS}) FIND_LIBRARY(GLEW_LIBRARY NAMES ${_GLEW_STATIC_LIBS} ${_GLEW_SHARED_LIBS})
ELSE() ELSE()

View File

@ -5,7 +5,7 @@
FIND_PATH(GMP_INCLUDE_DIR NAMES gmp.h) FIND_PATH(GMP_INCLUDE_DIR NAMES gmp.h)
SET(_GMP_STATIC_LIBS libgmp.a) SET(_GMP_STATIC_LIBS libgmp.a)
SET(_GMP_SHARED_LIBS gmp.dll gmp) SET(_GMP_SHARED_LIBS libgmp.dll.a gmp)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(GMP_LIBRARY NAMES ${_GMP_STATIC_LIBS} ${_GMP_SHARED_LIBS}) FIND_LIBRARY(GMP_LIBRARY NAMES ${_GMP_STATIC_LIBS} ${_GMP_SHARED_LIBS})
ELSE() ELSE()

View File

@ -0,0 +1,16 @@
# Try to find the libgit2 library
# GIT2_FOUND - system has libgit2
# GIT2_INCLUDE_DIR - the libgit2 include directory
# GIT2_LIBRARY - the libgit2 library
FIND_PATH(GIT2_INCLUDE_DIR NAMES git2.h)
SET(_GIT2_STATIC_LIBS libgit2.a)
SET(_GIT2_SHARED_LIBS libgit2.dll.a git2)
IF(USE_STATIC_LIBS)
FIND_LIBRARY(GIT2_LIBRARY NAMES ${_GIT2_STATIC_LIBS} ${_GIT2_SHARED_LIBS})
ELSE()
FIND_LIBRARY(GIT2_LIBRARY NAMES ${_GIT2_SHARED_LIBS} ${_GIT2_STATIC_LIBS})
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIT2 DEFAULT_MSG GIT2_LIBRARY GIT2_INCLUDE_DIR)
MARK_AS_ADVANCED(GIT2_LIBRARY GIT2_INCLUDE_DIR)

View File

@ -7,7 +7,7 @@
FIND_PATH(LUA_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES lua51 lua5.1 lua) FIND_PATH(LUA_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES lua51 lua5.1 lua)
FIND_LIBRARY(LUA_LIBRARY NAMES) FIND_LIBRARY(LUA_LIBRARY NAMES)
SET(_LUA_STATIC_LIBS liblua51.a liblua5.1.a liblua-5.1.a liblua.a ) SET(_LUA_STATIC_LIBS liblua51.a liblua5.1.a liblua-5.1.a liblua.a )
SET(_LUA_SHARED_LIBS lua51.dll lua5.1.dll lua-5.1.dll lua.dll lua51 lua5.1 lua-5.1 lua) SET(_LUA_SHARED_LIBS liblua51.dll.a liblua5.1.dll.a liblua-5.1.dll.a liblua.dll.a lua51.dll lua5.1 lua-5.1 lua)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(LUA_LIBRARY NAMES ${_LUA_STATIC_LIBS} ${_LUA_SHARED_LIBS}) FIND_LIBRARY(LUA_LIBRARY NAMES ${_LUA_STATIC_LIBS} ${_LUA_SHARED_LIBS})
ELSE() ELSE()

View File

@ -6,7 +6,7 @@
FIND_PATH(LUAJIT_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES luajit-2.0) FIND_PATH(LUAJIT_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES luajit-2.0)
SET(_LUAJIT_STATIC_LIBS libluajit51.a libluajit5.1.a libluajit-5.1.a libluajit.a) SET(_LUAJIT_STATIC_LIBS libluajit51.a libluajit5.1.a libluajit-5.1.a libluajit.a)
SET(_LUAJIT_SHARED_LIBS luajit51 luajit5.1 luajit-5.1 luajit) SET(_LUAJIT_SHARED_LIBS libluajit51.dll.a libluajit5.1.dll.a libluajit-5.1.dll.a libluajit.dll.a luajit51 luajit5.1 luajit-5.1 luajit)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(LUAJIT_LIBRARY NAMES ${_LUAJIT_STATIC_LIBS} ${_LUAJIT_SHARED_LIBS}) FIND_LIBRARY(LUAJIT_LIBRARY NAMES ${_LUAJIT_STATIC_LIBS} ${_LUAJIT_SHARED_LIBS})
ELSE() ELSE()

View File

@ -4,8 +4,8 @@
# MYSQL_LIBRARY - the mysql library # MYSQL_LIBRARY - the mysql library
FIND_PATH(MYSQL_INCLUDE_DIR NAMES mysql.h PATH_SUFFIXES mysql) FIND_PATH(MYSQL_INCLUDE_DIR NAMES mysql.h PATH_SUFFIXES mysql)
SET(_MYSQL_STATIC_LIBS mysqlclient.a mysqlclient_r.a) SET(_MYSQL_STATIC_LIBS libmysqlclient.a libmysqlclient_r.a)
SET(_MYSQL_SHARED_LIBS mysqlclient mysqlclient_r) SET(_MYSQL_SHARED_LIBS libmysqlclient.dll.a libmysqlclient_r.dll.a mysqlclient mysqlclient_r)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(MYSQL_LIBRARY NAMES ${_MYSQL_STATIC_LIBS} ${_MYSQL_SHARED_LIBS}) FIND_LIBRARY(MYSQL_LIBRARY NAMES ${_MYSQL_STATIC_LIBS} ${_MYSQL_SHARED_LIBS})
ELSE() ELSE()

View File

@ -5,7 +5,7 @@
FIND_PATH(OGG_INCLUDE_DIR NAMES ogg/ogg.h) FIND_PATH(OGG_INCLUDE_DIR NAMES ogg/ogg.h)
SET(_OGG_STATIC_LIBS libogg.a) SET(_OGG_STATIC_LIBS libogg.a)
SET(_OGG_SHARED_LIBS ogg.dll ogg) SET(_OGG_SHARED_LIBS libogg.dll.a ogg)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(OGG_LIBRARY NAMES ${_OGG_STATIC_LIBS} ${_OGG_SHARED_LIBS}) FIND_LIBRARY(OGG_LIBRARY NAMES ${_OGG_STATIC_LIBS} ${_OGG_SHARED_LIBS})
ELSE() ELSE()

View File

@ -4,8 +4,8 @@
# OPENAL_LIBRARY - the OPENAL library # OPENAL_LIBRARY - the OPENAL library
FIND_PATH(OPENAL_INCLUDE_DIR NAMES AL/al.h) FIND_PATH(OPENAL_INCLUDE_DIR NAMES AL/al.h)
SET(_OPENAL_STATIC_LIBS OpenAL.a al.a openal.a OpenAL32.a) SET(_OPENAL_STATIC_LIBS libOpenAL.a libal.a libopenal.a libOpenAL32.a)
SET(_OPENAL_SHARED_LIBS OpenAL.dll al.dll openal.dll OpenAL32.dll OpenAL al openal OpenAL32) SET(_OPENAL_SHARED_LIBS libOpenAL.dll.a libal.dll.a libopenal.dll.a libOpenAL32.dll.a OpenAL al openal OpenAL32)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(OPENAL_LIBRARY NAMES ${_OPENAL_STATIC_LIBS} ${_OPENAL_SHARED_LIBS}) FIND_LIBRARY(OPENAL_LIBRARY NAMES ${_OPENAL_STATIC_LIBS} ${_OPENAL_SHARED_LIBS})
ELSE() ELSE()

View File

@ -4,7 +4,7 @@
# OPENGLES1_LIBRARY - the OpenGL ES 1.0 library # OPENGLES1_LIBRARY - the OpenGL ES 1.0 library
FIND_PATH(OPENGLES1_INCLUDE_DIR NAMES GLES/gl.h) FIND_PATH(OPENGLES1_INCLUDE_DIR NAMES GLES/gl.h)
FIND_LIBRARY(OPENGLES1_LIBRARY NAMES GLESv1_CM.dll GLES_CM.dll GLESv1_CM GLES_CM) FIND_LIBRARY(OPENGLES1_LIBRARY NAMES GLESv1_CM GLES_CM)
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGLES2 DEFAULT_MSG OPENGLES1_LIBRARY OPENGLES1_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGLES2 DEFAULT_MSG OPENGLES1_LIBRARY OPENGLES1_INCLUDE_DIR)
MARK_AS_ADVANCED(OPENGLES1_LIBRARY OPENGLES1_INCLUDE_DIR) MARK_AS_ADVANCED(OPENGLES1_LIBRARY OPENGLES1_INCLUDE_DIR)

View File

@ -4,7 +4,7 @@
# OPENGLES2_LIBRARY - the OpenGL ES 2.0 library # OPENGLES2_LIBRARY - the OpenGL ES 2.0 library
FIND_PATH(OPENGLES2_INCLUDE_DIR NAMES GLES2/gl2.h) FIND_PATH(OPENGLES2_INCLUDE_DIR NAMES GLES2/gl2.h)
FIND_LIBRARY(OPENGLES2_LIBRARY NAMES GLESv2.dll GLESv2) FIND_LIBRARY(OPENGLES2_LIBRARY NAMES GLESv2)
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR)
MARK_AS_ADVANCED(OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR) MARK_AS_ADVANCED(OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR)

View File

@ -5,9 +5,9 @@
FIND_PATH(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h) FIND_PATH(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h)
SET(_OPENSSL_STATIC_LIBS libssl.a) SET(_OPENSSL_STATIC_LIBS libssl.a)
SET(_OPENSSL_SHARED_LIBS ssl.dll ssl) SET(_OPENSSL_SHARED_LIBS libssl.dll.a ssl)
SET(_OPENSSL_CRYPTO_STATIC_LIBS libcrypto.a) SET(_OPENSSL_CRYPTO_STATIC_LIBS libcrypto.a)
SET(_OPENSSL_CRYPTO_SHARED_LIBS libcrypto.dll crypto) SET(_OPENSSL_CRYPTO_SHARED_LIBS libcrypto.dll.a crypto)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(OPENSSL_LIBRARY NAMES ${_OPENSSL_STATIC_LIBS} ${_OPENSSL_SHARED_LIBS}) FIND_LIBRARY(OPENSSL_LIBRARY NAMES ${_OPENSSL_STATIC_LIBS} ${_OPENSSL_SHARED_LIBS})
FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY NAMES ${_OPENSSL_CRYPTO_STATIC_LIBS} ${_OPENSSL_CRYPTO_SHARED_LIBS}) FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY NAMES ${_OPENSSL_CRYPTO_STATIC_LIBS} ${_OPENSSL_CRYPTO_SHARED_LIBS})

View File

@ -5,7 +5,7 @@
FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h PATH_SUFFIXES physfs) FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h PATH_SUFFIXES physfs)
SET(_PHYSFS_STATIC_LIBS libphysfs.a) SET(_PHYSFS_STATIC_LIBS libphysfs.a)
SET(_PHYSFS_SHARED_LIBS physfs.dll physfs) SET(_PHYSFS_SHARED_LIBS libphysfs.dll.a physfs)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(PHYSFS_LIBRARY NAMES ${_PHYSFS_STATIC_LIBS} ${_PHYSFS_SHARED_LIBS}) FIND_LIBRARY(PHYSFS_LIBRARY NAMES ${_PHYSFS_STATIC_LIBS} ${_PHYSFS_SHARED_LIBS})
ELSE() ELSE()

View File

@ -5,7 +5,7 @@
FIND_PATH(VORBIS_INCLUDE_DIR NAMES vorbis/codec.h) FIND_PATH(VORBIS_INCLUDE_DIR NAMES vorbis/codec.h)
SET(_VORBIS_STATIC_LIBS libvorbis.a) SET(_VORBIS_STATIC_LIBS libvorbis.a)
SET(_VORBIS_SHARED_LIBS vorbis.dll vorbis) SET(_VORBIS_SHARED_LIBS libvorbis.dll.a vorbis)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(VORBIS_LIBRARY NAMES ${_VORBIS_STATIC_LIBS} ${_VORBIS_SHARED_LIBS}) FIND_LIBRARY(VORBIS_LIBRARY NAMES ${_VORBIS_STATIC_LIBS} ${_VORBIS_SHARED_LIBS})
ELSE() ELSE()

View File

@ -5,7 +5,7 @@
FIND_PATH(VORBISFILE_INCLUDE_DIR NAMES vorbis/vorbisfile.h) FIND_PATH(VORBISFILE_INCLUDE_DIR NAMES vorbis/vorbisfile.h)
SET(_VORBISFILE_STATIC_LIBS libvorbisfile.a) SET(_VORBISFILE_STATIC_LIBS libvorbisfile.a)
SET(_VORBISFILE_SHARED_LIBS vorbisfile.dll vorbisfile) SET(_VORBISFILE_SHARED_LIBS libvorbisfile.dll.a vorbisfile)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(VORBISFILE_LIBRARY NAMES ${_VORBISFILE_STATIC_LIBS} ${_VORBISFILE_SHARED_LIBS}) FIND_LIBRARY(VORBISFILE_LIBRARY NAMES ${_VORBISFILE_STATIC_LIBS} ${_VORBISFILE_SHARED_LIBS})
ELSE() ELSE()

View File

@ -5,7 +5,7 @@
FIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h) FIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h)
SET(_ZLIB_STATIC_LIBS libz.a libzlib.a zlib1.a) SET(_ZLIB_STATIC_LIBS libz.a libzlib.a zlib1.a)
SET(_ZLIB_SHARED_LIBS z.dll zlib.dll zdll.dll zlib1.dll z zlib zdll zlib1) SET(_ZLIB_SHARED_LIBS z zlib zdll zlib1)
IF(USE_STATIC_LIBS) IF(USE_STATIC_LIBS)
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${_ZLIB_STATIC_LIBS} ${_ZLIB_SHARED_LIBS}) FIND_LIBRARY(ZLIB_LIBRARY NAMES ${_ZLIB_STATIC_LIBS} ${_ZLIB_SHARED_LIBS})
ELSE() ELSE()

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef FRAMEWORK_GIT_DECLARATIONS_H
#define FRAMEWORK_GIT_DECLARATIONS_H
#include <framework/global.h>
class GitRepository;
typedef stdext::shared_object_ptr<GitRepository> GitRepositoryPtr;
#endif

View File

@ -0,0 +1,56 @@
/*
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "gitrepository.h"
#include <string>
#include <git2.h>
GitRepository::GitRepository()
{
m_repo = nullptr;
}
GitRepository::~GitRepository()
{
if(m_repo) {
git_repository_free(m_repo);
}
}
bool GitRepository::open(const std::string& path)
{
int error = git_repository_open(&m_repo, path.c_str());
if(error < 0) {
m_lastError = "failed to open repository";
return false;
}
return true;
}
void GitRepository::fetch(const std::string& remoteUrl)
{
//git_remote *remote = nullptr;
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef GITREPOSITORY_H
#define GITREPOSITORY_H
#include "declarations.h"
struct git_repository;
class GitRepository
{
public:
GitRepository();
~GitRepository();
bool open(const std::string& path);
void fetch(const std::string& remoteUrl);
private:
git_repository *m_repo;
std::string m_lastError;
};
#endif