add support for appveyor builds (32 bit windows only)

This commit is contained in:
mlangkabel
2018-12-03 12:10:46 +01:00
parent ea3abfc026
commit a3da0edf1e
4 changed files with 110 additions and 38 deletions
+3 -1
View File
@@ -1,5 +1,8 @@
# SourcetrailDBWriter
[![Build status](https://ci.appveyor.com/api/projects/status/gbblx1l790vm952c/branch/master?svg=true)](https://ci.appveyor.com/project/mlangkabel/sourcetraildb/branch/master)
TODO: write short description here with code example and sourcetrail screenshorts of resulting graph
@@ -30,7 +33,6 @@ TODO: write short description here with code example and sourcetrail screenshort
* rename NodeType::NODE_SYMBOL to UNKNOWN
* versioning in package name: lalala_v1_db21_c684
* add own license info as license file to repo
* add license info to source files
* add 3rd party license references
* debug vs release (may need to disable something in cmake)
+59
View File
@@ -0,0 +1,59 @@
version: 0.0.0.{build}
image: Visual Studio 2017
# TODO use "Visual Studio 15 2017 Win64" for 64 bit builds
artifacts:
- path: artifacts_core
name: sourcetraildb_core_windows_32bit_$(appveyor_build_version)
type: Zip
- path: artifacts_bindings_python
name: sourcetrailbd_python_windows_32bit_$(appveyor_build_version)
type: Zip
install:
- ps: |
# Install SWIG by Choco
choco install -y --no-progress swig
before_build:
# Setup core project
- cd core
- mkdir build
- cd build
- mkdir 32bit
- cd 32bit
- cmake -G "Visual Studio 15 2017" ../..
- cd ../../..
# Setup bindings_python project
- cd bindings_python
- mkdir build
- cd build
- mkdir 32bit
- cd 32bit
- cmake -G "Visual Studio 15 2017" ../.. -DPYTHON_INCLUDE_DIRS="C:/Python37/include" -DPYTHON_LIBRARIES="C:/Python37/libs/python37.lib"
- cd ../../..
build_script:
- cd core/build/32bit
- msbuild /p:configuration=Release /v:m ALL_BUILD.vcxproj
- cd ../../..
- cd bindings_python/build/32bit
- msbuild /p:configuration=Release /v:m ALL_BUILD.vcxproj
- cd ../../..
after_build:
- mkdir artifacts_core
- cd artifacts_core
- mkdir lib
- mkdir include
- cd ..
- ps: |
copy core/build/32bit/release/sourcetraildb.lib artifacts_core/lib/
copy core/build/32bit/include/version.h artifacts_core/include/
copy core/include/* artifacts_core/include/
- mkdir artifacts_bindings_python
- ps: |
copy bindings_python/build/32bit/release/_sourcetraildb.pyd artifacts_bindings_python/
copy bindings_python/build/32bit/release/sourcetraildb.py artifacts_bindings_python/
- echo All done!
+19 -8
View File
@@ -45,6 +45,21 @@ message(STATUS "Found Python include dirs: ${PYTHON_INCLUDE_DIRS}")
message(STATUS "Found Python libraries: ${PYTHON_LIBRARIES}")
# --- Find Core ---
if (NOT EXISTS "${CORE_INCLUDE_DIRS}")
message(STATUS "Core include dir \"${CORE_INCLUDE_DIRS}\" does not exist, trying to find Core automatically.")
set(CORE_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/../core/include" CACHE FILEPATH "path to core include directory")
message(STATUS "Set Core include dir to \"${CORE_INCLUDE_DIRS}\".")
endif ()
if (NOT EXISTS "${CORE_LIBRARIES}")
message(STATUS "Core library \"${CORE_LIBRARIES}\" does not exist, trying to find Core automatically.")
set(CORE_LIBRARIES "${CMAKE_SOURCE_DIR}/../core/build/${ARCH}bit/Release/sourcetraildb.lib" CACHE FILEPATH "path to core library directory")
message(STATUS "Set Core library to \"${CORE_LIBRARIES}\".")
endif ()
# --- Setup Paths ---
set(RESOURCES_SWIG_DIR "${CMAKE_SOURCE_DIR}/../resources_swig")
@@ -53,9 +68,6 @@ set(GENERATED_SRC_DIR "${CMAKE_BINARY_DIR}/src")
set(SWIG_INTERFACE_FILE "${RESOURCES_SWIG_DIR}/interface/${PACKAGE_NAME}.i")
set(GENERATED_WRAPPER_FILE "${GENERATED_SRC_DIR}/${PACKAGE_NAME}_wrap.cxx")
set(CORE_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/../core/include" CACHE FILEPATH "path to core include directory")
set(CORE_DEBUG_LIBRARY "${CMAKE_SOURCE_DIR}/../core/build/${ARCH}bit/Debug/sourcetraildb.lib" CACHE FILEPATH "path to core library directory")
set(CORE_RELEASE_LIBRARY "${CMAKE_SOURCE_DIR}/../core/build/${ARCH}bit/Release/sourcetraildb.lib" CACHE FILEPATH "path to core library directory")
if (WIN32)
file(WRITE ${GENERATED_WRAPPER_FILE} "")
@@ -80,18 +92,17 @@ set_target_properties(${LIB_NAME} PROPERTIES SUFFIX ".pyd")
add_custom_command(
TARGET ${LIB_NAME}
PRE_BUILD
COMMAND if not exist \"${GENERATED_SRC_DIR}\" mkdir \"${GENERATED_SRC_DIR}\" \n $ENV{SWIG_DIR}/swig.exe -c++ -python -I${RESOURCES_SWIG_DIR}/include -o ${GENERATED_WRAPPER_FILE} -outdir ${CMAKE_BINARY_DIR}/$(CONFIGURATION) ${SWIG_INTERFACE_FILE}
COMMAND if not exist \"${GENERATED_SRC_DIR}\" mkdir \"${GENERATED_SRC_DIR}\" \n swig -c++ -python -I${RESOURCES_SWIG_DIR}/include -o ${GENERATED_WRAPPER_FILE} -outdir ${CMAKE_BINARY_DIR}/$(CONFIGURATION) ${SWIG_INTERFACE_FILE}
COMMENT "Generating wrapper code file."
)
target_include_directories(${LIB_NAME} PUBLIC
"${RESOURCES_SWIG_DIR}/include"
"${CORE_INCLUDE_DIR}"
"${CORE_INCLUDE_DIRS}"
${PYTHON_INCLUDE_DIRS}
)
message("CORE_RELEASE_LIBRARY: ${CORE_RELEASE_LIBRARY}")
message("CORE_RELEASE_LIBRARY: ${CORE_LIBRARIES}")
target_link_libraries(${LIB_NAME} ${PYTHON_LIBRARIES})
target_link_libraries(${LIB_NAME} debug "${CORE_DEBUG_LIBRARY}" )
target_link_libraries(${LIB_NAME} optimized "${CORE_RELEASE_LIBRARY}" )
target_link_libraries(${LIB_NAME} ${CORE_LIBRARIES})
+29 -29
View File
@@ -5,9 +5,9 @@
#include "SymbolKind.h"
#include "SourceLocation.h"
#include "SourceRange.h"
#include "SourcetrailDBWriter.h"
#include "ReferenceKind.h"
#include "SrctrldbWriter.h"
namespace
{
@@ -71,71 +71,71 @@ namespace
}
}
sourcetrail::SrctrldbWriter srctrldbWriter;
sourcetrail::SourcetrailDBWriter dbWriter;
int getSupportedDatabaseVersion()
{
return srctrldbWriter.getSupportedDatabaseVersion();
return dbWriter.getSupportedDatabaseVersion();
}
std::string getLastError()
{
return srctrldbWriter.getLastError();
return dbWriter.getLastError();
}
void clearLastError()
{
srctrldbWriter.clearLastError();
dbWriter.clearLastError();
}
bool openProject(std::string projectDirectory, std::string projectName)
{
return srctrldbWriter.openProject(projectDirectory, projectName);
return dbWriter.openProject(projectDirectory, projectName);
}
bool closeProject()
{
return srctrldbWriter.closeProject();
return dbWriter.closeProject();
}
bool clearProject()
{
return srctrldbWriter.clearProject();
return dbWriter.clearProject();
}
bool isEmpty()
{
return srctrldbWriter.isEmpty();
return dbWriter.isEmpty();
}
bool isCompatible()
{
return srctrldbWriter.isCompatible();
return dbWriter.isCompatible();
}
int getLoadedDatabaseVersion()
{
return srctrldbWriter.getLoadedDatabaseVersion();
return dbWriter.getLoadedDatabaseVersion();
}
bool beginTransaction()
{
return srctrldbWriter.beginTransaction();
return dbWriter.beginTransaction();
}
bool commitTransaction()
{
return srctrldbWriter.commitTransaction();
return dbWriter.commitTransaction();
}
bool rollbackTransaction()
{
return srctrldbWriter.rollbackTransaction();
return dbWriter.rollbackTransaction();
}
bool optimizeDatabaseMemory()
{
return srctrldbWriter.optimizeDatabaseMemory();
return dbWriter.optimizeDatabaseMemory();
}
int recordSymbol(std::string serializedNameHierarchy)
@@ -144,68 +144,68 @@ int recordSymbol(std::string serializedNameHierarchy)
if (nameHierarchy.nameElements.empty())
{
// TODO: handle this case!
//srctrldbWriter.setLastError("Unable to deserialize name hierarchy \"" + serializedNameHierarchy + "\".");
//dbWriter.setLastError("Unable to deserialize name hierarchy \"" + serializedNameHierarchy + "\".");
return 0;
}
return srctrldbWriter.recordSymbol(nameHierarchy);
return dbWriter.recordSymbol(nameHierarchy);
}
bool recordSymbolDefinitionKind(int symbolId, DefinitionKind symbolDefinitionKind)
{
return srctrldbWriter.recordSymbolDefinitionKind(symbolId, convertDefinitionKind(symbolDefinitionKind));
return dbWriter.recordSymbolDefinitionKind(symbolId, convertDefinitionKind(symbolDefinitionKind));
}
bool recordSymbolKind(int symbolId, SymbolKind symbolKind)
{
return srctrldbWriter.recordSymbolKind(symbolId, convertSymbolKind(symbolKind));
return dbWriter.recordSymbolKind(symbolId, convertSymbolKind(symbolKind));
}
bool recordSymbolLocation(int symbolId, std::string filePath, int startLine, int startColumn, int endLine, int endColumn)
{
return srctrldbWriter.recordSymbolLocation(symbolId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
return dbWriter.recordSymbolLocation(symbolId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
}
bool recordSymbolScopeLocation(int symbolId, std::string filePath, int startLine, int startColumn, int endLine, int endColumn)
{
return srctrldbWriter.recordSymbolScopeLocation(symbolId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
return dbWriter.recordSymbolScopeLocation(symbolId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
}
bool recordSymbolSignatureLocation(int symbolId, std::string filePath, int startLine, int startColumn, int endLine, int endColumn)
{
return srctrldbWriter.recordSymbolSignatureLocation(symbolId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
return dbWriter.recordSymbolSignatureLocation(symbolId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
}
int recordReference(int contextSymbolId, int referencedSymbolId, ReferenceKind referenceKind)
{
return srctrldbWriter.recordReference(contextSymbolId, referencedSymbolId, convertReferenceKind(referenceKind));
return dbWriter.recordReference(contextSymbolId, referencedSymbolId, convertReferenceKind(referenceKind));
}
bool recordReferenceLocation(int referenceId, std::string filePath, int startLine, int startColumn, int endLine, int endColumn)
{
return srctrldbWriter.recordReferenceLocation(referenceId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
return dbWriter.recordReferenceLocation(referenceId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
}
int recordFile(std::string filePath)
{
return srctrldbWriter.recordFile(filePath);
return dbWriter.recordFile(filePath);
}
int recordLocalSymbol(std::string name)
{
return srctrldbWriter.recordLocalSymbol(name);
return dbWriter.recordLocalSymbol(name);
}
bool recordLocalSymbolLocation(int localSymbolId, std::string filePath, int startLine, int startColumn, int endLine, int endColumn)
{
return srctrldbWriter.recordLocalSymbolLocation(localSymbolId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
return dbWriter.recordLocalSymbolLocation(localSymbolId, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
}
bool recordCommentLocation(std::string filePath, int startLine, int startColumn, int endLine, int endColumn)
{
return srctrldbWriter.recordCommentLocation(sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
return dbWriter.recordCommentLocation(sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
}
bool recordError(std::string message, bool fatal, std::string filePath, int startLine, int startColumn, int endLine, int endColumn)
{
return srctrldbWriter.recordError(message, fatal, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
return dbWriter.recordError(message, fatal, sourcetrail::SourceRange({ filePath, startLine, startColumn, endLine, endColumn }));
}