Skip to content

Commit ec750af

Browse files
committed
Revamping builds on AppVeyor CI (Windows)
The builds are still **NOT WORKING** but at least they are now successfully started. The `host_writer` function should be passed as a function pointer to avoid issues with undefined symbols at the linking stage for the library.
1 parent 2a42843 commit ec750af

File tree

8 files changed

+122
-36
lines changed

8 files changed

+122
-36
lines changed

.appveyor.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
# Where "ps:" is used commands are executed in PowerShell
99

1010
# build version format: 1, 2, ...
11-
version: '{build}'
11+
version: '{build}-{branch}'
12+
13+
# branches to build
14+
branches:
15+
only:
16+
- fix-travis
17+
- fix-appveyor
1218

1319
os: Windows Server 2012 R2
1420

@@ -20,7 +26,7 @@ build:
2026
# prepare environment
2127
environment:
2228
# set custom path (will be more extended later in build_script section)
23-
path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files\7-Zip;C:\Program Files (x86)\CMake\bin
29+
#path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files\7-Zip;C:\Program Files (x86)\CMake\bin
2430
# set MinGw-w64 (64-bit) version 5.1.0 download URL
2531
url: http://kent.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.1.0/threads-posix/seh/x86_64-5.1.0-release-posix-seh-rt_v4-rev0.7z
2632
# user can possibly use different Python versions, we try to test multiple cases
@@ -61,10 +67,12 @@ before_build:
6167
- python get-pip.py
6268
# go back to project source dir
6369
- cd %APPVEYOR_BUILD_FOLDER%
64-
65-
build_script:
70+
# Workaround for CMake not wanting sh.exe on PATH for MinGW
71+
- set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
6672
- python setup.py --generator="%GENERATOR%" --cmake-options="-DENABLE_FORTRAN_API=ON"
6773
- cd build
74+
75+
build_script:
6876
- cmake --build . -- %BUILDFLAGS%
6977

7078
test_script:

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ include(Fortran_C)
2828
include(CXXFlags)
2929
include(CFlags)
3030
include(FortranFlags)
31+
include(autocmake_custom_color_messages)
3132
include(GNUdirs)
3233
include(autocmake_ccache)
3334
include(rpath)

cmake/autocmake.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ modules:
1717
- 'custom/compilers/FortranFlags.cmake'
1818
- plugins:
1919
- source:
20+
- '%(url_root)modules/custom_color_messages.cmake'
2021
- 'custom/GNUdirs.cmake'
2122
- '%(url_root)modules/ccache.cmake'
2223
- 'custom/rpath.cmake'

cmake/custom/GNUdirs.cmake

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
#
1212
# autocmake.yml configuration::
1313
#
14-
# ?
15-
16-
if("${${CMAKE_INSTALL_LIBDIR}}" STREQUAL "" OR NOT DEFINED ${CMAKE_INSTALL_LIBDIR})
17-
set(${CMAKE_INSTALL_LIBDIR} lib CACHE STRING "Directory to which libraries are installed" FORCE)
18-
endif()
14+
# docopt:
15+
# - "--bindir=<CMAKE_INSTALL_BINDIR> User executables [default: bin]."
16+
# - "--libdir=<CMAKE_INSTALL_LIBDIR> Object code libraries [default: lib]."
17+
# - "--includedir=<CMAKE_INSTALL_INCLUDEDIR> C header files [default: include]."
18+
# - "--datadir=<CMAKE_INSTALL_DATADIR> Read-only architecture-independent data root [default: share]."
19+
# define:
20+
# - "'-DCMAKE_INSTALL_BINDIR={0}'.format(arguments['--bindir'])"
21+
# - "'-DCMAKE_INSTALL_LIBDIR={0}'.format(arguments['--libdir'])"
22+
# - "'-DCMAKE_INSTALL_INCLUDEDIR={0}'.format(arguments['--includedir'])"
23+
# - "'-DCMAKE_INSTALL_DATADIR={0}'.format(arguments['--datadir'])"
1924

2025
include(GNUInstallDirs)

cmake/custom/windows.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ if(CMAKE_SYSTEM_NAME MATCHES Windows)
33
add_definitions(-DPCMSOLVER_BUILD_SHARED)
44
# Get math constants such as M_PI
55
add_definitions(-D_USE_MATH_DEFINES)
6+
# Mark as undefined symbols that have to be defined by the host
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-U,host_writer")
68
endif()
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#.rst:
2+
#
3+
# Colorize CMake output.
4+
# Code was found on StackOverflow: http://stackoverflow.com/a/19578320
5+
#
6+
# Usage within CMake code:
7+
# message("This is normal")
8+
# message("${Red}This is Red${ColourReset}")
9+
# message("${Green}This is Green${ColourReset}")
10+
# message("${Yellow}This is Yellow${ColourReset}")
11+
# message("${Blue}This is Blue${ColourReset}")
12+
# message("${Magenta}This is Magenta${ColourReset}")
13+
# message("${Cyan}This is Cyan${ColourReset}")
14+
# message("${White}This is White${ColourReset}")
15+
# message("${BoldRed}This is BoldRed${ColourReset}")
16+
# message("${BoldGreen}This is BoldGreen${ColourReset}")
17+
# message("${BoldYellow}This is BoldYellow${ColourReset}")
18+
# message("${BoldBlue}This is BoldBlue${ColourReset}")
19+
# message("${BoldMagenta}This is BoldMagenta${ColourReset}")
20+
# message("${BoldCyan}This is BoldCyan${ColourReset}")
21+
# message("${BoldWhite}This is BoldWhite\n\n${ColourReset}")
22+
#
23+
# Has no effect on WIN32.
24+
25+
if(WIN32)
26+
set(ColourReset "")
27+
set(ColourBold "")
28+
set(Red "")
29+
set(Green "")
30+
set(Yellow "")
31+
set(Blue "")
32+
set(Magenta "")
33+
set(Cyan "")
34+
set(White "")
35+
set(BoldRed "")
36+
set(BoldGreen "")
37+
set(BoldYellow "")
38+
set(BoldBlue "")
39+
set(BoldMagenta "")
40+
set(BoldCyan "")
41+
set(BoldWhite "")
42+
else()
43+
string(ASCII 27 Esc)
44+
set(ColourReset "${Esc}[m")
45+
set(ColourBold "${Esc}[1m")
46+
set(Red "${Esc}[31m")
47+
set(Green "${Esc}[32m")
48+
set(Yellow "${Esc}[33m")
49+
set(Blue "${Esc}[34m")
50+
set(Magenta "${Esc}[35m")
51+
set(Cyan "${Esc}[36m")
52+
set(White "${Esc}[37m")
53+
set(BoldRed "${Esc}[1;31m")
54+
set(BoldGreen "${Esc}[1;32m")
55+
set(BoldYellow "${Esc}[1;33m")
56+
set(BoldBlue "${Esc}[1;34m")
57+
set(BoldMagenta "${Esc}[1;35m")
58+
set(BoldCyan "${Esc}[1;36m")
59+
set(BoldWhite "${Esc}[1;37m")
60+
endif()

setup.py

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,35 @@
1717
./setup.py (-h | --help)
1818
1919
Options:
20-
--fc=<FC> Fortran compiler [default: gfortran].
21-
--extra-fc-flags=<EXTRA_FCFLAGS> Extra Fortran compiler flags [default: ''].
22-
--cc=<CC> C compiler [default: gcc].
23-
--extra-cc-flags=<EXTRA_CFLAGS> Extra C compiler flags [default: ''].
24-
--cxx=<CXX> C++ compiler [default: g++].
25-
--extra-cxx-flags=<EXTRA_CXXFLAGS> Extra C++ compiler flags [default: ''].
26-
--ccache=<USE_CCACHE> Toggle use of ccache <ON/OFF> [default: ON].
27-
--add-definitions=<STRING> Add preprocesor definitions [default: ''].
28-
--coverage Enable code coverage [default: False].
29-
--int64 Enable 64bit integers [default: False].
30-
--omp Enable OpenMP parallelization [default: False].
31-
--python=<PYTHON_INTERPRETER> The Python interpreter (development version) to use. [default: ''].
32-
--boost-headers=<BOOST_INCLUDEDIR> Include directories for Boost [default: ''].
33-
--boost-libraries=<BOOST_LIBRARYDIR> Library directories for Boost [default: ''].
34-
--build-boost=<FORCE_CUSTOM_BOOST> Deactivate Boost detection and build on-the-fly <ON/OFF> [default: OFF].
35-
--static Create only the static library [default: False].
36-
--eigen=<EIGEN3_ROOT> Root directory for Eigen3 [default: ''].
37-
--type=<TYPE> Set the CMake build type (debug, release, or relwithdeb) [default: release].
38-
--generator=<STRING> Set the CMake build system generator [default: Unix Makefiles].
39-
--show Show CMake command and exit.
40-
--cmake-executable=<CMAKE_EXECUTABLE> Set the CMake executable [default: cmake].
41-
--cmake-options=<STRING> Define options to CMake [default: ''].
42-
--prefix=<PATH> Set the install path for make install.
43-
<builddir> Build directory.
44-
-h --help Show this screen.
20+
--fc=<FC> Fortran compiler [default: gfortran].
21+
--extra-fc-flags=<EXTRA_FCFLAGS> Extra Fortran compiler flags [default: ''].
22+
--cc=<CC> C compiler [default: gcc].
23+
--extra-cc-flags=<EXTRA_CFLAGS> Extra C compiler flags [default: ''].
24+
--cxx=<CXX> C++ compiler [default: g++].
25+
--extra-cxx-flags=<EXTRA_CXXFLAGS> Extra C++ compiler flags [default: ''].
26+
--bindir=<CMAKE_INSTALL_BINDIR> User executables [default: bin].
27+
--libdir=<CMAKE_INSTALL_LIBDIR> Object code libraries [default: lib].
28+
--includedir=<CMAKE_INSTALL_INCLUDEDIR> C header files [default: include].
29+
--datadir=<CMAKE_INSTALL_DATADIR> Read-only architecture-independent data root [default: share].
30+
--ccache=<USE_CCACHE> Toggle use of ccache <ON/OFF> [default: ON].
31+
--add-definitions=<STRING> Add preprocesor definitions [default: ''].
32+
--coverage Enable code coverage [default: False].
33+
--int64 Enable 64bit integers [default: False].
34+
--omp Enable OpenMP parallelization [default: False].
35+
--python=<PYTHON_INTERPRETER> The Python interpreter (development version) to use. [default: ''].
36+
--boost-headers=<BOOST_INCLUDEDIR> Include directories for Boost [default: ''].
37+
--boost-libraries=<BOOST_LIBRARYDIR> Library directories for Boost [default: ''].
38+
--build-boost=<FORCE_CUSTOM_BOOST> Deactivate Boost detection and build on-the-fly <ON/OFF> [default: OFF].
39+
--static Create only the static library [default: False].
40+
--eigen=<EIGEN3_ROOT> Root directory for Eigen3 [default: ''].
41+
--type=<TYPE> Set the CMake build type (debug, release, or relwithdeb) [default: release].
42+
--generator=<STRING> Set the CMake build system generator [default: Unix Makefiles].
43+
--show Show CMake command and exit.
44+
--cmake-executable=<CMAKE_EXECUTABLE> Set the CMake executable [default: cmake].
45+
--cmake-options=<STRING> Define options to CMake [default: ''].
46+
--prefix=<PATH> Set the install path for make install.
47+
<builddir> Build directory.
48+
-h --help Show this screen.
4549
"""
4650

4751

@@ -57,6 +61,10 @@ def gen_cmake_command(options, arguments):
5761
command.append('-DEXTRA_FCFLAGS="{0}"'.format(arguments['--extra-fc-flags']))
5862
command.append('-DEXTRA_CFLAGS="{0}"'.format(arguments['--extra-cc-flags']))
5963
command.append('-DEXTRA_CXXFLAGS="{0}"'.format(arguments['--extra-cxx-flags']))
64+
command.append('-DCMAKE_INSTALL_BINDIR={0}'.format(arguments['--bindir']))
65+
command.append('-DCMAKE_INSTALL_LIBDIR={0}'.format(arguments['--libdir']))
66+
command.append('-DCMAKE_INSTALL_INCLUDEDIR={0}'.format(arguments['--includedir']))
67+
command.append('-DCMAKE_INSTALL_DATADIR={0}'.format(arguments['--datadir']))
6068
command.append('-DUSE_CCACHE={0}'.format(arguments['--ccache']))
6169
command.append('-DPREPROCESSOR_DEFINITIONS="{0}"'.format(arguments['--add-definitions']))
6270
command.append('-DENABLE_CODE_COVERAGE={0}'.format(arguments['--coverage']))

src/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ if(NOT STATIC_LIBRARY_ONLY)
2424
add_library(pcm-shared SHARED ${_objects})
2525
target_link_libraries(pcm-shared ${ZLIB_LIBRARIES} ${LIBC_INTERJECT})
2626
set_target_properties(pcm-shared PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} CLEAN_DIRECT_OUTPUT 1 OUTPUT_NAME "pcm")
27-
install(TARGETS pcm-shared
27+
install(TARGETS pcm-shared
28+
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
2829
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
2930
add_dependencies(pcm-shared generate-config-hpp)
3031
endif()
3132

3233
add_library(pcm-static STATIC ${_objects})
3334
set_target_properties(pcm-static PROPERTIES CLEAN_DIRECT_OUTPUT 1 OUTPUT_NAME "pcm")
34-
install(TARGETS pcm-static
35+
install(TARGETS pcm-static
3536
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
3637
add_dependencies(pcm-static generate-config-hpp)
3738

0 commit comments

Comments
 (0)