diff --git a/.azure-pipelines/azure-pipelines-win.yml b/.azure-pipelines/azure-pipelines-win.yml index ac84bf0..6493599 100644 --- a/.azure-pipelines/azure-pipelines-win.yml +++ b/.azure-pipelines/azure-pipelines-win.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 993c488..1364e4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 828ab7d..2bd6246 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -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 @@ -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}) @@ -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 @@ -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}) diff --git a/Config/CMakeLists.txt b/Source/Config/CMakeLists.txt similarity index 67% rename from Config/CMakeLists.txt rename to Source/Config/CMakeLists.txt index 97d73e9..6e69fe1 100644 --- a/Config/CMakeLists.txt +++ b/Source/Config/CMakeLists.txt @@ -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}" diff --git a/Config/vtkboneConfig.cmake.in b/Source/Config/vtkboneConfig.cmake.in similarity index 100% rename from Config/vtkboneConfig.cmake.in rename to Source/Config/vtkboneConfig.cmake.in diff --git a/Config/vtkboneConfigVersion.cmake.in b/Source/Config/vtkboneConfigVersion.cmake.in similarity index 100% rename from Config/vtkboneConfigVersion.cmake.in rename to Source/Config/vtkboneConfigVersion.cmake.in diff --git a/Config/vtkboneConfigure.h.in b/Source/Config/vtkboneConfigure.h.in similarity index 98% rename from Config/vtkboneConfigure.h.in rename to Source/Config/vtkboneConfigure.h.in index 7428f9e..14f4fe6 100644 --- a/Config/vtkboneConfigure.h.in +++ b/Source/Config/vtkboneConfigure.h.in @@ -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) diff --git a/Config/vtkbone_version.h.in b/Source/Config/vtkbone_version.h.in similarity index 100% rename from Config/vtkbone_version.h.in rename to Source/Config/vtkbone_version.h.in diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b7a1d6a..8a90087 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 diff --git a/cmake/modules/FindnetCDF.cmake b/cmake/modules/FindnetCDF.cmake index 1a5d1ed..ea55eb6 100644 --- a/cmake/modules/FindnetCDF.cmake +++ b/cmake/modules/FindnetCDF.cmake @@ -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 ) diff --git a/cmake/vtkboneWrapPython.cmake b/cmake/vtkboneWrapPython.cmake index 38920d9..b3876f0 100644 --- a/cmake/vtkboneWrapPython.cmake +++ b/cmake/vtkboneWrapPython.cmake @@ -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() @@ -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 diff --git a/conda-recipe/vtkbone/bld.bat b/conda-recipe/vtkbone/bld.bat index 83e3e24..8462c12 100644 --- a/conda-recipe/vtkbone/bld.bat +++ b/conda-recipe/vtkbone/bld.bat @@ -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 diff --git a/conda-recipe/vtkbone/build.sh b/conda-recipe/vtkbone/build.sh index cd056a9..e2cceaa 100644 --- a/conda-recipe/vtkbone/build.sh +++ b/conda-recipe/vtkbone/build.sh @@ -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[@]}" @@ -57,5 +56,4 @@ cmake .. \ ninja install -v # Run tests -python -c 'import vtkbone' nosetests ${SRC_DIR}/Testing/Python diff --git a/conda-recipe/vtkbone/meta.yaml b/conda-recipe/vtkbone/meta.yaml index 3632cb3..6ae0ea9 100644 --- a/conda-recipe/vtkbone/meta.yaml +++ b/conda-recipe/vtkbone/meta.yaml @@ -20,7 +20,7 @@ requirements: - gtest - python {{ python }} - boost >=1.61 - - libnetcdf 4.7.1 + - libnetcdf 4.7 - pqctio - aimio - vtk =8.2 @@ -29,7 +29,7 @@ requirements: run: - python {{ python }} - boost >=1.61 - - libnetcdf 4.7.1 + - libnetcdf 4.7 - pqctio - aimio - vtk =8.2