Skip to content

Commit d4d0636

Browse files
committed
build: remove sudo requirement from travis file
This commit updates the travis continuious integration setup to not require a sudo access. This will speed up linux builds as they can now be built in a docker image, instead of requiring a full vm. Signed-off-by: Keith Holman <keith.holman@windriver.com>
1 parent 37fe056 commit d4d0636

2 files changed

Lines changed: 39 additions & 13 deletions

File tree

.travis.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sudo: required
1+
sudo: false
22
language: c
33
compiler:
44
- clang
@@ -14,21 +14,26 @@ env:
1414
- OSAL_THREAD_SUPPORT=ON OSAL_WRAP=ON BUILD_TYPE=Debug
1515
- OSAL_THREAD_SUPPORT=ON OSAL_WRAP=ON BUILD_TYPE=Release
1616
install:
17+
- export DEPS_DIR=`pwd`/deps
18+
- mkdir -p $DEPS_DIR
19+
20+
# cmocka
1721
- wget https://cmocka.org/files/1.1/cmocka-1.1.1.tar.xz
1822
- tar -xvf cmocka-1.1.1.tar.xz
1923
- cd cmocka-1.1.1
2024
- mkdir build
2125
- cd build
22-
- cmake -DCMAKE_BUILD_TYPE:STRING=Debug ..
26+
- cmake -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX:PATH=$DEPS_DIR ..
2327
- make
24-
- sudo make install
28+
- make install
2529
- cd ../..
2630
- rm -rf cmocka-1.1.1
31+
2732
before_script:
2833
- mkdir build
2934
- cd build
3035
- cmake --version
31-
- cmake -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DOSAL_THREAD_SUPPORT:BOOL=$OSAL_THREAD_SUPPORT -DOSAL_WRAP:BOOL=$OSAL_WRAP ..
36+
- cmake -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DDEPENDS_ROOT_DIR:PATH=$DEPS_DIR -DOSAL_THREAD_SUPPORT:BOOL=$OSAL_THREAD_SUPPORT -DOSAL_WRAP:BOOL=$OSAL_WRAP ..
3237

3338
script:
3439
- make

build-sys/cmake/FindCmocka.cmake

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#
22
# cmocka support
33
#
4-
# If found the following will be defined:
5-
# CMOCKA_FOUND - System has cmocka
6-
# CMOCKA_INCLUDE_DIRS/CMOCKA_INCLUDES - Include directories for cmocka
7-
# CMOCKA_LIBRARIES/CMOCKA_LIBS - Libraries needed for cmocka
8-
# CMOCKA_DEFINITIONS - Compiler switches required for cmocka
4+
# The following variables can be set to add additional find support:
5+
# - CMOCKA_ROOT_DIR, specified an explicit root path to test
96
#
7+
# If found the following will be defined:
8+
# - CMOCKA_FOUND - System has cmocka
9+
# - CMOCKA_INCLUDE_DIRS/CMOCKA_INCLUDES - Include directories for cmocka
10+
# - CMOCKA_LIBRARIES/CMOCKA_LIBS - Libraries needed for cmocka
11+
# - CMOCKA_DEFINITIONS - Compiler switches required for cmocka
1012
#
11-
# Copyright (C) 2015 Wind River Systems, Inc. All Rights Reserved.
13+
# Copyright (C) 2015-2017 Wind River Systems, Inc. All Rights Reserved.
1214
#
1315
# The right to copy, distribute or otherwise make use of this software may
1416
# be licensed only pursuant to the terms of an applicable Wind River license
@@ -20,17 +22,33 @@ include( FindPackageHandleStandardArgs )
2022

2123
set( _PROGRAMFILES "ProgramFiles" )
2224
set( _PROGRAMFILES_X86 "ProgramFiles(x86)" )
25+
26+
# Try and find paths
27+
set( LIB_SUFFIX "" )
28+
get_property( LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS )
29+
if( LIB64 )
30+
set( LIB_SUFFIX 64 )
31+
endif()
32+
33+
# Allow the ability to specify a global dependency root directory
34+
if ( NOT CMOCKA_ROOT_DIR )
35+
set( CMOCKA_ROOT_DIR ${DEPENDS_ROOT_DIR} )
36+
endif()
37+
2338
find_path( CMOCKA_INCLUDE_DIR
2439
NAMES cmocka.h
2540
DOC "cmocka include directory"
26-
PATHS "$ENV{${_PROGRAMFILES}}/cmocka/include"
41+
PATHS "${CMOCKA_ROOT_DIR}/include"
42+
"$ENV{${_PROGRAMFILES}}/cmocka/include"
2743
"$ENV{${_PROGRAMFILES_X86}}/cmocka/include"
2844
)
2945

3046
find_library( CMOCKA_LIBRARY
3147
NAMES cmocka
3248
DOC "Required cmocka libraries"
33-
PATHS "$ENV{${_PROGRAMFILES}}/cmocka/lib"
49+
PATHS "${CMOCKA_ROOT_DIR}/lib${LIB_SUFFIX}"
50+
"${CMOCKA_ROOT_DIR}/lib"
51+
"$ENV{${_PROGRAMFILES}}/cmocka/lib"
3452
"$ENV{${_PROGRAMFILES_X86}}/cmocka/lib"
3553
)
3654

@@ -40,6 +58,9 @@ set( CMOCKA_INCLUDE_DIRS ${CMOCKA_INCLUDE_DIR} )
4058
set( CMOCKA_INCLUDES ${CMOCKA_INCLUDE_DIRS} )
4159
set( CMOCKA_DEFINITIONS "" )
4260

43-
find_package_handle_standard_args( cmocka DEFAULT_MSG CMOCKA_LIBRARY CMOCKA_INCLUDE_DIR )
61+
find_package_handle_standard_args( Cmocka
62+
FOUND_VAR CMOCKA_FOUND
63+
REQUIRED_VARS CMOCKA_INCLUDE_DIR CMOCKA_LIBRARY
64+
FAIL_MESSAGE DEFAULT_MSG )
4465
mark_as_advanced( CMOCKA_INCLUDE_DIR CMOCKA_LIBRARY )
4566

0 commit comments

Comments
 (0)