Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump CMake version to 3.16, buildsystem update to Python search #1264

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
buildsystem: bump cmake to 3.16 and search numpy with python3.cmake
simonsan authored and TheJJ committed May 19, 2020
commit 9c135ec58ed0cb2ef0965804dbd9fa030665429a
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright 2013-2020 the openage authors. See copying.md for legal info.

cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.16)
simonsan marked this conversation as resolved.
Show resolved Hide resolved

# required for FindPython3.cmake
# finding numpy with the findpython3 module
# >3.8 required for CMAKE_CXX_STANDARD for C++17

# main build configuration file
7 changes: 4 additions & 3 deletions buildsystem/HandlePythonOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Copyright 2015-2018 the openage authors. See copying.md for legal info.
# Copyright 2015-2020 the openage authors. See copying.md for legal info.

# finds the python interpreter, install destination and extension flags.

# the Python version number requirement is in modules/FindPython_test.cpp
find_package(Python ${PYTHON_MIN_VERSION} REQUIRED)
find_package(Cython ${CYTHON_MIN_VERSION} REQUIRED)
find_package(Numpy REQUIRED)

py_get_config_var(EXT_SUFFIX PYEXT_SUFFIX)

# This is the only useful thing after cleaning up what python suggests
set(PYEXT_CXXFLAGS "-fwrapv")
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(PYEXT_CXXFLAGS "-fwrapv")
endif()

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# suppress #warning about deprecated numpy api
16 changes: 0 additions & 16 deletions buildsystem/modules/FindNumpy.cmake

This file was deleted.

7 changes: 6 additions & 1 deletion buildsystem/modules/FindPython.cmake
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ endif()
set(Python3_FIND_REGISTRY "NEVER")

# use cmake's FindPython3 to locate library and interpreter
find_package(Python3 ${PYTHON_MIN_VERSION} COMPONENTS Interpreter Development)
find_package(Python3 ${PYTHON_MIN_VERSION} COMPONENTS Interpreter Development NumPy)


# python version string to cpython api test in modules/FindPython_test.cpp
@@ -65,6 +65,11 @@ elseif(PYTHON_TEST_RESULT)
set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS} CACHE PATH "Location of the Python include dir" FORCE)
set(PYTHONLIBS_VERSION_STRING ${Python3_VERSION})

# Numpy.cmake vars <= Python3.cmake vars
set(NUMPY_FOUND ${Python3_NumPy_FOUND})
set(NUMPY_VERSION ${Python3_NumPy_VERSION})
set(NUMPY_INCLUDE_DIR ${Python3_NumPy_INCLUDE_DIRS} CACHE STRING "Linker invocation for the NumPy library" FORCE)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Python REQUIRED_VARS PYTHON PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES)
endif()
6 changes: 3 additions & 3 deletions buildsystem/python.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2019 the openage authors. See copying.md for legal info.
# Copyright 2014-2020 the openage authors. See copying.md for legal info.

# provides macros for defining python extension modules and pxdgen sources.
# and a 'finalize' function that must be called in the end.
@@ -54,7 +54,7 @@ function(add_cython_modules)
# test.pyx is compiled to a shared library linked against PYEXT_LINK_LIBRARY
# __main__.pyx is compiled to a executable with embedded python interpreter,
# linked against libpython and PYEXT_LINK_LIBRARY.
# foo/bar.pyx is compiled to a executable with embedded pytthon interpreter,
# foo/bar.pyx is compiled to a executable with embedded python interpreter,
# linked only against libpython.
# foo/test.pyx is compiled to a shared library linked against nothing, and will
# not be installed.
@@ -196,7 +196,7 @@ function(add_pxds)
endif()

if(NOT "${source}" MATCHES ".*\\.px[id]$")
message(FATAL_ERROR "non-pxd/pxi file given to add_pyd: ${source}")
message(FATAL_ERROR "non-pxd/pxi file given to add_pxds: ${source}")
endif()

set_property(GLOBAL APPEND PROPERTY SFT_PXD_FILES "${source}")
2 changes: 1 addition & 1 deletion doc/building.md
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ Dependency list:
C gcc >=7 or clang >=5
CRA python >=3.6
C cython >=0.25
C cmake >=3.12
C cmake >=3.16
A numpy
A python imaging library (PIL) -> pillow
CR opengl >=3.3