From beec6578c86f030f5d204c841c4eebfdd218e5fc Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Thu, 17 May 2018 15:41:31 -0500 Subject: [PATCH 01/15] Fix CMake build issues on macOS. --- direct/src/showbase/CMakeLists.txt | 13 +++++++++++-- dtool/src/dtoolutil/CMakeLists.txt | 3 +++ dtool/src/prc/CMakeLists.txt | 1 + panda/metalibs/pandagl/CMakeLists.txt | 2 +- panda/src/cocoadisplay/CMakeLists.txt | 14 +++++++------- panda/src/display/CMakeLists.txt | 1 + panda/src/express/CMakeLists.txt | 2 +- panda/src/osxdisplay/CMakeLists.txt | 6 ++---- 8 files changed, 27 insertions(+), 15 deletions(-) diff --git a/direct/src/showbase/CMakeLists.txt b/direct/src/showbase/CMakeLists.txt index 9ca60be4ed..ee81e81704 100644 --- a/direct/src/showbase/CMakeLists.txt +++ b/direct/src/showbase/CMakeLists.txt @@ -1,5 +1,14 @@ -add_component_library(p3showbase SYMBOL BUILDING_DIRECT_SHOWBASE - showBase.cxx showBase.h) +set(P3SHOWBASE_FILES + showBase.cxx + showBase.h) +set(P3SHOWBASE_EXTRA_ARGS "") +if(IS_OSX) + list(APPEND P3SHOWBASE_FILES showBase_assist.mm) + set(P3SHOWBASE_EXTRA_ARGS "-ObjC++") +endif() + +add_component_library(p3showbase SYMBOL BUILDING_DIRECT_SHOWBASE ${P3SHOWBASE_FILES}) +set_target_properties(p3showbase PROPERTIES COMPILE_FLAGS ${P3SHOWBASE_EXTRA_ARGS}) target_link_libraries(p3showbase p3directbase panda) target_interrogate(p3showbase ALL) diff --git a/dtool/src/dtoolutil/CMakeLists.txt b/dtool/src/dtoolutil/CMakeLists.txt index e2e8cd5cd6..13d389a586 100644 --- a/dtool/src/dtoolutil/CMakeLists.txt +++ b/dtool/src/dtoolutil/CMakeLists.txt @@ -35,6 +35,8 @@ set(P3DTOOLUTIL_HEADERS if(APPLE) set(P3DTOOLUTIL_HEADERS ${P3DTOOLUTIL_HEADERS} filename_assist.mm filename_assist.h) + set(P3DTOOLUTIL_EXTRA_FLAGS "-ObjC++") + set_source_files_properties(filename_assist.mm filename_assist.h PROPERTIES WRAP_EXCLUDE YES) endif() set(P3DTOOLUTIL_SOURCES @@ -73,6 +75,7 @@ composite_sources(p3dtoolutil P3DTOOLUTIL_SOURCES) add_component_library(p3dtoolutil SYMBOL BUILDING_DTOOL_DTOOLUTIL ${P3DTOOLUTIL_HEADERS} ${P3DTOOLUTIL_SOURCES}) +set_target_properties(p3dtoolutil PROPERTIES COMPILE_FLAGS ${P3DTOOLUTIL_EXTRA_FLAGS}) target_include_directories(p3dtoolutil PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) # The extensions need py_panda.h and extension.h from interrogatedb target_include_directories(p3dtoolutil PUBLIC diff --git a/dtool/src/prc/CMakeLists.txt b/dtool/src/prc/CMakeLists.txt index afe1745af5..3b5d3fd237 100644 --- a/dtool/src/prc/CMakeLists.txt +++ b/dtool/src/prc/CMakeLists.txt @@ -77,6 +77,7 @@ target_include_directories(p3prc PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(p3prc PUBLIC $) target_link_libraries(p3prc p3dtool ${_OPENSSL_LIBRARIES}) +target_use_packages(p3prc OPENSSL) target_interrogate(p3prc ALL EXTENSIONS ${P3PRC_IGATEEXT}) install(TARGETS p3prc DESTINATION lib) diff --git a/panda/metalibs/pandagl/CMakeLists.txt b/panda/metalibs/pandagl/CMakeLists.txt index 150b969856..e2bd719880 100644 --- a/panda/metalibs/pandagl/CMakeLists.txt +++ b/panda/metalibs/pandagl/CMakeLists.txt @@ -19,7 +19,7 @@ if(HAVE_GL) if(HAVE_COCOA) set(PANDAGL_LINK_TARGETS ${PANDAGL_LINK_TARGETS} p3cocoadisplay) endif() - + if(HAVE_CARBON) set(PANDAGL_LINK_TARGETS ${PANDAGL_LINK_TARGETS} p3osxdisplay) endif() diff --git a/panda/src/cocoadisplay/CMakeLists.txt b/panda/src/cocoadisplay/CMakeLists.txt index 375b792bdf..822942ff66 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,12 @@ 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_PANDAGL) +composite_sources(p3cocoadisplay P3COCOADISPLAY_SOURCES) +add_component_library(p3cocoadisplay ${P3COCOADISPLAY_HEADERS} ${P3COCOADISPLAY_SOURCES}) +set_target_properties(p3cocoadisplay PROPERTIES DEFINE_SYMBOL BUILDING_PANDAGL COMPILE_FLAGS "-ObjC++") target_link_libraries(p3cocoadisplay p3display p3putil p3glgsg) # Frameworks: @@ -31,5 +33,3 @@ find_library(APPKIT_LIBRARY AppKit) find_library(CARBON_LIBRARY Carbon) target_link_libraries(p3cocoadisplay ${APPLICATIONSERVICES_LIBRARY} ${APPKIT_LIBRARY} ${CARBON_LIBRARY}) - -install(TARGETS p3cocoadisplay DESTINATION lib) diff --git a/panda/src/display/CMakeLists.txt b/panda/src/display/CMakeLists.txt index 3f7fb00253..a8479dc9a2 100644 --- a/panda/src/display/CMakeLists.txt +++ b/panda/src/display/CMakeLists.txt @@ -90,6 +90,7 @@ composite_sources(p3display P3DISPLAY_SOURCES) add_component_library(p3display SYMBOL BUILDING_PANDA_DISPLAY ${P3DISPLAY_HEADERS} ${P3DISPLAY_SOURCES}) target_link_libraries(p3display p3cull p3pgraphnodes) +target_use_packages(p3display X11) target_interrogate(p3display ALL EXTENSIONS ${P3DISPLAY_IGATEEXT}) install(TARGETS p3display DESTINATION lib) diff --git a/panda/src/express/CMakeLists.txt b/panda/src/express/CMakeLists.txt index 0543f743c8..6b177ec8a3 100644 --- a/panda/src/express/CMakeLists.txt +++ b/panda/src/express/CMakeLists.txt @@ -151,7 +151,7 @@ add_component_library(p3express SYMBOL BUILDING_PANDAEXPRESS target_include_directories(p3express PUBLIC $) target_link_libraries(p3express p3pandabase p3dtoolconfig p3dtool) -target_use_packages(p3express TAR ZLIB) +target_use_packages(p3express TAR ZLIB 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 0d6026e9dd..6cabaca987 100644 --- a/panda/src/osxdisplay/CMakeLists.txt +++ b/panda/src/osxdisplay/CMakeLists.txt @@ -13,8 +13,8 @@ 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_PANDAGL) +add_component_library(p3osxdisplay ${P3OSXDISPLAY_HEADERS} ${P3OSXDISPLAY_SOURCES}) +set_target_properties(p3osxdisplay PROPERTIES DEFINE_SYMBOL BUILDING_PANDAGL COMPILE_FLAGS "-ObjC++") target_link_libraries(p3osxdisplay p3display p3putil p3glgsg) # Frameworks: @@ -26,5 +26,3 @@ find_library(COCOA_LIBRARY Cocoa) target_link_libraries(p3osxdisplay ${APPLICATIONSERVICES_LIBRARY} ${CARBON_LIBRARY} ${AGL_LIBRARY} ${CORESERVICES_LIBRARY} ${COCOA_LIBRARY}) - -install(TARGETS p3osxdisplay DESTINATION lib) From 1b3c6fb44489b2476e6bca0ce453f4e88c0288c8 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Sat, 19 May 2018 10:30:26 -0500 Subject: [PATCH 02/15] Fix issue with extra flags --- direct/src/showbase/CMakeLists.txt | 5 +++-- dtool/src/dtoolutil/CMakeLists.txt | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/direct/src/showbase/CMakeLists.txt b/direct/src/showbase/CMakeLists.txt index ee81e81704..30065be7bf 100644 --- a/direct/src/showbase/CMakeLists.txt +++ b/direct/src/showbase/CMakeLists.txt @@ -4,11 +4,12 @@ set(P3SHOWBASE_FILES set(P3SHOWBASE_EXTRA_ARGS "") if(IS_OSX) list(APPEND P3SHOWBASE_FILES showBase_assist.mm) - set(P3SHOWBASE_EXTRA_ARGS "-ObjC++") endif() add_component_library(p3showbase SYMBOL BUILDING_DIRECT_SHOWBASE ${P3SHOWBASE_FILES}) -set_target_properties(p3showbase PROPERTIES COMPILE_FLAGS ${P3SHOWBASE_EXTRA_ARGS}) +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/src/dtoolutil/CMakeLists.txt b/dtool/src/dtoolutil/CMakeLists.txt index d2216059d4..9c6b3cb517 100644 --- a/dtool/src/dtoolutil/CMakeLists.txt +++ b/dtool/src/dtoolutil/CMakeLists.txt @@ -29,7 +29,6 @@ set(P3DTOOLUTIL_HEADERS if(APPLE) set(P3DTOOLUTIL_HEADERS ${P3DTOOLUTIL_HEADERS} filename_assist.mm filename_assist.h) - set(P3DTOOLUTIL_EXTRA_FLAGS "-ObjC++") set_source_files_properties(filename_assist.mm filename_assist.h PROPERTIES WRAP_EXCLUDE YES) endif() @@ -68,7 +67,6 @@ composite_sources(p3dtoolutil P3DTOOLUTIL_SOURCES) add_component_library(p3dtoolutil SYMBOL BUILDING_DTOOL_DTOOLUTIL ${P3DTOOLUTIL_HEADERS} ${P3DTOOLUTIL_SOURCES}) -set_target_properties(p3dtoolutil PROPERTIES COMPILE_FLAGS ${P3DTOOLUTIL_EXTRA_FLAGS}) # The extensions need py_panda.h and extension.h from interrogatedb target_include_directories(p3dtoolutil PUBLIC $) @@ -76,6 +74,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}) From e0bc3691742e7e403bb33060821c3ed8732f7bb9 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Mon, 28 May 2018 15:57:15 -0500 Subject: [PATCH 03/15] Make sure libs are installed, delete extraneous whitespace --- panda/metalibs/pandagl/CMakeLists.txt | 1 - panda/src/cocoadisplay/CMakeLists.txt | 2 ++ panda/src/osxdisplay/CMakeLists.txt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/panda/metalibs/pandagl/CMakeLists.txt b/panda/metalibs/pandagl/CMakeLists.txt index e2bd719880..78330b4a7f 100644 --- a/panda/metalibs/pandagl/CMakeLists.txt +++ b/panda/metalibs/pandagl/CMakeLists.txt @@ -19,7 +19,6 @@ if(HAVE_GL) if(HAVE_COCOA) set(PANDAGL_LINK_TARGETS ${PANDAGL_LINK_TARGETS} p3cocoadisplay) endif() - if(HAVE_CARBON) set(PANDAGL_LINK_TARGETS ${PANDAGL_LINK_TARGETS} p3osxdisplay) endif() diff --git a/panda/src/cocoadisplay/CMakeLists.txt b/panda/src/cocoadisplay/CMakeLists.txt index 822942ff66..8d40f301ed 100644 --- a/panda/src/cocoadisplay/CMakeLists.txt +++ b/panda/src/cocoadisplay/CMakeLists.txt @@ -33,3 +33,5 @@ find_library(APPKIT_LIBRARY AppKit) find_library(CARBON_LIBRARY Carbon) target_link_libraries(p3cocoadisplay ${APPLICATIONSERVICES_LIBRARY} ${APPKIT_LIBRARY} ${CARBON_LIBRARY}) + +install(TARGETS p3cocoadisplay DESTINATION lib) \ No newline at end of file diff --git a/panda/src/osxdisplay/CMakeLists.txt b/panda/src/osxdisplay/CMakeLists.txt index 6cabaca987..fd94a2bcc5 100644 --- a/panda/src/osxdisplay/CMakeLists.txt +++ b/panda/src/osxdisplay/CMakeLists.txt @@ -26,3 +26,5 @@ find_library(COCOA_LIBRARY Cocoa) target_link_libraries(p3osxdisplay ${APPLICATIONSERVICES_LIBRARY} ${CARBON_LIBRARY} ${AGL_LIBRARY} ${CORESERVICES_LIBRARY} ${COCOA_LIBRARY}) + +install(TARGETS p3osxdisplay DESTINATION lib) \ No newline at end of file From ef0170388f2ce83ac406fa89f3d4582923e55df8 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Mon, 28 May 2018 16:13:26 -0500 Subject: [PATCH 04/15] Only link X11 with p3display if HAVE_X11 is enabled. --- panda/src/display/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/panda/src/display/CMakeLists.txt b/panda/src/display/CMakeLists.txt index a8479dc9a2..b7e0a0d8a8 100644 --- a/panda/src/display/CMakeLists.txt +++ b/panda/src/display/CMakeLists.txt @@ -90,7 +90,9 @@ composite_sources(p3display P3DISPLAY_SOURCES) add_component_library(p3display SYMBOL BUILDING_PANDA_DISPLAY ${P3DISPLAY_HEADERS} ${P3DISPLAY_SOURCES}) target_link_libraries(p3display p3cull p3pgraphnodes) -target_use_packages(p3display X11) +if(HAVE_X11) + target_use_packages(p3display X11) +endif() target_interrogate(p3display ALL EXTENSIONS ${P3DISPLAY_IGATEEXT}) install(TARGETS p3display DESTINATION lib) From 87a05913f849ff44eef9f396941140a727d357fc Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Mon, 28 May 2018 17:38:32 -0500 Subject: [PATCH 05/15] Remove redundant conditional, add missing newline --- panda/src/cocoadisplay/CMakeLists.txt | 2 +- panda/src/display/CMakeLists.txt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/panda/src/cocoadisplay/CMakeLists.txt b/panda/src/cocoadisplay/CMakeLists.txt index 8d40f301ed..ecaa3467e5 100644 --- a/panda/src/cocoadisplay/CMakeLists.txt +++ b/panda/src/cocoadisplay/CMakeLists.txt @@ -34,4 +34,4 @@ find_library(CARBON_LIBRARY Carbon) target_link_libraries(p3cocoadisplay ${APPLICATIONSERVICES_LIBRARY} ${APPKIT_LIBRARY} ${CARBON_LIBRARY}) -install(TARGETS p3cocoadisplay DESTINATION lib) \ No newline at end of file +install(TARGETS p3cocoadisplay DESTINATION lib) diff --git a/panda/src/display/CMakeLists.txt b/panda/src/display/CMakeLists.txt index b7e0a0d8a8..a8479dc9a2 100644 --- a/panda/src/display/CMakeLists.txt +++ b/panda/src/display/CMakeLists.txt @@ -90,9 +90,7 @@ composite_sources(p3display P3DISPLAY_SOURCES) add_component_library(p3display SYMBOL BUILDING_PANDA_DISPLAY ${P3DISPLAY_HEADERS} ${P3DISPLAY_SOURCES}) target_link_libraries(p3display p3cull p3pgraphnodes) -if(HAVE_X11) - target_use_packages(p3display X11) -endif() +target_use_packages(p3display X11) target_interrogate(p3display ALL EXTENSIONS ${P3DISPLAY_IGATEEXT}) install(TARGETS p3display DESTINATION lib) From 18817e68484fc89b753c62c0ff1dcd91e1e20be8 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Tue, 29 May 2018 21:08:08 -0500 Subject: [PATCH 06/15] Add travis builds for macOS This also trims down the build matrix. --- .travis.yml | 30 ++++++++++++++++++++++++------ .travis/install_macos.sh | 9 +++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100755 .travis/install_macos.sh diff --git a/.travis.yml b/.travis.yml index 76fc9d3742..8bb6473275 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,19 @@ 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: + include: + - compiler: gcc addons: apt: @@ -40,6 +44,7 @@ addons: - nvidia-cg-toolkit - python-dev - python3-dev + - python3-pip - python-virtualenv - zlib1g-dev - fakeroot @@ -50,7 +55,13 @@ before_install: - makepanda/selfdestruct.py --yes install: -- virtualenv --python=${PYTHON_INTERP:-python3.4} venv && source venv/bin/activate +- > + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + ./.travis/install_macos.sh; + else + virtualenv --python=${PYTHON_INTERP:-python3} venv; + fi +- source venv/bin/activate - pip install pytest before_script: @@ -58,7 +69,14 @@ before_script: - cd built script: -- cmake -DHAVE_GTK2=NO -DBUILD_METALIBS=$BUILD_METALIBS -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT .. +- > + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + cmake -DHAVE_CARBON=NO -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2o_1 \ + -DBUILD_METALIBS=$BUILD_METALIBS -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT ..; + else + cmake -DHAVE_GTK2=NO -DBUILD_METALIBS=$BUILD_METALIBS \ + -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT ..; + fi - make -j4 - export PYTHONPATH=$PWD diff --git a/.travis/install_macos.sh b/.travis/install_macos.sh new file mode 100755 index 0000000000..0d603fee9a --- /dev/null +++ b/.travis/install_macos.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +brew install python@3 eigen libtar fftw libsquish zlib ffmpeg freetype bullet \ +wxmac opencv assimp libvorbis openssl@1.0 || 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 --python=${PYTHON_INTERP:-python3} venv From a8954d7f674fa91a6a28c93acc59702b3b691517 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Tue, 29 May 2018 21:49:00 -0500 Subject: [PATCH 07/15] Don't build GLX support if on macOS --- dtool/Config.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtool/Config.cmake b/dtool/Config.cmake index 61b213f7be..0bb92a18c2 100644 --- a/dtool/Config.cmake +++ b/dtool/Config.cmake @@ -572,7 +572,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) From 5619c3ed90856b02802d5b2a3a65ef8073ea2a98 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Tue, 29 May 2018 21:58:43 -0500 Subject: [PATCH 08/15] Make sure HAVE_OPENAL_FRAMEWORK is set correctly --- dtool/Package.cmake | 4 +++- dtool/dtool_config.h.in | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dtool/Package.cmake b/dtool/Package.cmake index b2935ce165..27c1dfde77 100644 --- a/dtool/Package.cmake +++ b/dtool/Package.cmake @@ -205,7 +205,9 @@ 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 19d5408c37..cf7b72664f 100644 --- a/dtool/dtool_config.h.in +++ b/dtool/dtool_config.h.in @@ -21,6 +21,9 @@ /* Define if we have OpenAL installed. */ #cmakedefine HAVE_OPENAL +/* 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 From 09009ca1a4131b2621fff0aff09eedeb0ca1c03d Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Wed, 30 May 2018 10:05:37 -0500 Subject: [PATCH 09/15] Be more specific in which python interpreter we want to run --- .travis/install_macos.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis/install_macos.sh b/.travis/install_macos.sh index 0d603fee9a..233775402c 100755 --- a/.travis/install_macos.sh +++ b/.travis/install_macos.sh @@ -5,5 +5,5 @@ wxmac opencv assimp libvorbis openssl@1.0 || 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 --python=${PYTHON_INTERP:-python3} venv +/usr/local/bin/${PYTHON_INTERP:-python3} -m pip install virtualenv +/usr/local/bin/${PYTHON_INTERP:-python3} -m virtualenv --python=${PYTHON_INTERP:-python3} venv From 0f241837be3ec6d271e63e9c8d9ef1c0fbcc1299 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Wed, 30 May 2018 10:07:34 -0500 Subject: [PATCH 10/15] Remove --python flag since we know we're running the proper python --- .travis/install_macos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/install_macos.sh b/.travis/install_macos.sh index 233775402c..833eb1828f 100755 --- a/.travis/install_macos.sh +++ b/.travis/install_macos.sh @@ -6,4 +6,4 @@ brew install ode --with-shared # We can't trust brew to make the right symlinks, so execute commands as modules /usr/local/bin/${PYTHON_INTERP:-python3} -m pip install virtualenv -/usr/local/bin/${PYTHON_INTERP:-python3} -m virtualenv --python=${PYTHON_INTERP:-python3} venv +/usr/local/bin/${PYTHON_INTERP:-python3} -m virtualenv venv From a70ccf5d1306cd5721039121de0e2bb10084a282 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Wed, 30 May 2018 19:16:25 -0500 Subject: [PATCH 11/15] CMake won't find the right Python 2.7, so tell it where it is. --- .travis.yml | 3 +-- .travis/install_macos.sh | 4 ++-- .travis/script_macos.sh | 9 +++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100755 .travis/script_macos.sh diff --git a/.travis.yml b/.travis.yml index 8bb6473275..f22141c929 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,8 +71,7 @@ before_script: script: - > if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - cmake -DHAVE_CARBON=NO -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2o_1 \ - -DBUILD_METALIBS=$BUILD_METALIBS -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT ..; + ../.travis/script_macos.sh; else cmake -DHAVE_GTK2=NO -DBUILD_METALIBS=$BUILD_METALIBS \ -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT ..; diff --git a/.travis/install_macos.sh b/.travis/install_macos.sh index 833eb1828f..6f0c5ae907 100755 --- a/.travis/install_macos.sh +++ b/.travis/install_macos.sh @@ -5,5 +5,5 @@ wxmac opencv assimp libvorbis openssl@1.0 || true brew install ode --with-shared # We can't trust brew to make the right symlinks, so execute commands as modules -/usr/local/bin/${PYTHON_INTERP:-python3} -m pip install virtualenv -/usr/local/bin/${PYTHON_INTERP:-python3} -m virtualenv venv +${PYTHON_INTERP:-python3} -m pip install virtualenv +${PYTHON_INTERP:-python3} -m virtualenv venv diff --git a/.travis/script_macos.sh b/.travis/script_macos.sh new file mode 100755 index 0000000000..e945307990 --- /dev/null +++ b/.travis/script_macos.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ "$PYTHON_INTERP" == "python2.7" ]]; then + export PY2_CMAKE_ARGS="-DPYTHON_EXECUTABLE=/usr/local/bin/python -DPYTHON_LIBRARY=/usr/local/opt/python@2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib" +fi + +cmake -DHAVE_CARBON=NO -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2o_1 \ +-DBUILD_METALIBS=$BUILD_METALIBS -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT \ +$PY2_CMAKE_ARGS .. From 3a678fb73826c47ffda171a2bddd8b82b94f9a3a Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Thu, 31 May 2018 22:16:25 -0500 Subject: [PATCH 12/15] Just use APPLE instead of IS_OSX for compiling in ObjC++ --- direct/src/showbase/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direct/src/showbase/CMakeLists.txt b/direct/src/showbase/CMakeLists.txt index 30065be7bf..1aff073438 100644 --- a/direct/src/showbase/CMakeLists.txt +++ b/direct/src/showbase/CMakeLists.txt @@ -2,7 +2,7 @@ set(P3SHOWBASE_FILES showBase.cxx showBase.h) set(P3SHOWBASE_EXTRA_ARGS "") -if(IS_OSX) +if(APPLE) list(APPEND P3SHOWBASE_FILES showBase_assist.mm) endif() From d8f3a669c2f7e3a7aca960f15b8e308d26a4ce20 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Fri, 1 Jun 2018 12:47:59 -0500 Subject: [PATCH 13/15] Move all the little scripts back into .travis.yml, use less specific paths when searching for openssl and python2.7 --- .travis.yml | 20 ++++++++++++++++---- .travis/install_macos.sh | 9 --------- .travis/script_macos.sh | 9 --------- 3 files changed, 16 insertions(+), 22 deletions(-) delete mode 100755 .travis/install_macos.sh delete mode 100755 .travis/script_macos.sh diff --git a/.travis.yml b/.travis.yml index f22141c929..54e25dffae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,9 +57,15 @@ before_install: install: - > if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - ./.travis/install_macos.sh; + 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; + virtualenv --python=${PYTHON_INTERP:-python3} venv fi - source venv/bin/activate - pip install pytest @@ -71,10 +77,16 @@ before_script: script: - > if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - ../.travis/script_macos.sh; + 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 ..; + -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT .. fi - make -j4 diff --git a/.travis/install_macos.sh b/.travis/install_macos.sh deleted file mode 100755 index 6f0c5ae907..0000000000 --- a/.travis/install_macos.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -brew install python@3 eigen libtar fftw libsquish zlib ffmpeg freetype bullet \ -wxmac opencv assimp libvorbis openssl@1.0 || 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 diff --git a/.travis/script_macos.sh b/.travis/script_macos.sh deleted file mode 100755 index e945307990..0000000000 --- a/.travis/script_macos.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [[ "$PYTHON_INTERP" == "python2.7" ]]; then - export PY2_CMAKE_ARGS="-DPYTHON_EXECUTABLE=/usr/local/bin/python -DPYTHON_LIBRARY=/usr/local/opt/python@2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib" -fi - -cmake -DHAVE_CARBON=NO -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2o_1 \ --DBUILD_METALIBS=$BUILD_METALIBS -DCOMPOSITE_SOURCE_LIMIT=$COMPOSITE_SOURCE_LIMIT \ -$PY2_CMAKE_ARGS .. From 16cfac482923bc734447d234fd8eaaa99483847d Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Tue, 5 Jun 2018 17:31:00 -0500 Subject: [PATCH 14/15] Add missing macOS-specific imports --- panda/src/cocoadisplay/cocoaPandaApp.mm | 1 + panda/src/display/subprocessWindow.cxx | 2 ++ 2 files changed, 3 insertions(+) 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 d001f3b1f6..ef3b09786c 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" TypeHandle SubprocessWindow::_type_handle; From cddd553d1e6d4b865b0bafb838c9c0511f2cee35 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Wed, 6 Jun 2018 09:16:26 -0500 Subject: [PATCH 15/15] Add COMPOSITE_SOURCE_EXCLUSIONS option It specifies a list of targets to exclude during the compositing stage. --- .travis.yml | 5 +++++ cmake/macros/CompositeSources.cmake | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 54e25dffae..84810b2b01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,12 @@ env: - 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: diff --git a/cmake/macros/CompositeSources.cmake b/cmake/macros/CompositeSources.cmake index ad0ac24a2e..adcb4ccfa7 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()