Skip to content

Commit 76b4e52

Browse files
committed
documentation: Bump CMake version to 3.16
buildsystem: Integrate with new Python3.cmake functions (NumPy)
1 parent b5d732f commit 76b4e52

File tree

6 files changed

+16
-26
lines changed

6 files changed

+16
-26
lines changed

Diff for: CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright 2013-2020 the openage authors. See copying.md for legal info.
22

3-
cmake_minimum_required(VERSION 3.12)
3+
cmake_minimum_required(VERSION 3.16)
44

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

88
# main build configuration file

Diff for: buildsystem/HandlePythonOptions.cmake

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# Copyright 2015-2018 the openage authors. See copying.md for legal info.
1+
# Copyright 2015-2020 the openage authors. See copying.md for legal info.
22

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

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

109
py_get_config_var(EXT_SUFFIX PYEXT_SUFFIX)
1110

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

1516
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
1617
# suppress #warning about deprecated numpy api

Diff for: buildsystem/modules/FindNumpy.cmake

-16
This file was deleted.

Diff for: buildsystem/modules/FindPython.cmake

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ endif()
3333
set(Python3_FIND_REGISTRY "NEVER")
3434

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

3838

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

68+
# Numpy.cmake vars <= Python3.cmake vars
69+
set(NUMPY_FOUND ${Python3_NumPy_FOUND})
70+
set(NUMPY_VERSION ${Python3_NumPy_VERSION})
71+
set(NUMPY_INCLUDE_DIR ${Python3_NumPy_INCLUDE_DIRS} CACHE STRING "Linker invocation for the NumPy library" FORCE)
72+
6873
include(FindPackageHandleStandardArgs)
6974
find_package_handle_standard_args(Python REQUIRED_VARS PYTHON PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES)
7075
endif()

Diff for: buildsystem/python.cmake

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2014-2019 the openage authors. See copying.md for legal info.
1+
# Copyright 2014-2020 the openage authors. See copying.md for legal info.
22

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

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

202202
set_property(GLOBAL APPEND PROPERTY SFT_PXD_FILES "${source}")

Diff for: doc/building.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Dependency list:
3030
C gcc >=7 or clang >=5
3131
CRA python >=3.6
3232
C cython >=0.25
33-
C cmake >=3.12
33+
C cmake >=3.16
3434
A numpy
3535
A python imaging library (PIL) -> pillow
3636
CR opengl >=3.3

0 commit comments

Comments
 (0)