mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
CMake: First batch of improvements per review
Addressing feedback per @rdb in GitHub #717
This commit is contained in:
parent
d77ad6d0ed
commit
5654e64645
@ -9,10 +9,12 @@ if(CMAKE_VERSION VERSION_GREATER "3.12" OR POLICY CMP0074)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Figure out the version
|
# Figure out the version
|
||||||
file(STRINGS "setup.cfg" _version REGEX "^version = ")
|
set(_s "[\\t ]*") # CMake doesn't support \s*
|
||||||
string(REGEX REPLACE "^.*= " "" _version "${_version}")
|
file(STRINGS "setup.cfg" _version REGEX "^version${_s}=${_s}")
|
||||||
|
string(REGEX REPLACE "^.*=${_s}" "" _version "${_version}")
|
||||||
project(Panda3D VERSION ${_version})
|
project(Panda3D VERSION ${_version})
|
||||||
unset(_version)
|
unset(_version)
|
||||||
|
unset(_s)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
@ -52,8 +54,8 @@ include(RunPzip) # Defines run_pzip function
|
|||||||
include(Versioning) # Hooks 'add_library' to apply VERSION/SOVERSION
|
include(Versioning) # Hooks 'add_library' to apply VERSION/SOVERSION
|
||||||
|
|
||||||
# Determine which trees to build.
|
# Determine which trees to build.
|
||||||
option(BUILD_DTOOL "Build the dtool source tree." ON)
|
option(BUILD_DTOOL "Build the dtool source tree." ON)
|
||||||
option(BUILD_PANDA "Build the panda source tree." ON)
|
option(BUILD_PANDA "Build the panda source tree." ON)
|
||||||
option(BUILD_DIRECT "Build the direct source tree." ON)
|
option(BUILD_DIRECT "Build the direct source tree." ON)
|
||||||
option(BUILD_PANDATOOL "Build the pandatool source tree." ON)
|
option(BUILD_PANDATOOL "Build the pandatool source tree." ON)
|
||||||
option(BUILD_CONTRIB "Build the contrib source tree." ON)
|
option(BUILD_CONTRIB "Build the contrib source tree." ON)
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
#
|
#
|
||||||
# FMOD - Support for FMOD audio output.
|
# FMOD - Support for FMOD audio output.
|
||||||
#
|
#
|
||||||
# Panda3D::OpenAL::p3fmod_audio
|
# Panda3D::FMOD::p3fmod_audio
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# OpenGL - Support for OpenGL rendering.
|
# OpenGL - Support for OpenGL rendering.
|
||||||
|
@ -103,7 +103,7 @@ if(NOT "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
|
|||||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Wno-unused-variable")
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Wno-unused-variable")
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Clang behaving as MSVC`
|
# Clang behaving as MSVC
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-command-line-argument")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-command-line-argument")
|
||||||
set(CMAKE_CXX_FLAGS
|
set(CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} -Wno-microsoft-template -Wno-unused-command-line-argument")
|
"${CMAKE_CXX_FLAGS} -Wno-microsoft-template -Wno-unused-command-line-argument")
|
||||||
|
@ -254,21 +254,6 @@ mark_as_advanced(DEFAULT_PRC_DIR PRC_DIR_ENVVARS PRC_PATH_ENVVARS
|
|||||||
# remaining variables are of general interest to everyone.
|
# remaining variables are of general interest to everyone.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
option(HAVE_P3D_RTDIST
|
|
||||||
"You may define this to build or develop the Panda3D rtdist,
|
|
||||||
the environment packaged up for distribution with the plugin."
|
|
||||||
OFF)
|
|
||||||
|
|
||||||
if(HAVE_P3D_RTDIST)
|
|
||||||
set(PANDA_PACKAGE_VERSION "local_dev" CACHE STRING "")
|
|
||||||
set(PANDA_PACKAGE_HOST_URL "http://localhost/" CACHE STRING "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(HAVE_P3D_RTDIST PANDA_PACKAGE_VERSION PANDA_PACKAGE_HOST)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# The following options relate to interrogate, the tool that is
|
# The following options relate to interrogate, the tool that is
|
||||||
# used to generate bindings for non-C++ languages.
|
# used to generate bindings for non-C++ languages.
|
||||||
|
|
||||||
|
@ -149,9 +149,6 @@ if(CMAKE_VERSION VERSION_LESS "3.15")
|
|||||||
# macOS requires this explicit flag on the linker command line to allow the
|
# macOS requires this explicit flag on the linker command line to allow the
|
||||||
# references to the Python symbols to resolve at dynamic link time
|
# references to the Python symbols to resolve at dynamic link time
|
||||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -undefined dynamic_lookup")
|
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -undefined dynamic_lookup")
|
||||||
# TODO: p3dcparser contains some direct Python references; get rid of
|
|
||||||
# this once that's gone
|
|
||||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -undefined dynamic_lookup")
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -263,7 +260,7 @@ package_status(ZLIB "zlib")
|
|||||||
# JPEG
|
# JPEG
|
||||||
find_package(JPEG QUIET)
|
find_package(JPEG QUIET)
|
||||||
|
|
||||||
package_option(JPEG DEFAULT ON "Enable support for loading .jpg images.")
|
package_option(JPEG "Enable support for loading .jpg images.")
|
||||||
|
|
||||||
package_status(JPEG "libjpeg")
|
package_status(JPEG "libjpeg")
|
||||||
|
|
||||||
@ -271,7 +268,6 @@ package_status(JPEG "libjpeg")
|
|||||||
find_package(PNG QUIET)
|
find_package(PNG QUIET)
|
||||||
|
|
||||||
package_option(PNG
|
package_option(PNG
|
||||||
DEFAULT ON
|
|
||||||
"Enable support for loading .png images."
|
"Enable support for loading .png images."
|
||||||
IMPORTED_AS PNG::PNG)
|
IMPORTED_AS PNG::PNG)
|
||||||
|
|
||||||
@ -344,7 +340,7 @@ package_status(FCOLLADA "FCollada")
|
|||||||
find_package(Eigen3 QUIET)
|
find_package(Eigen3 QUIET)
|
||||||
|
|
||||||
package_option(EIGEN
|
package_option(EIGEN
|
||||||
"Enables experimental support for the Eigen linear algebra library.
|
"Enables use of the Eigen linear algebra library.
|
||||||
If this is provided, Panda will use this library as the fundamental
|
If this is provided, Panda will use this library as the fundamental
|
||||||
implementation of its own linmath library; otherwise, it will use
|
implementation of its own linmath library; otherwise, it will use
|
||||||
its own internal implementation. The primary advantage of using
|
its own internal implementation. The primary advantage of using
|
||||||
|
@ -106,6 +106,30 @@ endif()
|
|||||||
if(INTERROGATE_PYTHON_INTERFACE)
|
if(INTERROGATE_PYTHON_INTERFACE)
|
||||||
add_python_module(panda3d.core ${CORE_MODULE_COMPONENTS} LINK panda)
|
add_python_module(panda3d.core ${CORE_MODULE_COMPONENTS} LINK panda)
|
||||||
|
|
||||||
|
# Generate our __init__.py
|
||||||
|
if(WIN32)
|
||||||
|
file(READ "${PROJECT_SOURCE_DIR}/cmake/templates/win32_python/__init__.py" win32_init)
|
||||||
|
else()
|
||||||
|
set(win32_init "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(WRITE "${PROJECT_BINARY_DIR}/panda3d/__init__.py"
|
||||||
|
"\"Python bindings for the Panda3D libraries\"
|
||||||
|
|
||||||
|
__version__ = '${PROJECT_VERSION}'
|
||||||
|
|
||||||
|
if __debug__:
|
||||||
|
import sys
|
||||||
|
if sys.version_info < (3, 0):
|
||||||
|
sys.stderr.write('''\\
|
||||||
|
WARNING: Python 2.7 will reach EOL after December 31, 2019.
|
||||||
|
To suppress this warning, upgrade to Python 3.
|
||||||
|
''')
|
||||||
|
sys.stdout.flush()
|
||||||
|
del sys
|
||||||
|
|
||||||
|
${win32_init}")
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
install_python_package(panda3d ARCH)
|
install_python_package(panda3d ARCH)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user