Merge branch 'master' of https://github.com/albertodemichelis/squirrel
This commit is contained in:
commit
8471ad1aea
@ -9,7 +9,7 @@ set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
|
|||||||
|
|
||||||
project(squirrel C CXX)
|
project(squirrel C CXX)
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(SQ_FLAGS -fno-exceptions -fno-strict-aliasing -Wall -Wextra -pedantic -Wcast-qual)
|
set(SQ_FLAGS -fno-exceptions -fno-strict-aliasing -Wall -Wextra -pedantic -Wcast-qual)
|
||||||
@ -33,25 +33,28 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -std=c++0x")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -std=c++0x")
|
||||||
elseif(MSVC)
|
elseif(MSVC)
|
||||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
add_definitions(-D_SQ64)
|
add_definitions(-D_SQ64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED INSTALL_BIN_DIR)
|
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||||
|
if(NOT DEFINED INSTALL_BIN_DIR)
|
||||||
set(INSTALL_BIN_DIR bin)
|
set(INSTALL_BIN_DIR bin)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED INSTALL_LIB_DIR)
|
if(NOT DEFINED INSTALL_LIB_DIR)
|
||||||
set(INSTALL_LIB_DIR lib)
|
set(INSTALL_LIB_DIR lib)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(squirrel)
|
add_subdirectory(squirrel)
|
||||||
add_subdirectory(sqstdlib)
|
add_subdirectory(sqstdlib)
|
||||||
add_subdirectory(sq)
|
add_subdirectory(sq)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32 AND NOT DEFINED DISABLE_DYNAMIC)
|
||||||
set_target_properties(squirrel sqstdlib PROPERTIES SOVERSION 0 VERSION 0.0.0)
|
set_target_properties(squirrel sqstdlib PROPERTIES SOVERSION 0 VERSION 0.0.0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,17 +1,25 @@
|
|||||||
add_executable(sq sq.c)
|
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||||
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
|
add_executable(sq sq.c)
|
||||||
target_link_libraries(sq squirrel sqstdlib)
|
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
|
||||||
install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
target_link_libraries(sq squirrel sqstdlib)
|
||||||
|
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||||
|
install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED DISABLE_STATIC)
|
if(NOT DEFINED DISABLE_STATIC)
|
||||||
add_executable(sq_static sq.c)
|
add_executable(sq_static sq.c)
|
||||||
set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C)
|
set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C)
|
||||||
target_link_libraries(sq_static squirrel_static sqstdlib_static)
|
target_link_libraries(sq_static squirrel_static sqstdlib_static)
|
||||||
|
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||||
install(TARGETS sq_static RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
install(TARGETS sq_static RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED LONG_OUTPUT_NAMES)
|
if(DEFINED LONG_OUTPUT_NAMES)
|
||||||
|
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||||
set_target_properties(sq PROPERTIES OUTPUT_NAME squirrel3)
|
set_target_properties(sq PROPERTIES OUTPUT_NAME squirrel3)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED DISABLE_STATIC)
|
if(NOT DEFINED DISABLE_STATIC)
|
||||||
set_target_properties(sq_static PROPERTIES OUTPUT_NAME squirrel3_static)
|
set_target_properties(sq_static PROPERTIES OUTPUT_NAME squirrel3_static)
|
||||||
|
@ -7,19 +7,27 @@ set(SQSTDLIB_SRC sqstdaux.cpp
|
|||||||
sqstdstring.cpp
|
sqstdstring.cpp
|
||||||
sqstdsystem.cpp)
|
sqstdsystem.cpp)
|
||||||
|
|
||||||
add_library(sqstdlib SHARED ${SQSTDLIB_SRC})
|
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||||
target_link_libraries(sqstdlib squirrel)
|
add_library(sqstdlib SHARED ${SQSTDLIB_SRC})
|
||||||
install(TARGETS sqstdlib RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
target_link_libraries(sqstdlib squirrel)
|
||||||
|
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||||
|
install(TARGETS sqstdlib RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
||||||
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
||||||
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED DISABLE_STATIC)
|
if(NOT DEFINED DISABLE_STATIC)
|
||||||
add_library(sqstdlib_static STATIC ${SQSTDLIB_SRC})
|
add_library(sqstdlib_static STATIC ${SQSTDLIB_SRC})
|
||||||
|
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||||
install(TARGETS sqstdlib_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
install(TARGETS sqstdlib_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED LONG_OUTPUT_NAMES)
|
if(DEFINED LONG_OUTPUT_NAMES)
|
||||||
|
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||||
set_target_properties(sqstdlib PROPERTIES OUTPUT_NAME sqstdlib3)
|
set_target_properties(sqstdlib PROPERTIES OUTPUT_NAME sqstdlib3)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED DISABLE_STATIC)
|
if(NOT DEFINED DISABLE_STATIC)
|
||||||
set_target_properties(sqstdlib_static PROPERTIES OUTPUT_NAME sqstdlib3_static)
|
set_target_properties(sqstdlib_static PROPERTIES OUTPUT_NAME sqstdlib3_static)
|
||||||
|
@ -69,7 +69,10 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
|
|||||||
const SQChar *format;
|
const SQChar *format;
|
||||||
SQChar *dest;
|
SQChar *dest;
|
||||||
SQChar fmt[MAX_FORMAT_LEN];
|
SQChar fmt[MAX_FORMAT_LEN];
|
||||||
sq_getstring(v,nformatstringidx,&format);
|
const SQRESULT res = sq_getstring(v,nformatstringidx,&format);
|
||||||
|
if (SQ_FAILED(res)) {
|
||||||
|
return res; // propagate the error
|
||||||
|
}
|
||||||
SQInteger format_size = sq_getsize(v,nformatstringidx);
|
SQInteger format_size = sq_getsize(v,nformatstringidx);
|
||||||
SQInteger allocated = (format_size+2)*sizeof(SQChar);
|
SQInteger allocated = (format_size+2)*sizeof(SQChar);
|
||||||
dest = sq_getscratchpad(v,allocated);
|
dest = sq_getscratchpad(v,allocated);
|
||||||
|
@ -11,18 +11,26 @@ set(SQUIRREL_SRC sqapi.cpp
|
|||||||
sqtable.cpp
|
sqtable.cpp
|
||||||
sqvm.cpp)
|
sqvm.cpp)
|
||||||
|
|
||||||
add_library(squirrel SHARED ${SQUIRREL_SRC})
|
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||||
install(TARGETS squirrel RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
add_library(squirrel SHARED ${SQUIRREL_SRC})
|
||||||
|
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||||
|
install(TARGETS squirrel RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
||||||
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
||||||
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED DISABLE_STATIC)
|
if(NOT DEFINED DISABLE_STATIC)
|
||||||
add_library(squirrel_static STATIC ${SQUIRREL_SRC})
|
add_library(squirrel_static STATIC ${SQUIRREL_SRC})
|
||||||
|
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||||
install(TARGETS squirrel_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
install(TARGETS squirrel_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED LONG_OUTPUT_NAMES)
|
if(DEFINED LONG_OUTPUT_NAMES)
|
||||||
|
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||||
set_target_properties(squirrel PROPERTIES OUTPUT_NAME squirrel3)
|
set_target_properties(squirrel PROPERTIES OUTPUT_NAME squirrel3)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED DISABLE_STATIC)
|
if(NOT DEFINED DISABLE_STATIC)
|
||||||
set_target_properties(squirrel_static PROPERTIES OUTPUT_NAME squirrel3_static)
|
set_target_properties(squirrel_static PROPERTIES OUTPUT_NAME squirrel3_static)
|
||||||
|
Loading…
Reference in New Issue
Block a user