Merge branch 'cmake' of https://github.com/treamology/panda3d into cmake

# Conflicts:
#	.travis.yml
#	direct/src/showbase/CMakeLists.txt
#	dtool/dtool_config.h.in
#	dtool/src/prc/CMakeLists.txt
#	panda/src/cocoadisplay/CMakeLists.txt
#	panda/src/express/CMakeLists.txt
#	panda/src/osxdisplay/CMakeLists.txt
This commit is contained in:
Sam Edwards 2018-10-13 20:04:44 -06:00
commit b3f1b7d40b
12 changed files with 95 additions and 20 deletions

View File

@ -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

View File

@ -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()

View File

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

View File

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

View File

@ -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 ------------

View File

@ -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

View File

@ -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})

View File

@ -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()

View File

@ -12,6 +12,7 @@
*/
#import "cocoaPandaApp.h"
#include "config_cocoadisplay.h"
@implementation CocoaPandaApp
- (void) sendEvent: (NSEvent *) event {

View File

@ -18,6 +18,8 @@
#include "graphicsEngine.h"
#include "config_display.h"
#include "nativeWindowHandle.h"
#include "mouseButton.h"
#include "throw_event.h"
using std::string;

View File

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

View File

@ -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()