Skip to content

Commit

Permalink
Merge pull request #28 from ess-dmsc/build_on_msvc
Browse files Browse the repository at this point in the history
Build with MSVC
  • Loading branch information
SkyToGround authored May 10, 2019
2 parents ca24134 + a8b1c92 commit 11050a4
Show file tree
Hide file tree
Showing 16 changed files with 675 additions and 68 deletions.
38 changes: 30 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.7)
project("graylog-logger"
VERSION 1.1.0
VERSION 1.2.0
DESCRIPTION "A simple logging library."
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup(SKIP_RPATH NO_OUTPUT_DIRS)
endif()

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

include("CppCheck")
# Conan - bring in dependencies with conan
set(CONAN_PROFILE "default" CACHE STRING "Name of conan profile to use, uses default by default")
set(CONAN "AUTO" CACHE STRING "conan options AUTO (conan must be in path), MANUAL (expects conanbuildinfo.cmake in build directory) or DISABLE")

if(${CONAN} MATCHES "AUTO")
include(${CMAKE_MODULE_PATH}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt
PROFILE ${CONAN_PROFILE}
BASIC_SETUP NO_OUTPUT_DIRS KEEP_RPATHS CMAKE_TARGETS
BUILD_TYPE "None"
BUILD outdated)
elseif(${CONAN} MATCHES "MANUAL")
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup(NO_OUTPUT_DIRS KEEP_RPATHS TARGETS)
else()
message(FATAL_ERROR "CONAN set to MANUAL but no file named conanbuildinfo.cmake found in build directory")
endif()
else()
message(FATAL_ERROR "Unrecognised option for CONAN, use AUTO or MANUAL")
endif()

if (NOT WIN32)
include("CppCheck")
else()
# Tell asio to target Windows 10
add_definitions(-D_WIN32_WINNT=0x0A00)
endif(NOT WIN32)

add_subdirectory(src)

Expand Down
45 changes: 45 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ node {
}

builders['macOS'] = get_macos_pipeline()
builders['windows10'] = get_win10_pipeline()
try {
parallel builders
} catch (e) {
Expand Down Expand Up @@ -170,3 +171,47 @@ def get_macos_pipeline()
}
}
}

def get_win10_pipeline() {
return {
node('windows10') {

// Use custom location to avoid Win32 path length issues
ws('c:\\jenkins\\') {
cleanWs()
dir("${project}") {
stage("win10: Checkout") {
checkout scm
} // stage

stage("win10: Setup") {
bat """if exist _build rd /q /s _build
mkdir _build
"""
} // stage

stage("win10: Install") {
bat """cd _build
conan.exe \
install ..\\conanfile.txt \
--settings build_type=Release \
--build=outdated"""
} // stage

stage("win10: Build") {
bat """cd _build
cmake .. -G \"Visual Studio 15 2017 Win64\" -DCMAKE_BUILD_TYPE=Release -DCONAN=MANUAL -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE
cmake --build . --config Release
"""
} // stage

stage("win10: Test") {
bat """cd _build
activate_run.bat && unit_tests\\Release\\unit_tests.exe && deactivate_run.bat
"""
} // stage
} // dir
} // ws
} // node
} // return
} // def
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The logging library depends on several external libraries:

You will also need CMake (version ≥ 3.9) to build the project. The project makes use of library and language features provided by C++14. It might be possible to link to the library using compilers that only supports C++11 though this has not been tested.

Due to the use of ASIO, the library should compile on most \*nix systems with no issues though only limited testing has been done. The library should also compile and work on Windows though this has not been tested.
Due to the use of ASIO, the library should compile on most \*nix systems and Windows 10 with no issues though only limited testing has been done.


### Installing
Expand All @@ -47,13 +47,11 @@ git clone https://github.com/ess-dmsc/graylog-logger.git
cd graylog-logger
mkdir build
cd build
conan install .. --build=missing
conan install .. --build=outdated
cmake ..
make install
```

If you do not want to use Conan for providing the dependencies; install them in the way you prefer and simply follow the instructions above but ignore the Conan-step.


#### Documentation
The code has some documentation. To generate it, run _doxygen_ in the root of the repository i.e.:
Expand Down
Loading

0 comments on commit 11050a4

Please sign in to comment.