Browse Source

Early Windows support!

tags/v1.8.0
Xerbo 4 years ago
parent
commit
b68d7630ea
5 changed files with 81 additions and 1 deletions
  1. +3
    -0
      .gitignore
  2. +16
    -0
      README.md
  3. +44
    -0
      build_windows.sh
  4. +1
    -1
      cmake/FindLibSndFile.cmake
  5. +17
    -0
      cmake/toolchain-mingw32.cmake

+ 3
- 0
.gitignore View File

@@ -53,3 +53,6 @@ aptdec

# CMake
build

libpng*/
zlib*/

+ 16
- 0
README.md View File

@@ -108,6 +108,22 @@ To stop the decode and calibrate the image simply kill the `sox` process.

Palettes are just simple PNG images, 256x256px in size with 24bit RGB color. The X axis represents the value of Channel A and the Y axis the value of Channel B.

## Compiling with cmake

Thanks to the help of [Aang23](https://github.com/Aang23) aptdec is moving towards cmake + cpack for builds.

To use cmake to build instead of GNU automake:
```
mkdir build && cd build
cmake ..
make
```

Since cmake is now being used for building, windows support has come. You can build for windows with the `build_windows.sh` script, you will need wine and mingw64 installed:
```
./build_windows.sh
```

## Further Reading

[User's Guide for Building and Operating


+ 44
- 0
build_windows.sh View File

@@ -0,0 +1,44 @@
WINE_LIBSNDFILE_PATH=~/.wine/drive_c/Program\ Files/Mega-Nerd/libsndfile
TEMP_PATH=/tmp/windows_build

# Compile zlib
git clone https://github.com/madler/zlib && cd zlib
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH ..
make -j4
make install
cd ../../

# Compile libpng
git clone https://github.com/glennrp/libpng && cd libpng
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH ..
make -j4
make install
cd ../../

# Download libsndfile (compiling from source is an absolute bitch)
if [[ ! -e $WINE_LIBSNDFILE_PATH ]]; then
wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28-w64-setup.exe
echo "This build script has guessed that you don't have libsndfile installed under wine, the libsndfile installer will be launched"
read
wine libsndfile-1.0.28-w64-setup.exe
fi
if [[ ! -e $WINE_LIBSNDFILE_PATH ]]; then
echo "Something went wrong installing libsndfile"
exit
fi

cp "$WINE_LIBSNDFILE_PATH/lib/libsndfile-1.def" $TEMP_PATH/lib/libsndfile-1.def
cp "$WINE_LIBSNDFILE_PATH/lib/libsndfile-1.lib" $TEMP_PATH/lib/libsndfile-1.lib
cp "$WINE_LIBSNDFILE_PATH/lib/pkgconfig/sndfile.pc" $TEMP_PATH/lib/pkgconfig/sndfile.pc
cp "$WINE_LIBSNDFILE_PATH/bin/libsndfile-1.dll" $TEMP_PATH/bin/libsndfile-1.dll
cp "$WINE_LIBSNDFILE_PATH/include/sndfile.h" $TEMP_PATH/include/sndfile.h

sed -i "s/c:\/devel\/target\/libsndfile/$(echo $TEMP_PATH | sed 's/\//\\\//g')/g" $TEMP_PATH/lib/pkgconfig/sndfile.pc

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH ..
cp $TEMP_PATH/bin/*.dll ./

echo "Done, you should have a executable called aptdec.exe"

+ 1
- 1
cmake/FindLibSndFile.cmake View File

@@ -2,7 +2,7 @@

FIND_PATH(LIBSNDFILE_INCLUDE_DIR sndfile.h)

SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile)
SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile libsndfile-1)
FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES} PATH)

IF (LIBSNDFILE_INCLUDE_DIR AND LIBSNDFILE_LIBRARY)


+ 17
- 0
cmake/toolchain-mingw32.cmake View File

@@ -0,0 +1,17 @@
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ${CMAKE_INSTALL_PREFIX})

# 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)

Loading…
Cancel
Save