c-basic/CMakeLists.txt

72 lines
4.4 KiB
CMake
Raw Normal View History

2022-12-22 00:52:59 +01:00
cmake_minimum_required(VERSION 3.0)
project(base)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include_directories(${PROJECT_SOURCE_DIR})
2022-12-22 01:03:15 +01:00
add_executable( abc src/abc.c )
add_executable( adder src/adder.c )
add_executable( args src/args.c )
add_executable( arrToBin src/arrToBin.c )
add_executable( ascii src/ascii.c )
add_executable( calculator src/calculator.c )
add_executable( callreference src/callreference.c )
add_executable( complex src/complex.c )
add_executable( dividableBy7 src/dividableBy7.c )
add_executable( structdump src/structdump.c )
add_executable( echo src/echo.c )
add_executable( echochar src/echochar.c )
add_executable( euler src/euler.c )
add_executable( factorial src/factorial.c )
add_executable( fail src/fail.c )
add_executable( fread src/fread.c )
add_executable( hello-world src/hello-world.c )
add_executable( options src/options.c )
add_executable( pointermagic src/pointermagic.c )
add_executable( primenumbers src/primenumbers.c )
add_executable( quersumme src/quersumme.c )
add_executable( readfile src/readfile.c )
add_executable( redefinition src/redefinition.c )
add_executable( redefinition-if src/redefinition-if.c )
add_executable( return-specified src/return-specified.c )
add_executable( scanf-test src/scanf-test.c )
add_executable( scnaf-hex-test src/scnaf-hex-test.c )
add_executable( signed-to-unsigned src/signed-to-unsigned.c )
add_executable( sizeofs src/sizeofs.c )
add_executable( success src/success.c )
add_executable( sum src/sum.c )
add_executable( tabtest src/tabtest.c )
add_executable( umlaut src/umlaut.c )
add_executable( unary-double-not src/unary-double-not.c )
add_executable( warning src/warning.c )
add_executable( pointer-arithmetic src/pointer-arithmetic.c )
2022-12-22 00:52:59 +01:00
target_link_libraries(abc m) # link libm to abc
2022-12-24 00:41:42 +01:00
project(huffman)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/huffman/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/huffman/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/huffman/bin)
add_executable( huffman huffman/src/huffman.c )
execute_process (
COMMAND bash -c "mkdir -p huffman/testfiles"
COMMAND bash -c "yes 'SAFJALJ AF OIAIFOsdp' | head -c 100KB > huffman/testfiles/small.txt"
COMMAND bash -c "dd if=/dev/urandom of=huffman/testfiles/1K-random.img count=1KiB"
COMMAND bash -c "dd if=/dev/urandom of=huffman/testfiles/10K-random.img count=10KiB"
COMMAND bash -c "dd if=/dev/urandom of=huffman/testfiles/100K-random.img count=100KiB"
COMMAND bash -c "dd if=/dev/urandom of=huffman/testfiles/1M-random.img count=1MiB"
COMMAND bash -c "dd if=/dev/urandom of=huffman/testfiles/10M-random.img count=10MiB"
COMMAND bash -c "dd if=/dev/zero of=huffman/testfiles/1K-zero.img count=1KiB"
COMMAND bash -c "dd if=/dev/zero of=huffman/testfiles/10K-zero.img count=10KiB"
COMMAND bash -c "dd if=/dev/zero of=huffman/testfiles/100K-zero.img count=100KiB"
COMMAND bash -c "dd if=/dev/zero of=huffman/testfiles/1M-zero.img count=1MiB"
COMMAND bash -c "dd if=/dev/zero of=huffman/testfiles/10M-zero.img count=10MiB"
COMMAND bash -c "echo -e \"Wer\ndas\nliest\nist\ndoof\n\" > huffman/testfiles/tiny.txt"
COMMAND bash -c "yes 'lslfkpoipop iipfiasp' | head -c 1MB > huffman/testfiles/mid.txt"
)
# TODO add condition to also generate bigger files
# TODO add targets for these testfiles