added json classes

added cmake files
minor changes
This commit is contained in:
Luis Stanglmeier 2022-06-22 17:49:52 +02:00
parent 06def051e4
commit 9bcf266ce2
40 changed files with 2765 additions and 39 deletions

0
LSFramework/CJsonArray.h Normal file
View file

View file

@ -0,0 +1,8 @@
private:
CcJsonNode m_oJsonData;
bool m_bParseError = false;
CcString m_sParseErrorMsg;
bool m_bIntend = false;
uint16 m_uiIntendLevel = 0;
static const CcString c_sIndent;

12
LSFramework/CJsonNode.h Normal file
View file

@ -0,0 +1,12 @@
private:
union CcDocumentsSHARED UJsonDataType
{
void* m_pVoid;
CcVariant* m_ovValue;
CcJsonObject* m_poJsonObject;
CcJsonArray* m_poJsonArray;
};
UJsonDataType m_uData;
EJsonDataType m_eType = EJsonDataType::Unknown; //!< Enum of current stored Object type.
CcString m_sName; //!< Name of this Object
};

View file

View file

@ -0,0 +1,35 @@
#//========================================================================
#// Copyright (c) Technische Software Entwicklung Plazotta © 2021
#//
#// DESCRIPTION:
#// Shell Script to Build a cmake project under linux, running the Unittest and finally start teh install step
#//
#// HISTORY:
#// 09.04.2021 / PP
#// Module created.
#//========================================================================
#!/bin/bash
#
ProjectName=@TSEP_AUTOBUILD_PROJECT@
UnitTestExe=@TSEP_AUTOBUILD_USED_UNITTEST@
#=======================================================================
# Start build
#=======================================================================
#echo " Auto Build Project : " $ProjectName
#echo " Auto Build Unit Test : " $UnitTestExe
#echo "."
#- Release --------------------------------------------------------------
./scripts/BuildLinuxProject.sh $ProjectName Release $UnitTestExe
if [ $? -ne 0 ]; then
echo "Error during Release build ..."
exit 1
fi
#- Debug ----------------------------------------------------------------
./scripts//BuildLinuxProject.sh $ProjectName Debug $UnitTestExe
if [ $? -ne 0 ]; then
echo "Error during Debug build ..."
exit 1
fi
#
exit 0

View file

@ -0,0 +1,43 @@
@ECHO OFF
REM //========================================================================
REM // Copyright (c) Technische Software Entwicklung Plazotta © 2021
REM //
REM // DESCRIPTION:
REM // Batch Building for Windows / Project Framework.Core
REM //
REM // HISTORY:
REM // 09.04.2021 / PP
REM // Module created.
REM //========================================================================
setlocal
pushd .
REM =======================================================================
REM Setup Parameter
REM =======================================================================
set ProjectName=@TSEP_AUTOBUILD_PROJECT@
set UnitTestExecutables=@TSEP_AUTOBUILD_USED_UNITTEST@
REM
REM =======================================================================
REM Rebuild the project
REM =======================================================================
cd scripts
call BuildVS2017Project.cmd %ProjectName% Release "%UnitTestExecutables%"
IF %ERRORLEVEL% NEQ 0 goto ERROR
call BuildVS2017Project.cmd %ProjectName% Debug "%UnitTestExecutables%"
IF %ERRORLEVEL% NEQ 0 goto ERROR
goto END
REM
REM =======================================================================
REM Error
REM =======================================================================
:ERROR
echo Error during automated build ......
PAUSE
exit /b 1
REM
REM =======================================================================
REM END
REM =======================================================================
:END
echo Automated build successful done .....
exit /b 0

View file

@ -0,0 +1,43 @@
@ECHO OFF
REM //========================================================================
REM // Copyright (c) Technische Software Entwicklung Plazotta © 2021
REM //
REM // DESCRIPTION:
REM // Batch Building for INtime / Project Framework.Core
REM //
REM // HISTORY:
REM // 27.07.2021 / DM
REM // Module created.
REM //========================================================================
setlocal
pushd .
REM =======================================================================
REM Setup Parameter
REM =======================================================================
set ProjectName=@TSEP_AUTOBUILD_PROJECT@
set UnitTestExecutables=@TSEP_AUTOBUILD_USED_UNITTEST@
REM
REM =======================================================================
REM Rebuild the project
REM =======================================================================
cd scripts
call BuildVS2017INtimeProject.cmd %ProjectName% Release "%UnitTestExecutables%"
IF %ERRORLEVEL% NEQ 0 goto ERROR
call BuildVS2017INtimeProject.cmd %ProjectName% Debug "%UnitTestExecutables%"
IF %ERRORLEVEL% NEQ 0 goto ERROR
goto END
REM
REM =======================================================================
REM Error
REM =======================================================================
:ERROR
echo Error during automated build ......
PAUSE
exit /b 1
REM
REM =======================================================================
REM END
REM =======================================================================
:END
echo Automated build successful done .....
exit /b 0

View file

@ -0,0 +1,75 @@
#//========================================================================
#// Copyright (c) Technische Software Entwicklung Plazotta © 2021
#//
#// DESCRIPTION:
#// Shell Script to Build a cmake project under linux, running the Unittest and finally start teh install step
#//
#// HISTORY:
#// 09.04.2021 / PP
#// Module created.
#//========================================================================
#!/bin/bash
#
#=======================================================================
# Check Parameter
#=======================================================================
if [ -z "$1" ]
then
echo "usage: BuildLinuxProject [ProjectName] [Configuration] [UnitTestExe]"
exit 2
fi
if [ -z "$2" ]
then
echo "usage: BuildLinuxProject [ProjectName] [Configuration] [UnitTestExe]"
exit 2
fi
if [ -z "$3" ]
then
echo "usage: BuildLinuxProject [ProjectName] [Configuration] [UnitTestExe]"
exit 2
fi
#=======================================================================
# Show Parameter
#=======================================================================
echo "======================================================================="
echo " Build Parameter"
echo "======================================================================="
echo " Project = $1"
echo " Configuration = $2"
echo " Unit Test Executable = $3"
echo "======================================================================="
echo "."
#=======================================================================
# parse unit test s
#=======================================================================
IFS=','
read -rasplitIFS<<< "$3"
#=======================================================================
# Start build
#=======================================================================
cd ../../BuildResults_linux_$2
#- MAKE ALL ------------------------------------------------------------
make all
if [ $? -ne 0 ]; then
echo "Build error ..."
exit 1
fi
#- UNIT Test -----------------------------------------------------------
cd bin
for unittests in "${splitIFS[@]}"; do
echo tsep | sudo -S ./../../AutoBuild/linux/scripts/RunUnitTest.sh $unittests
if [ $? -ne 0 ]; then
echo "Error during Unit test ..."
exit 1
fi
done
cd ..
#- Install -------------------------------------------------------------
make install
if [ $? -ne 0 ]; then
echo "Error during INSTALL ..."
exit 1
fi
#
exit 0

View file

@ -0,0 +1,126 @@
@ECHO OFF
REM //========================================================================
REM // Copyright (c) Technische Software Entwicklung Plazotta © 2021
REM //
REM // DESCRIPTION:
REM // Batch Building a VS2017 INtime Project, running the Unittest and finally start the install step
REM //
REM // HISTORY:
REM // 27.07.2021 / DM
REM // Module created.
REM // Refactored for INtime with PP's Windows Template.
REM //========================================================================
setlocal
setlocal enabledelayedexpansion
pushd .
REM =======================================================================
REM Check Parameter
REM =======================================================================
set TestFiles=%3
set TestFiles=%TestFiles:"=%
@if "%1"=="" goto HELP
@if "%2"=="" goto HELP
@if "%TestFiles%"=="" goto NO_PARSE
set TestFiles=%TestFiles:,= %
:NO_PARSE
REM =======================================================================
REM Show Parameter
REM =======================================================================
echo =======================================================================
echo Build Parameter
echo =======================================================================
echo Project = %1
echo Configuration = %2
echo Unit Test Executable = %TestFiles%
echo =======================================================================
echo .
REM =======================================================================
REM Setup the VS2017 environment
REM =======================================================================
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\vsdevcmd"
REM
REM =======================================================================
REM Rebuild the project
REM =======================================================================
cd ..\..\..\BuildResults\msvc2017_INtime
devenv %1.sln /rebuild %2
IF %ERRORLEVEL% NEQ 0 goto ERROR
REM
REM =======================================================================
REM Before running the unit tests delete the LdrtaResult file
REM to be sure the loop can work properly
REM =======================================================================
del /f ..\..\AutoBuild\INtime\scripts\LdrtaResult.txt
REM
REM =======================================================================
REM Run all unit tests
REM =======================================================================
for %%f in (%TestFiles%) do (
start ldrta.exe %2\bin\%%f.rta
if !ERRORLEVEL! NEQ 0 goto ERROR
)
REM
REM =======================================================================
REM Loop for recognizing the creation of the LdrtaResult file.
REM After check unit tests were successfully, otherwise error
REM =======================================================================
cd ..\..\AutoBuild\INtime\scripts
set /a CounterEnd=120
set /a Counter=0
set /a OkResult=0
set LdrtaFile=LdrtaResult.txt
:LOOP
echo Checking if the unit tests have created the result file
if exist "%LdrtaFile%" (
echo File was created
set /p Result=<"%LdrtaFile%"
goto FILECREATED
) else (
echo File was not created
goto FILENOTCREATED
)
:FILECREATED
if %Result% EQU %OkResult% (
echo Continueing AllBuild process
goto CONTINUE
) else (
echo Unit tests failed ...
goto ERROR
)
:FILENOTCREATED
if %Counter% EQU %CounterEnd% (
goto ERROR
) else (
set /a Counter=%Counter%+1
timeout /t 2 /nobreak
echo Timeout corresponds to 2 seconds
set /a CounterX2=%Counter%*2
echo Current total timeout counter: %CounterX2%
goto LOOP
)
REM
REM =======================================================================
REM Install files
REM =======================================================================
:CONTINUE
cd ..\..\..\BuildResults\msvc2017_INtime
devenv %1.sln /build %2 /Project INSTALL
IF %ERRORLEVEL% NEQ 0 goto ERROR
goto END
REM
REM =======================================================================
REM Error
REM =======================================================================
:ERROR
echo Error during build ...
exit /b 1
REM
REM =======================================================================
REM HELP
REM =======================================================================
:HELP
echo Usage BuildVs2017INtimeProject [ProjectName] [Configuration] [UnitTestExe]
echo .
:END
exit /b 0

View file

@ -0,0 +1,77 @@
@ECHO OFF
REM //========================================================================
REM // Copyright (c) Technische Software Entwicklung Plazotta © 2021
REM //
REM // DESCRIPTION:
REM // Batch Building a VS2017 Project, running the Unittest and finally start the install step
REM //
REM // HISTORY:
REM // 09.04.2021 / PP
REM // Module created.
REM //========================================================================
setlocal
setlocal enabledelayedexpansion
pushd .
REM =======================================================================
REM Check Parameter
REM =======================================================================
set TestFiles=%3
set TestFiles=%TestFiles:"=%
@if "%1"=="" goto HELP
@if "%2"=="" goto HELP
@if "%TestFiles%"=="" goto NO_PARSE
set TestFiles=%TestFiles:,= %
:NO_PARSE
REM =======================================================================
REM Show Parameter
REM =======================================================================
echo =======================================================================
echo Build Parameter
echo =======================================================================
echo Project = %1
echo Configuration = %2
echo Unit Test Executable = %TestFiles%
echo =======================================================================
echo .
REM =======================================================================
REM Setup the VS2017 environment
REM =======================================================================
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\vsdevcmd"
REM
REM =======================================================================
REM Rebuild the project
REM =======================================================================
cd ..\..\..\BuildResults\msvc2017_x64
devenv %1.sln /rebuild %2
IF %ERRORLEVEL% NEQ 0 goto ERROR
REM
REM =======================================================================
REM Run all unit tests
REM =======================================================================
for %%f in (%TestFiles%) do (
start /WAIT %2\bin\%%f.exe
IF !ERRORLEVEL! NEQ 0 goto ERROR
)
REM
REM =======================================================================
REM Install files
REM =======================================================================
devenv %1.sln /build %2 /Project INSTALL
IF %ERRORLEVEL% NEQ 0 goto ERROR
goto END
REM
REM =======================================================================
REM Error
REM =======================================================================
:ERROR
echo Error during build ...
exit /b 1
REM
REM =======================================================================
REM HELP
REM =======================================================================
:HELP
echo Usage BuildVs2017Project [ProjectName] [Configuration] [UnitTestExe]
echo .
:END
exit /b 0

View file

@ -0,0 +1,35 @@
#//========================================================================
#// Copyright (c) Technische Software Entwicklung Plazotta © 2021
#//
#// DESCRIPTION:
#// Shell Script to Build a cmake project under linux, running the Unittest and finally start teh install step
#//
#// HISTORY:
#// 09.04.2021 / PP
#// Module created.
#//========================================================================
#!/bin/bash
#
#=======================================================================
# Check Parameter
#=======================================================================
if [ -z "$1" ]
then
echo "usage: RunUnitTest [UnitTestExe]"
exit 2
fi
#=======================================================================
# Run Unit Test
#=======================================================================
#- Get the RUNPATH and setup the LD_LIBRARY_PATH------------------------
USED_LD_PATH=$(readelf -d $1 | grep RUNPATH | awk 'NR > 1 {print $1}' RS='[' FS=']')
export LD_LIBRARY_PATH=$USED_LD_PATH
./$1
if [ $? -ne 0 ]; then
exit 1
fi
#
exit 0

Binary file not shown.

View file

@ -0,0 +1,65 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2019
#
# CMAKE project settings file
#
# History
# 29.09.2019 / Plazotta
# Template created.
#
#-----------------------------------------------------------------------------------------
# Macro for version parsing
#
MACRO( VERSION_STR_TO_INTS major minor patch version )
STRING( REGEX REPLACE "([0-9]+).[0-9]+.[0-9]+" "\\1" ${major} ${version} )
STRING( REGEX REPLACE "[0-9]+.([0-9]+).[0-9]+" "\\1" ${minor} ${version} )
STRING( REGEX REPLACE "[0-9]+.[0-9]+.([0-9]+)" "\\1" ${patch} ${version} )
ENDMACRO( VERSION_STR_TO_INTS )
#
#-----------------------------------------------------------------------------------------
# Define the global CMAKE settings
#
set(CMAKE_CONFIGURATION_TYPES Debug Release)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#
#-----------------------------------------------------------------------------------------
# Define LINUX
#
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
else()
set(LINUX FALSE)
endif()
#
#-----------------------------------------------------------------------------------------
# Define TSEP CMAKE GENERATOR
#
message(" Generate Generator ....")
#
IF(WIN32)
set(TSEP_CMAKE_GENERATOR ${CMAKE_GENERATOR})
set(TSEP_BUILD_CONFIGURATION $(Configuration))
ENDIF()
#
IF(LINUX)
VERSION_STR_TO_INTS(GCC_MAJOR GCC_MINOR GCC_PATH ${CMAKE_CXX_COMPILER_VERSION})
set(TSEP_CMAKE_GENERATOR "Linux-gcc-")
string(APPEND TSEP_CMAKE_GENERATOR ${GCC_MAJOR})
if(CMAKE_BINARY_DIR MATCHES "(Debug*)")
set(TSEP_BUILD_CONFIGURATION "Debug")
else()
set(TSEP_BUILD_CONFIGURATION "Release")
endif()
message(" Generate Generator -> Linux ...." ${TSEP_CMAKE_GENERATOR})
ENDIF()
#
#-----------------------------------------------------------------------------------------
# handle the product/developer build variables
#
if(NOT DEFINED TSEP_PRODUCT_BUILD)
set (TSEP_PRODUCT_BUILD 0)
endif()
#-----------------------------------------------------------------------------------------
#

View file

@ -0,0 +1,807 @@
include (CMakeParseArguments)
#/////////////////////////////////////////////////////////////////////////////////////////////////
####################################
#set_output_dir
# Description:
# Change the output directory of the project to given folder
# for all configurations
#
# Syntax:
# set_output_dir(foldername)
####################################
macro (set_output_dir DIR)
foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES})
# make configuration variable upper case for CMAKE macros
string(TOUPPER ${CONFIG} CONFIGUPPERCASE)
# set directories
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIGUPPERCASE} ${DIR})
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIGUPPERCASE} ${DIR})
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIGUPPERCASE} ${DIR})
set( CMAKE_PDB_OUTPUT_DIRECTORY_${CONFIGUPPERCASE} ${DIR})
endforeach (CONFIG ${CMAKE_CONFIGURATION_TYPES})
endmacro (set_output_dir)
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_TRANSLATE)
# define file lists for all languages
foreach(arg IN LISTS ARGN)
set(TRANSLATION_FILES_ORIG
${TRANSLATION_FILES_ORIG}
resources/${PROJECT_NAME}_${arg}_generated.ts
)
set(TRANSLATION_FILES
${TRANSLATION_FILES}
resources/${PROJECT_NAME}_${arg}.ts
)
set(TRANSLATION_RESOURCE_LIST
${TRANSLATION_RESOURCE_LIST}
"<file>${PROJECT_NAME}_${arg}.qm</file>"
)
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/resources/${PROJECT_NAME}_${arg}.ts)
configure_file(${TSEP_PROJECT_CMAKE}/Templates/Translation.Template.ts ${CMAKE_CURRENT_LIST_DIR}/resources/${PROJECT_NAME}_${arg}.ts COPYONLY)
endif()
endforeach()
# replace all ";" from the resource list
string(REPLACE ";" "\n " TRANSLATION_RESOURCE_STRING "${TRANSLATION_RESOURCE_LIST}")
if (WIN32)
# copy project specific *translations.qrc to the resources folder
configure_file(${TSEP_PROJECT_CMAKE}/Templates/Translations.Template.qrc ${CMAKE_CURRENT_LIST_DIR}/resources/${PROJECT_NAME}_translations.qrc @ONLY)
endif()
# call qt translation functions
qt5_create_translation(ORIG_TRANSLATIONS ${CMAKE_CURRENT_LIST_DIR} ${TRANSLATION_FILES_ORIG})
qt5_add_translation(QM_FILES ${TRANSLATION_FILES})
configure_file(resources/${PROJECT_NAME}_translations.qrc ${CMAKE_BINARY_DIR}/${PROJECT_NAME} COPYONLY)
# define TSEP_TRANSLATION_FILES in parent scope so it can be added to the project by add_executable or add_library
set(TSEP_TRANSLATION_FILES_LOCAL ${TRANSLATION_FILES} ${TRANSLATION_FILES_ORIG} ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}_translations.qrc)
set(TSEP_TRANSLATION_FILES ${TSEP_TRANSLATION_FILES_LOCAL} PARENT_SCOPE)
# Group the files in the solution
source_group("Translation Files" FILES ${TSEP_TRANSLATION_FILES_LOCAL})
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_SETUP_DLL_VERSION ComponentDescription)
#------------------------------------------------------------------------------
# Windows Version Description with Resource Files
if(WIN32)
add_definitions(-DVER_COMPANYNAME_STR="${TSEP_COMPANY_LONGNAME}")
add_definitions(-DVER_FILEVERSION_STR="${TSEP_PRODUCT_VERSION}")
add_definitions(-DVER_FILEVERSION=${TSEP_PRODUCT_VERSION})
add_definitions(-DVER_FILEDESCRIPTION_STR="${ComponentDescription}")
add_definitions(-DVER_LEGALCOPYRIGHT_STR="${TSEP_COPYRIGHT_STRING}")
add_definitions(-DVER_PRODUCTNAME_STR="${TSEP_PROJECT}")
set(AUTOMATED_VERSION_FILES
${TSEP_DLL_VERSION_RC}
)
source_group("Automated Version Files" FILES ${AUTOMATED_VERSION_FILES})
else()
# define entry point for shared library to print the version information
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-e,tsep_version_entry_point" PARENT_SCOPE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-e,tsep_version_entry_point" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wl,-e,tsep_version_entry_point" PARENT_SCOPE)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wl,-e,tsep_version_entry_point" PARENT_SCOPE)
endif()
add_definitions(-DTSEP_VERSION="${TSEP_VERSION}")
add_definitions(-DTSEP_VERSION_MAJOR=${TSEP_VERSION_MAJOR})
add_definitions(-DTSEP_VERSION_MINOR=${TSEP_VERSION_MINOR})
add_definitions(-DTSEP_VERSION_PATCH=${TSEP_VERSION_PATCH})
add_definitions(-DTSEP_PRODUCT_NAME="${TSEP_PRODUCT_NAME}")
add_definitions(-DTSEP_COPYRIGHT="${TSEP_COPYRIGHT_STRING}")
add_definitions(-DTSEP_COMPANY_NAME="${TSEP_COMPANY_LONGNAME}")
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_SETUP_APP_VERSION ComponentDescription)
#------------------------------------------------------------------------------
# Windows Version Description with Resource Files
if(WIN32)
add_definitions(-DVER_COMPANYNAME_STR="${TSEP_COMPANY_LONGNAME}")
add_definitions(-DVER_FILEVERSION_STR="${TSEP_PRODUCT_VERSION}")
add_definitions(-DVER_FILEVERSION=${TSEP_PRODUCT_VERSION})
add_definitions(-DVER_FILEDESCRIPTION_STR="${ComponentDescription}")
add_definitions(-DVER_LEGALCOPYRIGHT_STR="${TSEP_COPYRIGHT_STRING}")
add_definitions(-DVER_PRODUCTNAME_STR="${TSEP_PROJECT}")
set(AUTOMATED_VERSION_FILES
${TSEP_APP_VERSION_RC}
)
source_group("Automated Version Files" FILES ${AUTOMATED_VERSION_FILES})
endif()
add_definitions(-DTSEP_VERSION="${TSEP_VERSION}")
add_definitions(-DTSEP_VERSION_MAJOR=${TSEP_VERSION_MAJOR})
add_definitions(-DTSEP_VERSION_MINOR=${TSEP_VERSION_MINOR})
add_definitions(-DTSEP_VERSION_PATCH=${TSEP_VERSION_PATCH})
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_ADD_EXPORT_FILE )
message(" Generating import cmake file for project / " ${PROJECT_NAME})
set(TEMP_PRODUCT_NAME "Tsep.")
string(APPEND TEMP_PRODUCT_NAME ${TSEP_PRODUCT_NAME})
set(TEMP_PROJECT_COLON_NAME "")
string(REPLACE "." "::" TEMP_PROJECT_COLON_NAME ${TEMP_PRODUCT_NAME})
set(TEMP_PROJECT_SIMPLE_NAME "")
string(REPLACE "." "" TEMP_PROJECT_SIMPLE_NAME ${TEMP_PRODUCT_NAME})
set(TEMP_PROJECT_DOT_NAME ${TEMP_PRODUCT_NAME})
string(TOUPPER ${TSEP_PRODUCT_NAME} TEMP_CMAKE_PROJECT_NAME)
#message("Colon " ${TEMP_PROJECT_COLON_NAME})
#message("Dot " ${TEMP_PROJECT_DOT_NAME})
#message("Simple " ${TEMP_PROJECT_SIMPLE_NAME})
# Copy the nuspec template file and configure it for the product
configure_file( ${TSEP_PROJECT_CMAKE}/Templates/CMakeLists.Import.Template ${TSEP_EXPORT_DIR}/${TEMP_PROJECT_SIMPLE_NAME}Config.cmake @ONLY )
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_ADD_EXPORT_HEADER HeaderList)
message(" Generating custom action to export header files for project / " ${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HeaderList}")
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_ADD_PROJECT_NEXUS_UPLOAD)
# Lower case for configuration flag
string( TOLOWER ${TSEP_UPDATE_IN_NEXUS} TSEP_UPDATE_IN_NEXUS_LOWER )
# Add a new target if Nexus upload is requested
if( TSEP_UPDATE_IN_NEXUS_LOWER STREQUAL "true" )
message(" Generating Nexus upload project for product / " ${TSEP_PRODUCT_NAME})
# Copy the nuspec template file and configure it for the product
configure_file( ${TSEP_PROJECT_CMAKE}/Templates/CMake.nuspec.Template ${TSEP_EXPORT_DIR}/${TSEP_PRODUCT_NAME}.nuspec )
# Copy the template nexus upload cmake file
file(MAKE_DIRECTORY NEXUS_UPLOAD)
file(COPY ${TSEP_PROJECT_CMAKE}/Templates/CMakeLists.Nexus.Template.cmake DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/NEXUS_UPLOAD )
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/NEXUS_UPLOAD/CMakeLists.Nexus.Template.cmake ${CMAKE_CURRENT_SOURCE_DIR}/NEXUS_UPLOAD/CMakeLists.txt )
# Create a new project for the nexus upload
add_subdirectory ( "NEXUS_UPLOAD" "${CMAKE_CURRENT_BINARY_DIR}/NEXUS_UPLOAD" )
endif()
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_THIRDPARTY_NEXUS_UPLOAD)
# Lower case for configuration flag
string( TOLOWER ${TSEP_UPDATE_IN_NEXUS} TSEP_UPDATE_IN_NEXUS_LOWER )
# Add a new target if Nexus upload is requested
if( TSEP_UPDATE_IN_NEXUS_LOWER STREQUAL "true" )
message(" Executing Nexus upload for third party product / " ${TSEP_PRODUCT_NAME})
# Create package
execute_process( WORKING_DIRECTORY ${TSEP_EXPORT_DIR}
COMMAND ${TSEP_NUGET_APPLICATION} pack ${TSEP_EXPORT_DIR}/${TSEP_PRODUCT_NAME}.nuspec -outputdirectory ${TSEP_EXPORT_DIR} -BasePath ${TSEP_EXPORT_DIR} -verbosity detailed
)
execute_process( WORKING_DIRECTORY ${TSEP_EXPORT_DIR}
COMMAND ${TSEP_NUGET_APPLICATION} push *.nupkg ${TSEP_NEXUS_GUID} -source ${TSEP_NEXUS_URL}/Development/ -verbosity detailed
)
endif()
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_ADD_PROJECT_CODE_ANALYZER)
# Visual Studio
if(WIN32)
message(" Generating Visual Studio Code Analyzer project for product / " ${TSEP_PRODUCT_NAME})
# Copy the template Nexus upload CMake file
file(MAKE_DIRECTORY VS_CODE_ANALYZER)
file(COPY ${TSEP_PROJECT_CMAKE}/Templates/CMakeLists.VS_CodeAnalyzer.Template.cmake DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/VS_CODE_ANALYZER )
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/VS_CODE_ANALYZER/CMakeLists.VS_CodeAnalyzer.Template.cmake ${CMAKE_CURRENT_SOURCE_DIR}/VS_CODE_ANALYZER/CMakeLists.txt )
# Create a new project for the Visual Studio CodeAnalyzer
add_subdirectory ( "VS_CODE_ANALYZER" "${CMAKE_CURRENT_BINARY_DIR}/VS_CODE_ANALYZER" )
endif()
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
MACRO(TSEP_GET_HEADER_DIRECTORIES return_list target_dir)
FILE(GLOB_RECURSE new_list ${target_dir}/*.h)
SET(dir_list "")
FOREACH(file_path ${new_list})
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
SET(dir_list ${dir_list} ${dir_path})
ENDFOREACH()
LIST(REMOVE_DUPLICATES dir_list)
SET(${return_list} ${dir_list})
ENDMACRO()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_ADD_OS_SPECIFIC_SETTINGS)
IF (WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC Iphlpapi.lib)
target_link_libraries(${PROJECT_NAME} PUBLIC Shlwapi.lib)
target_link_libraries(${PROJECT_NAME} PUBLIC Ws2_32.lib)
ENDIF()
IF (LINUX)
target_link_libraries(${PROJECT_NAME} PUBLIC dl)
target_link_libraries(${PROJECT_NAME} PUBLIC pthread)
target_link_libraries(${PROJECT_NAME} PUBLIC rt)
target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs)
ENDIF()
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX d)
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_CREATE_LINK_FOR_DIRECTORY directory_for_search)
if(WIN32)
#- Get all files from the given directory
file(GLOB FILES_TO_LINK ${directory_for_search}/bin/*.dll ${directory_for_search}/bin/*.exe)
#- Loop over all files
foreach(file_and_path_to_link ${FILES_TO_LINK})
#- Get the file name from the complete path
get_filename_component(file_to_link ${file_and_path_to_link} NAME)
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${file_and_path_to_link} native_file_and_path_to_link)
#- create the link
if(EXISTS "${PROJECT_BINARY_DIR}/Debug/bin/${file_to_link}")
file(REMOVE "${PROJECT_BINARY_DIR}/Debug/bin/${file_to_link}")
endif()
execute_process( WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/Debug/bin
COMMAND cmd.exe /c mklink "${file_to_link}" "${native_file_and_path_to_link}"
OUTPUT_QUIET)
#- create the link
if(EXISTS "${PROJECT_BINARY_DIR}/Release/bin/${file_to_link}")
file(REMOVE "${PROJECT_BINARY_DIR}/Release/bin/${file_to_link}")
endif()
execute_process( WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/Release/bin
COMMAND cmd.exe /c mklink "${file_to_link}" "${native_file_and_path_to_link}"
OUTPUT_QUIET)
endforeach()
endif()
endmacro()
#//////////////////////////////////////////////////////////////////////
macro(TSEP_USE_GOOGLE_TESTING)
message(" Enabling the Google Test Framework ")
enable_testing()
if(WIN32)
set(GTEST_ROOT ${TSEP_PROJECT_GOOGLE.TEST}/${TSEP_CMAKE_GENERATOR}) # <- Working hand-in-hand with the google export!
endif()
find_package(GTest REQUIRED)
if(WIN32)
TSEP_CREATE_LINK_FOR_DIRECTORY(${TSEP_PROJECT_GOOGLE.TEST}/${TSEP_CMAKE_GENERATOR})
endif()
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_CREATE_EXPORT)
#- Only for developer build
if(NOT TSEP_PRODUCT_BUILD)
message(" Generating custom action to export files for project / " ${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME}
EXPORT ${MAIN_PROJECT_NAME}Config
RUNTIME DESTINATION bin/${TSEP_CMAKE_GENERATOR}
LIBRARY DESTINATION bin/${TSEP_CMAKE_GENERATOR}
ARCHIVE DESTINATION bin/${TSEP_CMAKE_GENERATOR}
PUBLIC_HEADER DESTINATION inc
)
if (WIN32 AND NOT ${ARGC})
install (FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION bin/${TSEP_CMAKE_GENERATOR} OPTIONAL)
endif()
install(EXPORT ${MAIN_PROJECT_NAME}Config
DESTINATION bin/${TSEP_CMAKE_GENERATOR}/cmake
NAMESPACE Tsep::
)
endif()
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_PROVIDE_UNITTEST_FILES TestFileList)
message(" Generating custom action to provide the test file in the tmp directory / " ${PROJECT_NAME})
if (WIN32)
file(TO_NATIVE_PATH $ENV{TMP}/${PROJECT_NAME} DEST_DIR)
else()
file(TO_NATIVE_PATH /tmp/${PROJECT_NAME} DEST_DIR)
endif()
#- Add pre-link step to the copy the source files
add_custom_command(TARGET ${PROJECT_NAME}
DEPENDS ${TestFileList}
COMMENT "Provide Unit Test Files..."
POST_BUILD
VERBATIM
WORKING_DIRECTORY
COMMAND_EXPAND_LISTS
COMMAND ${CMAKE_COMMAND} -E remove_directory ${DEST_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TestFileList} ${DEST_DIR}
)
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_PROVIDE_APPLICATION_DATA_FILES ApplicationName AppDataFileList)
message(" Generating custom action to provide the application data file in the application data directory / " ${ApplicationName})
# Calculate the length of the loop
list(LENGTH ${AppDataFileList} len1)
math(EXPR len2 "${len1} / 2")
# Loop over the array
foreach(val RANGE 0 ${len2} 2)
# Calculate the next idx
math(EXPR valN "${val} + 1")
# Get the items
list(GET ${AppDataFileList} ${val} SubFolder)
list(GET ${AppDataFileList} ${valN} FileName)
# Do copy
if("${SubFolder}" STREQUAL "")
TSEP_PROVIDE_APPLICATION_DATA_FILES_IN_ROOTFOLDER(${ApplicationName} ${FileName})
else()
TSEP_PROVIDE_APPLICATION_DATA_FILES_IN_SUBFOLDER(${ApplicationName} ${SubFolder} ${FileName})
endif()
# message(STATUS "${val1} ${val2}")
endforeach()
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_PROVIDE_APPLICATION_DATA_FILES_IN_ROOTFOLDER ApplicationName AppDataFile)
message(" Generating custom action to provide the application data file -> ${AppDataFile}")
if (WIN32)
file(TO_NATIVE_PATH $ENV{PROGRAMDATA}/Tsep/${ApplicationName} DEST_DIR)
else()
file(TO_NATIVE_PATH $ENV{HOME}/.local/share DEST_DIR)
endif()
#- Add pre-link step to the copy the source files
add_custom_command(TARGET ${PROJECT_NAME}
DEPENDS ${AppDataFileList}
POST_BUILD
VERBATIM
WORKING_DIRECTORY
COMMAND_EXPAND_LISTS
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${AppDataFile} ${DEST_DIR}
)
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
macro(TSEP_PROVIDE_APPLICATION_DATA_FILES_IN_SUBFOLDER ApplicationName SubFolder AppDataFile)
message(" Generating custom action to provide the application data file in folder ${SubFolder} -> ${AppDataFile}")
if (WIN32)
file(TO_NATIVE_PATH $ENV{PROGRAMDATA}/Tsep/${ApplicationName}/${SubFolder} DEST_DIR)
else()
file(TO_NATIVE_PATH $ENV{HOME}/.local/share/${SubFolder} DEST_DIR)
endif()
#- Add pre-link step to the copy the source files
add_custom_command(TARGET ${PROJECT_NAME}
DEPENDS ${AppDataFileList}
POST_BUILD
VERBATIM
WORKING_DIRECTORY
COMMAND_EXPAND_LISTS
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${AppDataFile} ${DEST_DIR}
)
endmacro()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_GENERATE_DEPENDENCY_LINKS)
message(" Generating executable links for all dependencies")
# Generate the link only if we are in developer mode
if(NOT TSEP_PRODUCT_BUILD)
# Debug ----------------------------------------------------------------------------------------
TSEP_GENERATE_DEPENDENCY_LINKS_FOR_CONFIGURATION(Debug)
TSEP_GENERATE_ADDED_DEPENDENCY_LINKS_FOR_CONFIGURATION(Debug)
# Release ----------------------------------------------------------------------------------------
TSEP_GENERATE_DEPENDENCY_LINKS_FOR_CONFIGURATION(Release)
TSEP_GENERATE_ADDED_DEPENDENCY_LINKS_FOR_CONFIGURATION(Release)
endif()
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_GENERATE_DEPENDENCY_LINKS_FOR_CONFIGURATION)
get_target_property(ExecutableLinks ${PROJECT_NAME} LINK_LIBRARIES)
set (CONTAINS_QT_PROJECT_GLOBAL FALSE)
# For all files --------------------------------------------------------------------------------
foreach (Executable ${ExecutableLinks})
set (CONTAINS_QT_PROJECT FALSE)
set (CONTAINS_SSL_PROJECT FALSE)
set (CONTAINS_CRYPTO_PROJECT FALSE)
set (CONTAINS_TSEP_PROJECT FALSE)
string(FIND ${Executable} "Tsep::" TsepExecutable)
if (TsepExecutable GREATER -1)
set (CONTAINS_TSEP_PROJECT TRUE)
endif()
if(WIN32)
string(FIND ${Executable} "Qt5::" QtExecutable)
if (QtExecutable GREATER -1)
set (CONTAINS_QT_PROJECT TRUE)
set (CONTAINS_QT_PROJECT_GLOBAL TRUE)
endif()
string(FIND ${Executable} "OpenSSL::SSL" OpenSslExecutable)
if (OpenSslExecutable GREATER -1)
set (CONTAINS_SSL_PROJECT TRUE)
endif()
string(FIND ${Executable} "OpenSSL::Crypto" OpenSslExecutable)
if (OpenSslExecutable GREATER -1)
set (CONTAINS_CRYPTO_PROJECT TRUE)
endif()
endif()
if(CONTAINS_TSEP_PROJECT OR CONTAINS_QT_PROJECT OR CONTAINS_SSL_PROJECT OR CONTAINS_CRYPTO_PROJECT)
# at the moment not needed for linux
if(WIN32)
if(CONTAINS_SSL_PROJECT)
set(LinkFile ${OPENSSL_ROOT_DIR}/bin/libssl-1_1-x64.dll)
elseif(CONTAINS_CRYPTO_PROJECT)
set(LinkFile ${OPENSSL_ROOT_DIR}/bin/libcrypto-1_1-x64.dll)
elseif (${ARGV0} STREQUAL Debug)
get_target_property(LinkFile ${Executable} LOCATION_DEBUG)
else()
get_target_property(LinkFile ${Executable} LOCATION_RELEASE)
endif()
#- Get the file name from the complete path
get_filename_component(LinkFileName ${LinkFile} NAME)
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${LinkFile} LinkFileNative)
#- remove the file if it exists
if(EXISTS "${PROJECT_BINARY_DIR}/${ARGV0}/bin/${LinkFileName}")
file(REMOVE "${PROJECT_BINARY_DIR}/${ARGV0}/bin/${LinkFileName}")
endif()
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${LinkFileName} LinkFileNameNative)
execute_process( WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${ARGV0}/bin
COMMAND cmd.exe /c mklink "${LinkFileNameNative}" "${LinkFileNative}"
OUTPUT_QUIET)
endif()
endif()
endforeach()
# Qt platforms and iconengines have special destination folders
if(${CONTAINS_QT_PROJECT_GLOBAL})
set(PLATFORMS_DIR ${Qt5_DIR}/../../../plugins/platforms)
file(TO_NATIVE_PATH ${PLATFORMS_DIR} NATIVE_PLATFORMS_DIR)
execute_process(WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${ARGV0}/bin
COMMAND cmd.exe /c mklink /D platforms "${NATIVE_PLATFORMS_DIR}"
OUTPUT_QUIET)
set(ICONENGINES_DIR ${Qt5_DIR}/../../../plugins/iconengines)
file(TO_NATIVE_PATH ${ICONENGINES_DIR} NATIVE_ICONENGINES_DIR)
execute_process(WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${ARGV0}/bin
COMMAND cmd.exe /c mklink /D iconengines "${NATIVE_ICONENGINES_DIR}"
OUTPUT_QUIET)
endif()
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
# creates dependency links for dynamically loaded libraries under windows and extends the rpath under linux
function(TSEP_GENERATE_ADDED_DEPENDENCY_LINKS_FOR_CONFIGURATION)
get_target_property(ExecutableLinks ${PROJECT_NAME} MANUALLY_ADDED_DEPENDENCIES)
# For all files --------------------------------------------------------------------------------
foreach (Executable ${ExecutableLinks})
set (CONTAINS_TSEP_PROJECT FALSE)
string(FIND ${Executable} "Tsep::" TsepExecutable)
if (TsepExecutable GREATER -1)
set (CONTAINS_TSEP_PROJECT TRUE)
endif()
if(CONTAINS_TSEP_PROJECT)
if (${ARGV0} STREQUAL Debug)
get_target_property(LinkFile ${Executable} LOCATION_DEBUG)
else()
get_target_property(LinkFile ${Executable} LOCATION_RELEASE)
endif()
if(WIN32)
#- Get the file name from the complete path
get_filename_component(LinkFileName ${LinkFile} NAME)
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${LinkFile} LinkFileNative)
#- create the link
#- remove the file if it exists
if(EXISTS "${PROJECT_BINARY_DIR}/${ARGV0}/bin/${LinkFileName}")
file(REMOVE "${PROJECT_BINARY_DIR}/${ARGV0}/bin/${LinkFileName}")
endif()
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${LinkFileName} LinkFileNameNative)
execute_process( WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${ARGV0}/bin
COMMAND cmd.exe /c mklink "${LinkFileNameNative}" "${LinkFileNative}"
OUTPUT_QUIET)
else()
#- Get the path of the file
get_filename_component(LinkDirectoryName ${LinkFile} DIRECTORY)
get_target_property(OLD_RPATH ${PROJECT_NAME} BUILD_RPATH)
if (${OLD_PATH})
set_property(TARGET ${PROJECT_NAME} PROPERTY BUILD_RPATH "${OLD_RPATH};${LinkDirectoryName}")
else()
set_property(TARGET ${PROJECT_NAME} PROPERTY BUILD_RPATH "$ORIGIN;${LinkDirectoryName}")
endif()
endif()
endif()
endforeach()
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_GENERATE_CUSTOM_DEPENDENCY_LINK)
message(" Generating executable links for all dependencies")
# Debug ----------------------------------------------------------------------------------------
TSEP_GENERATE_CUSTOM_DEPENDENCY_LINK_FOR_CONFIGURATION(Debug ${ARGV0} ${ARGV1})
# Release ----------------------------------------------------------------------------------------
TSEP_GENERATE_CUSTOM_DEPENDENCY_LINK_FOR_CONFIGURATION(Release ${ARGV0} ${ARGV1})
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_GENERATE_CUSTOM_DEPENDENCY_LINK_FOR_CONFIGURATION)
#- Get the file name from the complete path
set(LinkFile ${ARGV1})
get_filename_component(LinkFileName ${LinkFile} NAME)
if(${ARGC} GREATER 2)
set(LinkFileName ${ARGV2}/${LinkFileName})
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${ARGV0}/bin/${ARGV2})
endif()
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${LinkFile} LinkFileNative)
#- create the link
if(WIN32)
#- remove the file if it exists
if(EXISTS "${PROJECT_BINARY_DIR}/${ARGV0}/bin/${LinkFileName}")
file(REMOVE "${PROJECT_BINARY_DIR}/${ARGV0}/bin/${LinkFileName}")
endif()
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${LinkFileName} LinkFileNameNative)
execute_process( WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${ARGV0}/bin
COMMAND cmd.exe /c mklink "${LinkFileNameNative}" "${LinkFileNative}"
OUTPUT_QUIET)
else()
file(COPY ${LinkFile} DESTINATION ${PROJECT_BINARY_DIR}/bin/)
endif()
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_GENERATE_CUSTOM_DEPENDENCY_TARGET_LINK)
message(" Generating executable links for all dependencies")
# Debug ----------------------------------------------------------------------------------------
TSEP_GENERATE_CUSTOM_DEPENDENCY_TARGET_LINK_FOR_CONFIGURATION(Debug ${ARGV0} ${ARGV1})
# Release ----------------------------------------------------------------------------------------
TSEP_GENERATE_CUSTOM_DEPENDENCY_TARGET_LINK_FOR_CONFIGURATION(Release ${ARGV0} ${ARGV1})
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_GENERATE_CUSTOM_DEPENDENCY_TARGET_LINK_FOR_CONFIGURATION)
#- Get the file name from the complete path
set(Executable ${ARGV1})
if (${ARGV0} STREQUAL Debug)
get_target_property(LinkFile ${Executable} LOCATION_DEBUG)
else()
get_target_property(LinkFile ${Executable} LOCATION_RELEASE)
endif()
get_filename_component(LinkFileName ${LinkFile} NAME)
if(${ARGC} GREATER 2)
set(LinkFileName ${ARGV2}/${LinkFileName})
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${ARGV0}/bin/${ARGV2})
endif()
#- create the link
if(WIN32)
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${LinkFile} LinkFileNative)
#- remove the file if it exists
if(EXISTS "${PROJECT_BINARY_DIR}/${ARGV0}/bin/${LinkFileName}")
file(REMOVE "${PROJECT_BINARY_DIR}/${ARGV0}/bin/${LinkFileName}")
endif()
#- convert the path into an operating system depending format
file(TO_NATIVE_PATH ${LinkFileName} LinkFileNameNative)
execute_process( WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${ARGV0}/bin
COMMAND cmd.exe /c mklink "${LinkFileNameNative}" "${LinkFileNative}"
OUTPUT_QUIET)
else()
message("${LinkFile} -> ${PROJECT_BINARY_DIR}/bin/${LinkFileName}")
file(COPY ${LinkFile} DESTINATION ${PROJECT_BINARY_DIR}/bin/)
endif()
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_USE_CODE_ANALYSIS ProjectName)
if (WIN32)
#- generate the poperty file only if it not exists
if(NOT EXISTS "${PROJECT_BINARY_DIR}/${TSEP_VS_PROP_FILE}")
message(" Create VS property sheet for code analysing for project / " ${ProjectName})
set(TsepConfigPropFile ${TSEP_PROJECT_CMAKE}/${TSEP_CA_RULESET_DIR}/${TSEP_VS_PROP_FILE})
file(TO_NATIVE_PATH ${TsepConfigPropFile} TsepConfigPropFileNative)
set(TsepCAFile ${TSEP_PROJECT_CMAKE}/${TSEP_CA_RULESET_DIR}/${TSEP_CA_RULESET_FILE})
file(TO_NATIVE_PATH ${TsepCAFile} TsepCAFileNative)
# Copy the nuspec template file and configure it for the product
configure_file(${TsepConfigPropFileNative} ${PROJECT_BINARY_DIR}/${TSEP_VS_PROP_FILE} @ONLY )
endif()
#- set the property
set_target_properties(${ProjectName} PROPERTIES VS_USER_PROPS ../${TSEP_VS_PROP_FILE})
endif()
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_ADD_AUTOBUILD_UNITTEST UnitExecutableName)
get_property(local_prop GLOBAL PROPERTY TSEP_AUTOBUILD_UNITTEST)
set(local_prop "${local_prop};${UnitExecutableName}")
set_property(GLOBAL PROPERTY TSEP_AUTOBUILD_UNITTEST ${local_prop})
#message("list " ${local_prop})
endfunction()
#/////////////////////////////////////////////////////////////////////////////////////////////////
function(TSEP_ADD_AUTOBUILD MainProjectName)
IF (INTIME)
set(TSEP_AUTOBUILD_DIR "${PROJECT_BINARY_DIR}/../../AutoBuild/INtime")
elseif (WIN32)
set(TSEP_AUTOBUILD_DIR "${PROJECT_BINARY_DIR}/../../AutoBuild/Windows")
elseif (LINUX)
set(TSEP_AUTOBUILD_DIR "${PROJECT_BINARY_DIR}/../AutoBuild/linux")
endif()
set(TSEP_AUTOBUILD_PROJECT ${MainProjectName})
get_property(local_prop GLOBAL PROPERTY TSEP_AUTOBUILD_UNITTEST)
message("-------------------------------------------------------")
message(" Auto Build Solution name : " ${TSEP_AUTOBUILD_PROJECT})
# Create the auto build directory
message(" Prepare auto build dir : " ${TSEP_AUTOBUILD_DIR})
if(EXISTS ${TSEP_AUTOBUILD_DIR})
file(REMOVE_RECURSE ${TSEP_AUTOBUILD_DIR})
endif()
file(MAKE_DIRECTORY ${TSEP_AUTOBUILD_DIR})
file(MAKE_DIRECTORY ${TSEP_AUTOBUILD_DIR}/scripts)
# Copy the files for the build, os dependend
IF (INTIME)
configure_file(${TSEP_PROJECT_CMAKE}/AutoBuild/BuildVs2017INtimeProject.cmd ${TSEP_AUTOBUILD_DIR}/scripts COPYONLY)
foreach (TSEP_AUTOBUILD_UNIT_EXE ${local_prop})
if("${TSEP_AUTOBUILD_USED_UNITTEST}" STREQUAL "")
set(TSEP_AUTOBUILD_USED_UNITTEST "${TSEP_AUTOBUILD_UNIT_EXE}")
else()
set(TSEP_AUTOBUILD_USED_UNITTEST "${TSEP_AUTOBUILD_USED_UNITTEST},${TSEP_AUTOBUILD_UNIT_EXE}")
endif()
endforeach()
message(" Auto Build Unittest : " ${TSEP_AUTOBUILD_USED_UNITTEST})
configure_file(${TSEP_PROJECT_CMAKE}/AutoBuild/BuildAllVS2017INtime.cmd ${TSEP_AUTOBUILD_DIR}/BuildAll.cmd @ONLY)
elseif (WIN32)
set(TSEP_AUTOBUILD_USED_UNITTEST "")
configure_file(${TSEP_PROJECT_CMAKE}/AutoBuild/BuildVS2017Project.cmd ${TSEP_AUTOBUILD_DIR}/scripts COPYONLY)
foreach (TSEP_AUTOBUILD_UNIT_EXE ${local_prop})
if("${TSEP_AUTOBUILD_USED_UNITTEST}" STREQUAL "")
set(TSEP_AUTOBUILD_USED_UNITTEST "${TSEP_AUTOBUILD_UNIT_EXE}")
else()
set(TSEP_AUTOBUILD_USED_UNITTEST "${TSEP_AUTOBUILD_USED_UNITTEST},${TSEP_AUTOBUILD_UNIT_EXE}")
endif()
endforeach()
message(" Auto Build Unittest : " ${TSEP_AUTOBUILD_USED_UNITTEST})
configure_file(${TSEP_PROJECT_CMAKE}/AutoBuild/BuildAllVS2017.cmd ${TSEP_AUTOBUILD_DIR}/BuildAll.cmd @ONLY)
elseif (LINUX)
configure_file(${TSEP_PROJECT_CMAKE}/AutoBuild/BuildLinuxProject.sh ${TSEP_AUTOBUILD_DIR}/scripts COPYONLY)
configure_file(${TSEP_PROJECT_CMAKE}/AutoBuild/RunUnitTest.sh ${TSEP_AUTOBUILD_DIR}/scripts COPYONLY)
foreach (TSEP_AUTOBUILD_UNIT_EXE ${local_prop})
if("${TSEP_AUTOBUILD_USED_UNITTEST}" STREQUAL "")
set(TSEP_AUTOBUILD_USED_UNITTEST "${TSEP_AUTOBUILD_UNIT_EXE}")
else()
set(TSEP_AUTOBUILD_USED_UNITTEST "${TSEP_AUTOBUILD_USED_UNITTEST},${TSEP_AUTOBUILD_UNIT_EXE}")
endif()
endforeach()
message(" Auto Build Unittest : " ${TSEP_AUTOBUILD_USED_UNITTEST})
configure_file(${TSEP_PROJECT_CMAKE}/AutoBuild/BuildAllLinux.sh ${TSEP_AUTOBUILD_DIR}/BuildAll.sh @ONLY)
endif()
endfunction()

View file

@ -0,0 +1,165 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2019
#
# CMAKE project settings file
#
# History
# 29.09.2019 / Plazotta
# Template created.
#
#-----------------------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------------------
# Define the project global CMAKE settings
#
set (TSEP_PROJECT_NAME ${PROJECT_NAME})
set (TSEP_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set (TSEP_EXPORT_DIR ${PROJECT_SOURCE_DIR}/../Export)
set (TSEP_BINARY_DIR ${PROJECT_BINARY_DIR})
set (TSEP_TARGET_DIR ${CMAKE_BINARY_DIR}/${TSEP_BUILD_CONFIGURATION})
set (TSEP_CA_RULESET_DIR RuleSets)
set (TSEP_CA_RULESET_FILE TsepNativeRecommendedRules.ruleset)
set (TSEP_VS_PROP_FILE TsepPropertySheet.props)
set(TSEP_AUTOBUILD_PROJECT "")
set_property(GLOBAL PROPERTY TSEP_AUTOBUILD_UNITTEST)
IF (WIN32)
set (TSEP_APPLICATION_ICON_PATH ${TSEP_PROJECT_CMAKE}"/Versions/Win32/TSEP.ico")
set (TSEP_APP_VERSION_RC ${TSEP_PROJECT_CMAKE}"/Versions/Win32/DefaultAppVersion.rc")
set (TSEP_DLL_VERSION_RC ${TSEP_PROJECT_CMAKE}"/Versions/Win32/DefaultDllVersion.rc")
set (TSEP_NUGET_APPLICATION nuget.exe)
ELSE()
set (TSEP_APPLICATION_ICON_PATH "")
set (TSEP_APP_VERSION_RC "")
set (TSEP_DLL_VERSION_RC "")
set (TSEP_NUGET_APPLICATION nuget)
ENDIF()
###############################################################################
###############################################################################
# SET INCLUDE PATH FOR CMAKE PROVIDED HEADERS
###############################################################################
include_directories(${CMAKE_CURRENT_LIST_DIR}/Includes)
###############################################################################
# PROJECT SPECIFIC VARIABLES
###############################################################################
###############################################################################
# COMPILER SETTINGS
###############################################################################
# Windows
###############################################################################
IF (WIN32)
#- Compiler Warning level 4 -> /W4 --------------------------------------------
#- Compiler Generate Debug Info -> /Zi ----------------------------------------
add_compile_options(
/W4
/Zi
)
#- Compile with UNICODE chars -------------------------------------------------
#- Compile with minimal windows libs --------------------------------------------
#- Minimum Windows is W7 (0x0601) ---------------------------------------------
#- No secure warnings ---------------------------------------------------------
add_definitions(
/DUNICODE
/D_UNICODE
/DWIN32_LEAN_AND_MEAN
/D_WIN32_WINNT=0x0601
/D_CRT_SECURE_NO_WARNINGS
)
add_link_options(
/Debug
)
ENDIF()
###############################################################################
# LINUX
###############################################################################
IF (LINUX)
#- Define for Intel linux -----------------------------------------------------
#- relocatable code ----------------------------------------------------------
add_compile_options(
-fPIC
-pthread
)
#add_definitions(
#)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-unknown-pragmas -Wno-pragma-once-outside-header -fvisibility=hidden")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -Wno-unknown-pragmas -Wno-pragma-once-outside-header -fvisibility=hidden")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_BUILD_RPATH "$ORIGIN")
ENDIF()
###############################################################################
# SET OUTPUT DIRECTORIES for exe, dll, lib and pdb files
###############################################################################
# must set directories for each configuration,
if(WIN32)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/../../Export)
# cmake can not use the $(Configuration) variable, so we must define separate debug and release variables
set(TSEP_TARGET_DIR ${CMAKE_BINARY_DIR}/$(Configuration))
set(TSEP_TARGET_DIR_RELEASE ${CMAKE_BINARY_DIR}/Release)
set(TSEP_TARGET_DIR_DEBUG ${CMAKE_BINARY_DIR}/Debug)
else()
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/../Export)
set(TSEP_TARGET_DIR ${CMAKE_BINARY_DIR})
set(TSEP_TARGET_DIR_RELEASE ${CMAKE_BINARY_DIR})
set(TSEP_TARGET_DIR_DEBUG ${CMAKE_BINARY_DIR})
endif()
# set directories
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${TSEP_TARGET_DIR_RELEASE}/bin)
if(WIN32)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${TSEP_TARGET_DIR_RELEASE}/lib)
else()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${TSEP_TARGET_DIR_RELEASE}/bin)
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${TSEP_TARGET_DIR_RELEASE}/lib)
set(CMAKE_PDB_OUTPUT_DIRECTORY_RELEASE ${TSEP_TARGET_DIR_RELEASE}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${TSEP_TARGET_DIR_DEBUG}/bin)
if(WIN32)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${TSEP_TARGET_DIR_DEBUG}/lib)
else()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${TSEP_TARGET_DIR_DEBUG}/bin)
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${TSEP_TARGET_DIR_DEBUG}/lib)
set(CMAKE_PDB_OUTPUT_DIRECTORY_DEBUG ${TSEP_TARGET_DIR_DEBUG}/lib)
IF (WIN32)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/Debug/bin")
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/Release/bin")
ENDIF()
###############################################################################
message(NOTICE "------------------------------------------------------------")
message(NOTICE " Used Generator = ${TSEP_CMAKE_GENERATOR}")
message(NOTICE " Used Config = ${TSEP_BUILD_CONFIGURATION}")
message(NOTICE " Used Project = ${TSEP_PROJECT_NAME}")
message(NOTICE " Source path = ${TSEP_SOURCE_DIR}")
message(NOTICE " Binary path = ${TSEP_BINARY_DIR}")
message(NOTICE " Target path = ${TSEP_TARGET_DIR}")
message(NOTICE " Product Build = ${TSEP_PRODUCT_BUILD}")
message(NOTICE "------------------------------------------------------------")
###############################################################################

View file

@ -0,0 +1,28 @@
// define the version string and embed it into the binary
extern "C" const char TSEP_BINARY_VERSION[] = "TSEP_VERSION:" TSEP_VERSION;
#ifdef __linux__
#ifdef TSEP_SHARED_LIBRARY
// if TSEP_SHARED_LIBRARY is defined an entry point for a shared library will be defined
// which will print the binary infromation
#include <stdio.h>
#include <stdlib.h>
extern "C" const char interp_path[] __attribute__((section(".interp"))) = "/lib64/ld-linux-x86-64.so.2";
extern "C" void tsep_version_entry_point()
{
printf(TSEP_PRODUCT_NAME " " TSEP_VERSION "\n");
printf(TSEP_COPYRIGHT "\n");
printf("Compiled by GCC %d.%d", __GNUC__, __GNUC_MINOR__);
#ifdef _DEBUG
printf(" (debug build)");
#endif
printf("\n");
exit(0);
}
#endif
#endif

View file

@ -0,0 +1,283 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="TSEP Native Recommended Rules" Description="These rules focus on the most critical and common problems in your native code, including potential security holes and application crashes. You should include this rule set in any custom rule set you create for your native projects. This ruleset is designed to work with Visual Studio Professional edition and higher." ToolsVersion="15.0">
<Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized">
<Name Resource="Tsep Rules" />
<Description Resource="Tsep" />
</Localization>
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C6001" Action="Warning" />
<Rule Id="C6011" Action="Warning" />
<Rule Id="C6014" Action="Warning" />
<Rule Id="C6029" Action="Warning" />
<Rule Id="C6031" Action="Warning" />
<Rule Id="C6053" Action="Warning" />
<Rule Id="C6054" Action="Warning" />
<Rule Id="C6059" Action="Warning" />
<Rule Id="C6063" Action="Warning" />
<Rule Id="C6064" Action="Warning" />
<Rule Id="C6066" Action="Warning" />
<Rule Id="C6067" Action="Warning" />
<Rule Id="C6101" Action="Warning" />
<Rule Id="C6200" Action="Warning" />
<Rule Id="C6201" Action="Warning" />
<Rule Id="C6214" Action="Warning" />
<Rule Id="C6215" Action="Warning" />
<Rule Id="C6216" Action="Warning" />
<Rule Id="C6217" Action="Warning" />
<Rule Id="C6220" Action="Warning" />
<Rule Id="C6226" Action="Warning" />
<Rule Id="C6230" Action="Warning" />
<Rule Id="C6235" Action="Warning" />
<Rule Id="C6236" Action="Warning" />
<Rule Id="C6237" Action="Warning" />
<Rule Id="C6242" Action="Warning" />
<Rule Id="C6248" Action="Warning" />
<Rule Id="C6250" Action="Warning" />
<Rule Id="C6255" Action="Warning" />
<Rule Id="C6258" Action="Warning" />
<Rule Id="C6259" Action="Warning" />
<Rule Id="C6260" Action="Warning" />
<Rule Id="C6262" Action="Warning" />
<Rule Id="C6263" Action="Warning" />
<Rule Id="C6268" Action="Warning" />
<Rule Id="C6269" Action="Warning" />
<Rule Id="C6270" Action="Warning" />
<Rule Id="C6271" Action="Warning" />
<Rule Id="C6272" Action="Warning" />
<Rule Id="C6273" Action="Warning" />
<Rule Id="C6274" Action="Warning" />
<Rule Id="C6276" Action="Warning" />
<Rule Id="C6277" Action="Warning" />
<Rule Id="C6278" Action="Warning" />
<Rule Id="C6279" Action="Warning" />
<Rule Id="C6280" Action="Warning" />
<Rule Id="C6281" Action="Warning" />
<Rule Id="C6282" Action="Warning" />
<Rule Id="C6283" Action="Warning" />
<Rule Id="C6284" Action="Warning" />
<Rule Id="C6285" Action="Warning" />
<Rule Id="C6286" Action="Warning" />
<Rule Id="C6287" Action="Warning" />
<Rule Id="C6288" Action="Warning" />
<Rule Id="C6289" Action="Warning" />
<Rule Id="C6290" Action="Warning" />
<Rule Id="C6291" Action="Warning" />
<Rule Id="C6292" Action="Warning" />
<Rule Id="C6293" Action="Warning" />
<Rule Id="C6294" Action="Warning" />
<Rule Id="C6295" Action="Warning" />
<Rule Id="C6296" Action="Warning" />
<Rule Id="C6297" Action="Warning" />
<Rule Id="C6299" Action="Warning" />
<Rule Id="C6302" Action="Warning" />
<Rule Id="C6303" Action="Warning" />
<Rule Id="C6305" Action="Warning" />
<Rule Id="C6306" Action="Warning" />
<Rule Id="C6308" Action="Warning" />
<Rule Id="C6310" Action="Warning" />
<Rule Id="C6312" Action="Warning" />
<Rule Id="C6314" Action="Warning" />
<Rule Id="C6317" Action="Warning" />
<Rule Id="C6318" Action="Warning" />
<Rule Id="C6319" Action="Warning" />
<Rule Id="C6324" Action="Warning" />
<Rule Id="C6328" Action="Warning" />
<Rule Id="C6331" Action="Warning" />
<Rule Id="C6332" Action="Warning" />
<Rule Id="C6333" Action="Warning" />
<Rule Id="C6335" Action="Warning" />
<Rule Id="C6381" Action="Warning" />
<Rule Id="C6383" Action="Warning" />
<Rule Id="C6384" Action="Warning" />
<Rule Id="C6385" Action="Warning" />
<Rule Id="C6386" Action="Warning" />
<Rule Id="C6387" Action="Warning" />
<Rule Id="C6388" Action="Warning" />
<Rule Id="C6500" Action="Warning" />
<Rule Id="C6501" Action="Warning" />
<Rule Id="C6503" Action="Warning" />
<Rule Id="C6504" Action="Warning" />
<Rule Id="C6505" Action="Warning" />
<Rule Id="C6506" Action="Warning" />
<Rule Id="C6508" Action="Warning" />
<Rule Id="C6509" Action="Warning" />
<Rule Id="C6510" Action="Warning" />
<Rule Id="C6511" Action="Warning" />
<Rule Id="C6513" Action="Warning" />
<Rule Id="C6514" Action="Warning" />
<Rule Id="C6515" Action="Warning" />
<Rule Id="C6516" Action="Warning" />
<Rule Id="C6517" Action="Warning" />
<Rule Id="C6518" Action="Warning" />
<Rule Id="C6522" Action="Warning" />
<Rule Id="C6525" Action="Warning" />
<Rule Id="C6527" Action="Warning" />
<Rule Id="C6530" Action="Warning" />
<Rule Id="C6540" Action="Warning" />
<Rule Id="C6551" Action="Warning" />
<Rule Id="C6552" Action="Warning" />
<Rule Id="C6701" Action="Warning" />
<Rule Id="C6702" Action="Warning" />
<Rule Id="C6703" Action="Warning" />
<Rule Id="C6704" Action="Warning" />
<Rule Id="C6705" Action="Warning" />
<Rule Id="C6706" Action="Warning" />
<Rule Id="C6993" Action="Warning" />
<Rule Id="C6995" Action="Warning" />
<Rule Id="C6997" Action="Warning" />
<Rule Id="C26100" Action="Warning" />
<Rule Id="C26101" Action="Warning" />
<Rule Id="C26110" Action="Warning" />
<Rule Id="C26111" Action="Warning" />
<Rule Id="C26112" Action="Warning" />
<Rule Id="C26115" Action="Warning" />
<Rule Id="C26116" Action="Warning" />
<Rule Id="C26117" Action="Warning" />
<Rule Id="C26140" Action="Warning" />
<Rule Id="C26402" Action="Warning" />
<Rule Id="C26404" Action="Warning" />
<Rule Id="C26405" Action="Warning" />
<Rule Id="C26407" Action="Warning" />
<Rule Id="C26408" Action="Warning" />
<Rule Id="C26410" Action="Warning" />
<Rule Id="C26411" Action="Warning" />
<Rule Id="C26416" Action="Warning" />
<Rule Id="C26417" Action="Warning" />
<Rule Id="C26418" Action="Warning" />
<Rule Id="C26427" Action="Warning" />
<Rule Id="C26430" Action="Warning" />
<Rule Id="C26433" Action="Warning" />
<Rule Id="C26434" Action="Warning" />
<Rule Id="C26435" Action="Warning" />
<Rule Id="C26436" Action="Warning" />
<Rule Id="C26437" Action="Warning" />
<!-- Special function noexcept -->
<Rule Id="C26438" Action="Warning" />
<Rule Id="C26439" Action="Warning" />
<!-- Unnamed Guards/RAII objects -->
<Rule Id="C26441" Action="Warning" />
<Rule Id="C26443" Action="Warning" />
<Rule Id="C26444" Action="Warning" />
<!-- Span/View over temporary -->
<Rule Id="C26449" Action="Warning" />
<!-- Arithmetic overflow -->
<Rule Id="C26450" Action="Warning" />
<Rule Id="C26451" Action="Warning" />
<Rule Id="C26452" Action="Warning" />
<Rule Id="C26453" Action="Warning" />
<Rule Id="C26454" Action="Warning" />
<Rule Id="C26456" Action="Warning" />
<Rule Id="C26466" Action="Warning" />
<Rule Id="C26475" Action="Warning" />
<Rule Id="C26477" Action="Warning" />
<Rule Id="C26478" Action="Warning" />
<Rule Id="C26487" Action="Warning" />
<Rule Id="C26488" Action="Warning" />
<Rule Id="C26493" Action="Warning" />
<Rule Id="C26494" Action="Warning" />
<Rule Id="C26495" Action="Warning" />
<!-- Use constexpr with call -->
<Rule Id="C26498" Action="Warning" />
<Rule Id="C26812" Action="Warning" />
<Rule Id="C26815" Action="Warning" />
<Rule Id="C26816" Action="Warning" />
<Rule Id="C26818" Action="Warning" />
<Rule Id="C26819" Action="Warning" />
<Rule Id="C28020" Action="Warning" />
<Rule Id="C28021" Action="Warning" />
<Rule Id="C28022" Action="Warning" />
<Rule Id="C28023" Action="Warning" />
<Rule Id="C28024" Action="Warning" />
<Rule Id="C28039" Action="Warning" />
<Rule Id="C28112" Action="Warning" />
<Rule Id="C28113" Action="Warning" />
<Rule Id="C28125" Action="Warning" />
<Rule Id="C28137" Action="Warning" />
<Rule Id="C28138" Action="Warning" />
<Rule Id="C28159" Action="Warning" />
<Rule Id="C28160" Action="Warning" />
<Rule Id="C28163" Action="Warning" />
<Rule Id="C28164" Action="Warning" />
<Rule Id="C28182" Action="Warning" />
<Rule Id="C28183" Action="Warning" />
<Rule Id="C28193" Action="Warning" />
<Rule Id="C28196" Action="Warning" />
<Rule Id="C28202" Action="Warning" />
<Rule Id="C28203" Action="Warning" />
<Rule Id="C28205" Action="Warning" />
<Rule Id="C28206" Action="Warning" />
<Rule Id="C28207" Action="Warning" />
<Rule Id="C28209" Action="Warning" />
<Rule Id="C28210" Action="Warning" />
<Rule Id="C28211" Action="Warning" />
<Rule Id="C28212" Action="Warning" />
<Rule Id="C28213" Action="Warning" />
<Rule Id="C28214" Action="Warning" />
<Rule Id="C28215" Action="Warning" />
<Rule Id="C28216" Action="Warning" />
<Rule Id="C28217" Action="Warning" />
<Rule Id="C28218" Action="Warning" />
<Rule Id="C28219" Action="Warning" />
<Rule Id="C28220" Action="Warning" />
<Rule Id="C28221" Action="Warning" />
<Rule Id="C28222" Action="Warning" />
<Rule Id="C28223" Action="Warning" />
<Rule Id="C28224" Action="Warning" />
<Rule Id="C28225" Action="Warning" />
<Rule Id="C28226" Action="Warning" />
<Rule Id="C28227" Action="Warning" />
<Rule Id="C28228" Action="Warning" />
<Rule Id="C28229" Action="Warning" />
<Rule Id="C28230" Action="Warning" />
<Rule Id="C28231" Action="Warning" />
<Rule Id="C28232" Action="Warning" />
<Rule Id="C28233" Action="Warning" />
<Rule Id="C28234" Action="Warning" />
<Rule Id="C28235" Action="Warning" />
<Rule Id="C28236" Action="Warning" />
<Rule Id="C28237" Action="Warning" />
<Rule Id="C28238" Action="Warning" />
<Rule Id="C28239" Action="Warning" />
<Rule Id="C28240" Action="Warning" />
<Rule Id="C28241" Action="Warning" />
<Rule Id="C28243" Action="Warning" />
<Rule Id="C28244" Action="Warning" />
<Rule Id="C28245" Action="Warning" />
<Rule Id="C28246" Action="Warning" />
<Rule Id="C28250" Action="Warning" />
<Rule Id="C28251" Action="Warning" />
<Rule Id="C28252" Action="Warning" />
<Rule Id="C28253" Action="Warning" />
<Rule Id="C28254" Action="Warning" />
<Rule Id="C28262" Action="Warning" />
<Rule Id="C28263" Action="Warning" />
<Rule Id="C28267" Action="Warning" />
<Rule Id="C28272" Action="Warning" />
<Rule Id="C28273" Action="Warning" />
<Rule Id="C28275" Action="Warning" />
<Rule Id="C28279" Action="Warning" />
<Rule Id="C28280" Action="Warning" />
<Rule Id="C28282" Action="Warning" />
<Rule Id="C28285" Action="Warning" />
<Rule Id="C28286" Action="Warning" />
<Rule Id="C28287" Action="Warning" />
<Rule Id="C28288" Action="Warning" />
<Rule Id="C28289" Action="Warning" />
<Rule Id="C28290" Action="Warning" />
<Rule Id="C28291" Action="Warning" />
<Rule Id="C28300" Action="Warning" />
<Rule Id="C28301" Action="Warning" />
<Rule Id="C28302" Action="Warning" />
<Rule Id="C28303" Action="Warning" />
<Rule Id="C28304" Action="Warning" />
<Rule Id="C28305" Action="Warning" />
<Rule Id="C28306" Action="Warning" />
<Rule Id="C28307" Action="Warning" />
<Rule Id="C28308" Action="Warning" />
<Rule Id="C28309" Action="Warning" />
<Rule Id="C28350" Action="Warning" />
<Rule Id="C28351" Action="Warning" />
</Rules>
</RuleSet>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<CodeAnalysisRuleSet>@TsepCAFileNative@</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup />
</Project>

View file

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<package>
<metadata>
<id>@TSEP_PRODUCT_NAME@</id>
<version>@TSEP_NEXUS_VERSION@</version>
<authors>$ENV{USERNAME}</authors>
<owners>TSEP</owners>
<description>@TSEP_PRODUCT_DESCRIPTION@</description>
<releaseNotes>internal</releaseNotes>
<copyright>Copyright 2021</copyright>
<tags>Application</tags>
</metadata>
<files>
<file src="*/**" target="/" />
<file src="*" target="/" />
</files>
</package>

View file

@ -0,0 +1,91 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2021
#
# CMAKE project file / @Add your project name@
#
#
#-----------------------------------------------------------------------------------------
# Define project specific requirements
#
# Project name, output file name, project description
#
set(PROJECT_NAME @Add your project name@)
set(PROJECT_OUTPUT_NAME @Add your project dll name@)
set(PROJECT_DESCRIPTION "@Add your project description@")
#
#-----------------------------------------------------------------------------------------
# Define group file names
#
# SOURCE FILES
#
set(SOURCE_FILES
src/...
)
#
# HEADER FILES
#
set(HEADER_FILES
src/...
)
#
# Define folders for group files
#
source_group("Source Files" FILES ${SOURCE_FILES})
source_group("Header Files" FILES ${HEADER_FILES})
#
# Include files, add your own includes
#
include_directories(
${CMAKE_CURRENT_LIST_DIR}/src
# /- Add your additional include paths -/
)
#
#-----------------------------------------------------------------------------------------
# Console application definitions
#
# Setup application version
#
TSEP_SETUP_APP_VERSION(${PROJECT_DESCRIPTION})
#
# Create console application
#
add_executable(${PROJECT_NAME}
${SOURCE_FILES}
${HEADER_FILES}
${TSEP_APP_VERSION_RC}
)
#
# Setup TSEP OS specific settings for the project
#
TSEP_ADD_OS_SPECIFIC_SETTINGS()
#
# Setup output
#
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_OUTPUT_NAME})
#
# Add used libs
#
#target_link_libraries(${PROJECT_NAME}
# PUBLIC
# /- Add your additional libraries -/
#)
#
# Include application data files
# i.e
#set (APPLICATION_DATA_FILES
# "certificates" ${CMAKE_CURRENT_LIST_DIR}/../Test/certificates/Themis.cer
#)
#
#set (APPLICATION_DATA_FILES
# "Folder in application data folder, may be empty" ${CMAKE_CURRENT_LIST_DIR}/../folder/File_to_Be_Used
#)
#
# Create links to necessary dependency libraries
#
TSEP_GENERATE_DEPENDENCY_LINKS()
#
# Create an Export directory with the defined data
#
TSEP_CREATE_EXPORT()
#

View file

@ -0,0 +1,98 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2021
#
# CMAKE project file / @Add your project name@
#
#
#-----------------------------------------------------------------------------------------
# Define project specific requirements
#
# Project name, output file name, project description
#
set(PROJECT_NAME @Add your project name@)
set(PROJECT_OUTPUT_NAME @Add your project dll name@)
set(PROJECT_DESCRIPTION "@Add your project description@")
#
#-----------------------------------------------------------------------------------------
# Define group file names
#
# SOURCE FILES
#
set(SOURCE_FILES
src/...
)
#
# HEADER FILES
#
set(HEADER_FILES
src/...
)
#
#-----------------------------------------------------------------------------------------
# Define solution folders for group files
#
source_group("Source Files" FILES ${SOURCE_FILES})
source_group("Header Files" FILES ${HEADER_FILES})
#
#-----------------------------------------------------------------------------------------
# DLL definitions
#
# Setup shared library version
#
TSEP_SETUP_DLL_VERSION(${PROJECT_DESCRIPTION})
#
# Create shared library target
#
add_library(${PROJECT_NAME} SHARED
${SOURCE_FILES}
${HEADER_FILES}
${TSEP_DLL_VERSION_RC}
)
#
# Add alias for the project
#
add_library(Tsep::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
#
# Setup TSEP OS specific settings for the project
#
TSEP_ADD_OS_SPECIFIC_SETTINGS()
#
# Setup output name
#
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_OUTPUT_NAME})
#
# Use VS Code Analysis for the project
#
TSEP_USE_CODE_ANALYSIS(${PROJECT_NAME})
#
# Define Export Headers
#
TSEP_ADD_EXPORT_HEADER("${HEADER_FILES}")
#
# Include files, add your own includes and for the export
#
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
$<INSTALL_INTERFACE:inc>
#PRIVATE
# include paths, which will not be exported
)
#
# Add used libs
#
#target_link_libraries(${PROJECT_NAME}
# PUBLIC
# /- Add your additional libraries -/
#)
#
# Create an Export directory with the defined data
#
TSEP_CREATE_EXPORT()
#
#
# Create links to necessary dependency libraries
#
TSEP_GENERATE_DEPENDENCY_LINKS()
#

View file

@ -0,0 +1,130 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2021
#
# CMAKE project file / @Add your project name@
#
#
#-----------------------------------------------------------------------------------------
# Define project specific requirements
#
# Project name, output file name, project description
#
set(PROJECT_NAME @Add your project name@)
set(PROJECT_OUTPUT_NAME @Add your project dll name@)
set(PROJECT_DESCRIPTION "@Add your project description@")
#
#-----------------------------------------------------------------------------------------
#
# qt moc, rcc uic
#
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#
# Define group file names
#
# SOURCE FILES
#
set(SOURCE_FILES
src/...
)
#
# HEADER FILES
#
set(HEADER_FILES
src/...
)
#
# UI FILES
#
set(UI_FILES
ui/...
)
qt5_wrap_ui(UI_FILES_WRAPPED ${UI_FILES})
#
#
# TRANSLATION
#
# Define supported Language
set(LANGUAGES
de
)
#
# Create .ts and .qm Files
TSEP_TRANSLATE(${LANGUAGES})
#
#
# RESOURCE FILES
#
set(RESOURCE_FILES
resources/...
)
#
# Define folders for group files
#
source_group("Source Files" FILES ${SOURCE_FILES})
source_group("Header Files" FILES ${HEADER_FILES})
source_group("UI Files" FILES ${UI_FILES} ${UI_FILES_WRAPPED})
source_group("Resource Files" FILES ${RESOURCE_FILES})
#
# Include files, add your own includes
#
include_directories(
${CMAKE_CURRENT_LIST_DIR}/src
# /- Add your additional include paths -/
)
#
#-----------------------------------------------------------------------------------------
# Gui application definitions
#
# Setup application version
#
TSEP_SETUP_APP_VERSION(${PROJECT_DESCRIPTION})
#
# Create gui application
#
add_executable(${PROJECT_NAME} WIN32
${SOURCE_FILES}
${HEADER_FILES}
${UI_FILES}
${UI_FILES_WRAPPED}
${RESOURCE_FILES}
${TSEP_APP_VERSION_RC}
${TSEP_TRANSLATION_FILES}
)
#
# Setup TSEP OS specific settings for the project
#
TSEP_ADD_OS_SPECIFIC_SETTINGS()
#
# Setup output
#
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_OUTPUT_NAME})
#
# Add used libs
#
#target_link_libraries(${PROJECT_NAME}
# PUBLIC
# /- Add your additional libraries -/
#)
#
#
# Include application data files
# i.e
#set (APPLICATION_DATA_FILES
# "certificates" ${CMAKE_CURRENT_LIST_DIR}/../Test/certificates/Themis.cer
#)
#
#set (APPLICATION_DATA_FILES
# "Folder in application data folder, may be empty" ${CMAKE_CURRENT_LIST_DIR}/../folder/File_to_Be_Used
#)
# Create links to necessary dependency libraries
#
TSEP_GENERATE_DEPENDENCY_LINKS()
#
# Create an Export directory with the defined data
#
TSEP_CREATE_EXPORT()
#

View file

@ -0,0 +1,85 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2021
#
# CMAKE project file / @Add your project name@
#
#
#-----------------------------------------------------------------------------------------
# Define project specific requirements
#
# Project name, output file name, project description
#
set(PROJECT_NAME @Add your project name@)
set(PROJECT_OUTPUT_NAME @Add your project lib name@)
set(PROJECT_DESCRIPTION "@Add your project description@")
#
#-----------------------------------------------------------------------------------------
# Define group file names
#
# SOURCE FILES
#
set(SOURCE_FILES
src/...
)
#
# HEADER FILES
#
set(HEADER_FILES
src/...
)
#
#-----------------------------------------------------------------------------------------
# Define solution folders for group files
#
source_group("Source Files" FILES ${SOURCE_FILES})
source_group("Header Files" FILES ${HEADER_FILES})
#
# Create static library target
#
add_library(${PROJECT_NAME} STATIC
${SOURCE_FILES}
${HEADER_FILES}
)
#
# Add alias for the project
#
add_library(Tsep::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
#
# Setup TSEP OS specific settings for the project
#
TSEP_ADD_OS_SPECIFIC_SETTINGS()
#
# Setup output name
#
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_OUTPUT_NAME})
#
# Use VS Code Analysis for the project
#
TSEP_USE_CODE_ANALYSIS(${PROJECT_NAME})
#
# Define Export Headers
#
TSEP_ADD_EXPORT_HEADER("${HEADER_FILES}")
#
# Include files, add your own includes and for the export
#
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
$<INSTALL_INTERFACE:inc>
#PRIVATE
# include paths, which will not be exported
)
#
# Add used libs
#
#target_link_libraries(${PROJECT_NAME}
# PUBLIC
# /- Add your additional libraries -/
#)
#
# Create an Export directory with the defined data
#
TSEP_CREATE_EXPORT(static)
#

View file

@ -0,0 +1,25 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2021
#
# CMAKE template file to upload the paket into Nexus
#
#
#-----------------------------------------------------------------------------------------
# Define project specific requirements
#
set(PROJECT_NAME NEXUS_UPLOAD)
set(PROJECT_DESCRIPTION "TSEP Nexus upload project")
add_custom_target(${PROJECT_NAME}
COMMENT "Upload Nexus Paket ..."
VERBATIM
WORKING_DIRECTORY ${TSEP_EXPORT_DIR}
COMMAND_EXPAND_LISTS
COMMAND ${TSEP_NUGET_APPLICATION} pack ${TSEP_EXPORT_DIR}/${TSEP_PRODUCT_NAME}.nuspec -outputdirectory ${TSEP_EXPORT_DIR} -BasePath ${TSEP_EXPORT_DIR} -verbosity detailed
COMMAND ${TSEP_NUGET_APPLICATION} push *.nupkg ${TSEP_NEXUS_GUID} -source ${TSEP_NEXUS_URL}/Development/ -verbosity detailed
)
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "CMakePredefinedTargets")
set_target_properties(${PROJECT_NAME} PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)

View file

@ -0,0 +1,58 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2021
#
# CMAKE project main file / @Add your project name@
#
#-----------------------------------------------------------------------------------------
# Define project specific requirements
#
# Minimum CMAKE version for this project
#
cmake_minimum_required (VERSION 3.15.0)
#
# Name of the project
set(MAIN_PROJECT_NAME @Add your project name@)
project(${MAIN_PROJECT_NAME})
#
#-----------------------------------------------------------------------------------------
# Include project specific definitions -> Generated file
#
include(Project.conf.cmake)
#
#-----------------------------------------------------------------------------------------
# Include cmake settings and macros
#
include(${TSEP_PROJECT_CMAKE}/CMakeMacros.cmake)
include(${TSEP_PROJECT_CMAKE}/CMakeSettings.cmake)
#
#-----------------------------------------------------------------------------------------
# google test framework -> enable if used
#
#TSEP_USE_GOOGLE_TESTING()
#
#-----------------------------------------------------------------------------------------
# Current project description
#
set(TSEP_PROJECT "@Add your project description@")
#
#-----------------------------------------------------------------------------------------
# Allow project folder structure
#
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#
#-----------------------------------------------------------------------------------------
# Define projects for building
#
add_subdirectory("@Add your project name@")
add_subdirectory("@Add your unittest name@")
#
#-----------------------------------------------------------------------------------------
# Define projects for managing and distributing
#
# NEXUS Upload (Only windows)
#
IF(WIN32)
TSEP_ADD_PROJECT_NEXUS_UPLOAD()
ENDIF()
#

View file

@ -0,0 +1,79 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2021
#
# CMAKE project file / @Add your project name@
#
#-----------------------------------------------------------------------------------------
# Define project specific requirements
#
# Project name, output file name, project description
#
set(PROJECT_NAME @Add your project name@)
set(PROJECT_OUTPUT_NAME @Add your project name@)
set(UNITTEST_PROJECT @Add your unittest name@)
set(PROJECT_DESCRIPTION "Unit tests for project @Add your project name@")
#
#-----------------------------------------------------------------------------------------
# Define group file names
#
# NOTE: When using GLOB or GLOB_RECURSE for gathering files, CMake will not notice when the amount of files has changed (a file has been added/removed).
# The CMakeList has to be compiled manually after adding/removing a source/header file.
#
# SOURCE FILES
#
FILE(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/*/*.cpp)
#
# HEADER FILES
#
FILE(GLOB_RECURSE HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/*/*.h)
#
#-----------------------------------------------------------------------------------------
# Define solution folders for group files
#
source_group("Source Files" FILES ${SOURCE_FILES} main.cpp)
source_group("Header Files" FILES ${HEADER_FILES})
#
#-----------------------------------------------------------------------------------------
# Console application definitions
#
# Setup application version
#
TSEP_SETUP_APP_VERSION(${PROJECT_DESCRIPTION})
#
# Create console application
#
add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES} ${TSEP_APP_VERSION_RC} main.cpp)
#
# Setup output
#
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_OUTPUT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "UnitTest")
#
# Add used libs
#
target_link_libraries(${PROJECT_NAME}
PUBLIC
${UNITTEST_PROJECT}
GTest::GTest
)
#
#-----------------------------------------------------------------------------------------
# Include files, add your own includes
TSEP_GET_HEADER_DIRECTORIES(SOURCE_INCLUDE_LIST ${TSEP_SOURCE_DIR}/${UNITTEST_PROJECT})
TSEP_GET_HEADER_DIRECTORIES(UNIT_TEST_INCLUDE_LIST ${CMAKE_CURRENT_LIST_DIR})
#
target_include_directories(${PROJECT_NAME}
PUBLIC
${UNIT_TEST_INCLUDE_LIST}
${SOURCE_INCLUDE_LIST}
#PRIVATE
# include paths, which will not be exported
)
#
# Create links to necessary dependency libraries
#
TSEP_GENERATE_DEPENDENCY_LINKS()
#

View file

@ -0,0 +1,29 @@
###########################################################################################
#
# (c) Technical Software Engineering Plazotta 2021
#
# CMAKE project main file
#
# History
# 29.09.2019 / Plazotta
# Template created.
#
#-----------------------------------------------------------------------------------------
# Define project spezific requierements
#
# Project name, output file name, project description
#
set(PROJECT_NAME VS_CODE_ANALYZER)
set(PROJECT_DESCRIPTION "TSEP Static Code Analyzer for Visual Studio")
#
#-----------------------------------------------------------------------------------------
# Static Code Analyzer for VS in Windows
#
#
IF (WIN32)
add_custom_target(${PROJECT_NAME}
COMMAND msbuild $(SolutionDir)/$(SolutionFileName) /m /t:Rebuild /p:RunCodeAnalysis=true /p:CodeAnalysisRuleSet=AllRules.ruleset
COMMENT "Running Code Analyzer ..."
)
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "CMakePredefinedTargets")
ENDIF (WIN32)

View file

@ -0,0 +1,35 @@
#//========================================================================
#// Copyright (c) Technische Software Entwicklung Plazotta © 2021
#//
#// DESCRIPTION:
#// Shell Script to Build a cmake project under linux
#//
#// HISTORY:
#// 09.04.2021 / PP
#// Module created.
#//========================================================================
#!/bin/bash
#
#- Setup Build Results -------------------------------------------------
cd ..
mkdir -p BuildResults
rm -r ./BuildResults_linux_Release
rm -r ./BuildResults_linux_Debug
mkdir -p BuildResults_linux_Release
mkdir -p BuildResults_linux_Debug
#- CMAKE (Release)------------------------------------------------------
cd BuildResults_linux_Release
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../Software
if [ $? -ne 0 ]; then
echo "Error during CMake(Release) generation..."
exit 1
fi
#- CMAKE (Debug) -------------------------------------------------------
cd ../BuildResults_linux_Debug
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../Software
if [ $? -ne 0 ]; then
echo "Error during CMake(Debug) generation..."
exit 1
fi

View file

@ -0,0 +1,47 @@
/**
* @page @Add your project name@
*
* @author TSEP
*
* @copyright (c) Technical Software Engineering Plazotta 2021
*
*/
/**
* @file @Add your project name@.Exports.h
* @brief Definition of export declarations for this library
*
**************************************************************************/
//TSEP_Pragma.UnitTest.Skip
#pragma once
// Note:
// "<project>_EXPORTS" preprocessor define is defined by CMake when compiling <project>
/*------------------------------------------------------------------------------
// OPERATING SYSTEM : WIN32
//----------------------------------------------------------------------------*/
#ifdef _WIN32
/// @cond Exclude this macro from doxygen
#ifdef @Add your project name@_EXPORTS
#define TSEP_@Add your uppercase project name@_API __declspec(dllexport)
#else
#define TSEP_@Add your uppercase project name@_API __declspec(dllimport)
#endif
/// @endcond
#endif
/*------------------------------------------------------------------------------
// OPERATING SYSTEM : LINUX
//----------------------------------------------------------------------------*/
#ifdef __linux__
#ifdef @Add your project name@_EXPORTS
#define TSEP_@Add your uppercase project name@_API __attribute__((visibility("default")))
#else
#define TSEP_@Add your uppercase project name@_API
#endif
#endif // __linux__

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
</TS>

View file

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="@PROJECT_NAME@.Translations">
@TRANSLATION_RESOURCE_STRING@
</qresource>
</RCC>

View file

@ -0,0 +1,44 @@
@echo off
setlocal
rem ###########################################################################################
rem #
rem # (c) Technical Software Engineering Plazotta 2019
rem #
rem # CMAKE generator file for Windows VS
rem #
rem # History
rem # 29.09.2019 / Plazotta
rem # Template created.
rem #
rem ###########################################################################################
rem #
rem # This generator executes cmake based on the here configured values. All files will be
rem # copied to the location as given in the parameter BUILDRESULTS. The solution file can
rem # be found in this location.
rem # In this case a normal Windows Visual Studio 2017 solution will be created.
rem #
rem ###########################################################################################
rem Define build parameters
set ARCHITECTURE=x64
set VISUAL_STUDIO=msvc2017
set GENERATOR=Visual Studio 15 2017 Win64
rem ###########################################################################################
rem Concatenate build directory
set BUILDRESULTS=%~dp0\..\BuildResults\%VISUAL_STUDIO%_%ARCHITECTURE%
rem ###########################################################################################
rem Create build directory and push into it
if not exist %BUILDRESULTS% mkdir %BUILDRESULTS%
pushd %BUILDRESULTS%
rem ###########################################################################################
rem Run CMake to build the solution
echo running CMake...
cmake.exe -G "%GENERATOR%" ../../Software
rem ###########################################################################################
popd
pause

View file

@ -0,0 +1,46 @@
#include "winres.h"
#ifndef DEBUG
#define VER_DEBUG 0
#else
#define VER_DEBUG 1
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_FILEVERSION
FILEFLAGSMASK 0x3fL
FILEFLAGS VER_DEBUG
FILEOS 0x40004L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_FILEVERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
VALUE "Translation", 0x409, 1252
END
END

View file

@ -0,0 +1,46 @@
#include "winres.h"
#ifndef DEBUG
#define VER_DEBUG 0
#else
#define VER_DEBUG 1
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_FILEVERSION
FILEFLAGSMASK 0x3fL
FILEFLAGS VER_DEBUG
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_FILEVERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
VALUE "Translation", 0x409, 1252
END
END

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -3,7 +3,7 @@
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
LSString::LSString(const char* pData) LSString::LSString(const char* pData)
: m_uiLength(StringLength(pData)) : m_zSize(StringLength(pData))
, m_uiCapacity(StringLength(pData)) , m_uiCapacity(StringLength(pData))
{ {
Assign(pData); Assign(pData);
@ -11,7 +11,7 @@ LSString::LSString(const char* pData)
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
LSString::LSString(const std::string& sRhs) LSString::LSString(const std::string& sRhs)
: m_uiLength(sRhs.length()) : m_zSize(sRhs.length())
, m_uiCapacity(sRhs.length()) , m_uiCapacity(sRhs.length())
{ {
Assign(sRhs); Assign(sRhs);
@ -20,7 +20,7 @@ LSString::LSString(const std::string& sRhs)
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
LSString& LSString::operator=(const LSString& sRhs) LSString& LSString::operator=(const LSString& sRhs)
{ {
m_uiLength = sRhs.Length(); m_zSize = sRhs.Size();
m_uiCapacity = sRhs.Capacity(); m_uiCapacity = sRhs.Capacity();
Assign(sRhs); Assign(sRhs);
return *this; return *this;
@ -28,7 +28,7 @@ LSString& LSString::operator=(const LSString& sRhs)
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
LSString::LSString(const LSString& sRhs) LSString::LSString(const LSString& sRhs)
: m_uiLength(sRhs.m_uiLength) : m_zSize(sRhs.m_zSize)
, m_uiCapacity(sRhs.m_uiCapacity) , m_uiCapacity(sRhs.m_uiCapacity)
{ {
Assign(sRhs); Assign(sRhs);
@ -43,39 +43,38 @@ LSString::~LSString()
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
void LSString::Assign(const char* pData) void LSString::Assign(const char* pData)
{ {
m_pData = new char[m_uiLength + 1]; m_pData = new char[m_zSize + 1];
memset(m_pData, 0, m_uiLength + 1); memset(m_pData, 0, m_zSize + 1);
if (pData) memcpy(m_pData, pData, m_uiLength); if (pData) memcpy(m_pData, pData, m_zSize);
} }
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
void LSString::Insert(const char* pData, size_t uiPos) void LSString::Insert(const char* pData, size_t zLength, size_t zPos)
{ {
if (!pData) return; if (!pData) return;
size_t zLength = StringLength(pData); size_t zNewLength = m_zSize + zLength;
size_t zNewLength = m_uiLength + zLength;
while (zNewLength > m_uiCapacity) while (zNewLength > m_uiCapacity)
{ {
IncreaseCapacity(zNewLength); IncreaseCapacity(zNewLength);
} }
char* pLeft = m_pData + uiPos; char* pLeft = m_pData + zPos;
char* pRight = m_pData + uiPos + zLength; char* pRight = m_pData + zPos + zLength;
memcpy(pRight, m_pData + uiPos, m_uiLength - uiPos); memcpy(pRight, m_pData + zPos, m_zSize - zPos);
memcpy(pLeft, pData, zLength); memcpy(pLeft, pData, zLength);
m_uiLength = zNewLength; m_zSize = zNewLength;
} }
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
bool LSString::RemoveAt(size_t uiPos, size_t uiSize) bool LSString::RemoveAt(size_t uiPos, size_t uiSize)
{ {
if (uiPos > m_uiLength) return false; if (uiPos > m_zSize) return false;
m_uiLength = m_uiLength - uiSize; m_zSize = m_zSize - uiSize;
char* pLast = m_pData + uiPos + uiSize; char* pLast = m_pData + uiPos + uiSize;
memcpy(m_pData + uiPos, pLast, uiSize); memcpy(m_pData + uiPos, pLast, uiSize);
memset(pLast, 0, uiSize); memset(pLast, 0, uiSize);
@ -87,20 +86,19 @@ bool LSString::RemoveAt(size_t uiPos, size_t uiSize)
size_t LSString::StringLength(const char* pChar) const size_t LSString::StringLength(const char* pChar) const
{ {
if (!pChar) return 0; if (!pChar) return 0;
size_t iRet = 0; size_t zRet = 0;
while (*pChar != 0x0) while (*(pChar + zRet) != 0x0)
{ {
pChar++; zRet++;
iRet++;
} }
return iRet; return zRet;
} }
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
int LSString::Find(const char * pData, size_t uiOffset, size_t uiLength) const int LSString::Find(const char * pData, size_t uiOffset, size_t uiLength) const
{ {
int iRet = -1; int iRet = -1;
while (uiOffset + uiLength <= m_uiLength) while (uiOffset + uiLength <= m_zSize)
{ {
iRet = memcmp(m_pData + uiOffset, pData, uiLength); iRet = memcmp(m_pData + uiOffset, pData, uiLength);
if (iRet == 0) break; if (iRet == 0) break;
@ -115,7 +113,7 @@ void LSString::IncreaseCapacity(size_t uiNewLength)
m_uiCapacity = (m_uiCapacity + uiNewLength) * c_uiCapacityIncreaseFactor; m_uiCapacity = (m_uiCapacity + uiNewLength) * c_uiCapacityIncreaseFactor;
char* pNew = new char[m_uiCapacity + 1]; char* pNew = new char[m_uiCapacity + 1];
memset(pNew, 0, m_uiCapacity + 1); memset(pNew, 0, m_uiCapacity + 1);
memcpy(pNew, m_pData, m_uiLength); memcpy(pNew, m_pData, m_zSize);
DELETE_ARRAY(m_pData); DELETE_ARRAY(m_pData);
m_pData = pNew; m_pData = pNew;
} }

View file

@ -33,7 +33,7 @@ public:
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
inline void Append(const LSString& sRhs) inline void Append(const LSString& sRhs)
{ {
Insert(sRhs, sRhs.Length()); Insert(sRhs, sRhs.Size());
} }
inline void Append(const std::string& sRhs) inline void Append(const std::string& sRhs)
{ {
@ -41,21 +41,21 @@ public:
} }
inline void Append(const char* pData) inline void Append(const char* pData)
{ {
Insert(pData, m_uiLength); Insert(pData, StringLength(pData), m_zSize);
} }
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
inline void Insert(const LSString& sRhs, size_t uiPos) inline void Insert(const LSString& sRhs, size_t zPos)
{ {
Insert(sRhs.m_pData, uiPos); Insert(sRhs.m_pData, sRhs.Size(), zPos);
} }
inline void Insert(const std::string& sRhs, size_t uiPos) inline void Insert(const std::string& sRhs, size_t zPos)
{ {
Insert(sRhs.c_str(), uiPos); Insert(sRhs.c_str(), sRhs.size(), zPos);
} }
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
inline bool Remove(const LSString& sRhs) inline bool Remove(const LSString& sRhs)
{ {
return RemoveAt(Find(sRhs), sRhs.m_uiLength); return RemoveAt(Find(sRhs), sRhs.m_zSize);
} }
inline bool Remove(const std::string& sRhs) inline bool Remove(const std::string& sRhs)
{ {
@ -69,7 +69,7 @@ public:
#pragma region Logic #pragma region Logic
void Assign(const char* pData); void Assign(const char* pData);
void Insert(const char* pData, size_t uiPos); void Insert(const char* pData, size_t zLength, size_t zPos);
bool RemoveAt(size_t uiPos, size_t uiSize); bool RemoveAt(size_t uiPos, size_t uiSize);
#pragma endregion #pragma endregion
@ -125,9 +125,9 @@ public:
return *(m_pData + uiPos); return *(m_pData + uiPos);
} }
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
inline size_t Length() const inline size_t Size() const
{ {
return m_uiLength; return m_zSize;
} }
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
inline size_t Capacity() const inline size_t Capacity() const
@ -150,7 +150,7 @@ private:
void IncreaseCapacity(size_t uiNewLength = 0); void IncreaseCapacity(size_t uiNewLength = 0);
char* m_pData = nullptr; char* m_pData = nullptr;
size_t m_uiLength = 0; size_t m_zSize = 0;
size_t m_uiCapacity = 0; size_t m_uiCapacity = 0;
const float c_uiCapacityIncreaseFactor = 1.5; const float c_uiCapacityIncreaseFactor = 1.5;
}; };

View file

@ -4,5 +4,14 @@ template <class T>
class LSVector class LSVector
{ {
LSVector()
{
}
~LSVector()
{
}
}; };

View file

@ -0,0 +1,25 @@
@echo off
setlocal
rem define build parameters
set ARCHITECTURE=x64
set VISUAL_STUDIO=msvc2019
set GENERATOR=Visual Studio 16 2019 Win64
rem concatenate build directory
set BUILDRESULTS=%~dp0\..\BuildResults\%VISUAL_STUDIO%_%ARCHITECTURE%
rem create build directory and push into it
if not exist %BUILDRESULTS% mkdir %BUILDRESULTS%
if not exist %BUILDRESULTS%\Debug\bin mkdir %BUILDRESULTS%\Debug\bin
if not exist %BUILDRESULTS%\Release\bin mkdir %BUILDRESULTS%\Release\bin
pushd %BUILDRESULTS%
rem run CMake to build the solution
echo running CMake...
cmake.exe -G "%GENERATOR%" ../../Software
popd
pause

File diff suppressed because one or more lines are too long