diff --git a/.travis.yml b/.travis.yml index d479dbf36a..214f283d79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,24 @@ language: cpp sudo: false # Build matrix: +os: +- linux +- osx compiler: -- gcc - clang env: -- BUILD_METALIBS=OFF COMPOSITE_SOURCE_LIMIT=0 -- BUILD_METALIBS=ON COMPOSITE_SOURCE_LIMIT=0 -- BUILD_METALIBS=OFF COMPOSITE_SOURCE_LIMIT=30 - BUILD_METALIBS=ON COMPOSITE_SOURCE_LIMIT=30 - BUILD_METALIBS=ON COMPOSITE_SOURCE_LIMIT=30 PYTHON_INTERP=python2.7 +- BUILD_METALIBS=OFF COMPOSITE_SOURCE_LIMIT=30 +- BUILD_METALIBS=ON COMPOSITE_SOURCE_LIMIT=0 +matrix: + exclude: + - os: osx + env: BUILD_METALIBS=ON COMPOSITE_SOURCE_LIMIT=0 + include: + - os: osx + env: BUILD_METALIBS=ON COMPOSITE_SOURCE_LIMIT=30 COMPOSITE_SOURCE_EXCLUSIONS=p3showbase;p3dtoolutil;p3cocoadisplay;p3osxdisplay;p3tinydisplay;p3display + - compiler: gcc addons: apt: @@ -40,6 +49,7 @@ addons: - nvidia-cg-toolkit - python-dev - python3-dev + - python3-pip - python-virtualenv - zlib1g-dev - fakeroot @@ -50,7 +60,19 @@ before_install: - makepanda/selfdestruct.py --yes install: -- virtualenv --python=${PYTHON_INTERP:-python3.4} venv && source venv/bin/activate +- > + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew install python@3 eigen libtar fftw libsquish zlib ffmpeg freetype \ + bullet opencv assimp libvorbis openssl || true + brew install ode --with-shared + + # We can't trust brew to make the right symlinks, so execute commands as modules + ${PYTHON_INTERP:-python3} -m pip install virtualenv + ${PYTHON_INTERP:-python3} -m virtualenv venv + else + virtualenv --python=${PYTHON_INTERP:-python3} venv + fi +- source venv/bin/activate - pip install pytest before_script: @@ -62,7 +84,19 @@ script: # interrogate has a way of explicitly calling init_libpanda) - '[ "x$BUILD_METALIBS" == "xON" ] || export LDFLAGS=-Wl,--no-as-needed' -- cmake -DHAVE_GTK2=NO -DBUILD_METALIBS=$BUILD_METALIBS -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT .. +- > + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + if [[ "$PYTHON_INTERP" == "python2.7" ]]; then + export PY2_CMAKE_ARGS=-DPYTHON_EXECUTABLE=/usr/local/Frameworks/Python.framework/Versions/2.7/bin/python + fi + + cmake -DHAVE_CARBON=NO -DBUILD_METALIBS=$BUILD_METALIBS \ + -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT \ + -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl $PY2_CMAKE_ARGS .. + else + cmake -DHAVE_GTK2=NO -DBUILD_METALIBS=$BUILD_METALIBS \ + -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT .. + fi - make -j4 - export PYTHONPATH=$PWD diff --git a/cmake/macros/CompositeSources.cmake b/cmake/macros/CompositeSources.cmake index ad0ac24a2e..f4d2c963c6 100644 --- a/cmake/macros/CompositeSources.cmake +++ b/cmake/macros/CompositeSources.cmake @@ -26,6 +26,10 @@ build dramatically but will be more memory intensive than a low value.") set(COMPOSITE_SOURCE_EXTENSIONS "cxx;c;mm" CACHE STRING "Only files of these extensions will be added to composite files.") +set(COMPOSITE_SOURCE_EXCLUSIONS "" CACHE STRING + "A list of targets to skip when compositing sources. This is mainly +desirable for CI builds.") + set(COMPOSITE_GENERATOR "${CMAKE_SOURCE_DIR}/cmake/scripts/MakeComposite.cmake") @@ -36,8 +40,12 @@ function(composite_sources target sources_var) set(sources ${orig_sources}) list(LENGTH sources num_sources) - if(num_sources LESS 2 OR ${COMPOSITE_SOURCE_LIMIT} LESS 2) - # It's silly to do this for a single source. + # Don't composite if in the list of exclusions, and don't bother compositing + # with too few sources + list (FIND COMPOSITE_SOURCE_EXCLUSIONS ${target} _index) + if(num_sources LESS 2 + OR ${COMPOSITE_SOURCE_LIMIT} LESS 2 + OR ${_index} GREATER -1) return() endif() diff --git a/direct/src/showbase/CMakeLists.txt b/direct/src/showbase/CMakeLists.txt index 0946ca10c5..091ad7c0d4 100644 --- a/direct/src/showbase/CMakeLists.txt +++ b/direct/src/showbase/CMakeLists.txt @@ -1,5 +1,18 @@ +set(P3SHOWBASE_FILES + showBase.cxx + showBase.h) + +if(APPLE) + list(APPEND P3SHOWBASE_FILES showBase_assist.mm) +endif() + add_component_library(p3showbase NOINIT SYMBOL BUILDING_DIRECT_SHOWBASE - showBase.cxx showBase.h) + ${P3SHOWBASE_FILES}) + +if(APPLE) + set_target_properties(p3showbase PROPERTIES COMPILE_FLAGS "-ObjC++") +endif() + target_link_libraries(p3showbase p3directbase panda) target_interrogate(p3showbase ALL) diff --git a/dtool/Config.cmake b/dtool/Config.cmake index a7d5a21043..80b15fd016 100644 --- a/dtool/Config.cmake +++ b/dtool/Config.cmake @@ -515,7 +515,7 @@ endif() #package_option(XCURSOR # "This enables custom cursor support in x11display.") -if(HAVE_GL AND HAVE_X11) +if(HAVE_GL AND HAVE_X11 AND NOT APPLE) option(HAVE_GLX "Enables GLX. Requires OpenGL and X11." ON) else() option(HAVE_GLX "Enables GLX. Requires OpenGL and X11." OFF) diff --git a/dtool/Package.cmake b/dtool/Package.cmake index f63406f60e..7b2e4c4dc7 100644 --- a/dtool/Package.cmake +++ b/dtool/Package.cmake @@ -294,6 +294,10 @@ package_option(OPENAL LICENSE "LGPL") config_package(OPENAL "OpenAL sound library") +if(OPENAL_FOUND AND APPLE) + set(HAVE_OPENAL_FRAMEWORK YES) +endif() + # # ------------ FreeType ------------ diff --git a/dtool/dtool_config.h.in b/dtool/dtool_config.h.in index 9cf6ba5b8d..30b95773d9 100644 --- a/dtool/dtool_config.h.in +++ b/dtool/dtool_config.h.in @@ -15,6 +15,9 @@ /* Define if we have RAD game tools, Miles Sound System installed. */ #cmakedefine HAVE_RAD_MSS +/* Define if we have OpenAL installed as a framework. */ +#cmakedefine HAVE_OPENAL_FRAMEWORK + /* Define if we have Freetype 2.0 or better available. */ #cmakedefine HAVE_FREETYPE diff --git a/dtool/src/dtoolutil/CMakeLists.txt b/dtool/src/dtoolutil/CMakeLists.txt index eab710f3fb..e624bf5985 100644 --- a/dtool/src/dtoolutil/CMakeLists.txt +++ b/dtool/src/dtoolutil/CMakeLists.txt @@ -29,6 +29,7 @@ set(P3DTOOLUTIL_HEADERS if(APPLE) set(P3DTOOLUTIL_HEADERS ${P3DTOOLUTIL_HEADERS} filename_assist.mm filename_assist.h) + set_source_files_properties(filename_assist.mm filename_assist.h PROPERTIES WRAP_EXCLUDE YES) endif() set(P3DTOOLUTIL_SOURCES @@ -72,6 +73,7 @@ target_link_libraries(p3dtoolutil p3dtoolbase ${CMAKE_DL_LIBS}) target_interrogate(p3dtoolutil ALL EXTENSIONS ${P3DTOOLUTIL_IGATEEXT}) if(APPLE) + set_target_properties(p3dtoolutil PROPERTIES COMPILE_FLAGS "-ObjC++") find_library(FOUNDATION_LIBRARY Foundation) find_library(APPKIT_LIBRARY AppKit) target_link_libraries(p3dtoolutil ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY}) diff --git a/panda/src/cocoadisplay/CMakeLists.txt b/panda/src/cocoadisplay/CMakeLists.txt index 2e39c4ee4b..bd7673ef89 100644 --- a/panda/src/cocoadisplay/CMakeLists.txt +++ b/panda/src/cocoadisplay/CMakeLists.txt @@ -7,7 +7,8 @@ set(P3COCOADISPLAY_HEADERS cocoaGraphicsPipe.h cocoaGraphicsPipe.I cocoaGraphicsWindow.h cocoaGraphicsWindow.I cocoaGraphicsStateGuardian.h cocoaGraphicsStateGuardian.I - cocoaPandaApp.h cocoaPandaView.h cocoaPandaWindowDelegate.h) + cocoaPandaApp.h cocoaPandaView.h cocoaPandaWindowDelegate.h + cocoaPandaAppDelegate.h) set(P3COCOADISPLAY_SOURCES config_cocoadisplay.mm @@ -18,11 +19,13 @@ set(P3COCOADISPLAY_SOURCES cocoaPandaApp.mm cocoaPandaView.mm cocoaPandaWindow.mm - cocoaPandaWindowDelegate.mm) + cocoaPandaWindowDelegate.mm + cocoaPandaAppDelegate.mm) -#composite_sources(p3cocoadisplay P3COCOADISPLAY_SOURCES) -add_library(p3cocoadisplay ${P3COCOADISPLAY_HEADERS} ${P3COCOADISPLAY_SOURCES}) -set_target_properties(p3cocoadisplay PROPERTIES DEFINE_SYMBOL BUILDING_PANDA_COCOADISPLAY) +composite_sources(p3cocoadisplay P3COCOADISPLAY_SOURCES) +add_component_library(p3cocoadisplay SYMBOL BUILDING_PANDA_COCOADISPLAY + ${P3COCOADISPLAY_HEADERS} ${P3COCOADISPLAY_SOURCES}) +set_target_properties(p3cocoadisplay PROPERTIES COMPILE_FLAGS "-ObjC++") target_link_libraries(p3cocoadisplay p3display p3putil p3glgsg) # Frameworks: @@ -32,4 +35,6 @@ find_library(CARBON_LIBRARY Carbon) target_link_libraries(p3cocoadisplay ${APPLICATIONSERVICES_LIBRARY} ${APPKIT_LIBRARY} ${CARBON_LIBRARY}) -install(TARGETS p3cocoadisplay DESTINATION lib) +if(NOT BUILD_METALIBS) + install(TARGETS p3cocoadisplay DESTINATION lib) +endif() diff --git a/panda/src/cocoadisplay/cocoaPandaApp.mm b/panda/src/cocoadisplay/cocoaPandaApp.mm index e7226786da..83f0b8ef42 100644 --- a/panda/src/cocoadisplay/cocoaPandaApp.mm +++ b/panda/src/cocoadisplay/cocoaPandaApp.mm @@ -12,6 +12,7 @@ */ #import "cocoaPandaApp.h" +#include "config_cocoadisplay.h" @implementation CocoaPandaApp - (void) sendEvent: (NSEvent *) event { diff --git a/panda/src/display/subprocessWindow.cxx b/panda/src/display/subprocessWindow.cxx index fe4b2eff5d..5ea85c3cc9 100644 --- a/panda/src/display/subprocessWindow.cxx +++ b/panda/src/display/subprocessWindow.cxx @@ -18,6 +18,8 @@ #include "graphicsEngine.h" #include "config_display.h" #include "nativeWindowHandle.h" +#include "mouseButton.h" +#include "throw_event.h" using std::string; diff --git a/panda/src/express/CMakeLists.txt b/panda/src/express/CMakeLists.txt index 2d2929fed3..e6d3e11482 100644 --- a/panda/src/express/CMakeLists.txt +++ b/panda/src/express/CMakeLists.txt @@ -136,7 +136,7 @@ add_component_library(p3express SYMBOL BUILDING_PANDA_EXPRESS ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS}) target_link_libraries(p3express p3pandabase p3dtoolconfig p3dtool - PKG::TAR PKG::ZLIB) + PKG::TAR PKG::ZLIB PKG::OPENSSL) target_interrogate(p3express ALL EXTENSIONS ${P3EXPRESS_IGATEEXT}) if(WIN32) diff --git a/panda/src/osxdisplay/CMakeLists.txt b/panda/src/osxdisplay/CMakeLists.txt index 98f3f6d57b..a26fc51123 100644 --- a/panda/src/osxdisplay/CMakeLists.txt +++ b/panda/src/osxdisplay/CMakeLists.txt @@ -13,8 +13,9 @@ set(P3OSXDISPLAY_SOURCES osxGraphicsBuffer.cxx) composite_sources(p3osxdisplay P3OSXDISPLAY_SOURCES) -add_library(p3osxdisplay ${P3OSXDISPLAY_HEADERS} ${P3OSXDISPLAY_SOURCES}) -set_target_properties(p3osxdisplay PROPERTIES DEFINE_SYMBOL BUILDING_PANDA_OSXDISPLAY) +add_component_library(p3osxdisplay SYMBOL BUILDING_PANDA_OSXDISPLAY + ${P3OSXDISPLAY_HEADERS} ${P3OSXDISPLAY_SOURCES}) +set_target_properties(p3osxdisplay PROPERTIES COMPILE_FLAGS "-ObjC++") target_link_libraries(p3osxdisplay p3display p3putil p3glgsg) # Frameworks: @@ -27,4 +28,6 @@ target_link_libraries(p3osxdisplay ${APPLICATIONSERVICES_LIBRARY} ${CARBON_LIBRARY} ${AGL_LIBRARY} ${CORESERVICES_LIBRARY} ${COCOA_LIBRARY}) -install(TARGETS p3osxdisplay DESTINATION lib) +if(NOT BUILD_METALIBS) + install(TARGETS p3osxdisplay DESTINATION lib) +endif()