Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First step to update cmake #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions Benchmark/cholesky_gemm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ if(BLAS_FOUND AND LAPACK_FOUND)
./*.cpp
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)

LINK_DIRECTORIES(
)


# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
if(${SPECX_COMPILE_WITH_MPI} OR NOT ${exec} MATCHES "-mpi\.")
Expand All @@ -53,10 +42,18 @@ if(BLAS_FOUND AND LAPACK_FOUND)

if(SPECX_COMPILE_WITH_CUDA)
set_source_files_properties(${exec} PROPERTIES LANGUAGE CUDA)
set(SPECX_LIBRARIES "${SPECX_LIBRARIES};cublas;cusolver")
set(CUBLAS_LIBRARIES "cublas;cusolver")
endif()

add_executable(${execname} ${exec})
add_executable(${execname} ${exec})

# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)

# TODO set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-llapack -lblas")

Expand All @@ -66,6 +63,7 @@ if(BLAS_FOUND AND LAPACK_FOUND)
${SPECX_LIBRARIES}
${BLAS_LIBRARIES}
${LAPACK_LIBRARIES}
${CUBLAS_LIBRARIES}
)
endif()
endforeach(exec)
Expand Down
17 changes: 9 additions & 8 deletions Benchmark/graph_traversal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ file(
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)


# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
get_filename_component(
Expand All @@ -55,7 +48,15 @@ foreach(exec ${source_tests_files})
add_executable(
${execname}
${exec}
)
)

# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)

target_link_libraries(
${execname}
Expand Down
18 changes: 9 additions & 9 deletions Benchmark/particles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ file(
./*.cpp
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)


# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
if(${SPECX_COMPILE_WITH_MPI} OR NOT ${exec} MATCHES "-mpi\.")
Expand All @@ -44,7 +36,15 @@ foreach(exec ${source_tests_files})
add_executable(
${execname}
${exec}
)
)

# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)

target_link_libraries(
${execname}
Expand Down
19 changes: 7 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
#===========================================================================
# Project Declaration
#===========================================================================
project(specx LANGUAGES CXX VERSION 1.0.0)
set(SPECX_SOURCE_DIR ${specx_SOURCE_DIR} )
set(SPECX_BINARY_DIR ${specx_BINARY_DIR} )
project(SPECX LANGUAGES CXX VERSION 1.0.0)

include(CheckLanguage)
check_language(CUDA)
Expand All @@ -28,8 +26,7 @@ if(SPECX_COMPILE_WITH_CUDA)
enable_language(CUDA)

if(NOT CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "75" CACHE STRING
"Set CUDA target architecture" FORCE)
set(CMAKE_CUDA_ARCHITECTURES "75" CACHE STRING "Set CUDA target architecture" FORCE)
endif()
endif()

Expand All @@ -48,9 +45,9 @@ if(insource)
message(FATAL_ERROR "${PROJECT_NAME} requires an out of source build.\
Remove CMakeCache.txt (alternatively you can remove all untracked files with\
git clean -i, git clean -d or git clean -df). Then, create a subirectory outside\
the specx source tree, cd into the directory you just created and then type\
cmake <path to specx repository>.\
Alternatively you can create a build directory at the root of the specx\
the SPECX source tree, cd into the directory you just created and then type\
cmake <path to SPECX repository>.\
Alternatively you can create a build directory at the root of the SPECX\
source tree but then it is recommended to name it 'build' as it is the only\
build directory name that is explicitly marked as to be ignored by Git.")
endif(insource)
Expand All @@ -74,7 +71,6 @@ if(SPECX_COMPILE_WITH_CUDA)

include(FindCUDA)

include_directories(${CUDA_INCLUDE_DIRS})
list(APPEND SPECX_INCLUDE_DIR ${CUDA_INCLUDE_DIRS})

# Threads::Threads seems useless
Expand All @@ -99,9 +95,8 @@ endif()
OPTION(SPECX_COMPILE_WITH_MPI "Set to on to use MPI" OFF)
if(SPECX_COMPILE_WITH_MPI)
find_package(MPI REQUIRED)
include_directories(SYSTEM ${MPI_INCLUDE_PATH})
list(APPEND SPECX_INCLUDE_DIR ${MPI_INCLUDE_PATH})
list(APPEND SPECX_LIBRARIES ${MPI_CXX_LIBRARIES})
list(APPEND SPECX_INCLUDE_DIR ${CUDA_INCLUDE_DIRS})
endif()

# need pthread
Expand Down Expand Up @@ -165,7 +160,7 @@ if( SPECX_USE_COVERAGE )
list(APPEND SPECX_LIBRARIES gcov)
# Then one can use these commands:
# lcov --directory CMakeFiles/ -c -o coverage-rapport.info
# genhtml -o ./coverage -t "Coverage specx" coverage-rapport.info
# genhtml -o ./coverage -t "Coverage SPECX" coverage-rapport.info
endif()

# Extra-flags
Expand Down
19 changes: 10 additions & 9 deletions Examples/Basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,7 @@ if(SPECX_BUILD_EXAMPLES)
source_tests_files
./*.cpp
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)



# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
get_filename_component(
Expand All @@ -46,6 +38,15 @@ if(SPECX_BUILD_EXAMPLES)
${exec}
)


# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)

target_link_libraries(
${execname}
specx
Expand Down
16 changes: 9 additions & 7 deletions Examples/MC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ if(SPECX_BUILD_EXAMPLES)
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)


# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
get_filename_component(
Expand All @@ -46,6 +39,15 @@ if(SPECX_BUILD_EXAMPLES)
${execname}
${exec}
)


# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)

target_link_libraries(
${execname}
Expand Down
17 changes: 9 additions & 8 deletions Examples/Slides/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ if(SPECX_BUILD_EXAMPLES)
./*.cpp
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)


# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
get_filename_component(
Expand All @@ -45,6 +37,15 @@ if(SPECX_BUILD_EXAMPLES)
${execname}
${exec}
)


# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
)

target_link_libraries(
${execname}
Expand Down
2 changes: 2 additions & 0 deletions Src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ add_library(
${source_lib_files}
)

target_include_directories(specx PUBLIC ${SPECX_INCLUDE_DIR})

if(SPECX_DO_INSTALL)
target_include_directories(specx INTERFACE $<INSTALL_INTERFACE:include>)
INSTALL(TARGETS specx EXPORT specx DESTINATION lib )
Expand Down
19 changes: 10 additions & 9 deletions UTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ if(SPECX_BUILD_UTESTS)
./*.cpp
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
${UTESTS_SPECX_SOURCE_DIR}
)


# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
get_filename_component(
Expand All @@ -42,6 +33,16 @@ if(SPECX_BUILD_UTESTS)
${execname}
${exec}
)


# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
${UTESTS_SPECX_SOURCE_DIR}
)

target_link_libraries(
${execname}
Expand Down
24 changes: 15 additions & 9 deletions UTests/Cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ file(
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
${SPECX_SOURCE_DIR}/UTests
${UTESTS_CUDA_SPECX_SOURCE_DIR}
)


# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
get_filename_component(
Expand All @@ -32,10 +23,25 @@ foreach(exec ${source_tests_files})
MESSAGE(STATUS "UTests -- Add ${execname}")
endif()

if(SPECX_COMPILE_WITH_CUDA)
set_source_files_properties(${exec} PROPERTIES LANGUAGE CUDA)
endif()

add_executable(
${execname}
${exec}
)


# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
${SPECX_SOURCE_DIR}/UTests
${UTESTS_CUDA_SPECX_SOURCE_DIR}
)

target_link_libraries(
${execname}
Expand Down
19 changes: 11 additions & 8 deletions UTests/Hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ file(
)


# Adding the project sources dir as an include dir
INCLUDE_DIRECTORIES(
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
${SPECX_SOURCE_DIR}/UTests
${UTESTS_HIP_SPECX_SOURCE_DIR}
)


# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
Expand All @@ -36,6 +28,17 @@ foreach(exec ${source_tests_files})
${execname}
${exec}
)


# Adding the project sources dir as an include dir
target_include_directories(
${execname}
PRIVATE
${SPECX_BINARY_DIR}/Src
${SPECX_SOURCE_DIR}/Src
${SPECX_SOURCE_DIR}/UTests
${UTESTS_HIP_SPECX_SOURCE_DIR}
)

target_link_libraries(
${execname}
Expand Down
Loading