Skip to content

Commit

Permalink
Update to brion 3.3.1 (#3)
Browse files Browse the repository at this point in the history
* Use plain CMake (remove common/CMake dependency)
* remove submodules
* emSim 1.0.1
  • Loading branch information
mgeplf authored Feb 1, 2021
1 parent 9b95b79 commit 6f0ee49
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 81 deletions.
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

2 changes: 0 additions & 2 deletions .gitsubprojects

This file was deleted.

1 change: 0 additions & 1 deletion CMake/common
Submodule common deleted from 045c48
46 changes: 12 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,26 @@
# This file is part of EMSim <https://github.com/BlueBrain/EMSim>

cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(EMSim VERSION 1.0.0)
project(EMSim VERSION 1.0.1)
set(EMSim_VERSION_ABI 1)

if(NOT EXISTS ${CMAKE_SOURCE_DIR}/CMake/common/Common.cmake)
message(FATAL_ERROR "CMake/common missing, run: git submodule update --init")
endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake
${CMAKE_SOURCE_DIR}/CMake/common)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake)

set(EMSIM_LICENSE LGPL)
set(EMSIM_DESCRIPTION "Electro-magnetic simulation software")
set(COMMON_PROJECT_DOMAIN ch.epfl.bluebrain)
set(EMSIM_DEB_DEPENDS libboost-program-options-dev libboost-test-dev libglm-dev)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

include(Common)

common_find_package(Boost REQUIRED COMPONENTS unit_test_framework program_options)
common_find_package(Brion REQUIRED)
common_find_package_post()
find_package(glm)
find_package(Boost REQUIRED COMPONENTS program_options)
find_package(Brion REQUIRED)

set(ISPC_BINARY ispc)

find_program(ISPC ispc)
if(NOT ISPC)
set(ISPC_BINARY ${CMAKE_BINARY_DIR}/ispc-v1.9.2-linux/ispc)
if(NOT EXISTS ${ISPC_BINARY})
message("ispc not found. Trying to download... " ${ISPC_BINARY})
file(DOWNLOAD
https://github.com/ispc/ispc/releases/download/v1.9.2/ispc-v1.9.2b-linux.tar.gz
${CMAKE_BINARY_DIR}/ispc-v1.9.2b-linux.tar.gz
SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ispc-v1.9.2b-linux.tar.gz
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
endif()

add_subdirectory(glm)

enable_testing()

add_subdirectory(apps)
add_subdirectory(emSim)
add_subdirectory(tests)

set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md")
set(EMSIM_PACKAGE_DEB_DEPENDS libboost-program-options-dev libglm-dev)
include(DoxygenRule)
11 changes: 7 additions & 4 deletions apps/emsimLFP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

set(EMSIM_SOURCES main.cpp)
set(EMSIM_LINK_LIBRARIES PUBLIC boost_program_options EMSimCommon )

common_application( emsim )
add_executable(emsim main.cpp)
target_link_libraries(emsim
PUBLIC
${Boost_PROGRAM_OPTIONS_LIBRARY}
EMSimCommon
)
install(TARGETS emsim RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
11 changes: 7 additions & 4 deletions apps/emsimVSD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

set(EMSIMVSD_SOURCES main.cpp)
set(EMSIMVSD_LINK_LIBRARIES PUBLIC boost_program_options EMSimCommon )

common_application( emsimVSD )
add_executable(emsimVSD main.cpp)
target_link_libraries(emsimVSD
PUBLIC
${Boost_PROGRAM_OPTIONS_LIBRARY}
EMSimCommon
)
install(TARGETS emsimVSD RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
31 changes: 29 additions & 2 deletions emSim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,33 @@ foreach(ISPC_FILE ${ISPC_FILES})
list(APPEND EMSIMCOMMON_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${ISPC_FILE}.o )
endforeach()

set(EMSIMCOMMON_LINK_LIBRARIES PUBLIC Brion Brain glm)
set(EMSIM_INCLUDE_DIR ${PROJECT_SOURCE_DIR})

add_library(EMSimCommon
SHARED
${EMSIMCOMMON_PUBLIC_HEADERS}
${EMSIMCOMMON_HEADERS}
${EMSIMCOMMON_SOURCES}
)

target_include_directories(EMSimCommon PUBLIC
$<BUILD_INTERFACE:${EMSIM_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)
target_include_directories(EMSimCommon PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/>
$<INSTALL_INTERFACE:$/include>)
target_include_directories(EMSimCommon SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})

target_link_libraries(EMSimCommon
PUBLIC
Brion
Brain
glm
)

install(TARGETS EMSimCommon
EXPORT EMSimCommon
LIBRARY
DESTINATION lib
)

common_library(EMSimCommon)
2 changes: 2 additions & 0 deletions emSim/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
#include <cstddef>
#include <cstdint>

#define GLM_FORCE_CTOR_INIT
#include <glm/glm.hpp>


#include <emSim/helpers.h>

namespace ems
Expand Down
10 changes: 5 additions & 5 deletions emSim/EventsLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ void EventsLoader::_computeStaticEventGeometry(
{
auto pos = soma.getCentroid();
float radius = soma.getMeanRadius();
_events->addEvent(glm::vec3(pos.x(), pos.y(), pos.z()), radius);
_circuitAABB.add(glm::vec3(pos.x(), pos.y(), pos.z()), radius);
_events->addEvent(pos, radius);
_circuitAABB.add(pos, radius);
}
continue;
}
Expand All @@ -136,10 +136,10 @@ void EventsLoader::_computeStaticEventGeometry(

for (const auto& point : points)
{
auto pos = point.get_sub_vector<3, 0>();
auto pos = glm::vec3(point);
float radius = compartmentLength * .2f;
_events->addEvent(glm::vec3(pos.x(), pos.y(), pos.z()), radius);
_circuitAABB.add(glm::vec3(pos.x(), pos.y(), pos.z()), radius);
_events->addEvent(pos, radius);
_circuitAABB.add(pos, radius);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions emSim/SamplePoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
#ifndef _SamplePoints_h_
#define _SamplePoints_h_

#define GLM_FORCE_CTOR_INIT
#include <glm/glm.hpp>

#include <string>
#include <vector>

Expand Down
20 changes: 9 additions & 11 deletions emSim/VSDLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#include <iostream>

#include <servus/servus.h>

#include <emSim/VSDLoader.h>

namespace ems
Expand All @@ -41,9 +39,10 @@ VSDLoader::VSDLoader(const VSDParams& params)
_circuit.reset(new brain::Circuit(_bc));
_gids = params.target.empty() ? _circuit->getRandomGIDs(params.fraction)
: _circuit->getRandomGIDs(params.fraction, params.target);
auto reportSource = _bc.getReportSource(params.reportVoltage);
_reportVoltage.reset(new brion::CompartmentReport(reportSource, brion::MODE_READ, _gids));
_reportArea.reset(new brion::CompartmentReport(servus::URI(params.reportArea), brion::MODE_READ, _gids));
auto reportSourceVoltage = _bc.getReportSource(params.reportVoltage);
_reportVoltage.reset(new brion::CompartmentReport(reportSourceVoltage, brion::MODE_READ, _gids));
auto reportSourceArea = _bc.getReportSource(params.reportArea);
_reportArea.reset(new brion::CompartmentReport(reportSourceArea, brion::MODE_READ, _gids));

const uint32_t timeStepMultiplier = params.timeStep / _reportVoltage->getTimestep() + 0.5f;
_dt = timeStepMultiplier * _reportVoltage->getTimestep();
Expand Down Expand Up @@ -183,10 +182,9 @@ void VSDLoader::_computeStaticEventGeometry(const FlatInverseMapping& mapping,
const auto& soma = morphology.getSoma();
const auto pos = soma.getCentroid();
const float radius = soma.getMeanRadius();
_circuitAABB.add(glm::vec3(pos.x(), pos.y(), pos.z()),
radius);
_circuitAABB.add(pos, radius);
for (uint16_t k = 0; k != compartments; ++k)
positions.push_back(glm::vec3(pos.x(), pos.y(), pos.z()));
positions.push_back(pos);

continue;
}
Expand All @@ -210,10 +208,10 @@ void VSDLoader::_computeStaticEventGeometry(const FlatInverseMapping& mapping,
assert(compartments == points.size());
for (const auto& point : points)
{
auto pos = point.get_sub_vector<3, 0>();
auto pos = glm::vec3(point);
float radius = compartmentLength * .2f;
positions.push_back(glm::vec3(pos.x(), pos.y(), pos.z()));
_circuitAABB.add(glm::vec3(pos.x(), pos.y(), pos.z()), radius);
positions.push_back(pos);
_circuitAABB.add(pos, radius);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion emSim/Volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@

#ifndef _Volume_h_
#define _Volume_h_

#define GLM_FORCE_CTOR_INIT
#include <glm/glm.hpp>

#include <string>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions emSim/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <memory>
#include <sstream>

#define GLM_FORCE_CTOR_INIT
#include <glm/glm.hpp>

namespace ems
Expand Down
1 change: 0 additions & 1 deletion glm
Submodule glm deleted from 0d973b
26 changes: 16 additions & 10 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# Copyright (c) BBP/EPFL 2011-2017, Stefan.Eilemann@epfl.ch
# Change this number when adding tests to force a CMake run: 1
## Copyright (c) BBP/EPFL 2011-2017, Stefan.Eilemann@epfl.ch

# Includes the install_files function below
include(InstallFiles)
find_package(Boost REQUIRED COMPONENTS unit_test_framework)

# TEST_LIBRARIES variable is used by the CommonCTest.cmake script to link against the given libraries
set(TEST_LIBRARIES ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} EMSimCommon)
set(TESTS_SRC
samplePoints.cpp
volume.cpp
)

# CommonCTest, in the current folder recursively compiles targets for *.cpp files using TEST_LIBRARIES
include(CommonCTest)
foreach(FILE ${TESTS_SRC})
get_filename_component(NAME ${FILE} NAME_WE)
add_executable(${NAME} ${FILE})

# Installs the compiled tests ${TEST_FILES} into the examples directory
install_files(share/EMSim/tests FILES ${TEST_FILES} COMPONENT examples)
target_link_libraries(${NAME}
PRIVATE
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
EMSimCommon
)
add_test(NAME ${NAME} COMMAND ${NAME})
endforeach()

0 comments on commit 6f0ee49

Please sign in to comment.