Skip to content

Commit

Permalink
Add windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
Besler committed Dec 11, 2019
1 parent 798af4e commit 007e5ad
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .azure-pipelines/azure-pipelines-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
python.version: '3.6'
Python37:
python.version: '3.7'
Python38:
python.version: '3.8'
steps:
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add conda to path
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ include (${PROJECT_SOURCE_DIR}/cmake/vtkboneVersion.cmake)

# === Configure project
include (${PROJECT_SOURCE_DIR}/cmake/vtkboneOptions.cmake)
add_subdirectory(Config)
include (${PROJECT_SOURCE_DIR}/cmake/vtkboneWrapPython.cmake)

# === Enable Testing
# Note: must be enabled in root CMake file.
Expand Down
29 changes: 17 additions & 12 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ set (VTKBONE_DISTRIBUTED_INCLUDE_FILES
vtkboneWin32Header.h
)

# === Options around shared libraries

# Build shared libs ?
# Defaults to the same VTK setting.
option (BUILD_SHARED_LIBS
"Build shared libraries."
${VTK_BUILD_SHARED_LIBS})
set (VTKBONE_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})

# === Configure the package

add_subdirectory(Config)

# === Find packages

# Requires Boost
Expand Down Expand Up @@ -172,23 +185,14 @@ find_package(netCDF REQUIRED)
# Include all directories
# We need to include TBB untill VTK fixes their CMake exports
include_directories (${TBB_INCLUDE_DIRS})
include_directories (${PROJECT_BINARY_DIR}/Config/)
include_directories (${PROJECT_BINARY_DIR}/Source/Config/)
include_directories (${Boost_INCLUDE_DIR})
include_directories (${N88UTIL_INCLUDE_DIRS})
include_directories (${AIMIO_INCLUDE_DIRS})
include_directories (${PQCTIO_INCLUDE_DIRS})
include_directories (${NETCDF_INCLUDE_DIRS})
include_directories (${netCDF_INCLUDE_DIRS})
include ("${VTK_USE_FILE}")

# === Options around shared libraries

# Build shared libs ?
# Defaults to the same VTK setting.
option (BUILD_SHARED_LIBS
"Build shared libraries."
${VTK_BUILD_SHARED_LIBS})
set (VTKBONE_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})

# === Create the vtkbone C++ library
# We need to include TBB untill VTK fixes their CMake exports
add_library (vtkbone ${VTKBONE_SRCS})
Expand All @@ -201,7 +205,7 @@ target_link_libraries (vtkbone
n88util::n88util
Boost::date_time Boost::filesystem Boost::system
TBB::tbb
${netCDF_LIBRARIES}
netcdf
)

# On Linux systems, need to build static libraries with -fPIC
Expand Down Expand Up @@ -253,6 +257,7 @@ install(EXPORT vtkboneTargets
)

# === Wrap Python
include (${PROJECT_SOURCE_DIR}/cmake/vtkboneWrapPython.cmake)
if (VTKBONE_WRAP_PYTHON)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
Expand Down
12 changes: 6 additions & 6 deletions Config/CMakeLists.txt → Source/Config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

# Create version file
configure_file (
"${PROJECT_SOURCE_DIR}/Config/vtkbone_version.h.in"
"${PROJECT_BINARY_DIR}/Config/vtkbone_version.h"
"${PROJECT_SOURCE_DIR}/Source/Config/vtkbone_version.h.in"
"${PROJECT_BINARY_DIR}/Source/Config/vtkbone_version.h"
)

# Create the vtkboneConfigure.h file.
# To include this file in source,
# include_directories (${PROJECT_BINARY_DIR}/Config/)
# include_directories (${PROJECT_BINARY_DIR}/Source/Config/)
configure_file (
"${PROJECT_SOURCE_DIR}/Config/vtkboneConfigure.h.in"
"${PROJECT_BINARY_DIR}/Config/vtkboneConfigure.h"
"${PROJECT_SOURCE_DIR}/Source/Config/vtkboneConfigure.h.in"
"${PROJECT_BINARY_DIR}/Source/Config/vtkboneConfigure.h"
)
install (FILES "${PROJECT_BINARY_DIR}/Config/vtkboneConfigure.h" DESTINATION include)
install (FILES "${PROJECT_BINARY_DIR}/Source/Config/vtkboneConfigure.h" DESTINATION include)

# Create the vtkboneConfig.cmake and vtkboneConfigVersion files
file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#cmakedefine VTKBONE_BUILD_SHARED_LIBS
#ifndef VTKBONE_BUILD_SHARED_LIBS
#define VTKBONE_STATIC
#else
#endif

#if defined(_MSC_VER) && !defined(VTKBONE_STATIC)
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ schedules:
include:
- master
always: true

trigger:
- master

jobs:
- template: ./.azure-pipelines/azure-pipelines-linux.yml
- template: ./.azure-pipelines/azure-pipelines-osx.yml
# - template: ./.azure-pipelines/azure-pipelines-win.yml
- template: ./.azure-pipelines/azure-pipelines-win.yml
16 changes: 8 additions & 8 deletions cmake/modules/FindnetCDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ MACRO (netCDF_ADJUST_LIB_VARS basename)
MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR )
ENDMACRO (netCDF_ADJUST_LIB_VARS)


# Try to find netCDF using an installed netCDF-config.cmake
if( NOT netCDF_FOUND )
if (FIND_netCDF_DEBUG)
message ("Looking for netCDF config.")
endif()
find_package( netCDF QUIET NO_MODULE )
endif()
# NOTE: Turned off to avoid hdf5 target issues on windows. Gotta find manually
# # Try to find netCDF using an installed netCDF-config.cmake
# if( NOT netCDF_FOUND )
# if (FIND_netCDF_DEBUG)
# message ("Looking for netCDF config.")
# endif()
# find_package( netCDF QUIET NO_MODULE )
# endif()

# Try to find netCDF manually
if( NOT netCDF_FOUND )
Expand Down
4 changes: 2 additions & 2 deletions cmake/vtkboneWrapPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ macro(vtkbone_wrap_python library_name WRAP_SRCS)

# Determine site-packages for python install
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(SITE_PACKAGES "Lib/site-packages")
set(SITE_PACKAGES "${CMAKE_INSTALL_PREFIX}/../Lib/site-packages")
get_filename_component(SITE_PACKAGES "${SITE_PACKAGES}" ABSOLUTE)
else ()
set(SITE_PACKAGES "lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages")
endif()
Expand Down Expand Up @@ -73,7 +74,6 @@ macro(vtkbone_wrap_python library_name WRAP_SRCS)

# Create lib${library_name}Python
Python_add_library (${library_name}Python MODULE ${library_name}PythonInit.cxx)
# add_library (${library_name}Python MODULE )
target_link_libraries(${library_name}Python
PRIVATE
${library_name}PythonD
Expand Down
11 changes: 10 additions & 1 deletion conda-recipe/vtkbone/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,23 @@ cmake .. ^
-DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^
-DBOOST_ROOT:PATH="%PREFIX%" ^
-DENABLE_TESTING:BOOL=ON ^
-DPYTHON_INCLUDE_PATH:PATH="%PREFIX%\\include" ^
-DPYTHON_LIBRARY:FILEPATH="%PREFIX%\\libs\\python%PY_VER%.lib" ^
-DPython_ROOT_DIR:PATH="${PREFIX}" ^
-DVTKBONE_PYTHON_VERSION:STRING="%PY_VER%" ^
-DCMAKE_MODULE_PATH:PATH="%SRC_DIR%\cmake\modules" ^
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS:BOOL=OFF ^
-DBUILD_SHARED_LIBS:BOOL=ON
if errorlevel 1 exit 1

:: Compile and install
ninja install
ninja install -v
if errorlevel 1 exit 1

:: Set environemnt variables for nosetests
set PATH=%PATH%;%PREFIX%\\Library\\lib;%PREFIX%\\Library\\bin
set PYTHONPATH=%PYTHONPATH%;%PREFIX%\\Lib\\site-packages

:: Run tests
nosetests "%SRC_DIR%\Testing\Python"
if errorlevel 1 exit 1
2 changes: 0 additions & 2 deletions conda-recipe/vtkbone/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ cmake .. \
-DPython_ROOT_DIR:PATH="${PREFIX}" \
-DPython_FIND_STRATEGY="LOCATION" \
-DVTKBONE_PYTHON_VERSION:STRING="${PY_VER}" \
-DVTKBONE_USE_VTKNETCDF:BOOl=OFF \
-DCMAKE_MODULE_PATH:PATH="${SRC_DIR}/cmake/modules" \
-DENABLE_TESTING:BOOL=ON \
"${CMAKE_PLATFORM_FLAGS[@]}"
Expand All @@ -57,5 +56,4 @@ cmake .. \
ninja install -v

# Run tests
python -c 'import vtkbone'
nosetests ${SRC_DIR}/Testing/Python
4 changes: 2 additions & 2 deletions conda-recipe/vtkbone/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ requirements:
- gtest
- python {{ python }}
- boost >=1.61
- libnetcdf 4.7.1
- libnetcdf 4.7
- pqctio
- aimio
- vtk =8.2
Expand All @@ -29,7 +29,7 @@ requirements:
run:
- python {{ python }}
- boost >=1.61
- libnetcdf 4.7.1
- libnetcdf 4.7
- pqctio
- aimio
- vtk =8.2
Expand Down

0 comments on commit 007e5ad

Please sign in to comment.