Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Modify devkit and dll name in debug #150

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ jobs:
- CXX=g++ CC=gcc cmake -DRINGMESH_WITH_GRAPHICS:BOOL=ON -DRINGMESH_WITH_UTILITIES:BOOL=ON -DRINGMESH_WITH_TESTS:BOOL=ON -DRINGMESH_WITH_GUI:BOOL=ON -DRINGMESH_WITH_TUTORIALS:BOOL=ON ..
- cd Coverage
- build-wrapper-linux-x86-64 --out-dir $TRAVIS_BUILD_DIR/bw-outputs cmake --build . -- -j2
- ldd ringmesh/bin/tests/test-plugin-manager
- objdump -x ringmesh/bin/tests/test-plugin-manager | grep RPATH
- ls ringmesh/lib
- cmake -E env CTEST_OUTPUT_ON_FAILURE=1 cmake --build ringmesh --target coverage -- -j2
- cmake --build ringmesh --target package
- cd $TRAVIS_BUILD_DIR
Expand Down
23 changes: 18 additions & 5 deletions cmake/RINGMesh.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,29 @@ include(${MINIZIP_INSTALL_PREFIX}/cmake/minizip-exports.cmake)

install(
DIRECTORY
${TINYXML2_INSTALL_PREFIX}/
${ZLIB_ROOT}/
${GEOGRAM_INSTALL_PREFIX}/
${TINYXML2_INSTALL_PREFIX}/lib/
${ZLIB_ROOT}/lib/
${GEOGRAM_INSTALL_PREFIX}/lib/
DESTINATION
.
lib/${CMAKE_BUILD_TYPE}
)
if(WIN32)
install(
DIRECTORY
${TINYXML2_INSTALL_PREFIX}/bin/
${ZLIB_ROOT}/bin/
${GEOGRAM_INSTALL_PREFIX}/bin/
DESTINATION
bin/${CMAKE_CFG_INTDIR}
)
if(RINGMESH_WITH_GRAPHICS)
install(
FILES
${GEOGRAM_INSTALL_PREFIX}/lib/glfw3.dll
DESTINATION
bin
bin/${CMAKE_CFG_INTDIR}
)
endif
endif()

include(GenerateExportHeader)
Expand Down Expand Up @@ -126,6 +136,8 @@ set(CMAKE_INSTALL_RPATH ".")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d")

#------------------------------------------------------------------------------------------------
# file automatically generated by cmake
Expand All @@ -143,6 +155,7 @@ install(

# Exports RINGMesh target
include(CMakePackageConfigHelpers)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin/${CMAKE_BUILD_TYPE})
include(InstallRequiredSystemLibraries)
configure_package_config_file(
cmake/RINGMeshConfig.cmake.in
Expand Down
8 changes: 4 additions & 4 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ function(add_ringmesh_library directory)
)
install(TARGETS ${target_name}
EXPORT ${target_name}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin/${CMAKE_BUILD_TYPE}
LIBRARY DESTINATION lib/${CMAKE_BUILD_TYPE}
ARCHIVE DESTINATION lib/${CMAKE_BUILD_TYPE}
)
install(EXPORT ${target_name}
FILE RINGMesh_${target_name}_target.cmake
Expand Down Expand Up @@ -179,7 +179,7 @@ endmacro()

function(add_ringmesh_binary bin_path)
add_ringmesh_executable(${bin_path} "Utilities" ${ARGN})
install(TARGETS ${exe_name} RUNTIME DESTINATION bin)
install(TARGETS ${exe_name} RUNTIME DESTINATION bin/${CMAKE_BUILD_TYPE})
set_target_properties(${exe_name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
endfunction()
Expand Down
11 changes: 11 additions & 0 deletions src/ringmesh/geomodel/core/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,21 @@

namespace
{
#ifdef RINGMESH_DEBUG
RINGMESH_PLUGIN_INITIALIZE(
RINGMesh_geomodel_core,
// Plugin initialization
RINGMesh::PluginManager::load_plugin( "RINGMesh_meshd" );
RINGMesh::GeoModelGeologicalEntity2D::initialize();
RINGMesh::GeoModelGeologicalEntity3D::initialize();
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this modification still needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is, in my opinion

#else
RINGMESH_PLUGIN_INITIALIZE(
RINGMesh_geomodel_core,
// Plugin initialization
RINGMesh::PluginManager::load_plugin( "RINGMesh_mesh" );
RINGMesh::GeoModelGeologicalEntity2D::initialize();
RINGMesh::GeoModelGeologicalEntity3D::initialize();
);
#endif
} // namespace
8 changes: 8 additions & 0 deletions src/ringmesh/mesh/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@

namespace
{
#ifdef RINGMESH_DEBUG
RINGMESH_PLUGIN_INITIALIZE(
RINGMesh_mesh,
// Plugin initialization
RINGMesh::PluginManager::load_plugin( "RINGMesh_geogram_extensiond" );
);
#else
RINGMESH_PLUGIN_INITIALIZE(
RINGMesh_mesh,
// Plugin initialization
RINGMesh::PluginManager::load_plugin( "RINGMesh_geogram_extension" );
);
#endif
} // namespace
22 changes: 16 additions & 6 deletions tests/basic/test-plugin-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ void load_plugin_from_command_line()
void load_plugin_from_file()
{
std::ofstream config( PluginManager::configuration_file );
config << "RINGMesh_io";
config << "RINGMesh_io";
#ifdef RINGMESH_DEBUG
config << "d";
#endif

config.close();
if( !PluginManager::load_plugins() )
{
Expand All @@ -71,27 +75,33 @@ void load_plugin_from_file()

void load_plugin_from_code()
{
auto status = PluginManager::load_plugin( "RINGMesh_geomodel_builder" );
std::string geomodel_builder = "RINGMesh_geomodel_builder";
#ifdef RINGMESH_DEBUG
geomodel_builder += "d";
#endif
auto status = PluginManager::load_plugin( geomodel_builder );
if( !status )
{
throw RINGMeshException(
"TEST", "Failed to load RINGMesh_geomodel_builder" );
}

status = PluginManager::load_plugin( "RINGMesh_geomodel_core" );
std::string geomodel_core = "RINGMesh_geomodel_core";
#ifdef RINGMESH_DEBUG
geomodel_core += "d";
#endif
status = PluginManager::load_plugin( geomodel_core );
if( !status )
{
throw RINGMeshException(
"TEST", "Failed to load RINGMesh_geomodel_core" );
}

status = PluginManager::load_plugin( "RINGMesh_geomodel_core" );
status = PluginManager::load_plugin( geomodel_core );
if( status )
{
throw RINGMeshException(
"TEST", "Not supposed to load RINGMesh_geomodel_core twice" );
}

status = PluginManager::load_plugin( "Foo" );
if( status )
{
Expand Down
6 changes: 5 additions & 1 deletion tests/geogram_extension/test-geogram-mesh-factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ int main()
{
try
{
PluginManager::load_plugin( "RINGMesh_geogram_extension" );
std::string geogram_ext = "RINGMesh_geogram_extension";
#ifdef RINGMESH_DEBUG
geogram_ext += "d";
#endif
PluginManager::load_plugin( geogram_ext );

Logger::out( "TEST", "Is geogram plugin well loaded?" );
// Test geogram mesh register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ void test_geomodel_geological_entity_factories()
int main()
{
try
{
PluginManager::load_plugin( "RINGMesh_geomodel_core" );
{
std::string geomodel_core = "RINGMesh_geomodel_core";
#ifdef RINGMESH_DEBUG
geomodel_core += "d";
#endif
PluginManager::load_plugin( geomodel_core );

Logger::out( "TEST", "Are geological entity factories initialized?" );
test_geomodel_geological_entity_factories();
Expand Down
6 changes: 5 additions & 1 deletion tests/io/test-io-initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ int main()
{
try
{
PluginManager::load_plugin( "RINGMesh_io" );
std::string io = "RINGMesh_io";
#ifdef RINGMESH_DEBUG
io += "d";
#endif
PluginManager::load_plugin( io );

Logger::out( "TEST", "Is io plugin well loaded?" );
// Test mesh initialize
Expand Down
7 changes: 5 additions & 2 deletions tests/tetrahedralize/test-tetragen-initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ int main()
{
try
{
PluginManager::load_plugin( "RINGMesh_tetrahedralize" );

std::string tetrahedralize = "RINGMesh_tetrahedralize";
#ifdef RINGMESH_DEBUG
tetrahedralize += "d";
#endif
PluginManager::load_plugin( tetrahedralize );
Logger::out( "TEST", "Is tetragen initialized?" );
test_tetragen_initialize();
}
Expand Down
2 changes: 2 additions & 0 deletions tools/Coverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
endif()

set(CMAKE_COVERAGE_POSTFIX "d")

add_compile_options(-g -O0 -fno-elide-constructors -fprofile-arcs -ftest-coverage -fno-inline -fno-inline-small-functions -fno-default-inline)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
link_libraries(gcov)
Expand Down