diff --git a/.travis.yml b/.travis.yml index b3417019..94f75443 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,8 @@ language: cpp sudo: required dist: xenial -osx_image: xcode10.1 # macOS 10.13 os: - linux - - osx compiler: - gcc - clang @@ -39,20 +37,32 @@ jobs: env: DOCKER_BUILD=ubuntu-18.04 - os: linux env: DOCKER_BUILD=ubuntu-19.10 - exclude: - # Various macOS tests seem to be broken. + + # macOS tests - os: osx - compiler: gcc + osx_image: xcode10.1 # macOS 10.13 + compiler: clang + env: LLVM_CONFIG=llvm-config-3.5 CLANG=clang-3.5 - os: osx - env: LLVM_CONFIG=llvm-config-5.0 CLANG=clang-5.0 USE_CMAKE=1 + osx_image: xcode10.1 # macOS 10.13 + compiler: clang + env: LLVM_CONFIG=llvm-config-3.8 CLANG=clang-3.8 - os: osx - env: LLVM_CONFIG=llvm-config-6.0 CLANG=clang-6.0 USE_CMAKE=1 STATIC_LLVM=0 STATIC_LUAJIT=0 + osx_image: xcode11.3 # macOS 10.14 + compiler: clang + env: LLVM_CONFIG=llvm-config-6.0 CLANG=clang-6.0 USE_CMAKE=1 - os: osx - env: LLVM_CONFIG=llvm-config-8 CLANG=clang-8 + osx_image: xcode11.3 # macOS 10.14 + compiler: clang + env: LLVM_CONFIG=llvm-config-7 CLANG=clang-7 USE_CMAKE=1 - os: osx - env: LLVM_CONFIG=llvm-config-9 CLANG=clang-9 + osx_image: xcode11.3 # macOS 10.14 + compiler: clang + env: LLVM_CONFIG=llvm-config-8 CLANG=clang-8 USE_CMAKE=1 - os: osx - env: LLVM_CONFIG=llvm-config-9 CLANG=clang-9 USE_CMAKE=1 STATIC_LLVM=0 STATIC_LUAJIT=0 + osx_image: xcode11.3 # macOS 10.14 + compiler: clang + env: LLVM_CONFIG=llvm-config-9 CLANG=clang-9 USE_CMAKE=1 script: - ./travis.sh diff --git a/Makefile b/Makefile index 4689b16e..336e6a82 100644 --- a/Makefile +++ b/Makefile @@ -209,7 +209,8 @@ endif build/lib/libluajit-5.1.a: build/$(LUAJIT_TAR) (cd build; tar -xf $(LUAJIT_TAR)) # MACOSX_DEPLOYMENT_TARGET is a workaround for https://github.com/LuaJIT/LuaJIT/issues/484 - (cd $(LUAJIT_DIR); $(MAKE) install PREFIX=$(realpath build) CC=$(CC) STATIC_CC="$(CC) -fPIC" MACOSX_DEPLOYMENT_TARGET=10.6) + # see also https://github.com/LuaJIT/LuaJIT/issues/575 + (cd $(LUAJIT_DIR); $(MAKE) install PREFIX=$(realpath build) CC=$(CC) STATIC_CC="$(CC) -fPIC" MACOSX_DEPLOYMENT_TARGET=10.7) release/include/terra/%.h: $(LUAJIT_INCLUDE)/%.h $(LUAJIT_LIB) cp $(LUAJIT_INCLUDE)/$*.h $@ diff --git a/cmake/Modules/GetLuaJIT.cmake b/cmake/Modules/GetLuaJIT.cmake index 328a8cb1..d0348a5a 100644 --- a/cmake/Modules/GetLuaJIT.cmake +++ b/cmake/Modules/GetLuaJIT.cmake @@ -104,7 +104,8 @@ else() OUTPUT ${LUAJIT_STATIC_LIBRARY} ${LUAJIT_SHARED_LIBRARY_PATHS} ${LUAJIT_EXECUTABLE} ${LUAJIT_INSTALL_HEADERS} DEPENDS ${LUAJIT_SOURCE_DIR} # MACOSX_DEPLOYMENT_TARGET is a workaround for https://github.com/LuaJIT/LuaJIT/issues/484 - COMMAND make install "PREFIX=${LUAJIT_INSTALL_PREFIX}" "CC=${CMAKE_C_COMPILER}" "STATIC_CC=${CMAKE_C_COMPILER} -fPIC" MACOSX_DEPLOYMENT_TARGET=10.6 + # see also https://github.com/LuaJIT/LuaJIT/issues/575 + COMMAND make install "PREFIX=${LUAJIT_INSTALL_PREFIX}" "CC=${CMAKE_C_COMPILER}" "STATIC_CC=${CMAKE_C_COMPILER} -fPIC" MACOSX_DEPLOYMENT_TARGET=10.7 WORKING_DIRECTORY ${LUAJIT_SOURCE_DIR} VERBATIM ) diff --git a/tests/dynlib.t b/tests/dynlib.t index 09e725bd..3b106ebf 100644 --- a/tests/dynlib.t +++ b/tests/dynlib.t @@ -1,7 +1,7 @@ local ffi = require 'ffi' -- test that the dynamic library for terra was built correctly -- by compiling a new program that links against it and running it -terralib.includepath = terralib.terrahome.."/include/terra" +terralib.includepath = terralib.includepath .. ";" .. terralib.terrahome .. "/include/terra" C = terralib.includecstring [[ #include #include "terra.h" diff --git a/tests/exportdynamic.t b/tests/exportdynamic.t index 3bbd63b3..0583823f 100644 --- a/tests/exportdynamic.t +++ b/tests/exportdynamic.t @@ -1,4 +1,4 @@ -terralib.includepath = terralib.terrahome.."/include/terra" +terralib.includepath = terralib.includepath .. ";" .. terralib.terrahome .. "/include/terra" C = terralib.includecstring [[ #include "lua.h" #include "lauxlib.h" diff --git a/tests/lib/objc.t b/tests/lib/objc.t index c3758645..82e476be 100644 --- a/tests/lib/objc.t +++ b/tests/lib/objc.t @@ -14,13 +14,18 @@ local mangleSelector --replace methods such as: myobj:methodcall(arg0,arg1) --with calls to the objc runtime api: objc_msgSend(&obj,sel_registerName("methodcall"),arg0,arg1) +-- Hack: As of macOS 10.15 this type signature has changed, see: +-- https://www.mikeash.com/pyblog/objc_msgsends-new-prototype.html +local objc_msgSend_type = terralib.types.funcpointer( + {&C.objc_object, &C.objc_selector}, &C.objc_object, true) + local struct Wrapper { data : &C.objc_object } Wrapper.metamethods.__methodmissing = macro(function(sel,obj,...) local arguments = {...} sel = mangleSelector(sel,#arguments) - return `Wrapper { C.objc_msgSend(obj.data,C.sel_registerName(sel),arguments) } + return `Wrapper { ([objc_msgSend_type](C.objc_msgSend))(obj.data,C.sel_registerName(sel),arguments) } end) function mangleSelector(sel,nargs) diff --git a/tests/luaapi.t b/tests/luaapi.t index 10a69360..f615d427 100644 --- a/tests/luaapi.t +++ b/tests/luaapi.t @@ -1,4 +1,4 @@ -terralib.includepath = terralib.terrahome.."/include/terra" +terralib.includepath = terralib.includepath .. ";" .. terralib.terrahome .. "/include/terra" C = terralib.includecstring [[ #include "lua.h" #include "lauxlib.h" diff --git a/travis.sh b/travis.sh index 5d5350fc..2a5cd83e 100755 --- a/travis.sh +++ b/travis.sh @@ -142,6 +142,11 @@ if [[ $(uname) = Darwin ]]; then hdiutil detach /Volumes/CUDAMacOSXInstaller fi + # workaround for https://github.com/terralang/terra/issues/365 + if [[ ! -e /usr/include ]]; then + export INCLUDE_PATH="$(xcrun --sdk macosx --show-sdk-path)/usr/include" + fi + export PATH=$PWD:$PATH fi @@ -167,16 +172,28 @@ if [[ $USE_CMAKE -eq 1 ]]; then -DTERRA_SLIB_INCLUDE_LUAJIT=OFF ) fi + if [[ $(uname) = Darwin ]]; then + # Hack: CMake tries to be smart and use XCode's copy of Clang by + # default. This causes LuaJIT to not build on Mojave and later + # (math.h not found) if the header package is not installed. + CMAKE_FLAGS+=( + -DCMAKE_C_COMPILER=$(which $CC) + -DCMAKE_CXX_COMPILER=$(which $CXX) + ) + fi pushd build cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../install "${CMAKE_FLAGS[@]}" make install -j2 - ctest -j2 || (test "$(uname)" = "Darwin" && test "$LLVM_CONFIG" = "llvm-config-3.8") + ctest --output-on-failure -j2 || (test "$(uname)" = "Darwin" && test "$LLVM_CONFIG" = "llvm-config-3.8") popd - pushd tests - ../install/bin/terra ./run - popd + # Skip this on macOS because it spews too much on Mojave and newer. + if [[ $(uname) != Darwin ]]; then + pushd tests + ../install/bin/terra ./run + popd + fi else make LLVM_CONFIG=$(which $LLVM_CONFIG) CLANG=$(which $CLANG) test