Skip to content

Commit

Permalink
Merge pull request #727 from bam241/windows
Browse files Browse the repository at this point in the history
  • Loading branch information
gonuke authored Aug 22, 2021
2 parents 7bc70a1 + a87cce3 commit 472ac87
Show file tree
Hide file tree
Showing 17 changed files with 231 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Standard Build and Test
name: Linux Build/Test

on:
# allows us to run workflows manually
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/windows_build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Windows Build/Test

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
branches:
- develop
- master

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
BuildTest:
runs-on: windows-2019
steps:

- uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""

- name: Conda dependencies
shell: bash -l {0}
run: |
conda install curl eigen
conda install -c conda-forge hdf5=1.10.6
- name: Environment Variables
shell: bash -l {0}
run: |
echo "HOME_PATH=$GITHUB_WORKSPACE/.." >> $GITHUB_ENV
echo "CONDA_LOC=C:/Miniconda/Library" >> $GITHUB_ENV
cd ${HOME_PATH}
mkdir install_dir
- name: Build MOAB
shell: bash -l {0}
run: |
cd ${HOME_PATH}
git clone --depth 1 https://bitbucket.org/fathomteam/moab -b 5.3.0
mkdir moab_build
cd moab_build
cmake ../moab \
-DENABLE_BLASLAPACK=OFF \
-DENABLE_FORTRAN=OFF \
-DENABLE_IMESH=OFF \
-DENABLE_TESTING=OFF \
-DENABLE_HDF5=ON \
-DBUILD_SHARED_LIBS=ON \
-G"Visual Studio 16 2019" \
-DCMAKE_INSTALL_PREFIX=../install_dir/ \
-DHDF5_ROOT="${CONDA_LOC}" \
-DHDF5_hdf5_LIBRARY_RELEASE="${CONDA_LOC}/lib/libhdf5_hl.lib;${CONDA_LOC}/lib/libhdf5.lib;${CONDA_LOC}/lib/zlib.lib;${CONDA_LOC}/lib/libhdf5_cpp.lib" \
-DCMAKE_EXE_LINKER_FLAGS="/std:c++latest -DH5_BUILT_AS_DYNAMIC_LIB" \
-DCMAKE_MODULE_LINKER_FLAGS="/std:c++latest" \
-DCMAKE_SHARED_LINKER_FLAGS="/std:c++latest" \
-DCMAKE_STATIC_LINKER_FLAGS="" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe" \
-DCMAKE_CXX_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe"
cmake --build . --config Release
cmake --install . --config Release
- uses: actions/checkout@v2

- name: build DAGMC
shell: bash -l {0}
run: |
cd ${HOME_PATH}
mkdir build
cd build
cmake ../dagmc \
-G"Visual Studio 16 2019" \
-DBUILD_EXE=ON \
-DBUILD_STATIC_EXE=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_TALLY=OFF \
-DBUILD_BUILD_OBB=OFF \
-DBUILD_UWUW=ON \
-DBUILD_MAKE_WATERTIGHT=ON \
-DBUILD_OVERLAP_CHECK=OFF \
-DBUILD_TESTS=ON \
-DMOAB_DIR=../install_dir \
-DHDF5_ROOT="${CONDA_LOC}" \
-DHDF5_hdf5_LIBRARY_RELEASE="${CONDA_LOC}/lib/libhdf5_hl.lib;${CONDA_LOC}/lib/libhdf5.lib;${CONDA_LOC}/lib/zlib.lib;${CONDA_LOC}/lib/libhdf5_cpp.lib" \
-DCMAKE_INSTALL_PREFIX=../install_dir/ \
-DCMAKE_EXE_LINKER_FLAGS="" \
-DCMAKE_MODULE_LINKER_FLAGS="" \
-DCMAKE_SHARED_LINKER_FLAGS="" \
-DCMAKE_STATIC_LINKER_FLAGS="" \
-DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cmake --install . --config Release
- name: Installation Environment Variables
shell: bash -l {0}
run: |
echo "PATH=$PATH:/d/a/DAGMC/install_dir/bin:/d/a/DAGMC/install_dir/tests" >> $GITHUB_ENV
- name: test DAGMC
shell: bash -l {0}
run: |
cd $HOME_PATH/install_dir/tests
dagmc_pointinvol_test.exe
dagmc_rayfire_test.exe
dagmc_simple_test.exe
dagmc_unit_tests.exe
make_watertight_cone_tests.exe
make_watertight_cylinder_tests.exe
make_watertight_no_curve_sphere_tests.exe
make_watertight_sphere_n_box_test.exe
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ set(DAGMC_MINOR_VERSION 2)
set(DAGMC_PATCH_VERSION 0)
set(DAGMC_VERSION ${DAGMC_MAJOR_VERSION}.${DAGMC_MINOR_VERSION}.${DAGMC_PATCH_VERSION})

if(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()


# Set DAGMC Git SHA

# Set git SHA1 hash as a compile definition
Expand Down
20 changes: 14 additions & 6 deletions cmake/DAGMC_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ macro (dagmc_setup_build)
execute_process(COMMAND date +%m/%d/%y OUTPUT_VARIABLE ENV_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND date +%H:%M:%S OUTPUT_VARIABLE ENV_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)

set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
endmacro ()

macro (dagmc_setup_options)
Expand Down Expand Up @@ -109,8 +108,11 @@ endmacro ()

macro (dagmc_setup_flags)
message("")
set(CMAKE_CXX_STANDARD 17)

set(CMAKE_CXX_STANDARD 11)
if(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()

if (BUILD_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand All @@ -136,13 +138,17 @@ macro (dagmc_setup_flags)
message(STATUS "Building static executables")
set(BUILD_SHARED_EXE OFF)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
if(NOT MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS)
set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)
set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
set(CMAKE_EXE_LINK_DYNAMIC_Fortran_FLAGS)
if(NOT MSVC)
set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)
set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
set(CMAKE_EXE_LINK_DYNAMIC_Fortran_FLAGS)
endif()
else ()
message(STATUS "Building shared executables")
set(BUILD_SHARED_EXE ON)
Expand Down Expand Up @@ -227,6 +233,7 @@ macro (dagmc_install_library lib_name)
set_target_properties(${lib_name}-shared
PROPERTIES INSTALL_RPATH "${INSTALL_RPATH_DIRS}"
INSTALL_RPATH_USE_LINK_PATH TRUE)

endif ()
message(STATUS "LINK LIBS: ${LINK_LIBS_SHARED}")
target_link_libraries(${lib_name}-shared PUBLIC ${LINK_LIBS_SHARED})
Expand All @@ -251,6 +258,7 @@ macro (dagmc_install_library lib_name)
set_target_properties(${lib_name}-static
PROPERTIES INSTALL_RPATH "" INSTALL_RPATH_USE_LINK_PATH FALSE)
endif ()

target_link_libraries(${lib_name}-static ${LINK_LIBS_STATIC})
target_include_directories(${lib_name}-static INTERFACE $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}>
${MOAB_INCLUDE_DIRS})
Expand Down
5 changes: 4 additions & 1 deletion cmake/FindMOAB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ message(STATUS "HDF5_LIBRARIES_SHARED: ${HDF5_LIBRARIES_SHARED}")
message(STATUS "HDF5_LIBRARIES_STATIC: ${HDF5_LIBRARIES_STATIC}")

include_directories(${HDF5_INCLUDE_DIRS})

if(MSVC)
set(BUILD_STATIC_LIBS TRUE)
set(BUILD_SHARED_LIBS OFF)
endif()
# Find MOAB library (shared)
if (BUILD_SHARED_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
Expand Down
6 changes: 5 additions & 1 deletion cmake/test_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ project(Test_DAGMC_config)
cmake_minimum_required(VERSION 2.8)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_STANDARD 11)

set(CMAKE_CXX_STANDARD 17)
if(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()

find_package(DAGMC REQUIRED)

Expand Down
2 changes: 2 additions & 0 deletions doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Next version

* adding special build flag to enable old hdf5 interface for PyNE when compiling against hdf5@1.12+ (#728)
* Renamed `jobs` variable CI build system to avoid undocumented conflict with `git submodule` (#735)
* Windows compatibility fix
* remove_unsupported.py script is now compatible with python2...
* Return correct bounding boxes when configured with Double-Down. (#779)


Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ endif ()

# Required libraries
add_subdirectory(dagmc)
add_subdirectory(pyne)

# UWUW
if (BUILD_MCNP5 OR BUILD_MCNP6 OR BUILD_GEANT4 OR BUILD_FLUKA OR BUILD_CI_TESTS)
set(BUILD_UWUW ON)
endif ()
if (BUILD_UWUW)
add_subdirectory(uwuw)
add_subdirectory(pyne)
endif ()

# dagtally library (required for DAG-MCNP and CI)
Expand Down
42 changes: 31 additions & 11 deletions src/dagmc/tools/ray_fire_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
#include <math.h>
#include <stdio.h>
#include <time.h>
#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <sys/resource.h>
#include <unistd.h>

#else
#include <io.h>
#endif
#include <cfloat>
#include <cstdlib>
#include <fstream>
Expand All @@ -16,9 +20,7 @@
#include "moab/CartVect.hpp"
#include "moab/Core.hpp"
#include "moab/Interface.hpp"
#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <sys/resource.h>
#endif

#ifdef SOLARIS
extern "C" int getrusage(int, struct rusage*);
#ifndef RUSAGE_SELF
Expand All @@ -30,10 +32,10 @@ using namespace moab;

// define following macro for verbose debugging of random ray generation
//#define DEBUG

#if !defined(_MSC_VER) && !defined(__MINGW32__)
void get_time_mem(double& tot_time, double& user_time, double& sys_time,
double& tot_mem);

#endif
void dump_pyfile(char* filename, double timewith, double timewithout,
double tmem, DagMC& dagmc,
OrientedBoxTreeTool::TrvStats* trv_stats,
Expand Down Expand Up @@ -338,8 +340,18 @@ int main(int argc, char* argv[]) {

CartVect xyz, uvw;

double ttime1, utime1, stime1, tmem1, ttime2, utime2, stime2, tmem2;
double ttime1 = 0;
double utime1 = 0;
double stime1 = 0;
double tmem1 = 0;
double ttime2 = 0;
double utime2 = 0;
double stime2 = 0;
double tmem2 = 0;

#if !defined(_MSC_VER) && !defined(__MINGW32__)
get_time_mem(ttime1, utime1, stime1, tmem1);
#endif

srand(randseed);

Expand Down Expand Up @@ -370,8 +382,11 @@ int main(int argc, char* argv[]) {
random_rays_missed++;
}
}
double timewith = 0;
#if !defined(_MSC_VER) && !defined(__MINGW32__)
get_time_mem(ttime2, utime2, stime2, tmem1);
double timewith = ttime2 - ttime1;
timewith = ttime2 - ttime1;
#endif

srand(randseed); // reseed to generate the same values as before

Expand All @@ -384,9 +399,11 @@ int main(int argc, char* argv[]) {
RNDVEC(uvw, direction_az);
}
}

double timewithout = 0;
#if !defined(_MSC_VER) && !defined(__MINGW32__)
get_time_mem(ttime1, utime1, stime1, tmem2);
double timewithout = ttime1 - ttime2;
timewithout = ttime1 - ttime2;
#endif

std::cout << " done." << std::endl;

Expand All @@ -395,6 +412,7 @@ int main(int argc, char* argv[]) {
<< " random rays did not hit the target volume" << std::endl;
}

#if !defined(_MSC_VER) && !defined(__MINGW32__)
if (num_random_rays > 0) {
std::cout << "Total time per ray fire: " << timewith / num_random_rays
<< " sec" << std::endl;
Expand All @@ -404,7 +422,7 @@ int main(int argc, char* argv[]) {
}
std::cout << "Program memory used: " << tmem2 << " bytes ("
<< tmem2 / (1024 * 1024) << " MB)" << std::endl;

#endif
/* Gather OBB tree stats and make final reports */
EntityHandle root;
ErrorCode result = dagmc.get_root(vol, root);
Expand Down Expand Up @@ -447,6 +465,7 @@ int main(int argc, char* argv[]) {
return 0;
}

#if !defined(_MSC_VER) && !defined(__MINGW32__)
void get_time_mem(double& tot_time, double& user_time, double& sys_time,
double& tot_mem) {
struct rusage r_usage;
Expand Down Expand Up @@ -489,6 +508,7 @@ void get_time_mem(double& tot_time, double& user_time, double& sys_time,
&dum_int, &vm_size, &rss);
if (num_fields == 24) tot_mem = ((double)vm_size);
}
#endif

class HistogramBuilder : public OrientedBoxTreeTool::Op {
protected:
Expand Down
15 changes: 9 additions & 6 deletions src/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ include_directories(${GTEST_DIR})
include_directories(${GTEST_DIR}/include)

# CXX compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-as-needed")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")

if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-as-needed")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers")
endif()

# Compiler directives
add_definitions(-DGTEST_HAS_PTHREAD=ON)
Expand Down
Loading

0 comments on commit 472ac87

Please sign in to comment.