Skip to content

Commit

Permalink
Merge pull request #5 from Synchrotron-Radiation-Workshop/fix_omp_thr…
Browse files Browse the repository at this point in the history
…eads

FIX: Properly setup OpenMP for all targets of the project.
  • Loading branch information
hhslepicka authored Mar 9, 2021
2 parents 68725bf + fe6c24a commit 4ea8320
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
10 changes: 9 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ if(USE_OPENMP)
message(STATUS "OpenMP libomp location: ${OpenMP_libomp_LIBRARY} | Include: ${OpenMP_CXX_INCLUDE_DIRS}")
message(STATUS "OpenMP Flags: C -> ${OpenMP_C_FLAGS} | CXX -> ${OpenMP_CXX_FLAGS}")
set(SRW_DEFINITIONS -D_GNU_SOURCE -D__USE_XOPEN2K8 -DFFTW_ENABLE_FLOAT -D_GM_WITHOUT_BASE -DSRWLIB_STATIC -DNO_TIMER -DANSI_DECLARATORS -DTRILIBRARY -D_WITH_OMP)

# Setup OpenMP as a linked library for all targets
link_libraries(OpenMP::OpenMP_CXX)
# Setup OpenMP include dir for all targets
include_directories(${OpenMP_CXX_INCLUDE_DIRS})
else()
set(SRW_DEFINITIONS -D_GNU_SOURCE -D__USE_XOPEN2K8 -DFFTW_ENABLE_FLOAT -D_GM_WITHOUT_BASE -DSRWLIB_STATIC -DNO_TIMER -DANSI_DECLARATORS -DTRILIBRARY -D_FFTW3)
endif()

# Setup definitions for all targets
add_definitions(${SRW_DEFINITIONS})

add_subdirectory(ext)
add_subdirectory(core)
add_subdirectory(lib)

add_subdirectory(clients)
add_subdirectory(clients)
2 changes: 1 addition & 1 deletion src/clients/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ if(WIN32)
endif()


install(TARGETS srwlpy LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS srwlpy LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
7 changes: 1 addition & 6 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ if (UNIX)
target_link_libraries(srw m)
endif()

if (USE_OPENMP)
target_link_libraries(srw OpenMP::OpenMP_CXX)
target_include_directories(srw PUBLIC ${OpenMP_CXX_INCLUDE_DIRS})
endif()

target_include_directories(srw PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
)
Expand All @@ -46,4 +41,4 @@ target_include_directories(srw PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../ext/genmath>
)

install(TARGETS srw LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS srw LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

0 comments on commit 4ea8320

Please sign in to comment.