Skip to content

Commit

Permalink
initial commit of files for building 64-bit Csound on Win64 using msy…
Browse files Browse the repository at this point in the history
…s2 and mingw64-w64-x86_64
  • Loading branch information
Steven Yi authored and Steven Yi committed Dec 29, 2015
1 parent ce565fb commit 3aa76f6
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 0 deletions.
1 change: 1 addition & 0 deletions mingw64/.gitignore
@@ -0,0 +1 @@
csound-mingw64
26 changes: 26 additions & 0 deletions mingw64/Custom-mingw64.cmake
@@ -0,0 +1,26 @@
# CUSTOM PROPERTIES TO SET

# GLOBAL

set(CMAKE_BUILD_TYPE "RelWithDebInfo")
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(BUILD_STATIC_LIBRARY ON)
set(USE_OPEN_MP OFF)
set(TCL_VERSION 8.5)
#set(PYTHON_INCLUDE_DIRS "/usr/include/python2.7")
##set(BUILD_CSOUND_AC OFF)
##set(BUILD_CSOUND_AC_PYTHON_INTERFACE OFF)
##set(BUILD_CSOUND_AC_LUA_INTERFACE OFF)


#GET_FILENAME_COMPONENT(MINGW_DEPS_DIR "${CMAKE_CURRENT_BINARY_DIR}/../mingw64" ABSOLUTE)
#list(APPEND CMAKE_SYSTEM_LIBRARY_PATH "c:/cygwin64/lib")
#list(APPEND CMAKE_SYSTEM_INCLUDE_PATH "c:/cygwin64/usr/include")
#set(CMAKE_SYSTEM_INCLUDE_PATH "${CMAKE_SYSTEM_INCLUDE_PATH};$MINGW_DEPS_DIR/usr/local/include")

#### NOTE the processor type needs setting
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wall -O3 -mtune=core2 -I${MINGW_DEPS_DIR}/usr/local/include --sysroot=/usr/x86_64-w64-mingw32")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -O3 -mtune=core2 -fpermissive")
## also to test multicore
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wno-missing-field-initializers -Wno-unused-parameter -O3 -mtune=core2 -DJPFF")

16 changes: 16 additions & 0 deletions mingw64/README.md
@@ -0,0 +1,16 @@
# Building with msys2 and Mingw64

The following are instructions for building Csound for 64-bit Windows (x86_64) using msys2 and mingw64. The following was tested on Windows 10.

## Setup

1. Install the x86_64 version of [msys2](http://msys2.github.io/). Follow the pacman setup instructions carefully.
2. Install additional development tools using pacman. (TBD)
3. Open a MinGW-w64 Win64 Shell. This will load a terminal with all tools for mingw64 setup.
4. Change directories to this directory and run ./build.sh

## Notes

* SWIG_DIR is not parsed correctly by CMake within msys2. The reason is unknown at this time, and SWIG_DIR was hardcoded in build.sh to the appropriate location. This is a hack, as the value will have to change if the version of SWIG is updated in the package repository for mingw64.

* Building the python interface for 64-bit python requires some hacking to build with mingw64. Information is available at [this site](http://ascend4.org/Setting_up_a_MinGW-w64_build_environment).
47 changes: 47 additions & 0 deletions mingw64/Toolchain-mingw64.cmake
@@ -0,0 +1,47 @@
# 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)

#GET_FILENAME_COMPONENT(MINGW_DEPS_DIR "${CMAKE_CURRENT_BINARY_DIR}/../mingw64" ABSOLUTE)
#message(STATUS ">>> ${MINGW_DEPS_DIR}")
# here is the target environment located
#SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ${MINGW_DEPS_DIR} ${MINGW_DEPS_DIR}/usr/local)
#SET(CMAKE_FIND_ROOT_PATH /mingw64 /mingw64/x86_64-w64-mingw32 /usr)

#SET(CMAKE_SYSTEM_PREFIX_PATH /mingw64/x85_64-w64-mingw32)

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


# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
# http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=8959
# http://stackoverflow.com/questions/19754316/cross-compiling-opencv-with-mingw-using-cmakein-linux-for-windows

# this one is important
#SET(CMAKE_SYSTEM_NAME Windows)
##this one not so much
##SET(CMAKE_SYSTEM_VERSION 1)

## specify the cross compiler
#SET(PREFIX x86_64-w64-mingw32)
##SET(CMAKE_MAKE_PROGRAM mingw32-make)
#SET(CMAKE_C_COMPILER ${PREFIX}-gcc)
#SET(CMAKE_CXX_COMPILER ${PREFIX}-g++)
#SET(CMAKE_AR ${PREFIX}-gcc-ar)
#SET(CMAKE_NM ${PREFIX}-gcc-nm)
#SET(CMAKE_RC_COMPILER windres)

## specify the cross linker
#SET(CMAKE_RANLIB ${PREFIX}-gcc-ranlib)

# where is the target environment
#SET(CMAKE_FIND_ROOT_PATH / /mingw64)
7 changes: 7 additions & 0 deletions mingw64/build.sh
@@ -0,0 +1,7 @@
#!/bin/bash

mkdir csound-mingw64
cd csound-mingw64
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw64.cmake -DCMAKE_INSTALL_PREFIX=dist -DCUSTOM_CMAKE=../Custom-mingw64.cmake -DUSE_GETTEXT=0 -DSWIG_DIR=C:\msys2\mingw64\share\swig\3.0.6 -G "MSYS Makefiles"
make -j6 install

0 comments on commit 3aa76f6

Please sign in to comment.