Skip to content

Commit a2c7e6c

Browse files
committed
Fix TravisCI build issues
Fixes #5 and #6
1 parent 78e20c9 commit a2c7e6c

5 files changed

Lines changed: 22 additions & 17 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ install:
2626
#- conda config --add channels conda-forge # hightest priority
2727
script:
2828
- mkdir build && cd build
29-
- cmake ..
29+
- cmake -DPYTHON_WORKAROUND=ON ..
3030
- make .

CMakeLists.txt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
cmake_minimum_required(VERSION 3.0.2)
2+
3+
option(PYTHON_WORKAROUND "Workaround for environments with multiple python versions" OFF)
4+
5+
# Problem building in Travis-CI tried fix:
6+
# https://github.com/pybind/pybind11/issues/236
7+
# This is really a bad fix, as the Python headers
8+
# won't be found in most build environments.
9+
# See also: https://github.com/Fluorescence-Tools/LabelLib/issues/5
10+
if(PYTHON_WORKAROUND)
11+
set(PYTHONLIBS_FOUND TRUE)
12+
set(PYTHON_MODULE_EXTENSION .so)
13+
set(PYTHON_MODULE_PREFIX "")
14+
endif(PYTHON_WORKAROUND)
15+
216
set(CMAKE_CXX_STANDARD 11)
317
if(MSVC)
418
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
@@ -20,11 +34,6 @@ set(GIT_VERSION_STRING "version-unknown")
2034
if(GIT_FOUND)
2135
include(GitDateVersion)
2236
gitDateVersionString(GIT_VERSION_STRING)
23-
# Split the version string by the hyphens, e.g., 2018.12.03-(HEAD detached at 4f65afa)-4f65afa,
24-
# and take the first element as a version name
25-
string(REPLACE "-" ";" GIT_VERSION_LIST ${GIT_VERSION_STRING})
26-
message(STATUS "${GIT_VERSION_LIST}")
27-
list(GET GIT_VERSION_LIST 0 GIT_VERSION_STRING)
2837
message(STATUS "GIT version: ${GIT_VERSION_STRING}")
2938
endif()
3039
add_definitions("-DGIT_VERSION_STRING=\"${GIT_VERSION_STRING}\"")

FlexLabel/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ if (NOT TARGET Eigen3::Eigen)
1717
endif (NOT TARGET Eigen3::Eigen)
1818
include_directories(${EIGEN3_INCLUDE_DIR})
1919

20-
# Problem building in Travis-CI tried fix:
21-
# https://github.com/pybind/pybind11/issues/236
22-
# This is really a bad fix, as the Python headers
23-
# won't be found in most build environments.
24-
set(PYTHONLIBS_FOUND TRUE)
25-
set(PYTHON_MODULE_EXTENSION .so)
26-
set(PYTHON_MODULE_PREFIX "")
2720
find_package(pybind11 2.2 QUIET)
2821
if(NOT pybind11_FOUND)
2922
message(STATUS "Using thirdparty/pybind11")

cmake/GitDateVersion.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function (gitDateVersionString _verStr)
1919
endif()
2020

2121
execute_process(
22-
COMMAND "${GIT_EXECUTABLE}" branch --contains ${hash}
22+
COMMAND "${GIT_EXECUTABLE}" branch --contains ${hash} "--format=%(refname:short)" --sort=-committerdate
2323
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
2424
RESULT_VARIABLE res
2525
OUTPUT_VARIABLE branch
@@ -28,7 +28,6 @@ function (gitDateVersionString _verStr)
2828
if(NOT res EQUAL 0)
2929
set(branch "nobranch")
3030
endif()
31-
STRING(REPLACE "* " "" branch ${branch})
3231
STRING(REGEX REPLACE "\n.*" "" branch ${branch})
3332

3433
execute_process(

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,16 @@ def build_extension(self, ext):
5858

5959

6060
def gitVersionString():
61+
hard_version="2018.12.11"
6162
try:
6263
out = subprocess.check_output(['git', 'show', '-s', '--format=%cd', '--date=short'])
63-
out = out.decode().replace('-','.')
64+
out = out.decode().replace('-','.').strip()
65+
if out != hard_version:
66+
print("WARNING: git-based version ({}) "
67+
"does not match the default version ({})!".format(out,hard_version))
6468
return out
6569
except:
66-
return "unknown-version"
70+
return hard_version
6771

6872

6973
setup(

0 commit comments

Comments
 (0)