diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84c048a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/.travis.yml b/.travis.yml index 2159d34..40bafc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,14 @@ matrix: include: - os: linux compiler: gcc + addons: + apt: + packages: + - cmake script: + - mkdir -p build + - cd build + - cmake .. - make - os: linux @@ -15,8 +22,12 @@ matrix: - gcc-arm-linux-gnueabihf - libc6-dev-armhf-cross - qemu-user + - cmake script: - - CFLAGS="-O2 -mfpu=neon -g -static -DMAXREPEATS=2 -DLATBENCH_COUNT=10000" make + - mkdir -p build + - cd build + - cmake -DCMAKE_C_FLAGS="-O2 -mfpu=neon -g -static -DMAXREPEATS=2 -DLATBENCH_COUNT=10000" .. + - make - qemu-arm ./tinymembench - os: linux @@ -28,8 +39,12 @@ matrix: - gcc-aarch64-linux-gnu - libc6-dev-arm64-cross - qemu-user + - cmake script: - - CFLAGS="-O2 -g -static -DMAXREPEATS=2 -DLATBENCH_COUNT=10000" make + - mkdir -p build + - cd build + - cmake -DCMAKE_C_FLAGS="-O2 -g -static -DMAXREPEATS=2 -DLATBENCH_COUNT=10000" .. + - make - qemu-aarch64 ./tinymembench - os: linux @@ -40,8 +55,12 @@ matrix: - mingw32 - mingw32-binutils - mingw32-runtime + - cmake script: - - CFLAGS="-O2 -g -DMAXREPEATS=2 -DLATBENCH_COUNT=10000" make + - mkdir -p build + - cd build + - cmake -DCMAKE_C_FLAGS="-O2 -g -DMAXREPEATS=2 -DLATBENCH_COUNT=10000" .. + - make - i586-mingw32msvc-objdump -d ./tinymembench # Fails because of https://sourceware.org/bugzilla/show_bug.cgi?id=12687 # - wine ./tinymembench @@ -56,6 +75,10 @@ matrix: - gcc-mingw-w64-i686 - gcc-mingw-w64 - wine + - cmake script: - - CFLAGS="-O2 -g -DMAXREPEATS=2 -DLATBENCH_COUNT=10000" make + - mkdir -p build + - cd build + - cmake -DCMAKE_C_FLAGS="-O2 -g -DMAXREPEATS=2 -DLATBENCH_COUNT=10000" .. + - make - wine ./tinymembench diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e8011b0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.0) +project(tinymembench ASM C) +set(CMAKE_C_STANDARD 11) + +set(asm_files + aarch64-asm.S + arm-neon.S + mips-32.S + x86-sse2.S +) + +set(sources_files + asm-opt.c + main.c + util.c +) + +add_executable(tinymembench ${asm_files} ${sources_files}) +target_include_directories(tinymembench PRIVATE .) +target_link_libraries(tinymembench m) + +INSTALL(TARGETS tinymembench RUNTIME DESTINATION /usr/bin/) diff --git a/Makefile b/Makefile deleted file mode 100644 index 31ca60e..0000000 --- a/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -all: tinymembench - -ifdef WINDIR - CC = gcc -endif - -tinymembench: main.c util.o util.h asm-opt.h version.h asm-opt.o x86-sse2.o arm-neon.o mips-32.o aarch64-asm.o - ${CC} -O2 ${CFLAGS} -o tinymembench main.c util.o asm-opt.o x86-sse2.o arm-neon.o mips-32.o aarch64-asm.o -lm - -util.o: util.c util.h - ${CC} -O2 ${CFLAGS} -c util.c - -asm-opt.o: asm-opt.c asm-opt.h x86-sse2.h arm-neon.h mips-32.h - ${CC} -O2 ${CFLAGS} -c asm-opt.c - -x86-sse2.o: x86-sse2.S - ${CC} -O2 ${CFLAGS} -c x86-sse2.S - -arm-neon.o: arm-neon.S - ${CC} -O2 ${CFLAGS} -c arm-neon.S - -aarch64-asm.o: aarch64-asm.S - ${CC} -O2 ${CFLAGS} -c aarch64-asm.S - -mips-32.o: mips-32.S - ${CC} -O2 ${CFLAGS} -c mips-32.S - -clean: - -rm -f tinymembench - -rm -f tinymembench.exe - -rm -f *.o