diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index bbef1e0..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "CMake/common"] - path = CMake/common - url = https://github.com/Eyescale/CMake -[submodule "glm"] - path = glm - url = https://github.com/g-truc/glm.git diff --git a/.gitsubprojects b/.gitsubprojects deleted file mode 100644 index 42dfc6c..0000000 --- a/.gitsubprojects +++ /dev/null @@ -1,2 +0,0 @@ -# -*- mode: cmake -*- -git_subproject(Brion https://github.com/BlueBrain/Brion 319efda) diff --git a/CMake/common b/CMake/common deleted file mode 160000 index 045c48c..0000000 --- a/CMake/common +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 045c48c282e500b95a2c5d7e5aaaeb9aa8152732 diff --git a/CMakeLists.txt b/CMakeLists.txt index d2ddc74..917c492 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,48 +5,26 @@ # This file is part of 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) diff --git a/apps/emsimLFP/CMakeLists.txt b/apps/emsimLFP/CMakeLists.txt index 149ee7f..0d2abb1 100644 --- a/apps/emsimLFP/CMakeLists.txt +++ b/apps/emsimLFP/CMakeLists.txt @@ -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}) diff --git a/apps/emsimVSD/CMakeLists.txt b/apps/emsimVSD/CMakeLists.txt index 4db8313..257d7cc 100644 --- a/apps/emsimVSD/CMakeLists.txt +++ b/apps/emsimVSD/CMakeLists.txt @@ -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}) diff --git a/emSim/CMakeLists.txt b/emSim/CMakeLists.txt index 941bfcc..2e855a8 100644 --- a/emSim/CMakeLists.txt +++ b/emSim/CMakeLists.txt @@ -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 + $ + $) +target_include_directories(EMSimCommon PUBLIC + $ + $) +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) diff --git a/emSim/Events.h b/emSim/Events.h index f543f47..6fc07ae 100644 --- a/emSim/Events.h +++ b/emSim/Events.h @@ -23,8 +23,10 @@ #include #include +#define GLM_FORCE_CTOR_INIT #include + #include namespace ems diff --git a/emSim/EventsLoader.cpp b/emSim/EventsLoader.cpp index fedf0db..10b7c1d 100644 --- a/emSim/EventsLoader.cpp +++ b/emSim/EventsLoader.cpp @@ -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; } @@ -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); } } } diff --git a/emSim/SamplePoints.h b/emSim/SamplePoints.h index 3561df2..66e6708 100644 --- a/emSim/SamplePoints.h +++ b/emSim/SamplePoints.h @@ -20,7 +20,9 @@ #ifndef _SamplePoints_h_ #define _SamplePoints_h_ +#define GLM_FORCE_CTOR_INIT #include + #include #include diff --git a/emSim/VSDLoader.cpp b/emSim/VSDLoader.cpp index a677cd6..0437e07 100644 --- a/emSim/VSDLoader.cpp +++ b/emSim/VSDLoader.cpp @@ -19,8 +19,6 @@ #include -#include - #include namespace ems @@ -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(); @@ -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; } @@ -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); } } } diff --git a/emSim/Volume.h b/emSim/Volume.h index 2174b5b..ff9e266 100644 --- a/emSim/Volume.h +++ b/emSim/Volume.h @@ -19,8 +19,9 @@ #ifndef _Volume_h_ #define _Volume_h_ - +#define GLM_FORCE_CTOR_INIT #include + #include #include diff --git a/emSim/helpers.h b/emSim/helpers.h index b8d7027..533ebab 100644 --- a/emSim/helpers.h +++ b/emSim/helpers.h @@ -24,6 +24,7 @@ #include #include +#define GLM_FORCE_CTOR_INIT #include namespace ems diff --git a/glm b/glm deleted file mode 160000 index 0d973b4..0000000 --- a/glm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0d973b40a49e550b1ea7df22a8573bc5fff84f24 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 61d30fa..8dab909 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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()