Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/devel' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
cdplagos committed Aug 28, 2018
2 parents 0d2dde2 + 2a2292e commit 55254ef
Show file tree
Hide file tree
Showing 44 changed files with 1,837 additions and 1,248 deletions.
57 changes: 57 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# Appveyor CI configuration file
#
# ICRAR - International Centre for Radio Astronomy Research
# (c) UWA - The University of Western Australia, 2018
# Copyright by UWA (in the framework of the ICRAR)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

version: '1.0.{build}'

image: Visual Studio 2017

platform:
- x64

cache: c:\tools\vcpkg\installed\

configuration:
- Release

install:
- cmd: git submodule update --init --recursive
- cmd: git clone https://github.com/CxxTest/cxxtest
- cmd: cd c:\tools\vcpkg
- cmd: git pull
- cmd: vcpkg update
- cmd: vcpkg integrate install
- cmd: vcpkg install boost-filesystem:x64-windows
- cmd: vcpkg install boost-log:x64-windows
- cmd: vcpkg install boost-program-options:x64-windows
- cmd: vcpkg install boost-system:x64-windows
- cmd: vcpkg install gsl:x64-windows
- cmd: vcpkg install hdf5[cpp]:x64-windows
- cmd: cd "%APPVEYOR_BUILD_FOLDER%"

before_build:
- cmd: cmake -G "Visual Studio 15 2017 Win64" . -DSHARK_TEST=ON -DCMAKE_INCLUDE_PATH='%APPVEYOR_BUILD_FOLDER%\cxxtest' -DCMAKE_PROGRAM_PATH="%APPVEYOR_BUILD_FOLDER%\cxxtest\bin" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DSHARK_HDF5_USE_CONFIG=ON

build:
project: $(APPVEYOR_BUILD_FOLDER)\$(APPVEYOR_PROJECT_NAME).sln

test_script:
- cmd: set "PATH=%APPVEYOR_BUILD_FOLDER%\Release;%PATH%"
- cmd: ctest --output-on-failure -V
64 changes: 58 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ endmacro()
# which is a hard requirement -- if it's not there we fail misserably
#
macro(find_hdf5)
find_package(HDF5 REQUIRED COMPONENTS CXX)

# The CONFIG mode is needed at least when using vcpkg's hdf5
if (SHARK_HDF5_USE_CONFIG)
find_package(HDF5 REQUIRED COMPONENTS CXX CONFIG)
else()
find_package(HDF5 REQUIRED COMPONENTS CXX)
endif()

#
# HDF5_VERSION is defined only in cmake 3.3+
Expand Down Expand Up @@ -143,15 +149,22 @@ macro(find_hdf5)

# We need to pass down the information about the HDF5 version to shark
message("-- Using HDF5 version ${HDF5_VERSION}")
message("-- HDF5 libraries / C++ libraries: ${HDF5_LIBRARIES} / ${HDF5_CXX_LIBRARIES}")
string(REPLACE "." ";" VERSION_LIST ${HDF5_VERSION})
list(GET VERSION_LIST 0 HDF5_VERSION_MAJOR)
list(GET VERSION_LIST 1 HDF5_VERSION_MINOR)
list(GET VERSION_LIST 2 HDF5_VERSION_PATCH)
set(SHARK_LIBS ${SHARK_LIBS} ${HDF5_CXX_LIBRARIES})
include_directories(${HDF5_INCLUDE_DIRS})
add_definitions(${HDF5_DEFINITIONS})
add_definitions("-DHDF5_VERSION_MAJOR=${HDF5_VERSION_MAJOR}"
"-DHDF5_VERSION_MINOR=${HDF5_VERSION_MINOR}"
"-DHDF5_VERSION_PATCH=${HDF5_VERSION_PATCH}")

if (SHARK_HDF5_USE_CONFIG)
set(SHARK_LIBS ${SHARK_LIBS} hdf5::hdf5_cpp-shared)
else()
set(SHARK_LIBS ${SHARK_LIBS} ${HDF5_CXX_LIBRARIES})
endif()
endmacro()

#
Expand All @@ -171,8 +184,33 @@ endmacro()
macro(find_openmp)
find_package(OpenMP)
if (OPENMP_FOUND)

# We require at least OpenMP 2.0, so let's double check
# we have that at least
set(OPENMP_VERSION_CHECK_SOURCE "
#include <stdio.h>
int main(int argc, char *argv[]) {
#if _OPENMP >= 200203
return 0;
#else
fail to compile please
#endif
}")
set(WORK_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMPVersionCheck)
set(SRC_FILE ${WORK_DIR}/ompver.cpp)
file(WRITE ${SRC_FILE} "${OPENMP_VERSION_CHECK_SOURCE}")
try_compile(COMPILE_RESULT ${CMAKE_BINARY_DIR} ${SRC_FILE}
COMPILE_DEFINITIONS ${OpenMP_CXX_FLAGS})

if (COMPILE_RESULT)
set(SHARK_OPENMP ON)
else()
message("-- OpenMP found, but is <= 2.0. Compiling without OpenMP support")
endif()
endif()

if (SHARK_OPENMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(SHARK_OPENMP ON)
endif()
endmacro()

Expand All @@ -187,6 +225,11 @@ if (NOT SHARK_NO_OPENMP)
find_openmp()
endif()

# Windows builds need to link to ws2_32 (due to usage of gethostname)
if (WIN32)
set(SHARK_LIBS ${SHARK_LIBS} ws2_32)
endif()

#
# Save all compile-time options here
#
Expand Down Expand Up @@ -254,9 +297,17 @@ set(SHARKLIB_SRCS
src/hdf5/traits.cpp
src/hdf5/writer.cpp
)
add_library(sharklib SHARED ${SHARKLIB_SRCS})

if (WIN32)
set(SHARLIB_MODE STATIC)
else()
set(SHARLIB_MODE SHARED)
endif()
add_library(sharklib ${SHARLIB_MODE} ${SHARKLIB_SRCS})
target_link_libraries(sharklib ${SHARK_LIBS})
set_target_properties(sharklib PROPERTIES LIBRARY_OUTPUT_NAME shark)
set_target_properties(sharklib PROPERTIES
LIBRARY_OUTPUT_NAME shark
RUNTIME_OUTPUT_NAME shark)

# The shark-importer executable
set(SHARK_IMPORTER_SRCS
Expand All @@ -278,7 +329,8 @@ target_link_libraries(shark sharklib)
# Installing stuff: programs, scripts, static data
install(TARGETS sharklib shark shark-importer
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib)
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(PROGRAMS hpc/shark-run hpc/shark-submit
DESTINATION bin)
install(DIRECTORY data
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# shark

[![Build Status](https://travis-ci.org/ICRAR/shark.svg?branch=master)](https://travis-ci.org/ICRAR/shark)
[![Build Status](https://ci.appveyor.com/api/projects/status/4vy02t8q4h4xpr7k/branch/master?svg=true)](https://ci.appveyor.com/project/rtobar/shark/branch/master)
[![Documentation Status](https://readthedocs.org/projects/shark-sam/badge/?version=latest)](https://shark-sam.readthedocs.io/en/latest/?badge=latest)

shark is a new, flexible semi-analytic model of galaxy formation.
Expand Down
Loading

0 comments on commit 55254ef

Please sign in to comment.