Merge pull request #577 from g-pechorin/patch-4

not-git (and "nested" builds)
pull/580/merge
Alexander Gessler 2015-06-04 23:46:05 +02:00
commit 36a9f2be1a
6 changed files with 49 additions and 37 deletions

View File

@ -23,7 +23,7 @@ add_definitions( -DOPENDDL_NO_USE_CPP11 )
# Get the current working branch # Get the current working branch
execute_process( execute_process(
COMMAND git rev-parse --abbrev-ref HEAD COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
@ -31,7 +31,7 @@ execute_process(
# Get the latest abbreviated commit hash of the working branch # Get the latest abbreviated commit hash of the working branch
execute_process( execute_process(
COMMAND git log -1 --format=%h COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )

View File

@ -30,7 +30,14 @@ endif()
set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gtest") set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gtest")
ExternalProject_Add(gtest # try to find git - if found, setup gtest
find_package(Git)
if(NOT GIT_FOUND)
set(AddGTest_FOUND false CACHE BOOL "Was gtest setup correctly?")
else(NOT GIT_FOUND)
set(AddGTest_FOUND true CACHE BOOL "Was gtest setup correctly?")
ExternalProject_Add(gtest
GIT_REPOSITORY https://chromium.googlesource.com/external/googletest GIT_REPOSITORY https://chromium.googlesource.com/external/googletest
TIMEOUT 10 TIMEOUT 10
PREFIX "${GTEST_PREFIX}" PREFIX "${GTEST_PREFIX}"
@ -40,25 +47,26 @@ ExternalProject_Add(gtest
LOG_BUILD ON LOG_BUILD ON
# Disable install # Disable install
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
set(LIB_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}") set(LIB_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}")
set(LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}") set(LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(GTEST_LOCATION "${GTEST_PREFIX}/src/gtest-build") set(GTEST_LOCATION "${GTEST_PREFIX}/src/gtest-build")
set(GTEST_DEBUG_LIBRARIES set(GTEST_DEBUG_LIBRARIES
"${GTEST_LOCATION}/${DEBUG_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}" "${GTEST_LOCATION}/${DEBUG_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${CMAKE_THREAD_LIBS_INIT}") "${CMAKE_THREAD_LIBS_INIT}")
SET(GTEST_RELEASE_LIBRARIES SET(GTEST_RELEASE_LIBRARIES
"${GTEST_LOCATION}/${RELEASE_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}" "${GTEST_LOCATION}/${RELEASE_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${CMAKE_THREAD_LIBS_INIT}") "${CMAKE_THREAD_LIBS_INIT}")
if(MSVC_VERSION EQUAL 1700) if(MSVC_VERSION EQUAL 1700)
add_definitions(-D_VARIADIC_MAX=10) add_definitions(-D_VARIADIC_MAX=10)
endif() endif()
ExternalProject_Get_Property(gtest source_dir) ExternalProject_Get_Property(gtest source_dir)
include_directories(${source_dir}/include) include_directories(${source_dir}/include)
include_directories(${source_dir}/gtest/include) include_directories(${source_dir}/gtest/include)
ExternalProject_Get_Property(gtest binary_dir) ExternalProject_Get_Property(gtest binary_dir)
link_directories(${binary_dir}) link_directories(${binary_dir})
endif(NOT GIT_FOUND)

View File

@ -155,11 +155,11 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
boost::scoped_array<char> _buffer (new char[searchBytes+1 /* for the '\0' */]); boost::scoped_array<char> _buffer (new char[searchBytes+1 /* for the '\0' */]);
char* buffer = _buffer.get(); char* buffer = _buffer.get();
const unsigned int read = pStream->Read(buffer,1,searchBytes); const size_t read = pStream->Read(buffer,1,searchBytes);
if (!read) if (!read)
return false; return false;
for (unsigned int i = 0; i < read;++i) for (size_t i = 0; i < read; ++i)
buffer[i] = ::tolower(buffer[i]); buffer[i] = ::tolower(buffer[i]);
// It is not a proper handling of unicode files here ... // It is not a proper handling of unicode files here ...
@ -392,11 +392,11 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
// Convert to UTF8 data to ISO-8859-1 // Convert to UTF8 data to ISO-8859-1
void BaseImporter::ConvertUTF8toISO8859_1(std::string& data) void BaseImporter::ConvertUTF8toISO8859_1(std::string& data)
{ {
unsigned int size = data.size(); size_t size = data.size();
unsigned int i = 0, j = 0; size_t i = 0, j = 0;
while(i < size) { while(i < size) {
if((unsigned char) data[i] < 0x80) { if ((unsigned char) data[i] < (size_t) 0x80) {
data[j] = data[i]; data[j] = data[i];
} else if(i < size - 1) { } else if(i < size - 1) {
if((unsigned char) data[i] == 0xC2) { if((unsigned char) data[i] == 0xC2) {

View File

@ -80,7 +80,7 @@ void Value::setBool( bool value ) {
bool Value::getBool() { bool Value::getBool() {
assert( ddl_bool == m_type ); assert( ddl_bool == m_type );
return ( bool ) ( *m_data ); return ( *m_data ) ? true : false;
} }
void Value::setInt8( int8 value ) { void Value::setInt8( int8 value ) {

View File

@ -46,6 +46,7 @@ SET( TEST_SRCS
SOURCE_GROUP( tests FILES ${TEST_SRCS} ) SOURCE_GROUP( tests FILES ${TEST_SRCS} )
if(AddGTest_FOUND)
add_executable( unit add_executable( unit
unit/CCompilerTest.c unit/CCompilerTest.c
unit/Main.cpp unit/Main.cpp
@ -60,5 +61,6 @@ target_link_libraries( unit assimp
debug ${GTEST_DEBUG_LIBRARIES} debug ${GTEST_DEBUG_LIBRARIES}
optimized ${GTEST_RELEASE_LIBRARIES} optimized ${GTEST_RELEASE_LIBRARIES}
) )
endif(AddGTest_FOUND)
add_subdirectory(headercheck) add_subdirectory(headercheck)

View File

@ -46,7 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AICMD_MAIN_INCLUDED #ifndef AICMD_MAIN_INCLUDED
#define AICMD_MAIN_INCLUDED #define AICMD_MAIN_INCLUDED
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>