Skip to content

Commit

Permalink
modify cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaojingtang1234 committed Aug 29, 2023
1 parent 323b308 commit 43f8214
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* *
* ------------------------------------------------------------------------- */
/**
* @file inelastic_solid_hardening.hpp
* @file inelastic_solid_hardening.h
* @brief These are classes for define properties of elastic solid materials.
* These classes are based on isotropic linear elastic solid.
* Several more complex materials, including neo-hookean, FENE noe-hookean
Expand Down
32 changes: 25 additions & 7 deletions tests/user_examples/xj_stretching/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
STRING(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SPHINXSYS_PROJECT_DIR}/cmake) # main (top) cmake dir

set(CMAKE_VERBOSE_MAKEFILE on)

STRING( REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} )
PROJECT("${CURRENT_FOLDER}")

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin/")
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(BUILD_INPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/input")
SET(BUILD_RELOAD_PATH "${EXECUTABLE_OUTPUT_PATH}/reload")




add_executable(${PROJECT_NAME})
aux_source_directory(. DIR_SRCS)
target_sources(${PROJECT_NAME} PRIVATE ${DIR_SRCS})
ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS})

target_link_libraries(${PROJECT_NAME} sphinxsys_2d GTest::gtest GTest::gtest_main)
target_link_libraries(${PROJECT_NAME} extra_sources_2d)

set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")

add_test(NAME ${PROJECT_NAME}
COMMAND ${PROJECT_NAME}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
else()
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh
DESTINATION ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND bash ${EXECUTABLE_OUTPUT_PATH}/run_test.sh
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
endif()
2 changes: 2 additions & 0 deletions tests/user_examples/xj_stretching/run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./xj_stretching --r=true
./xj_stretching --r=false --i=true
2 changes: 1 addition & 1 deletion tests/user_examples/xj_stretching/xj_stretching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* internal constrained subregion. *
* ----------------------------------------------------------------------------*/
#include "sphinxsys.h"
#include "inelastic_solid_hardening.hpp"
#include "inelastic_solid_hardening.h"

using namespace SPH;
//------------------------------------------------------------------------------
Expand Down

0 comments on commit 43f8214

Please sign in to comment.