-
Notifications
You must be signed in to change notification settings - Fork 64
Travis build + Conan dependencies managment #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DrBarbare
wants to merge
1
commit into
TankOs:master
Choose a base branch
from
DrBarbare:feature/conan-dependencies-managment
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
command_prefix=() | ||
|
||
# Install pre-requisites | ||
if [ "${TRAVIS_OS_NAME}" = "osx" ]; | ||
then | ||
brew update || brew update | ||
brew install cmake || :; | ||
elif [ ! "${TRAVIS_OS_NAME}" = "windows" ]; | ||
then | ||
# Start a pre-configured docker image | ||
# Images are picked from bincrafters sfml recipe | ||
docker pull ${DOCKER_IMAGE} | ||
docker run -v ${PWD}:${PWD} -w ${PWD} \ | ||
-u root \ | ||
--name "${RUNNER}" \ | ||
--rm -t -d ${DOCKER_IMAGE} | ||
command_prefix=(docker exec ${RUNNER}) | ||
fi | ||
|
||
# Install Conan | ||
if [ "${TRAVIS_OS_NAME}" = "windows" ]; | ||
then | ||
choco install conan || :; | ||
export PATH="${PATH}:/c/Program Files/Conan/conan"; | ||
else | ||
${command_prefix[@]} pip install conan --upgrade; | ||
fi | ||
|
||
# Install dependencies using Conan | ||
conan=(${command_prefix[@]} conan) | ||
${conan[@]} remote add -f bincrafters https://api.bintray.com/conan/bincrafters/public-conan | ||
${conan[@]} profile new default --detect # Generates default profile detecting GCC and sets old ABI | ||
|
||
if [ "${TRAVIS_OS_NAME}" = "osx" ]; | ||
then | ||
# AppleClang is a bit old, and most recent library is libc++ | ||
# https://forums.developer.apple.com/thread/73004 | ||
${conan[@]} profile update settings.compiler.libcxx=libc++ default | ||
elif [ "${TRAVIS_OS_NAME}" = "windows" ]; | ||
then | ||
# The "--detect" option finds gcc 8, so we set Visual Studio manually | ||
${conan[@]} profile update settings.compiler="Visual Studio" default | ||
${conan[@]} profile update settings.compiler.version=15 default | ||
|
||
# libcxx setting not used on windows | ||
${conan[@]} profile remove settings.compiler.libcxx default | ||
else | ||
# Sets libcxx to C++11 ABI | ||
${conan[@]} profile update settings.compiler.libcxx=libstdc++11 default | ||
fi | ||
|
||
${conan[@]} install . --build missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
cmake=("cmake") | ||
need_stop=false | ||
if [ "${TRAVIS_OS_NAME}" = "osx" ]; | ||
then | ||
generator="-GXcode" | ||
CORES=4 # Apple toolchain can't figure out the number of cores... | ||
elif [ "${TRAVIS_OS_NAME}" = "windows" ]; | ||
then | ||
generator="-GVisual Studio 15 2017 Win64" | ||
else | ||
generator="-GNinja" | ||
cmake=(docker exec ${RUNNER} cmake) | ||
need_stop=true | ||
fi | ||
|
||
build_dir="$(pwd)/build" | ||
|
||
# Configure | ||
${cmake[@]} -H"$(pwd)" -B"${build_dir}" "${generator}" -DCMAKE_BUILD_TYPE=Release | ||
|
||
# Compile | ||
${cmake[@]} --build "${build_dir}" --config Release -j ${CORES:-} | ||
|
||
# Stop docker image for linux machine | ||
if ${need_stop}; | ||
then | ||
docker stop "${RUNNER}" | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,33 @@ | ||
*.a | ||
*.o | ||
*.os | ||
*.so | ||
# Documentation artifacts | ||
/doc/html/ | ||
|
||
# Build artifacts | ||
*build*/ | ||
/.vs | ||
/CMakeSettings.json | ||
*Build*/ | ||
**.a | ||
**.o | ||
**.os | ||
**.so | ||
**.lib | ||
**.dll | ||
**.dlib | ||
|
||
# Conan files | ||
conan*info.* | ||
graph_info.json | ||
|
||
# Editors cache | ||
|
||
## Qt Creator | ||
CMakeLists.txt.usr | ||
|
||
## VSCode | ||
.vscode | ||
|
||
## Visual Studio | ||
.vs | ||
|
||
## Misc | ||
*~ | ||
*.swp | ||
CMakeSettings.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
linux: &linux | ||
os: linux | ||
dist: xenial | ||
language: minimal | ||
sudo: required | ||
services: | ||
- docker | ||
osx: &osx | ||
os: osx | ||
language: generic | ||
osx: &windows | ||
os: windows | ||
language: cpp | ||
matrix: | ||
include: | ||
- <<: *linux | ||
env: DOCKER_IMAGE=lasote/conangcc8 | ||
- <<: *linux | ||
env: DOCKER_IMAGE=lasote/conanclang60 | ||
- <<: *osx | ||
osx_image: xcode10 | ||
- <<: *windows | ||
|
||
install: | ||
# Generate a RUNNER name to use in docker images across install and run | ||
- export RUNNER="runner-${RANDOM}" | ||
- chmod +x .ci/install.sh | ||
- ./.ci/install.sh | ||
|
||
script: | ||
- chmod +x .ci/run.sh | ||
- ./.ci/run.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,17 +13,24 @@ set( SFGUI_VERSION ${SFGUI_MAJOR_VERSION}.${SFGUI_MINOR_VERSION}.${SFGUI_REVISIO | |
|
||
### USER INPUT ### | ||
|
||
option( SFGUI_BUILD_EXAMPLES "Build examples." ON ) | ||
option( SFGUI_BUILD_DOC "Generate API documentation." OFF ) | ||
option( SFGUI_INCLUDE_FONT "Include default font in library (DejaVuSans)." ON ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reordered those so that the indentation still look nice. |
||
option( SFGUI_BUILD_SHARED_LIBS "Build shared library." ON ) | ||
set( BUILD_SHARED_LIBS ${SFGUI_BUILD_SHARED_LIBS} ) | ||
option( SFGUI_BUILD_EXAMPLES "Build examples." ON) | ||
option( SFGUI_BUILD_DOC "Generate API documentation." OFF) | ||
option( SFGUI_INCLUDE_FONT "Include default font in library (DejaVuSans)." ON) | ||
option( SFML_STATIC_LIBRARIES "Do you want to link SFML statically?" OFF) | ||
|
||
|
||
# Find packages. | ||
find_package( OpenGL REQUIRED ) | ||
find_package( SFML 2.5 REQUIRED COMPONENTS graphics window system ) | ||
if ( EXISTS ${CMAKE_SOURCE_DIR}/conanbuildinfo.cmake ) | ||
include( ${CMAKE_SOURCE_DIR}/conanbuildinfo.cmake ) | ||
conan_basic_setup() | ||
else () | ||
option( SFML_STATIC_LIBRARIES "Do you want to link SFML statically?" OFF) | ||
find_package( SFML 2.5 REQUIRED COMPONENTS graphics window system ) | ||
set( SFML_LIBRARIES sfml-graphics ) | ||
endif() | ||
|
||
|
||
set( INCLUDE_PATH "${PROJECT_SOURCE_DIR}/include/" ) | ||
set( SOURCE_PATH "${PROJECT_SOURCE_DIR}/src/" ) | ||
|
@@ -56,7 +63,7 @@ if( SFGUI_INCLUDE_FONT ) | |
target_compile_definitions( ${TARGET} PRIVATE SFGUI_INCLUDE_FONT ) | ||
endif() | ||
|
||
target_link_libraries( ${TARGET} PUBLIC sfml-graphics sfml-window sfml-system ${OPENGL_gl_LIBRARY} ) | ||
target_link_libraries( ${TARGET} PUBLIC ${CONAN_LIBS} ${SFML_LIBRARIES} ${OPENGL_gl_LIBRARY} ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the fact that CMake evaluates non-existent variables to nothing. |
||
|
||
# Tell the compiler to export when necessary. | ||
set_target_properties( ${TARGET} PROPERTIES DEFINE_SYMBOL SFGUI_EXPORTS ) | ||
|
@@ -105,17 +112,12 @@ if( WIN32 ) | |
set( SHARE_PATH "." ) | ||
set( LIB_PATH "lib" ) | ||
elseif( APPLE ) | ||
# Apple Frameworks being nice bundles, CMake directly interpret them as targets! | ||
find_library( COREFOUNDATION_LIBRARY CoreFoundation ) | ||
mark_as_advanced( COREFOUNDATION_LIBRARY ) | ||
|
||
add_library( CoreFoundation SHARED IMPORTED ) | ||
set_target_properties( | ||
CoreFoundation PROPERTIES | ||
IMPORTED_LOCATION "${COREFOUNDATION_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "/System/Library/Frameworks/CoreFoundation.framework/Headers" | ||
) | ||
|
||
target_link_libraries( ${TARGET} PUBLIC CoreFoundation ) | ||
target_link_libraries( ${TARGET} PUBLIC ${COREFOUNDATION_LIBRARY} ) | ||
|
||
set( SHARE_PATH "${CMAKE_INSTALL_PREFIX}/share/SFGUI" ) | ||
set( LIB_PATH "lib" ) | ||
elseif( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" ) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[requires] | ||
sfml/2.5.1@bincrafters/stable | ||
|
||
[options] | ||
sfml:graphics=True | ||
sfml:window=True | ||
|
||
[generators] | ||
cmake |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker image are pulled from the bincrafters SFML configuration