summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpengxuanzheng <[email protected]>2020-09-02 14:57:12 +0800
committerpengxuanzheng <[email protected]>2020-09-02 14:57:12 +0800
commit1573688b5ac8afa62a5a52ee06d81a410df05090 (patch)
treefbd58500f18cea9a73e9c41c7f437569be2eb3a1 /src
parente009d14697bd886830366d185b574ea563db1ee1 (diff)
修改3rd为support
Diffstat (limited to 'src')
-rw-r--r--src/.tsg_lua_func.cpp.swpbin16384 -> 0 bytes
-rw-r--r--src/CMakeLists.txt22
-rw-r--r--src/tsg_lua_func.cpp23
3 files changed, 12 insertions, 33 deletions
diff --git a/src/.tsg_lua_func.cpp.swp b/src/.tsg_lua_func.cpp.swp
deleted file mode 100644
index f7d03b2..0000000
--- a/src/.tsg_lua_func.cpp.swp
+++ /dev/null
Binary files differ
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ab8b411..9c28334 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,17 +1,9 @@
cmake_minimum_required(VERSION 3.5)
SET(CMAKE_CXX_COMPILER /usr/bin/g++)
aux_source_directory(. DIR_LIB_SRCS)
-include_directories("../3rd/install/include/luajit-2.1" "/usr/local/include/gperftools/")
-link_directories("../3rd/install/lib")
-link_libraries("libluajit-5.1.so")
-
-find_package(tcmalloc)
-if(tcmalloc_FOUND)
- include_directories(PRIVATE ${TCMALLOC_INCLUDE_DIR})
- link_libraries(${TCMALLOC_LIBRARY})
-else(tcmalloc_FOUND)
- message(FATAL_ERROR "TCMALLOC library not found")
-endif(tcmalloc_FOUND)
+include_directories("../support/install/include/luajit-2.1" "/usr/local/include/gperftools/")
+link_directories("../support/install/lib")
+#link_libraries("libluajit-5.1.so")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -shared -fPIC")
SET(CMAKE_CXX_DEBUG_FLAGS "${CMAKE_CXX_DEBUG_FLAGS} -DTSG_LUA_DEBUG")
@@ -19,8 +11,10 @@ SET(CMAKE_BUILD_TYPE "Release")
add_library(tsglua_static ${DIR_LIB_SRCS})
add_library(tsglua SHARED ${DIR_LIB_SRCS})
set_target_properties(tsglua_static PROPERTIES OUTPUT_NAME "tsglua")
-target_link_libraries(tsglua libluajit-5.1.so dl)
+target_link_libraries(tsglua dl luajit2-static)
+set_target_properties(tsglua PROPERTIES PREFIX "")
-#install(TARGETS libtsglua.so LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
-#install(TARGETS libtsglua.a LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libtsglua.so DESTINATION ${PROJECT_SOURCE_DIR}/lib COMPONENT PROFILE)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libtsglua.a DESTINATION ${PROJECT_SOURCE_DIR}/lib COMPONENT PROFILE)
+install(FILES ${PROJECT_SOURCE_DIR}/src/tsg_lua_interface.h DESTINATION ${PROJECT_SOURCE_DIR}/include COMPONENT PROFILE)
diff --git a/src/tsg_lua_func.cpp b/src/tsg_lua_func.cpp
index 299cab1..ba53492 100644
--- a/src/tsg_lua_func.cpp
+++ b/src/tsg_lua_func.cpp
@@ -14,8 +14,7 @@ extern "C"
#include "luajit.h"
#include "lauxlib.h"
}
-#include<tcmalloc.h>
-#include"../include/tsg_lua_interface.h"
+#include"tsg_lua_interface.h"
#ifndef MIN
#define MIN(a,b) (((a) < (b))?(a):(b))
@@ -469,33 +468,19 @@ int tsg_lua_memmem(lua_State *L)
return 2;
}
-#if 0
-static void *mem_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
-{
- (void)ud;
- (void)osize;
- if (nsize == 0) {
- tc_free(ptr);
- return NULL;
- } else {
- return tc_realloc(ptr, nsize);
- }
-}
-#endif
tsg_lua_handle tsg_lua_vm_create()
{
lua_State *L;
- jmp_buf *lua_exception = (jmp_buf *)tc_malloc(sizeof(jmp_buf));
+ jmp_buf *lua_exception = (jmp_buf *)malloc(sizeof(jmp_buf));
if (lua_exception == NULL)
{
return NULL;
}
L = luaL_newstate();
- //L = lua_newstate(mem_alloc, NULL);
if (L == NULL)
{
- tc_free(lua_exception);
+ free(lua_exception);
return NULL;
}
lua_setexdata(L, lua_exception);
@@ -1319,7 +1304,7 @@ int tsg_destory_lua(tsg_lua_handle lua)
lua_exception = (jmp_buf *)lua_getexdata(L);
if (lua_exception != NULL)
{
- tc_free(lua_exception);
+ free(lua_exception);
}
lua_close(L);