diff --git a/CMakeLists.txt b/CMakeLists.txt index f15a4822..4ab44472 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,8 +120,8 @@ endif() # Lib -------------------------------------------------------------------------- -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib) +#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib) add_subdirectory(src/lib) add_subdirectory(src/external) @@ -160,8 +160,8 @@ target_link_libraries(${LIB_PROJECT_NAME} ${Boost_LIBRARIES}) # Lib Parser ------------------------------------------------------------------- -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser) +#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser) add_subdirectory(src/lib_parser) @@ -178,6 +178,13 @@ set_property( "${CMAKE_SOURCE_DIR}/src/lib" ) +set_target_properties( + ${LIB_PARSER_PROJECT_NAME} + PROPERTIES + DEBUG_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME}_d + RELEASE_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME} +) + target_include_directories(${LIB_PARSER_PROJECT_NAME} SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS} @@ -192,8 +199,8 @@ target_link_libraries(${LIB_PARSER_PROJECT_NAME} ${CLANG_LIBRARIES} ${REQ_LLVM_L # Lib License ------------------------------------------------------------------- -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_license) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_license) +#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_license) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_license) add_subdirectory(src/lib_license) @@ -207,6 +214,13 @@ set_property( "${CMAKE_SOURCE_DIR}/src/lib_license" ) +set_target_properties( + ${LIB_LICENSE_PROJECT_NAME} + PROPERTIES + DEBUG_OUTPUT_NAME ${LIB_LICENSE_PROJECT_NAME}_d + RELEASE_OUTPUT_NAME ${LIB_LICENSE_PROJECT_NAME} +) + target_include_directories(${LIB_LICENSE_PROJECT_NAME} SYSTEM PUBLIC ${Boost_INCLUDE_DIRS} @@ -229,8 +243,8 @@ endif() # Lib Gui ---------------------------------------------------------------------- -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_gui) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_gui) +#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_gui) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_gui) add_subdirectory(src/lib_gui) @@ -294,6 +308,13 @@ set_property( "${CMAKE_SOURCE_DIR}/src/lib_license" ) +set_target_properties( + ${LIB_GUI_PROJECT_NAME} + PROPERTIES + DEBUG_OUTPUT_NAME ${LIB_GUI_PROJECT_NAME}_d + RELEASE_OUTPUT_NAME ${LIB_GUI_PROJECT_NAME} +) + # include external header without warnings target_include_directories(${LIB_GUI_PROJECT_NAME} SYSTEM PUBLIC "${CMAKE_SOURCE_DIR}/src/external" diff --git a/script/git-publish.sh b/script/git-publish.sh index 33cd0e27..30cb7e79 100755 --- a/script/git-publish.sh +++ b/script/git-publish.sh @@ -77,7 +77,7 @@ fi # Prepare publish message with commit messages GIT_DIR=$(git rev-parse --show-toplevel)/.git -cat $GIT_DIR/../.git_commit_template.txt > $GIT_DIR/PUBLISH_MSG +cat $GIT_DIR/../setup/git/git_commit_template.txt > $GIT_DIR/PUBLISH_MSG printf "\n# commits:\n" >> $GIT_DIR/PUBLISH_MSG git log --graph --format=%B $BASE_COMMIT..HEAD | sed 's/^/# &/' >> $GIT_DIR/PUBLISH_MSG diff --git a/script/setup.sh b/script/setup.sh index e7a54193..25a0851b 100755 --- a/script/setup.sh +++ b/script/setup.sh @@ -21,10 +21,10 @@ cd $MY_PATH/.. # git settings echo -e $INFO "install git settings" -git config commit.template .git_commit_template.txt +git config commit.template setup/git/git_commit_template.txt git config color.ui true -cp .git_pre_commit_hook.sh .git/hooks/pre-commit - +cp setup/git/git_pre_commit_hook.sh .git/hooks/pre-commit +cp setup/git/git_pre_push_hook.sh .git/hooks/pre-push # Create Debug and Release folders echo -e $INFO "create build folders" diff --git a/setup/Linux/coati.desktop b/setup/Linux/coati.desktop index 2d3cf7f5..7d85452b 100644 --- a/setup/Linux/coati.desktop +++ b/setup/Linux/coati.desktop @@ -7,4 +7,5 @@ Exec=/usr/bin/coati Icon=coati Terminal=true Type=Application +MimeType=application/x-coati StartupNotify=true diff --git a/setup/Linux/deinstall.sh b/setup/Linux/deinstall.sh index 9f7de119..de2e460e 100755 --- a/setup/Linux/deinstall.sh +++ b/setup/Linux/deinstall.sh @@ -1,6 +1,6 @@ MY_PATH=`dirname "$0"` -MY_PATH=../$MY_PATH +MY_PATH=../$MY_PATH echo "Remove coati form system" printf 'enter [y/n] ' @@ -16,4 +16,5 @@ rm /usr/share/icons/coati.png rm /usr/share/icons/project-coati.png rm /opt/coati -rf update-mime/database /usr/share/mime +update-desktop-database diff --git a/setup/Linux/install.sh b/setup/Linux/install.sh index d6622ec9..e0f4de42 100755 --- a/setup/Linux/install.sh +++ b/setup/Linux/install.sh @@ -16,6 +16,7 @@ cp $MY_PATH/setup/coati.desktop /usr/share/applications/ > /dev/null cp $MY_PATH/data/gui/icon/logo_1024_1024.png /usr/share/icons/coati.png > /dev/null cp $MY_PATH/data/gui/icon/project_256_256.png /usr/share/icons/project-coati.png > /dev/null update-mime-database /usr/share/mime > /dev/null +update-desktop-database > /dev/null -ln -s /opt/coati/coati.sh /usr/bin/coati > /dev/null +ln -s /opt/coati/Coati.sh /usr/bin/coati > /dev/null diff --git a/.git_commit_template.txt b/setup/git/git_commit_template.txt similarity index 100% rename from .git_commit_template.txt rename to setup/git/git_commit_template.txt diff --git a/.git_pre_commit_hook.sh b/setup/git/git_pre_commit_hook.sh similarity index 100% rename from .git_pre_commit_hook.sh rename to setup/git/git_pre_commit_hook.sh diff --git a/setup/git/git_pre_push_hook.sh b/setup/git/git_pre_push_hook.sh new file mode 100755 index 00000000..8580e37c --- /dev/null +++ b/setup/git/git_pre_push_hook.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +# This hook enforces to run builds and test when pushed to the $protected_branch + +proteced_branches=("forced_tests" "master") + +#proteced_branch='master' +current_branch=$(git symbolic-ref -q --short HEAD) + +FAIL="\033[31mFail:\033[00m" +PASS="\033[32mPass:\033[00m" +INFO="\033[33mInfo:\033[00m" + +ROOTDIR=$(pwd) + +# Determine current platform +PLATFORM='unknown' +if [ "$(uname)" == "Darwin" ]; then + PLATFORM='MacOS' +elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + PLATFORM='Linux' +elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then + PLATFORM='Windows' +fi + +function build { + echo -e $INFO Building $1 \($2\) + cmake --build build/$2 --target $1 > /dev/null + #output to commandline for debugging + #cmake --build build/$2 --target $1 + if [ $? -eq 0 ] + then + echo -e $PASS Building $1 \($2\) passed + else + echo -e $FAIL Building $1 \($2\) failed + exit 1 + fi +} + +function build_type { + echo -e $INFO Starting with buildtype: $1 + if [ "$PLATFORM" == "Windows" ] + then + echo -e $INFO Builing the Coati VS Solution + cmake --build build --config $1 > /dev/null + if [ $? -ne 0 ] + then + echo -e $FAIL At least one build or test failed, no push to $branch + exit 1 + fi + else + build Coati $1 + build Coati_trial $1 + build Coati_test $1 + build Coati_license_generator $1 + run_tests $1 + fi +} + +function run_tests { + echo -e $INFO Run $1 Tests + + cd bin/test + echo $1/Coati_test + $1/Coati_test + if [ $? -eq 0 ] + then + echo -e $PASS $1 Tests passed + else + echo -e $FAIL $1 Tests failed + exit 1 + fi + cd $ROOTDIR +} + +for branch in "${proteced_branches[@]}" +do + if [ $current_branch == $branch ] + then + echo Try to push to $branch + echo Run builds and test + echo This will take a while +# build_type Debug + build_type Release + echo -e $PASS All builds and tests passed pushing to $branch + exit 0 + fi +done + +exit 0 +