~hp/dfuse_pack

5f44050bb700c39353ff3df0a6b51ab872fb0f41 — Hanspeter Portner 5 years ago 3e91c55
initial migration to meson.
18 files changed, 130 insertions(+), 138 deletions(-)

M .gitlab-ci.yml
D .travis.yml
D CMakeLists.txt
M README.md
M VERSION
D cmake/arm-linux-gnueabihf.cmake
D cmake/i686-linux-gnu.cmake
D cmake/i686-w64-mingw32.cmake
D cmake/universal-apple-darwin.cmake
D cmake/x86_64-linux-gnu.cmake
D cmake/x86_64-w64-mingw32.cmake
A meson.build
A meson/arm-linux-gnueabihf
A meson/i686-linux-gnu
A meson/i686-w64-mingw32
A meson/universal-apple-darwin
A meson/x86_64-linux-gnu
A meson/x86_64-w64-mingw32
M .gitlab-ci.yml => .gitlab-ci.yml +5 -8
@@ 4,9 4,9 @@ stages:

.variables_template: &variables_definition
  variables:
    BASE_NAME: "dfuse_pack"
    BASE_NAME: "lv2lint"
    PKG_CONFIG_PATH: "/opt/lv2/lib/pkgconfig:/opt/${CI_BUILD_NAME}/lib/pkgconfig"
    TOOLCHAIN_FILE: "${CI_PROJECT_DIR}/cmake/${CI_BUILD_NAME}.cmake"
    TOOLCHAIN_FILE: "${CI_PROJECT_DIR}/meson/${CI_BUILD_NAME}"

.common_template: &common_definition
  <<: *variables_definition


@@ 19,12 19,9 @@ stages:
.build_template: &build_definition
  <<: *common_definition
  script:
    - mkdir build
    - pushd build
    - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${CI_PROJECT_DIR}/${BASE_NAME}-$(cat ../VERSION)/${CI_BUILD_NAME}" -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} ..
    - cmake .. # needed for darwin
    - make
    - make install
    - meson --prefix=/ --cross-file "${TOOLCHAIN_FILE}" -Dstatic-build=false build
    - ninja -C build
    - DESTDIR="${CI_PROJECT_DIR}/${BASE_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" ninja -C build install

.universal_linux_template: &universal_linux_definition
  image: ventosus/universal-linux-gnu

D .travis.yml => .travis.yml +0 -17
@@ 1,17 0,0 @@
language:
 - c
os:
 - linux
compiler:
 - gcc
 - clang
before_install:
 - sudo apt-get -qq update
install:
 - sudo apt-get install -y libeina-dev
before_script:
 - mkdir build
 - cd build
 - cmake ..
script:
 - make

D CMakeLists.txt => CMakeLists.txt +0 -13
@@ 1,13 0,0 @@
cmake_minimum_required(VERSION 2.8)

project(dfuse_pack)

set(CMAKE_C_FLAGS "-fdata-sections -ffunction-sections ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-std=gnu11 -Wextra -Wno-unused-parameter -ffast-math -fvisibility=hidden ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes ${CMAKE_C_FLAGS}")

include_directories("${PROJECT_SOURCE_DIR}")

# dfuse_pack
add_executable(dfuse_pack dfuse_pack.c)
install(TARGETS dfuse_pack DESTINATION bin)

M README.md => README.md +3 -4
@@ 14,11 14,10 @@ This command line utility lets you pack raw binary firmware images into a DfuSe 

### Build / install

	mkdir build
	meson build
	cd build
	cmake ..
	make
	sudo make install
	ninja -j4
	sudo ninja install

### Arguments


M VERSION => VERSION +1 -1
@@ 1,1 1,1 @@
0.10.0
0.11.1

D cmake/arm-linux-gnueabihf.cmake => cmake/arm-linux-gnueabihf.cmake +0 -18
@@ 1,18 0,0 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR "armv7h")
set(TOOLCHAIN "arm-linux-gnueabihf")

# which compilers to use for C and C++
set(CMAKE_C_COMPILER "${TOOLCHAIN}-gcc")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN}-g++")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "usr/${TOOLCHAIN}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search 
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

D cmake/i686-linux-gnu.cmake => cmake/i686-linux-gnu.cmake +0 -7
@@ 1,7 0,0 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR "i686")
set(TOOLCHAIN "i686-linux-gnu")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags")
set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags")

D cmake/i686-w64-mingw32.cmake => cmake/i686-w64-mingw32.cmake +0 -23
@@ 1,23 0,0 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR "i686")
set(TOOLCHAIN "i686-w64-mingw32")

# which compilers to use for C and C++
set(CMAKE_C_COMPILER "${TOOLCHAIN}-gcc")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN}-g++")
set(CMAKE_RC_COMPILER "${TOOLCHAIN}-windres")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search 
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(LIBS ${LIBS} "-static-libgcc")

set(WINE wine32)

D cmake/universal-apple-darwin.cmake => cmake/universal-apple-darwin.cmake +0 -20
@@ 1,20 0,0 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(TOOLCHAIN "universal-apple-darwin")

set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")

# which compilers to use for C and C++
set(CMAKE_C_COMPILER "/usr/${TOOLCHAIN}/bin/x86_64-apple-darwin15-clang")
set(CMAKE_CXX_COMPILER "/usr/${TOOLCHAIN}/bin/x86_64-apple-darwin15-clang++")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search 
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

D cmake/x86_64-linux-gnu.cmake => cmake/x86_64-linux-gnu.cmake +0 -4
@@ 1,4 0,0 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(TOOLCHAIN "x86_64-linux-gnu")

D cmake/x86_64-w64-mingw32.cmake => cmake/x86_64-w64-mingw32.cmake +0 -23
@@ 1,23 0,0 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(TOOLCHAIN "x86_64-w64-mingw32")

# which compilers to use for C and C++
set(CMAKE_C_COMPILER "${TOOLCHAIN}-gcc")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN}-g++")
set(CMAKE_RC_COMPILER "${TOOLCHAIN}-windres")

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN}")

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search 
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(LIBS ${LIBS} "-static-libgcc")

set(WINE wine64)

A meson.build => meson.build +17 -0
@@ 0,0 1,17 @@
project('dfuse_pack', 'c', default_options : [
	'buildtype=release',
	'warning_level=1',
	'werror=false',
	'b_lto=true',
	'c_std=c11'])

version = run_command('cat', 'VERSION').stdout().strip()

add_project_arguments('-D_GNU_SOURCE', language : 'c')

conf_data = configuration_data()
cc = meson.get_compiler('c')

executable('dfuse_pack',
	'dfuse_pack.c',
	install : true)

A meson/arm-linux-gnueabihf => meson/arm-linux-gnueabihf +18 -0
@@ 0,0 1,18 @@
[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'armv7hl'
endian = 'little'

[binaries]
c = '/usr/bin/arm-linux-gnueabihf-gcc'
cpp = '/usr/bin/arm-linux-gnueabihf-cpp'
ar = '/usr/bin/arm-linux-gnueabihf-ar'
strip = '/usr/bin/arm-linux-gnueabihf-strip'
pkgconfig = '/usr/bin/pkg-config'
exe_wrapper = '/usr/bin/qemu-arm'

[properties]
root = '/usr/arm-linux-gnueabihf'
c_link_args = ['-Wl,-z,defs']
needs_exe_wrapper = true

A meson/i686-linux-gnu => meson/i686-linux-gnu +17 -0
@@ 0,0 1,17 @@
[host_machine]
system = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'

[binaries]
c = '/usr/bin/x86_64-linux-gnu-gcc'
cpp = '/usr/bin/x86_64-linux-gnu-g++'
ar = '/usr/bin/x86_64-linux-gnu-ar'
strip = '/usr/bin/x86_64-linux-gnu-strip'
pkgconfig = '/usr/bin/pkg-config'

[properties]
c_args = ['-m32']
c_link_args = ['-m32', '-Wl,-z,defs']
needs_exe_wrapper = false

A meson/i686-w64-mingw32 => meson/i686-w64-mingw32 +17 -0
@@ 0,0 1,17 @@
[host_machine]
system = 'windows'
cpu_family = 'i686'
cpu = 'i686'
endian = 'little'

[binaries]
c = '/usr/bin/i686-w64-mingw32-gcc'
cpp = '/usr/bin/i686-w64-mingw32-c++'
ar = '/usr/bin/i686-w64-mingw32-ar'
strip = '/usr/bin/i686-w64-mingw32-strip'
pkgconfig = '/usr/bin/pkg-config'
exe_wrapper = '/usr/bin/wine'

[properties]
root = '/usr/i686-w64-mingw32'
needs_exe_wrapper = true

A meson/universal-apple-darwin => meson/universal-apple-darwin +19 -0
@@ 0,0 1,19 @@
[host_machine]
system = 'darwin'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[binaries]
c = '/usr/universal-apple-darwin/bin/x86_64-apple-darwin15-clang'
cpp = '/usr/universal-apple-darwin/bin/x86_64-apple-darwin15-clang++'
objc = '/usr/universal-apple-darwin/bin/x86_64-apple-darwin15-clang'
ar = '/usr/universal-apple-darwin/bin/x86_64-apple-darwin15-ar'
strip = '/usr/universal-apple-darwin/bin/x86_64-apple-darwin15-strip'
pkgconfig = '/usr/bin/pkg-config'

[properties]
root = '/usr/universal-apple-darwin/SDK/MacOSX10.11.sdk'
c_args = ['-arch', 'i386', '-arch', 'x86_64']
c_link_args = ['-arch', 'i386', '-arch', 'x86_64']
needs_exe_wrapper = true

A meson/x86_64-linux-gnu => meson/x86_64-linux-gnu +16 -0
@@ 0,0 1,16 @@
[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[binaries]
c = '/usr/bin/x86_64-linux-gnu-gcc'
cpp = '/usr/bin/x86_64-linux-gnu-g++'
ar = '/usr/bin/x86_64-linux-gnu-ar'
strip = '/usr/bin/x86_64-linux-gnu-strip'
pkgconfig = '/usr/bin/pkg-config'

[properties]
c_link_args = ['-Wl,-z,defs']
needs_exe_wrapper = false

A meson/x86_64-w64-mingw32 => meson/x86_64-w64-mingw32 +17 -0
@@ 0,0 1,17 @@
[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[binaries]
c = '/usr/bin/x86_64-w64-mingw32-gcc'
cpp = '/usr/bin/x86_64-w64-mingw32-c++'
ar = '/usr/bin/x86_64-w64-mingw32-ar'
strip = '/usr/bin/x86_64-w64-mingw32-strip'
pkgconfig = '/usr/bin/pkg-config'
exe_wrapper = '/usr/bin/wine64'

[properties]
root = '/usr/x86_64-w64-mingw32'
needs_exe_wrapper = true