Skip to content

Commit

Permalink
AppVeyor integration (#2)
Browse files Browse the repository at this point in the history
* Add appveyor.yml.

* Add Conan installation/setup to appveyor.yml.

* Fix appveyor.yml environment.

* Use Chocolatey to install Conan.

* Use pip to install Conan.

* Fix Conan setup.

* Fix appveyor.yml.

* Add a testing target that works on Windows.

* Attempt to fix Boost on AppVeyor.

* Remove extraneous Boost components.

* Help AppVeyor find Boost.

* Add BOOST_LIBRARY_PATH.

* Fix AppVeyor syntax error.

* Fix Boost library dir environment variable name.

* Attempt to diagnose AppVeyor issues.

* Attempt to diagnose AppVeyor issues.

* Try to make AppVeyor issue a build.

* Add missing VisualStudioVersion environment variable.

* Fix appveyor.yml syntax.

* Try a different way of getting VC version.

* Add missing %.

* More diagnostics.

* Yet more diagnostics.

* Investigate AppVeyor library structure.

* Hard-code VC version in Boost library dir.

* More diagnostics.

* Experiment some more.

* More investigation.

* Clean up.
  • Loading branch information
tmadden committed Apr 19, 2018
1 parent c28c830 commit 46c23b2
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 26 deletions.
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.bat text eol=lf
*.c text eol=lf
*.cpp text eol=lf
*.h text eol=lf
*.hpp text eol=lf
*.ipp text eol=lf
*.js text eol=lf
*.json text eol=lf
*.md text eol=lf
*.ml text eol=lf
*.mll text eol=lf
*.mly text eol=lf
*.py text eol=lf
*.sh text eol=lf
*.txt text eol=lf
*.yml text eol=lf
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ before_script:
- export CC=`which gcc-5`
- export CXX=`which g++-5`
- scripts/set-up-conan.sh
- ./fips set config linux-make-debug
- ./fips gen

script:
- ./fips make test
- ./fips make test linux-make-debug
- ./fips make test linux-make-release
23 changes: 20 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,20 @@ set(CMAKE_CXX_FLAGS "${ORIGINAL_CXX_FLAGS}")
fips_include_directories(${CONAN_INCLUDE_DIRS}
"$<$<CONFIG:Release>:${CONAN_INCLUDE_DIRS_RELEASE}>"
"$<$<CONFIG:Debug>:${CONAN_INCLUDE_DIRS_DEBUG}>")
# And remember the libs that it wants to link against.
set(EXTERNAL_LIBS ${CONAN_LIBS})

# If we're running on AppVeyor, we omit Boost from Conan and just use the one
# that AppVeyor supplies. (This saves a lot of time and frustration.)
if(DEFINED ENV{APPVEYOR})
find_package(Boost REQUIRED COMPONENTS program_options)
fips_include_directories(${Boost_INCLUDE_DIRS})
list(APPEND EXTERNAL_LIBS ${Boost_LIBRARIES})
endif()

fips_include_directories(${PROJECT_SOURCE_DIR}/src)

# Add the given linker options on anything that gets linked.
# MACRO - Add the given linker options on anything that gets linked.
macro(add_link_options )
string(REPLACE ";" " " OPTIONS "${ARGV}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OPTIONS}")
Expand All @@ -64,7 +74,7 @@ macro(add_link_options )
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OPTIONS}")
endmacro()

# Add the given linker options for executables.
# MACRO - Add the given linker options for executables.
macro(add_exe_link_options )
string(REPLACE ";" " " OPTIONS "${ARGV}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPTIONS}")
Expand Down Expand Up @@ -113,7 +123,7 @@ fips_begin_module(alia)
fips_src(src/alia)
fips_dir(.)
fips_end_module()
target_link_libraries(alia ${CONAN_LIBS})
target_link_libraries(alia ${EXTERNAL_LIBS})

# Add the unit test runner.
fips_begin_app(unit_test_runner cmdline)
Expand Down Expand Up @@ -195,3 +205,10 @@ else()
COMMAND ${CMAKE_COMMAND} --build . --target unit_tests
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
endif()

# CMake doesn't seem to generate a test target in some cases (which I haven't
# quite figured out), so generate a custom one.
add_custom_target(
ctest
COMMAND ctest -C ${CMAKE_BUILD_TYPE}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
69 changes: 69 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# version string format -- This will be overwritten later anyway
version: "{build}"

image:
- Visual Studio 2017
- Visual Studio 2015

platform:
- x86
- x64

configuration:
- Debug
- Release

init:
- git config --global core.autocrlf input
# Set build version to git commit-hash
- ps: Update-AppveyorBuild -Version "$($env:APPVEYOR_REPO_BRANCH) - $($env:APPVEYOR_REPO_COMMIT)"

install:
# Set up Conan.
- set PATH=%PATH%;%PYTHON%/Scripts/
- pip.exe install conan
- conan user
- conan --version
- scripts\set-up-conan.bat

environment:
BOOST_ROOT: C:/Libraries/boost_1_66_0

for:
- matrix:
only:
- platform: x64
configuration: Release
before_build:
- fips set config win64-vstudio-release
environment:
LIBRARY_ARCHITECTURE: lib64
- matrix:
only:
- platform: x64
configuration: Debug
before_build:
- fips set config win64-vstudio-debug
environment:
LIBRARY_ARCHITECTURE: lib64
- matrix:
only:
- platform: x86
configuration: Release
before_build:
- fips set config win32-vstudio-release
environment:
LIBRARY_ARCHITECTURE: lib32
- matrix:
only:
- platform: x86
configuration: Debug
before_build:
- fips set config win32-vstudio-debug
environment:
LIBRARY_ARCHITECTURE: lib32

build_script:
- set BOOST_LIBRARYDIR=%BOOST_ROOT%/%LIBRARY_ARCHITECTURE%-msvc-14.1
- fips gen
- fips make ctest
43 changes: 24 additions & 19 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
from conans import ConanFile, CMake
import os


class CradleConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = \
"Boost/1.64.0@conan/stable", \
"catch/1.5.0@TyRoXx/stable", \
"FakeIt/master@gasuketsu/stable"
"FakeIt/2.0.4@gasuketsu/stable"
generators = "cmake"
default_options = \
"Boost:without_atomic=True", \
"Boost:without_chrono=True", \
"Boost:without_container=True", \
"Boost:without_context=True", \
"Boost:without_coroutine=True", \
"Boost:without_coroutine2=True", \
"Boost:without_graph=True", \
"Boost:without_graph_parallel=True", \
"Boost:without_log=True", \
"Boost:without_math=True", \
"Boost:without_mpi=True", \
"Boost:without_serialization=True", \
"Boost:without_signals=True", \
"Boost:without_test=True", \
"Boost:without_timer=True", \
"Boost:without_type_erasure=True", \
"Boost:without_wave=True", \
"FakeIt:integration=catch", \
"*:shared=False"
if "APPVEYOR" not in os.environ:
# AppVeyor provides Boost directly (and seems to have trouble building
# it through Conan), so omit Boost if we're running on AppVeyor.
requires = requires + ("Boost/1.64.0@conan/stable", )
default_options = default_options + \
("Boost:without_atomic=True",
"Boost:without_chrono=True",
"Boost:without_container=True",
"Boost:without_context=True",
"Boost:without_coroutine=True",
"Boost:without_coroutine2=True",
"Boost:without_graph=True",
"Boost:without_graph_parallel=True",
"Boost:without_log=True",
"Boost:without_math=True",
"Boost:without_mpi=True",
"Boost:without_serialization=True",
"Boost:without_signals=True",
"Boost:without_test=True",
"Boost:without_timer=True",
"Boost:without_type_erasure=True",
"Boost:without_wave=True")

def imports(self):
dest = os.getenv("CONAN_IMPORT_PATH", "bin")
Expand Down
5 changes: 5 additions & 0 deletions scripts/set-up-conan.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:: Install additional Conan remotes that are needed to build alia.
@echo off
echo "Setting up Conan..."
conan remote add conan-community https://api.bintray.com/conan/conan-community/conan || exit /b
conan remote add conan-transit https://api.bintray.com/conan/conan/conan-transit || exit /b
2 changes: 1 addition & 1 deletion scripts/set-up-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -x -e
virtualenv --python=python3.5 .python
source .python/bin/activate
python --version
pip install conan jinja2 gcovr pytest websocket-client
pip install conan gcovr

0 comments on commit 46c23b2

Please sign in to comment.