Skip to content

Commit

Permalink
emscripten option to disable gtest (#28)
Browse files Browse the repository at this point in the history
* emscripten option to disable gtest

* comment out compiling flags

* bug fix

Co-authored-by: wen-yang chu <[email protected]>
  • Loading branch information
BenceVirtonomy and chuvirtonomy authored Sep 9, 2021
1 parent e087d28 commit 54a3034
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ if(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" " /MP")
add_definitions(-D_USE_MATH_DEFINES)
elseif(EMSCRIPTEN)
set(PRE_POST "")
#set(EM_FLAGS "${PRE_POST} -fPIC -g -O0 --profiling -DUNIX -D__linux__=1 --bind -std=c++11 -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0")
set(EM_FLAGS "${PRE_POST} -fPIC -g -O3 -DUNIX -D__linux__=1 --bind -std=c++11 -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EM_FLAGS}")
set(EM_FLAGS " -s INITIAL_MEMORY=536870912 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=0 -s ERROR_ON_UNDEFINED_SYMBOLS=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EM_FLAGS}")
# set(PRE_POST "")
# #set(EM_FLAGS "${PRE_POST} -fPIC -g -O0 --profiling -DUNIX -D__linux__=1 --bind -std=c++11 -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0")
# set(EM_FLAGS "${PRE_POST} -fPIC -g -O3 -DUNIX -D__linux__=1 --bind -std=c++11 -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EM_FLAGS}")
# set(EM_FLAGS " -s INITIAL_MEMORY=536870912 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=0 -s ERROR_ON_UNDEFINED_SYMBOLS=1")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EM_FLAGS}")
else()
add_compile_definitions(__linux__=1)
set(CMAKE_CXX_FLAGS "-w -std=c++11 -DUNIX -pthread")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace SPH
{
for (size_t index_i = 0; index_i != meanvalue[0][0].size(); ++index_i)
{
for (size_t index_j = 0; index_j != meanvalue[0][0].size(); +index_j)
for (size_t index_j = 0; index_j != meanvalue[0][0].size(); ++index_j)
{
meanvalue_new[i][j][index_i][index_j] = (meanvalue[i][j][index_i][index_j] *
(number_of_run_ - 1) + current_result[i][j][index_i][index_j]) / number_of_run_;
Expand Down
24 changes: 14 additions & 10 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ option(BUILD_2D_EXAMPLES "BUILD_2D_EXAMPLES" 1)
option(BUILD_3D_EXAMPLES "BUILD_3D_EXAMPLES" 1)
option(BUILD_UNIT_TESTS "BUILD_UNIT_TESTS" 1)

find_package(GTest REQUIRED)
include(GoogleTest)
if(NOT EMSCRIPTEN)
find_package(GTest REQUIRED)
include(GoogleTest)

if(ONLY_3D)
set(BUILD_2D_EXAMPLES 0)
endif()
if(ONLY_3D)
set(BUILD_2D_EXAMPLES 0)
endif()

if(BUILD_2D_EXAMPLES)
ADD_SUBDIRECTORY(2d_examples)
endif()

if(BUILD_2D_EXAMPLES)
ADD_SUBDIRECTORY(2d_examples)
if(BUILD_UNIT_TESTS)
ADD_SUBDIRECTORY(unit_tests_src)
endif()
endif()

if(BUILD_3D_EXAMPLES)
ADD_SUBDIRECTORY(3d_examples)
endif()

if(BUILD_UNIT_TESTS)
ADD_SUBDIRECTORY(unit_tests_src)
endif()

0 comments on commit 54a3034

Please sign in to comment.