mirror of
https://github.com/italicsjenga/juce-cmake-toolchains.git
synced 2024-12-23 07:01:30 +11:00
toolchains
This commit is contained in:
parent
5dc17bb321
commit
c70facffaa
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
mac/*
|
||||
win/*
|
||||
.vscode/*
|
53
toolchain-mac.cmake
Executable file
53
toolchain-mac.cmake
Executable file
|
@ -0,0 +1,53 @@
|
|||
list(APPEND CMAKE_PREFIX_PATH "$HOME/JUCE/mac")
|
||||
|
||||
# Sample toolchain file for building for Mac OS X from an Ubuntu Linux system.
|
||||
#
|
||||
# Typical usage:
|
||||
# *) install cross compiler from https://github.com/tpoechtrager/osxcross
|
||||
# *) mkdir build
|
||||
# *) cd build
|
||||
# *) cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/ubuntu-osxcross-10.7.cmake ..
|
||||
set(CMAKE_SYSTEM_NAME Darwin)
|
||||
set(TOOLCHAIN_PREFIX x86_64-apple-darwin20.4)
|
||||
set(OSXCROSS /usr/local/osxcross)
|
||||
set(SDK ${OSXCROSS}/SDK/MacOSX11.3.sdk)
|
||||
|
||||
# cross compilers to use for C and C++
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-clang)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-clang++)
|
||||
set(CMAKE_AR ${TOOLCHAIN_PREFIX}-ar)
|
||||
set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-ld)
|
||||
set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-ranlib)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-arch arm64 -arch x86_64")
|
||||
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
|
||||
|
||||
# target environment on the build host system
|
||||
# set 1st to dir with the cross compiler's C/C++ headers/libs
|
||||
set(CMAKE_FIND_ROOT_PATH ${OSXCROSS})
|
||||
|
||||
# set(CMAKE_FIND_ROOT_PATH ${SDK}/usr)
|
||||
# set(CMAKE_FIND_ROOT_PATH ${SDK}/System/Library/Frameworks)
|
||||
set(CMAKE_FRAMEWORK_PATH ${SDK}/System/Library/Frameworks)
|
||||
|
||||
set(CMAKE_OSX_SYSROOT ${SDK})
|
||||
|
||||
set(CMAKE_INSTALL_LIB_PREFIX ${SDK}/usr/lib)
|
||||
|
||||
# modify default behavior of FIND_XXX() commands to
|
||||
# search for headers/libs in the target environment and
|
||||
# search for programs in the build 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(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
|
||||
|
||||
# more linking variables
|
||||
set(CMAKE_INSTALL_NAME_DIR "@rpath")
|
||||
set(CMAKE_INSTALL_RPATH ...)
|
||||
|
||||
# set(CMAKE_EXE_LINKER_FLAGS_INIT "-static-libgcc -static-libstdc++ --static")
|
||||
# add_link_options("--static")
|
31
toolchain-win-mingw.cmake
Executable file
31
toolchain-win-mingw.cmake
Executable file
|
@ -0,0 +1,31 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH "$HOME/JUCE/win-mingw")
|
||||
|
||||
# cross compilers to use for C, C++ and Fortran
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
|
||||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
set(CMAKE_RC_FLAGS -DGCC_WINDRES)
|
||||
|
||||
set(CMAKE_AR ${TOOLCHAIN_PREFIX}-ar)
|
||||
set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-ld)
|
||||
|
||||
# target environment on the build host system
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
# set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}/include)
|
||||
|
||||
# modify default behavior of FIND_XXX() commands
|
||||
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(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".lib" ".a")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-static-libgcc -static-libstdc++ --static")
|
||||
add_link_options("--static")
|
||||
|
||||
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/lib/gcc/${TOOLCHAIN_PREFIX}/10-posix)
|
40
toolchain-win.cmake
Executable file
40
toolchain-win.cmake
Executable file
|
@ -0,0 +1,40 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_VERSION 10.0)
|
||||
|
||||
set(WINSDK_DIR $ENV{HOME}/winsdk)
|
||||
set(LLVM_DIR $ENV{HOME}/llvm-project)
|
||||
set(CLANG_INCLUDE_DIR ${LLVM_DIR}/build/lib/clang/15.0.0)
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}/JUCE/win")
|
||||
|
||||
# cross compilers to use for C, C++ and Fortran
|
||||
set(CMAKE_C_COMPILER clang-cl)
|
||||
set(CMAKE_CXX_COMPILER clang-cl)
|
||||
set(CMAKE_RC_COMPILER llvm-rc)
|
||||
set(CFLAGS "-Wno-unused-command-line-argument -fuse-ld=lld-link")
|
||||
set(CXXFLAGS "-Wno-unused-command-line-argument -fuse-ld=lld-link")
|
||||
set(CMAKE_AR llvm-lib)
|
||||
set(CMAKE_MT llvm-mt)
|
||||
set(CMAKE_LINKER lld-link)
|
||||
|
||||
# target environment on the build host system
|
||||
set(CMAKE_FIND_ROOT_PATH "${CLANG_INCLUDE_DIR};${WINSDK_DIR}/sdk;${WINSDK_DIR}/crt")
|
||||
|
||||
# modify default behavior of FIND_XXX() commands
|
||||
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(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".lib" ".a")
|
||||
|
||||
add_link_options("/libpath:${LLVM_DIR}/clang/test/Driver/Inputs/resource_dir/lib/windows")
|
||||
add_link_options("/libpath:${LLVM_DIR}/lld/test/COFF/Inputs/")
|
||||
add_link_options("/libpath:${WINSDK_DIR}/sdk/lib/ucrt/x86_64")
|
||||
add_link_options("/libpath:${WINSDK_DIR}/sdk/lib/um/x86_64")
|
||||
add_link_options("/libpath:${WINSDK_DIR}/crt/lib/x86_64")
|
||||
|
||||
include_directories(${CLANG_INCLUDE_DIR}/include)
|
||||
include_directories(${WINSDK_DIR}/crt/include)
|
||||
include_directories(${WINSDK_DIR}/sdk/include/ucrt)
|
||||
include_directories(${WINSDK_DIR}/sdk/include/um)
|
||||
include_directories(${WINSDK_DIR}/sdk/include/shared)
|
Loading…
Reference in a new issue