Skip to content

Commit

Permalink
Merge pull request #24 from sfarrens/optional_tests
Browse files Browse the repository at this point in the history
macOS Updates
  • Loading branch information
sfarrens authored Mar 28, 2019
2 parents eacbc12 + 47279d4 commit 23ed797
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Ignore build files
build/
*build*
36 changes: 24 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ project(sparse2d)
endif()
message(STATUS "Installing to: ${CMAKE_INSTALL_PREFIX}")

# Find OpenMP
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set(OpenMP_CXX_FLAGS "-fopenmp")
set(OpenMP_CXX_LIB_NAMES "omp")
set(OpenMP_CXX_LIBRARIES "/usr/local/opt/libomp/lib/libomp.dylib")
else()
find_package(OpenMP REQUIRED)
endif()

# Locate CFITSIO using pkg-config or use command line arguments to configure
# CFITSIO
if(CFITSIO_LIBRARIES STREQUAL "" OR NOT DEFINED CFITSIO_LIBRARIES OR
Expand Down Expand Up @@ -181,15 +190,18 @@ project(sparse2d)
# UNIT TESTS #
# -----------#

# Add unit tests
enable_testing()
set(UNIT_TESTS mr_transform_test)

foreach(program ${UNIT_TESTS})
add_executable(${program} ${PROJECT_SOURCE_DIR}/tests/${program}.cpp)
target_link_libraries(${program} mga2d sparse2d sparse1d tools)
if(SPARSE3D)
target_link_libraries(${program} mga2d sparse3d sparse2d sparse1d tools)
endif(SPARSE3D)
add_test(${program} ${program})
endforeach(program)
option(RUN_TESTS "Build and run unit tests" ON)
if(RUN_TESTS)
# Add unit tests
enable_testing()
set(UNIT_TESTS mr_transform_test)

foreach(program ${UNIT_TESTS})
add_executable(${program} ${PROJECT_SOURCE_DIR}/tests/${program}.cpp)
target_link_libraries(${program} mga2d sparse2d sparse1d tools)
if(SPARSE3D)
target_link_libraries(${program} mga2d sparse3d sparse2d sparse1d tools)
endif(SPARSE3D)
add_test(${program} ${program})
endforeach(program)
endif(RUN_TESTS)

0 comments on commit 23ed797

Please sign in to comment.