mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
build system is added and is tested for serial execution
This commit is contained in:
31
cmake/bashrc
Normal file
31
cmake/bashrc
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
export pFlow_PROJECT_VERSION=v0.1
|
||||
|
||||
export pFlow_PROJECT=phasicFlow-$pFlow_PROJECT_VERSION
|
||||
|
||||
|
||||
projectDir="$HOME/PhasicFlow"
|
||||
kokkosDir="$HOME/Kokkos/kokkos"
|
||||
|
||||
export pFlow_PROJECT_DIR="$projectDir/$pFlow_PROJECT"
|
||||
|
||||
# [WM_PROJECT_USER_DIR] - Location of user files
|
||||
export pFlow_PROJECT_USER_DIR="$projectDir/$USER-$pFlow_PROJECT_VERSION"
|
||||
|
||||
export pFlow_LIB_DIR="$pFlow_PROJECT_DIR/lib"
|
||||
|
||||
export pFlow_BIN_DIR="$pFlow_PROJECT_DIR/bin"
|
||||
|
||||
export pFlow_SRC_DIR="$pFlow_PROJECT_DIR/src"
|
||||
|
||||
export Kokkos_DIR="$kokkosDir"
|
||||
|
||||
# Cleanup variables (done as final statement for a clean exit code)
|
||||
unset projectDir
|
||||
|
||||
export PATH="$pFlow_BIN_DIR:$PATH"
|
||||
|
||||
export LD_LIBRARY_PATH="$pFlow_LIB_DIR:$LD_LIBRARY_PATH"
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
4
cmake/globals.cmake
Normal file
4
cmake/globals.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
set(validFiles)
|
||||
list(APPEND validFiles *.C *.cpp *.cxx *.c *.cu *.H *.hpp *.hxx *.h *.cuh)
|
||||
|
43
cmake/makeExecutableGlobals.cmake
Normal file
43
cmake/makeExecutableGlobals.cmake
Normal file
@ -0,0 +1,43 @@
|
||||
#add a library to dFlow with source files and target_link_libs (thouse under the main CMakeLists.txt)
|
||||
macro(pFlow_make_executable_install target_name source_files target_link_libs)
|
||||
|
||||
# add library
|
||||
add_executable(${target_name} ${${source_files}})
|
||||
|
||||
target_link_libraries(${target_name} PUBLIC ${${target_link_libs}})
|
||||
|
||||
#get all valid the source files under the current folder
|
||||
file(GLOB_RECURSE allValidFilePaths RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${validFiles})
|
||||
|
||||
set(validFilePathsExcSRCs ${allValidFilePaths})
|
||||
list(REMOVE_ITEM validFilePathsExcSRCs ${${source_files}})
|
||||
set(includeDirs)
|
||||
set(includeFiles ${validFilePathsExcSRCs})
|
||||
|
||||
# get the directory names
|
||||
foreach(file_path ${validFilePathsExcSRCs})
|
||||
GET_FILENAME_COMPONENT(dir_path ${file_path} DIRECTORY)
|
||||
list(APPEND includeDirs ${dir_path})
|
||||
endforeach()
|
||||
|
||||
#remove duplicates
|
||||
list(REMOVE_DUPLICATES includeDirs)
|
||||
|
||||
target_include_directories(${target_name}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${includeDirs}
|
||||
)
|
||||
|
||||
message(STATUS "\nCreating make file for executable ${target_name}")
|
||||
message(STATUS " ${target_name} link libraries are: ${${target_link_libs}}")
|
||||
message(STATUS " ${target_name} source files are: ${source_files}")
|
||||
message(STATUS " ${target_name} include dirs are: ${includeDirs}\n")
|
||||
|
||||
|
||||
install(TARGETS ${target_name} DESTINATION bin)
|
||||
|
||||
|
||||
endmacro()
|
||||
|
||||
|
52
cmake/makeLibraryGlobals.cmake
Normal file
52
cmake/makeLibraryGlobals.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
#add a library to dFlow with source files and target_link_libs (thouse under the main CMakeLists.txt)
|
||||
macro(pFlow_add_library_install target_name src_files target_link_libs)
|
||||
|
||||
set(source_files ${${src_files}})
|
||||
|
||||
# add library
|
||||
add_library(${target_name} ${source_files})
|
||||
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}
|
||||
)
|
||||
|
||||
target_link_libraries(${target_name} PUBLIC ${${target_link_libs}})
|
||||
|
||||
#get all valid the source files under the current folder
|
||||
file(GLOB_RECURSE allValidFilePaths RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${validFiles})
|
||||
|
||||
set(validFilePathsExcSRCs ${allValidFilePaths})
|
||||
foreach(file ${source_files})
|
||||
list(REMOVE_ITEM validFilePathsExcSRCs ${file})
|
||||
endforeach()
|
||||
|
||||
set(includeDirs)
|
||||
set(includeFiles ${validFilePathsExcSRCs})
|
||||
|
||||
# get the directory names
|
||||
foreach(file_path ${validFilePathsExcSRCs})
|
||||
GET_FILENAME_COMPONENT(dir_path ${file_path} DIRECTORY)
|
||||
list(APPEND includeDirs ${dir_path})
|
||||
endforeach()
|
||||
|
||||
#remove duplicates
|
||||
list(REMOVE_DUPLICATES includeDirs)
|
||||
|
||||
|
||||
target_include_directories(${target_name}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${includeDirs}
|
||||
)
|
||||
|
||||
message(STATUS "\nCreating make file for library ${target_name}")
|
||||
message(STATUS " ${target_name} link libraries are: ${${target_link_libs}}")
|
||||
message(STATUS " ${target_name} source files are: ${source_files}")
|
||||
message(STATUS " ${target_name} include dirs are: ${includeDirs}\n")
|
||||
|
||||
install(TARGETS ${target_name} DESTINATION lib)
|
||||
install(FILES ${includeFiles} DESTINATION include/${target_name})
|
||||
|
||||
endmacro()
|
||||
|
||||
|
Reference in New Issue
Block a user