82 Commits

Author SHA1 Message Date
Sam Edwards
0997c6b19c CMake: Don't depend on Python interpreter
This allows building against the Python libraries even when the
Python interpreter/executable is missing. The correct extensions
for the binary modules will be guessed, the tests will fail,
and the bytecode for any pure-Python modules will not be
precompiled.
2018-10-07 00:51:26 -06:00
Sam Edwards
53920e7aee CMake: Move __init__.py generation to Python.cmake
This also allows us to generate a suitable __init__.py for fixing
up PATH and/or __path__ on platforms that need it to properly
import Python extension modules.
2018-09-28 21:24:26 -06:00
Sam Edwards
73e273e782 CMake: Remove hardcoded 'panda3d.*' assumptions from Python.cmake 2018-09-28 17:28:17 -06:00
Sam Edwards
2e2a8eae98 CMake: Byte-compile all .py files when building Panda
This also involves the creation a new include: Python.cmake

This file will contain utility functions for building Python
modules and installing Python packages.
2018-09-28 17:15:56 -06:00
Sam Edwards
bd187643f3 CMake: Look for packages by CONFIG first
This requires a macro to override find_package,
as the default behavior in CMake is to fall back
from MODULE onto CONFIG.

Note that Bullet is given a specific override
not to look for a CONFIG, since Bullet tends to
use weird paths in its CONFIG script.
2018-09-21 19:22:59 -06:00
Sam Edwards
968ca123d4 CMake: Use packages by imported target where available
This is preferable because imported targets generally include
all of the relevant information specific to the particular
installation of each package, and without needing to hunt down
a bunch of variables to do it.

To do this, package_option() (which is starting to grow in scope
a little beyond just providing the package option, come to think
of it) is given a new IMPORTED_AS option, which tells the package
configuration system to look for one or more imported targets and
link against them instead.
2018-09-21 16:24:48 -06:00
Sam Edwards
1520d712d4 CMake: Remove target_use_packages
Instead, let's use a PKG::PKGNAME interface library, which simplifies
the linking and also allows us to use imported libraries from
find_package in the future.
2018-09-21 10:17:05 -06:00
Sam Edwards
cf26888672 CMake: Stop using include_directories()
Setting this directly on the target is cleaner,
and in most cases, the INTERFACE_INCLUDE_DIRECTORIES
mechanism takes care of it for us.
2018-09-18 18:17:43 -06:00
Sam Edwards
193cf71233 CMake: Pass Python extension files to Interrogate with relative paths
This makes sure absolute paths don't show up in #include,
since Interrogate doesn't (currently) use the proper representation
for this. (See #386)
2018-09-07 00:34:02 -06:00
Sam Edwards
9f55b9e77e CMake: Don't Interrogate with deprecated -longlong on Windows 2018-09-07 00:33:52 -06:00
Sam Edwards
e501d20927 CMake: Don't compile Interrogate runtime code into interrogatedb
This should obviate the need for pystub as well.

Note that it's currently a little bit hacky; the source will
have to be moved to make the CMake dependencies work better.
2018-09-06 23:57:53 -06:00
Sam Edwards
0c889db928 CMake: Don't conflict with find_package internal variables 2018-09-05 19:19:36 -06:00
Sam Edwards
1970751c8a CMake: Do something sensible with static Python modules
These *do* make sense and there are Panda3D users that use
this kind of configuration, so we should try to be accommodating.
2018-09-03 21:04:40 -06:00
Sam Edwards
77018c5383 CMake: Name Python targets more distinctively
Python targets are now prefixed with "panda3d." in
e.g. "panda3d.core"
2018-09-03 21:01:54 -06:00
Sam Edwards
76378c8990 CMake: Ask Python for preferred binary extension suffix 2018-08-19 23:10:20 -06:00
Sam Edwards
29bc62bf9b CMake: Alias Interrogate
This allows us to have a different name for Interrogate
on the host vs. Interrogate on the target platform, which
facilitates cross-compiling.
2018-06-13 21:07:56 -06:00
Sam Edwards
21a30a8429 CMake: Make INTERROGATE_PYTHON_INTERFACE option dependent
This also makes it sufficient for turning on Interrogate.
2018-06-13 21:07:56 -06:00
Sam Edwards
2e98b68e3b CMake: Make directbase/pandabase INTERFACE libraries
They export no code, and are really only used to contain several
preprocessor macros relevant to their respective packages. On
Windows, they're a problem: MSVC doesn't generate a .lib when
compiling a .dll that exports nothing.
2018-06-10 02:29:49 -06:00
Sam Edwards
a088e6aba5 CMake: Autogenerate metalib init files 2018-06-10 02:29:35 -06:00
Sam Edwards
f54b4b61dd CMake: Don't use pzip when not built 2018-06-01 02:56:43 -06:00
Sam Edwards
4c4c17cac2 CMake: Flag composite files as generated
No idea why this was commented out.
2018-05-26 18:01:05 -06:00
Sam Edwards
538c615abe CMake: Light tidying in Interrogate.cmake 2018-05-14 19:07:27 -06:00
Sam Edwards
8e230495a1 CMake: Consolidate "module or static" library logic 2018-05-14 19:07:27 -06:00
Sam Edwards
5b3ca1bb05 CMake: Fix up the "transitive library" metalib logic
This fixes some cases where transitive libraries, as nominated
by a component library, were not being absorbed into a metalib,
due to the library actually not being defined yet. This makes the
logic a little more robust, first by explicitly requiring a metalib
definition to come after all component library definitions, and second
to assume a library "linked" to a component library is a non-component
if it isn't defined (yet).
2018-04-20 00:20:14 -06:00
Sam Edwards
218d0e8ade CMake: Build dtool metalibs as metalibs 2018-04-19 00:07:08 -06:00
Sam Edwards
5a31844e11 CMake: Slightly tweak component-library -D inheritance rules
This only inherits -D flags from another component library. The private
-D flags should not be inherited from regular libraries.
2018-04-19 00:07:08 -06:00
Sam Edwards
4cec331722 CMake: Add support for building metalibs as metalibs 2018-04-18 14:42:56 -06:00
Sam Edwards
7590c37f0c CMake: Have Interrogate respect INTERFACE_COMPILE_DEFINITIONS
This commit isn't technically quite right, since Interrogate should
use the definitions from COMPILE_DEFINITIONS but the module should
be built with INTERFACE_COMPILE_DEFINITIONS, but whatever. That can
be changed if it becomes a nuisance later on.

The rationale here is it's consistent with how CMake treats these
two properties.
2018-04-18 12:23:18 -06:00
Sam Edwards
c0b8b3c542 CMake: Interrogate bugfix for LINK and IMPORT keywords together 2018-04-15 00:35:49 -06:00
Sam Edwards
1401a1cc48 CMake: Don't use (SO)VERSION for modules 2018-04-05 16:11:59 -06:00
Sam Edwards
cfd603bb8d CMake: Build Python binary modules as MODULE, never SHARED 2018-04-05 16:11:59 -06:00
Sam Edwards
411e0ee93f CMake: Use interrogate's -import instead of linking directly 2018-04-05 16:11:59 -06:00
Sam Edwards
2f6c79b9e6 CMake: Build libraries with VERSION/SOVERSION
This takes advantage of SONAME and versioning on platforms that support it.
2018-04-02 15:49:05 -06:00
Sam Edwards
540c4fc2cd CMake: Delete excess spaces 2018-02-21 02:54:09 -07:00
Sam Edwards
0783013ecd CMake: Custom targets don't need EXCLUDE_FROM_ALL 2018-02-18 20:24:27 -07:00
Sam Edwards
6907eb5207 CMake: Fix Interrogate -module panda3d.${module} flag missing 2018-02-18 03:57:56 -07:00
Sam Edwards
2399655920 CMake: Make sure Interrogate doesn't see package include directories 2018-02-17 16:56:35 -07:00
Sam Edwards
f75e245b1f CMake: Enhance PackageConfig's include directory processing and name separation 2018-02-16 17:38:51 -07:00
Sam Edwards
021728f4b3 CMake: Start the process of organizing packages into Package.cmake 2018-02-14 16:46:20 -07:00
Sam Edwards
f8c63dbe2b CMake: Refactor interrogate.cmake a little
In particular, rely on INTERROGATE_PYTHON_INTERFACE, not
HAVE_PYTHON AND HAVE_INTERROGATE.
2018-02-11 12:48:17 -07:00
Sam Edwards
b68b6caeb0 CMake: Support targeting Python 3 2018-02-09 22:06:14 -07:00
Sam Edwards
1d666a9841 CMake: Build the models, makepanda-style 2018-02-07 18:59:44 -07:00
Sam Edwards
d66f5fa8e2 CMake: Kill support for <2.8.12
The rationale for this is in a comment at the top of the main
CMakeLists.txt file. It was getting harder to maintain support for a
version this old, and pretty much no current system has CMake <3.

Good riddance.
2018-02-06 14:47:12 -07:00
Sam Edwards
e46890010a cmake: Don't rely on $<TARGET_PROPERTY:...> in CMake < 2.8.10. 2016-12-02 20:41:22 -08:00
Sam Edwards
e58697bee4 cmake: Fix AutoInclude workaround always being used irrespective of version.
Also fixes Interrogate's reliance on the INTERFACE_INCLUDE_DIRECTORIES target
property before generation time by using a generator expression to determine
Interrogate's include flags.
2016-12-01 02:36:40 -08:00
Sam Edwards
3bd9750439 Merge branch 'cmake-proper-interrogate' into cmake 2014-10-11 18:15:59 -07:00
Sam Edwards
1fa1eb63cb CMake: Don't use target_include_directories, it's not supported on CMake 2.8.4. 2014-08-02 20:26:15 -07:00
Sam Edwards
0d13247721 Merge branch 'cmake' into cmake-proper-interrogate
Conflicts:
	cmake/macros/Interrogate.cmake
	panda/src/express/CMakeLists.txt
	panda/src/ode/CMakeLists.txt
2014-07-26 19:12:22 -07:00
Sam Edwards
a26df45c38 cmake: Fix Interrogate installation so that runtime paths are properly removed. 2014-04-28 16:21:10 -06:00
Sam Edwards
c82c0df266 cmake: Fix Interrogate macro bug causing component sources to get scanned along with their composite counterparts. 2014-04-16 06:07:55 -06:00