Skip to content

Commit

Permalink
documentation: Bump CMake version to 3.16
Browse files Browse the repository at this point in the history
buildsystem: Integrate with new Python3.cmake functions (NumPy)
  • Loading branch information
simonsan committed May 7, 2020
1 parent b5d732f commit 76b4e52
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 26 deletions.
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)

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

# main build configuration file
Expand Down
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
Expand Down
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
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 76b4e52

Please sign in to comment.