Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random build #416

Merged
merged 13 commits into from
Aug 28, 2021
Merged
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ before_script:
-DWITH_QGLVIEWER=false -DWITH_ITK=false -DWITH_EIGEN=true -DEIGEN3_INCLUDE_DIR='$EIGEN_ROOT/include/eigen3'"
- if [ $CONFIG == "Debug,QGLVIEWER" AND $TRAVIS_OS_NAME == osx ]; then export DGTALTYPE="-DBUILD_EXAMPLES=OFF
-DDGTAL_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug -DWITH_QGLVIEWER=true -DWITH_QT5=true
-DWITH_ITK=false -DWITH_EIGEN=true -DEIGEN3_INCLUDE_DIR='$EIGEN_ROOT/include/eigen3'";
-DWITH_ITK=false -DWITH_EIGEN=true -DEIGEN3_INCLUDE_DIR='$EIGEN_ROOT/include/eigen3'" ;
fi
- if [ $CONFIG == "Debug,QGLVIEWER" AND $TRAVIS_OS_NAME == linux ]; then export
DGTALTYPE="-DBUILD_EXAMPLES=OFF -DDGTAL_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug
Expand All @@ -84,7 +84,7 @@ before_script:
script:
- echo "---- $DGTALTYPE ---$BUILD_DOC---$UPLOAD_DOC--*$DOC*-$BTYPE---"
- cmake . -DDGtal_DIR=$PWD/DGtal $BTYPE $DGTALTYPE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=$CXXCOMPILER
-DCMAKE_C_COMPILER=$CCOMPILER
-DCMAKE_C_COMPILER=$CCOMPILER -DDGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD=25 -DDGTALTOOLS_RANDOMIZED_BUILD_WHITELIST="$(cat ../cmake/whiteListBuildTools.txt | tr -d '\n' ; ../cmake/create_whitelist.sh)"
- if [ $DOC == "true" ]; then make doc; echo "doc"; fi
- if [ $CONFIG == "Debug" ]; then make; fi
- if [ $CONFIG == "Debug,QGLVIEWER" ]; then make; fi
Expand Down
21 changes: 19 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
PROJECT(DGtalTools)

cmake_minimum_required (VERSION 3.1)
cmake_policy(SET CMP0057 NEW)
cmake_policy(SET CMP0057 NEW) # the new interpretation of IN_LIST is by default not set (at least until 3.21.1).

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")

SET(DGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD "100" CACHE INTERNAL "Threshold for the random selection of tools to build.")
SET(DGTALTOOLS_RANDOMIZED_BUIL_WHITELIST "" CACHE INTERNAL "List of whitelisted tools to build.")

# -----------------------------------------------------------------------------
# DGtal dependencies
Expand Down Expand Up @@ -66,6 +67,20 @@ SET(VERSION ${DGtalTools_VERSION_MAJOR}.${DGtalTools_VERSION_MINOR}.${DGtalTools



# -----------------------------------------------------------------------------
# Randomized build.
# -----------------------------------------------------------------------------

message(STATUS "Randomized build")
if (DGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD EQUAL "100")
message(STATUS "All tools will be compiled (cmake variable DGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD)")
else()
message(STATUS "Only ~${DGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD}% of the (randomly selected) tools will be compiled.")
message(STATUS " (you can adjust this with the cmake variable DGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD)")
message(STATUS " Whitelist: ${DGTALTOOLS_RANDOMIZED_BUILD_WHITELIST}")
message(STATUS " (you can adjust this with the cmake variable DGTALTOOLS_RANDOMIZED_BUILD_WHITELIST)")
endif()
message(STATUS "-------------------------------------------------------------------------------")



Expand All @@ -87,7 +102,9 @@ INCLUDE(doxygen)
INCLUDE(TargetDoxygenDoc OPTIONAL)
message(STATUS "-------------------------------------------------------------------------------")


#------Tools subdirectories ------
include(cmake/AddToolsFunction.cmake)
add_subdirectory(volumetric)
add_subdirectory(generators)
add_subdirectory(estimators)
Expand Down
10 changes: 5 additions & 5 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# DGtalTools 1.3(beta)



# DGtalTools 1.2

- *build*
- New cmake option (DGTAL_RANDOMIZED_BUILD_THRESHOLD) to set the
(approximated) % of tools build
(Bertrand Kerautret [#416](https://github.com/DGtal-team/DGtal/pull/416))

- *visualisation*
- 3dImplicitSurfaceExtractorByThickening: adding OBJ export.
(David Coeurjolly [#413](https://github.com/DGtal-team/DGtalTools/pull/413))
Expand All @@ -30,7 +31,6 @@
- *volumetric*
- volReSample: it can now export image including ITK image spacing.
(Bertrand Kerautret [#404](https://github.com/DGtal-team/DGtalTools/pull/404))




Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ before_build:
- cmake -Wno-dev -G"%VS_GEN%" -DCMAKE_BUILD_TYPE=%CONFIG% -DWITH_QGLVIEWER:BOOL=ON -DWITH_QT5:BOOL=ON -DQGLVIEWER_INCLUDE_DIR=C:\projects\libqglviewer -DQGLVIEWER_LIBRARIES=C:\projects\libqglviewer\QGLViewer\QGLViewer2.lib -DBUILD_TESTING:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=FALSE -DBOOST_ROOT=%BOOST_ROOT% -DZLIB_LIBRARY=c:/zlib-install/lib/zlibd.lib -DZLIB_INCLUDE_DIR=c:/zlib-install/include/ .
- msbuild /m /p:Configuration=%CONFIG% /p:Platform=%B_NAME% DGtal.sln
- cd %APPVEYOR_BUILD_FOLDER%
- cmake -Wno-dev -G"%VS_GEN%" -DCMAKE_BUILD_TYPE=%CONFIG% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DCMAKE_INSTALL_PREFIX:PATH=c:\zlib-install C:\zlib\zlib-1.2.9 -DDGtal_DIR=C:\projects\dgtal .
- cmake -Wno-dev -G"%VS_GEN%" -DCMAKE_BUILD_TYPE=%CONFIG% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DCMAKE_INSTALL_PREFIX:PATH=c:\zlib-install C:\zlib\zlib-1.2.9 -DDGtal_DIR=C:\projects\dgtal -DDGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD=25 -DDGTALTOOLS_RANDOMIZED_BUILD_WHITELIST="$(cat ../cmake/whiteListBuildTools.txt | tr -d '\n' ; ../cmake/create_whitelist.sh)" .


build_script:
Expand Down
14 changes: 14 additions & 0 deletions cmake/AddToolsFunction.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# DGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD must be a global variable between 0 and 99.
# DGTALTOOLS_RANDOMIZED_BUILD_WHITELIST must be a global variable containing the list of tools that will be always build.

function(DGtalTools_add_tool tool_file) #optional_avoid_add_test
string(RANDOM LENGTH 2 ALPHABET "0123456789" _random)
if ((${_random} LESS ${DGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD}) OR ${tool_file} IN_LIST DGTALTOOLS_RANDOMIZED_BUILD_WHITELIST )
add_executable(${tool_file} ${tool_file}.cpp ${ARGN})
target_link_libraries (${tool_file} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS ${tool_file}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
endfunction()
7 changes: 7 additions & 0 deletions cmake/create_whitelist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/zsh

foreach i (`git diff --name-only HEAD HEAD~5 | grep cpp`)
echo -e "$WL$i:r:t\c"
WL=";"
end

1 change: 1 addition & 0 deletions cmake/whiteListBuildTools.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
converterDir;convertVol;img2freeman;itk2vol;estimatorsDir;2dLocalEstimators;curvatureScaleSpaceBCC;volSurfaceRegularization;generatorDir;contourGenerator;geometricTransformDir;rigidTransform3D;imageProcessingDir;at-u0-v1;visualisationDir;3dCurvatureViewer;meshViewer;3dImageViewer;volumetricDir;volSegment;
16 changes: 3 additions & 13 deletions converters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ SET(DGTAL_TOOLS_SRC ${DGTAL_TOOLS_SRC}
endif( WITH_HDF5 )

FOREACH(FILE ${DGTAL_TOOLS_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies} )
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)


Expand All @@ -44,11 +39,6 @@ if ( WITH_ITK )
dicom2vol
itk2vol)
FOREACH(FILE ${DGTAL_TOOLS_ITK})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies} )
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
ENDFOREACH(FILE)
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)
ENDIF( WITH_ITK )
24 changes: 4 additions & 20 deletions estimators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,15 @@ SET(DGTAL_TOOLS_SRC
)

if (WITH_EIGEN)
add_executable(volSurfaceRegularization volSurfaceRegularization.cpp volSurfaceRegularization-details/surface_approx.cpp)
target_link_libraries(volSurfaceRegularization ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS volSurfaceRegularization
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(volSurfaceRegularization volSurfaceRegularization-details/surface_approx.cpp)
endif()

if ( WITH_VISU3D_QGLVIEWER )
SET(VISU3D_TESTS_SRC
3dCurveTangentEstimator
)
FOREACH(FILE ${VISU3D_TESTS_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)
endif ( WITH_VISU3D_QGLVIEWER )

Expand All @@ -39,19 +29,13 @@ if ( WITH_CGAL )
3dLocalEstimators
)
FOREACH(FILE ${CGAL_TESTS_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)
endif ( WITH_CGAL )

FOREACH(FILE ${DGTAL_TOOLS_SRC})
DGtalTools_add_tool(${FILE})
if(MSVC)
set_source_files_properties( ${FILE} PROPERTIES COMPILE_FLAGS "/bigobj" )
endif(MSVC)
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
ENDFOREACH(FILE)
7 changes: 1 addition & 6 deletions generators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ SET(DGTAL_TOOLS_SRC
)

FOREACH(FILE ${DGTAL_TOOLS_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)

7 changes: 1 addition & 6 deletions geometricTransform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ SET(DGTAL_TOOLS_SRC


FOREACH(FILE ${DGTAL_TOOLS_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies} )
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE} ${FILE}.cpp)
ENDFOREACH(FILE)

7 changes: 1 addition & 6 deletions imageProcessing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ if(WITH_EIGEN)
atv-u2-v0
)
FOREACH(FILE ${DGTAL_TOOLS_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies} )
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)
endif(WITH_EIGEN)
32 changes: 5 additions & 27 deletions visualisation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ SET(DGTAL_TOOLS_SRC
)

foreach (FILE ${DGTAL_TOOLS_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)

if ( WITH_VISU3D_QGLVIEWER )
Expand All @@ -30,44 +25,27 @@ if ( WITH_VISU3D_QGLVIEWER )
3dImplicitSurfaceExtractorByThickening )

FOREACH(FILE ${DGTAL_EXAMPLES_QGL_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries ( ${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})

install(TARGETS ${FILE} RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE})
endforeach (FILE)

add_executable(3dImageViewer 3dImageViewer specificClasses/Viewer3DImage)
target_link_libraries(3dImageViewer ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS 3dImageViewer RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(3dImageViewer specificClasses/Viewer3DImage.cpp)

include_directories(${CMAKE_CURRENT_BINARY_DIR})

if (WITH_QT4)
QT4_WRAP_UI(ui_sliceViewer_FORMS_HEADERS sliceViewer.ui)
QT4_WRAP_CPP(sliceViewer_HEADERS_MOC sliceViewer.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
add_executable(sliceViewer sliceViewer.cpp ${sliceViewer_HEADERS_MOC}
${ui_sliceViewer_FORMS_HEADERS})
target_link_libraries (sliceViewer ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})

DGtalTools_add_tool(sliceViewer ${sliceViewer_HEADERS_MOC} ${ui_sliceViewer_FORMS_HEADERS})
elseif (WITH_QT5)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
qt5_wrap_ui(ui_sliceViewer_FORMS_HEADERS sliceViewer.ui)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS}")
add_executable(sliceViewer sliceViewer.cpp ${ui_sliceViewer_FORMS_HEADERS})
target_link_libraries(sliceViewer ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
DGtalTools_add_tool(sliceViewer ${ui_sliceViewer_FORMS_HEADERS})
endif (WITH_QT4)

install(TARGETS sliceViewer RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif (WITH_VISU3D_QGLVIEWER)


Expand Down
16 changes: 3 additions & 13 deletions volumetric/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ SET(DGTAL_TOOLS_SRC


FOREACH(FILE ${DGTAL_TOOLS_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries (${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)


Expand All @@ -33,11 +28,6 @@ if ( WITH_VISU3D_QGLVIEWER )
homotopicThinning3D
criticalKernelsThinning3D )
FOREACH(FILE ${DGTAL_EXAMPLES_QGL_SRC})
add_executable(${FILE} ${FILE}.cpp)
target_link_libraries ( ${FILE} ${DGTAL_LIBRARIES} ${DGtalToolsLibDependencies})
install(TARGETS ${FILE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
DGtalTools_add_tool(${FILE})
ENDFOREACH(FILE)
endif ( WITH_VISU3D_QGLVIEWER )
endif ( WITH_VISU3D_QGLVIEWER )