Skip to content
Snippets Groups Projects
linux_gcc_build_x64_debug_local.sh 3.85 KiB
Newer Older
  • Learn to ignore specific revisions
  • export BOOST_ROOT=${PWD}../../external_dependencies/boost
    export LIB4NEURO_INCLUDE_DIR=${PWD}/../../include
    
    
    # Should we build the examples? (yes/no)
    
    
    # Should we build the unit-tests? (yes/no)
    BUILD_TESTS=yes
    
    
    # Should we rebuild BOOST? (yes/no)
    
    # Should we build the lib4neuro library? (yes)
    
    
    #**********************DO NOT CHANGE BEYOND THIS LINE****************************************
    
    if [ -z ${DEPENDENCIES_LINK_TYPE} ]; then DEPENDENCIES_LINK_TYPE=static; fi
    if [ -z ${CLEAN_AFTER} ]; then CLEAN_AFTER=yes; fi
    
    
    export LINK_TYPE=static
    
    if [ ${DEPENDENCIES_LINK_TYPE} = "shared" ]
    
    if [ ${CLEAN_AFTER} = "no" ]
    
    
    RED='\033[0;31m'
    CYAN='\033[0;36m'
    YELLOW='\033[1;33m'
    GREEN='\033[0;32m'
    WHITE='\033[1;37m'
    NC='\033[0m' # No Color
    echo "Building the '${CYAN}lib4neuro${NC}' project for ${WHITE}Debug${NC}"
    
    
    BUILD_SOMETHING=no
    BUILD_SOMETHING_LIB=no
    
    
    if [ ${BUILD_LIB} = "yes" ]
    
    then
        echo "${CYAN}lib4neuro${NC} build type: ${WHITE}Debug${NC}"
        echo "${CYAN}lib4neuro${NC} build architecture: ${WHITE}x64${NC}"
        echo "${CYAN}lib4neuro${NC} will be built in '${YELLOW}build/lib/${NC}'"
        BUILD_SOMETHING=yes
        BUILD_SOMETHING_LIB=yes
    fi
    
    if [ $BUILD_TESTS = "yes" ]
    then
        echo "${CYAN}lib4neuro${NC} unit tests will be built in '${YELLOW}build/unit-tests${NC}'"
        BUILD_SOMETHING=yes
        BUILD_SOMETHING_LIB=yes
    fi
    
    
    if [ ${BUILD_EXAMPLES} = "yes" ]
    
    then
        echo "${CYAN}lib4neuro${NC} examples will be built in '${YELLOW}build/examples${NC}'"
        BUILD_SOMETHING=yes
        BUILD_SOMETHING_LIB=yes
    fi
    
    
    #if [ ${REBUILD_BOOST} = "yes" ]
    #then
    
    #    echo "The required '${CYAN}BOOST${NC}' library will be recompiled in the directory '${YELLOW}external_dependencies/boost${NC}'"
    #    rm -rf ../../external_dependencies/boost/stage
    #    rm -rf ../../external_dependencies/boost/bin.v2
    
    
    # Boost rebuild
    
    #if [ ${REBUILD_BOOST} = "yes" ]
    #then
    
    #    ./build_boost_gcc.sh || BUILD_ERROR_OCCURED=1
    
    # Should we build the lib4neuro library? (yes)
    
    if [ ${BUILD_SOMETHING_LIB} = "yes" -a $BUILD_ERROR_OCCURED = "0" ]
    
        if [ ${BUILD_LIB} = "yes" ]
    
        then
            ./linux_clean_lib.sh
        fi
    
    
        if [ ${BUILD_EXAMPLES} = "yes" ]
    
        then
            ./linux_clean_examples.sh
        fi
    
    
        if [ ${BUILD_TESTS} = "yes" ]
    
        then
            ./linux_clean_tests.sh
        fi	
    
        echo "Building the '${CYAN}lib4neuro${NC}' project for ${WHITE}Debug${NC} (preparing makefiles)"
    	
    
        cd ../..
    
        cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DBOOST_LIBRARYDIR=${BOOST_LIBRARYDIR} -DBOOST_INCLUDEDIR=${BOOST_INCLUDEDIR} -DBUILD_TESTS=${BUILD_TESTS} -DBUILD_EXAMPLES=${BUILD_EXAMPLES} -DBUILD_LIB=${BUILD_LIB} -DLIB4NEURO_DIR=${PWD}/build/lib -DDEPENDENCIES_LINK_TYPE=${LINK_TYPE} -DLIB4NEURO_INCLUDE_DIR=${LIB4NEURO_INCLUDE_DIR} . || { echo "${RED}Makefile preparation finished with errors${NC}!"; BUILD_ERROR_OCCURED=1; }
    
    	if [ ${BUILD_ERROR_OCCURED} = "0" ]
    
    	then
            echo "Building the '${CYAN}lib4neuro${NC}' project for ${WHITE}Debug${NC} (building)"
    
            cmake --build . --config Debug -- -j${N_CORES} && echo "${GREEN}Build complete${NC}." || { echo "${RED}Build finished with errors${NC}!"; BUILD_ERROR_OCCURED=1; }
    
    
        cd build_scripts/linux
    
    
    if [ ${BUILD_LIB} = "yes" ]
    
    if [ ${BUILD_EXAMPLES} = "yes" ]
    
    if [ ${BUILD_TESTS} = "yes" ]
    
    if [ ${BUILD_SOMETHING_LIB} = "yes" ]
    
        ./linux_clean_garbage.sh
    fi
    
    if [ ${BUILD_ERROR_OCCURED} = "1" ]
    
    then
        echo "${RED}Build encountered some errors!${NC}"
        exit 1