1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
# C# examples
set(CSHARP_EXAMPLES
SimplePrintPatientName
ExtractOneFrame
ExtractImageRegion
ExtractImageRegionWithLUT
ManipulateFile
RescaleImage
ExtractEncapsulatedFile
DecompressImage
DecompressImageMultiframe
DecompressJPEGFile
SimplePrint
ScanDirectory
#SortImage2
GetArray
NewSequence
GenerateDICOMDIR
StandardizeFiles
ReformatFile
CompressLossyJPEG
SendFileSCU
MpegVideoInfo
BasicImageAnonymizer
FileAnonymize
FileStreaming
FileChangeTS
FileChangeTSLossy
)
if(BUILD_TESTING)
list(APPEND CSHARP_EXAMPLES
BasicAnonymizer
ClinicalTrialIdentificationWorkflow
)
endif()
set(DEP)
# http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_add_a_dependency_to_a_source_file_which_is_generated_in_a_subdirectory.3F
# Tell CMake the source won't be available until build time.
set_source_files_properties(${GDCM_LIBRARY_DIR}/gdcm-sharp.dll PROPERTIES GENERATED 1)
# Make sure the source is generated before the executable builds.
foreach(example ${CSHARP_EXAMPLES})
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${example}.cs result)
add_custom_command(
OUTPUT ${GDCM_EXECUTABLE_DIR}/${example}.exe
COMMAND ${CMAKE_CSHARP_COMPILER} "${CSC_PLATFORM_FLAG}" "/r:${GDCM_LIBRARY_DIR}/gdcm-sharp.dll" "/out:${GDCM_EXECUTABLE_DIR}/${example}.exe" ${result}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${example}.cs
COMMENT "Create ${example}.exe"
)
add_custom_target(gdcm_sharp_${example} DEPENDS ${GDCM_EXECUTABLE_DIR}/${example}.exe)
# Make sure the gdcm-sharp.dll is generated before the exampls builds.
add_dependencies(gdcm_sharp_${example} GDCMCSharp)
list(APPEND DEP ${GDCM_EXECUTABLE_DIR}/${example}.exe)
endforeach()
add_custom_target(GDCMExampleCSharp ALL
DEPENDS ${DEP}
COMMENT "building examples"
)
add_dependencies(GDCMExampleCSharp GDCMCSharp)
if(BUILD_TESTING)
if(GDCM_DATA_ROOT)
ADD_CSHARP_TEST(TestSimplePrintCSharp ${GDCM_EXECUTABLE_DIR}/SimplePrint.exe ${GDCM_DATA_ROOT}/012345.002.050.dcm)
# TODO:
#if(BUILD_EXAMPLES)
# ADD_CSHARP_TEST(HelloWorldCSharp ${GDCM_EXECUTABLE_DIR}/HelloWorld.exe ${GDCM_DATA_ROOT}/012345.002.050.dcm)
#endif()
endif()
endif()
|