Skip to content

Commit 36c6c84

Browse files
authored
Merge pull request #2 from ababak/drop_python2
Drop python2, support Python 3.9, 3.10, 3.11, 3.12
2 parents 1ce4f11 + 6bc658f commit 36c6c84

20 files changed

+97
-133
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ out
7171
.Spotlight-V100
7272
.Trashes
7373
ehthumbs.db
74-
Thumbs.db
74+
Thumbs.db

Dockerfile

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,75 +3,15 @@
33
# Andriy Babak <ababak@gmail.com>
44
#
55
# Build the docker image:
6-
# docker build --rm -t ababak/cgcpp:1.6 .
6+
# docker build --rm -t ababak/cgcpp:1.7 .
7+
# docker run --rm -v "$(pwd):c:/source:ro" -r "$(pwd)/out:c:/out" ababak/cgcpp:1.7
8+
# docker run --rm -v "$(pwd -W):c:/source:ro" -v "$(pwd -W)/out:c:/out" ababak/cgcpp:1.7
79
# See README.md for details
810

9-
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as base
11+
FROM ababak/boost:latest as base
1012

1113
LABEL maintainer="ababak@gmail.com"
1214

13-
SHELL ["powershell", "-ExecutionPolicy", "RemoteSigned", "-Command"]
14-
15-
# Install BuildTools
16-
RUN Invoke-WebRequest "https://aka.ms/vs/16/release/vs_buildtools.exe" -OutFile vs_buildtools.exe; \
17-
Start-Process vs_buildtools.exe -Wait -ArgumentList '\
18-
--quiet \
19-
--wait \
20-
--norestart \
21-
--nocache \
22-
--installPath C:/BuildTools \
23-
--add Microsoft.VisualStudio.Workload.MSBuildTools \
24-
--add Microsoft.VisualStudio.Workload.VCTools \
25-
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
26-
--add Microsoft.VisualStudio.Component.Windows10SDK.18362 \
27-
--add Microsoft.VisualStudio.Component.VC.CMake.Project \
28-
--add Microsoft.VisualStudio.Component.TestTools.BuildTools \
29-
--add Microsoft.VisualStudio.Component.VC.ASAN \
30-
--add Microsoft.VisualStudio.Component.VC.140'; \
31-
Remove-Item c:/vs_buildtools.exe
32-
33-
# Install Chocolatey package manager
34-
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
35-
iex (New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
36-
37-
# Install Chocolatey packages
38-
RUN choco install -y \
39-
7zip \
40-
nasm \
41-
openssh \
42-
git
43-
44-
# Install Python
45-
RUN choco install -y \
46-
python2
47-
RUN choco install -y \
48-
python39
49-
RUN choco install -y \
50-
python310
51-
52-
ENV PYTHONIOENCODING UTF-8
53-
54-
# Install Boost
55-
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
56-
Invoke-WebRequest "https://boost.teeks99.com/bin/1.67.0/boost_1_67_0-msvc-14.1-64.exe" -OutFile boost.exe; \
57-
Start-Process boost.exe -Wait -ArgumentList '/DIR="C:/local/boost_1_67_0" /SILENT'; \
58-
Remove-Item c:/boost.exe
59-
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
60-
Invoke-WebRequest "https://boost.teeks99.com/bin/1.76.0/boost_1_76_0-msvc-14.1-64.exe" -OutFile boost.exe; \
61-
Start-Process boost.exe -Wait -ArgumentList '/DIR="C:/local/boost_1_76_0" /SILENT'; \
62-
Remove-Item c:/boost.exe
63-
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
64-
Invoke-WebRequest "https://boost.teeks99.com/bin/1.80.0/boost_1_80_0-msvc-14.1-64.exe" -OutFile boost.exe; \
65-
Start-Process boost.exe -Wait -ArgumentList '/DIR="C:/local/boost_1_80_0" /SILENT'; \
66-
Remove-Item c:/boost.exe
67-
68-
ENV CMAKE_GENERATOR "NMake Makefiles"
69-
RUN setx /M PATH $( \
70-
'c:/cmake' + ';' + \
71-
$env:PATH + ';' + \
72-
$env:PROGRAMFILES + '/NASM' \
73-
)
74-
7515
COPY cmake C:/cmake
7616
COPY build.bat C:/build.bat
7717

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
[![Docker Image CI](https://github.com/ababak/cgcpp/actions/workflows/docker-image.yml/badge.svg?branch=v1.4.0)](https://github.com/ababak/cgcpp/actions/workflows/docker-image.yml)
1+
[![Docker Image CI](https://github.com/ababak/cgcpp/actions/workflows/docker-image.yml/badge.svg?branch=v1.7.0)](https://github.com/ababak/cgcpp/actions/workflows/docker-image.yml)
22

33
# Computer Graphics C++ (cgcpp)
44
A universal solution for common needs in C++ in computer graphics software.
55

66
### Supports
7-
- Python 2.7, Boost 1.67.0 on Windows
87
- Python 3.9, Boost 1.76.0 on Windows
9-
- Autodesk Maya 2019-2023 on Windows *(Python 2.7 and Boost 1.67.0 in Maya 2019-2022, Python 3.9 and Boost 1.76.0 in Maya 2023)*
10-
- SideFX Houdini 19.0-19.5 on Windows *(Python 2.7 and Boost 1.67.0 in Houdini 19.0, Python 3.9 and Boost 1.76.0 in Houdini 19.5)*
8+
- Python 3.10, Boost 1.80.0 on Windows
9+
- Python 3.11, Boost 1.82.0 on Windows
10+
- Python 3.12, Boost 1.85.0 on Windows
11+
- Autodesk Maya 2019-2025 on Windows *(Python 3.9 and Boost 1.76.0 in Maya 2023, Python 3.10 and Boost 1.80.0 in Maya 2024, Python 3.11 and Boost 1.82.0 in Maya 2025)*
12+
- SideFX Houdini 19.0-19.5 on Windows *(Python 3.9 and Boost 1.76.0 in Houdini 19.5, Python 3.10 and Boost 1.80.0 in Houdini 20.0)*
1113

1214
Support for other platforms and other DCC applications may come later.
1315

cmake/build_functions.cmake

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# (c) Andriy Babak 2020-2021
1+
# (c) Andriy Babak 2020-2024
22
#
33
# date: 08/09/2020
4-
# modified: 05/08/2022 16:02:45
4+
# modified: 24/07/2024 13:34:57
55
#
66
# Author: Andriy Babak
77
# e-mail: ababak@gmail.com
@@ -13,21 +13,23 @@
1313
function(build_maya_module MAYA_VERSION PROJECT_BUILD_TYPE)
1414
find_package (Maya REQUIRED)
1515
set (CMAKE_BUILD_TYPE "${PROJECT_BUILD_TYPE}" CACHE INTERNAL "" FORCE)
16-
if (MAYA_VERSION VERSION_LESS 2023)
17-
set(PYTHON_REQUESTED_VERSION 2.7)
18-
set(Python_ROOT_DIR "C:/Python27")
19-
set(BOOST_REQUESTED_VERSION 1.67.0)
20-
set(BOOST_ROOT "C:/local/boost_1_67_0")
21-
elseif (MAYA_VERSION VERSION_LESS 2024)
16+
if (MAYA_VERSION VERSION_LESS 2024)
2217
set(PYTHON_REQUESTED_VERSION 3.9)
2318
set(Python_ROOT_DIR "C:/Python39")
2419
set(BOOST_REQUESTED_VERSION 1.76.0)
2520
set(BOOST_ROOT "C:/local/boost_1_76_0")
26-
else ()
21+
elseif (MAYA_VERSION VERSION_LESS 2025)
2722
set(PYTHON_REQUESTED_VERSION 3.10)
2823
set(Python_ROOT_DIR "C:/Python310")
2924
set(BOOST_REQUESTED_VERSION 1.80.0)
3025
set(BOOST_ROOT "C:/local/boost_1_80_0")
26+
elseif (MAYA_VERSION VERSION_LESS 2026)
27+
set(PYTHON_REQUESTED_VERSION 3.11)
28+
set(Python_ROOT_DIR "C:/Python311")
29+
set(BOOST_REQUESTED_VERSION 1.82.0)
30+
set(BOOST_ROOT "C:/local/boost_1_82_0")
31+
else ()
32+
message( FATAL_ERROR "Unsupported Maya version: ${MAYA_VERSION}" )
3133
endif ()
3234
message (STATUS "Python version: ${PYTHON_REQUESTED_VERSION}")
3335
string (REPLACE "." "" PYTHON_DOTLESS_VERSION "${PYTHON_REQUESTED_VERSION}")
@@ -72,16 +74,18 @@ function(build_houdini_module HOUDINI_VERSION PROJECT_BUILD_TYPE)
7274
# specifying this path.
7375
list(APPEND CMAKE_PREFIX_PATH "${HFS}/toolkit/cmake")
7476
find_package (Houdini REQUIRED)
75-
if (Houdini_VERSION VERSION_LESS 19.5)
76-
set(PYTHON_REQUESTED_VERSION 2.7)
77-
set(Python_ROOT_DIR "C:/Python27")
78-
set(BOOST_REQUESTED_VERSION 1.67.0)
79-
set(BOOST_ROOT "C:/local/boost_1_67_0")
80-
else ()
77+
if (Houdini_VERSION VERSION_LESS 20.0)
8178
set(PYTHON_REQUESTED_VERSION 3.9)
8279
set(Python_ROOT_DIR "C:/Python39")
8380
set(BOOST_REQUESTED_VERSION 1.76.0)
8481
set(BOOST_ROOT "C:/local/boost_1_76_0")
82+
elseif (Houdini_VERSION VERSION_LESS 20.5)
83+
set(PYTHON_REQUESTED_VERSION 3.10)
84+
set(Python_ROOT_DIR "C:/Python310")
85+
set(BOOST_REQUESTED_VERSION 1.80.0)
86+
set(BOOST_ROOT "C:/local/boost_1_80_0")
87+
else ()
88+
message( FATAL_ERROR "Unsupported Houdini version: ${HOUDINI_VERSION}" )
8589
endif ()
8690
message (STATUS "Python version: ${PYTHON_REQUESTED_VERSION}")
8791
string (REPLACE "." "" PYTHON_DOTLESS_VERSION "${PYTHON_REQUESTED_VERSION}")
@@ -171,27 +175,32 @@ endfunction()
171175

172176

173177
function(build_python_module PYTHON_REQUESTED_VERSION PROJECT_BUILD_TYPE)
174-
if (PYTHON_REQUESTED_VERSION VERSION_EQUAL 2.7)
175-
set(Python_ROOT_DIR "C:/Python27")
176-
set(BOOST_REQUESTED_VERSION 1.67.0)
177-
set(BOOST_ROOT "C:/local/boost_1_67_0")
178-
elseif (PYTHON_REQUESTED_VERSION VERSION_EQUAL 3.9)
179-
set(Python_ROOT_DIR "C:/Python39")
180-
set(BOOST_REQUESTED_VERSION 1.76.0)
181-
set(BOOST_ROOT "C:/local/boost_1_76_0")
178+
string (REPLACE "." "" PYTHON_DOTLESS_VERSION "${PYTHON_REQUESTED_VERSION}")
179+
message (STATUS "Python version: ${PYTHON_REQUESTED_VERSION}")
180+
set (TARGET_NAME "${PROJECT_NAME}_python${PYTHON_DOTLESS_VERSION}")
181+
set (CMAKE_BUILD_TYPE "${PROJECT_BUILD_TYPE}" CACHE INTERNAL "" FORCE)
182+
message (STATUS "Target name: ${TARGET_NAME}")
183+
if (PYTHON_REQUESTED_VERSION VERSION_EQUAL 3.9)
184+
set (Python_ROOT_DIR "C:/Python39")
185+
set (BOOST_REQUESTED_VERSION 1.76.0)
186+
set (BOOST_ROOT "C:/local/boost_1_76_0")
182187
elseif (PYTHON_REQUESTED_VERSION VERSION_EQUAL 3.10)
183-
set(Python_ROOT_DIR "C:/Python310")
184-
set(BOOST_REQUESTED_VERSION 1.80.0)
185-
set(BOOST_ROOT "C:/local/boost_1_80_0")
188+
set (Python_ROOT_DIR "C:/Python310")
189+
set (BOOST_REQUESTED_VERSION 1.80.0)
190+
set (BOOST_ROOT "C:/local/boost_1_80_0")
191+
elseif (PYTHON_REQUESTED_VERSION VERSION_EQUAL 3.11)
192+
set (Python_ROOT_DIR "C:/Python311")
193+
set (BOOST_REQUESTED_VERSION 1.82.0)
194+
set (BOOST_ROOT "C:/local/boost_1_82_0")
195+
elseif (PYTHON_REQUESTED_VERSION VERSION_EQUAL 3.12)
196+
set (Python_ROOT_DIR "C:/Python312")
197+
set (BOOST_REQUESTED_VERSION 1.85.0)
198+
set (BOOST_ROOT "C:/local/boost_1_85_0")
186199
else ()
187200
message( FATAL_ERROR "Unsupported Python version: ${PYTHON_REQUESTED_VERSION}" )
188201
endif ()
189-
message (STATUS "Python version: ${PYTHON_REQUESTED_VERSION}")
190-
string (REPLACE "." "" PYTHON_DOTLESS_VERSION "${PYTHON_REQUESTED_VERSION}")
191-
set (CMAKE_BUILD_TYPE "${PROJECT_BUILD_TYPE}" CACHE INTERNAL "" FORCE)
192202
find_package (Python ${PYTHON_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Development)
193203
find_package (Boost ${BOOST_REQUESTED_VERSION} EXACT REQUIRED COMPONENTS python${PYTHON_DOTLESS_VERSION} system filesystem)
194-
set (TARGET_NAME "${PROJECT_NAME}_python${PYTHON_DOTLESS_VERSION}")
195204
add_library (${TARGET_NAME} SHARED ${SRC})
196205
target_include_directories (
197206
${TARGET_NAME}

cmake/compiler.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# (c) Andriy Babak 2020-2021
1+
# (c) Andriy Babak 2020-2024
22
#
33
# date: 08/09/2020
44
# modified: 28/05/2021 16:41:32

cmake/init-config.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# (c) Andriy Babak 2020-2021
1+
# (c) Andriy Babak 2020-2024
22
#
33
# date: 08/09/2020
4-
# modified: 20/04/2023 15:21:22
4+
# modified: 24/07/2024 13:15:27
55
#
66
# Author: Andriy Babak
77
# e-mail: ababak@gmail.com
@@ -17,6 +17,9 @@ include(build_functions)
1717

1818
message (STATUS "CMake version: ${CMAKE_VERSION}")
1919

20+
set(Boost_NO_WARN_NEW_VERSIONS ON)
21+
set(Boost_NO_BOOST_CMAKE ON)
22+
set(Boost_USE_STATIC_RUNTIME OFF)
2023
set(Boost_USE_STATIC_LIBS ON)
2124
add_definitions(-DBOOST_PYTHON_STATIC_LIB)
2225
set (Python_FIND_STRATEGY "LOCATION")

cmake/maya-config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# (c) Andriy Babak 2020-2021
1+
# (c) Andriy Babak 2020-2024
22
#
33
# date: 07/09/2020
44
# modified: 28/05/2021 16:41:00

examples/source_exception/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ find_package (init)
55

66
project (lib_exception)
77
set (SRC "lib_exception.cpp")
8-
build_python_module (2.7 "Release")
98
build_python_module (3.9 "Release")
9+
build_python_module (3.10 "Release")
10+
build_python_module (3.11 "Release")
11+
build_python_module (3.12 "Release")
1012

1113
message (STATUS "CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX}")

examples/source_exception/lib_exception.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* (c) Andriy Babak 2019-2022
2+
* (c) Andriy Babak 2019-2024
33
*
44
* date: 23/01/2019
5-
* modified: 05/08/2022 17:15:19
5+
* modified: 30/05/2024 10:41:16
66
*
77
* Author: Andriy Babak
88
* e-mail: ababak@gmail.com

examples/source_houdini/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ project (houdini_module)
77
set (SRC "houdini_module.cpp")
88
message (STATUS "Building module for Houdini 19.0.657")
99
build_houdini_module (19.0.657 "Release")
10+
message (STATUS "Building module for Houdini 20.0.688")
11+
build_houdini_module (20.0.688 "Release")

examples/source_houdini/houdini_module.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* (c) Andriy Babak 2022
2+
* (c) Andriy Babak 2022-2024
33
*
44
* date: 05/08/2022
5-
* modified: 05/08/2022 18:55:46
5+
* modified: 30/05/2024 10:40:58
66
*
77
* Author: Andriy Babak
88
* e-mail: ababak@gmail.com

examples/source_maya/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ find_package (init)
55

66
project (maya_module)
77
set (SRC "maya_module.cpp")
8-
message (STATUS "Building module for Maya 2020")
9-
build_maya_module (2020 "Release")
108
message (STATUS "Building module for Maya 2022")
119
build_maya_module (2022 "Release")
1210
message (STATUS "Building module for Maya 2023")
1311
build_maya_module (2023 "Release")
12+
message (STATUS "Building module for Maya 2024")
13+
build_maya_module (2023 "Release")
14+
message (STATUS "Building module for Maya 2025")
15+
build_maya_module (2023 "Release")

examples/source_maya/maya_module.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* (c) Andriy Babak 2019-2022
2+
* (c) Andriy Babak 2019-2024
33
*
44
* date: 10/01/2019
5-
* modified: 05/08/2022 13:12:07
5+
* modified: 30/05/2024 10:40:42
66
*
77
* Author: Andriy Babak
88
* e-mail: ababak@gmail.com

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(c) Andriy Babak 2021
33
44
date: 28/05/2021
5-
modified: 04/08/2022 17:50:02
5+
modified: 24/07/2024 10:15:50
66
77
Author: Andriy Babak
88
e-mail: ababak@gmail.com
@@ -72,7 +72,7 @@ def run(self):
7272
docker_args = [
7373
self.DOCKER_APP,
7474
"build",
75-
"--rm",
75+
# "--rm",
7676
"-t",
7777
self.DOCKER_IMAGE,
7878
".",
@@ -129,18 +129,18 @@ def run(self):
129129

130130

131131
class BuildEgg(BuildEggCommand):
132-
'''Custom egg build to ensure resources built.
132+
"""Custom egg build to ensure resources built.
133133
134134
.. note::
135135
136136
Required because when this project is a dependency for another project,
137137
only bdist_egg will be called and *not* build.
138138
139-
'''
139+
"""
140140

141141
def run(self):
142-
'''Run egg build ensuring build_resources called first.'''
143-
self.run_command('build_ext')
142+
"""Run egg build ensuring build_resources called first."""
143+
self.run_command("build_ext")
144144
BuildEggCommand.run(self)
145145

146146

source/cgcpp/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
2-
(c) Andriy Babak 2021
2+
(c) Andriy Babak 2021-2024
33
44
date: 31/05/2021
5-
modified: 20/04/2023 12:00:25
5+
modified: 30/05/2024 10:40:19
66
77
Author: Andriy Babak
88
e-mail: ababak@gmail.com
@@ -19,11 +19,12 @@
1919
from ._version import __version__
2020
from . import build
2121

22-
__copyright__ = "(c) Andriy Babak 2021-2022"
22+
__copyright__ = "(c) Andriy Babak 2021-2024"
2323

2424
lib_loader_name = "lib_loader"
2525
lib_suffix = "_python{major}{minor}".format(
26-
major=sys.version_info.major, minor=sys.version_info.minor,
26+
major=sys.version_info.major,
27+
minor=sys.version_info.minor,
2728
)
2829
lib_loader_path = "{folder}/{name}{suffix}.pyd".format(
2930
folder=os.path.dirname(__file__), name=lib_loader_name, suffix=lib_suffix

0 commit comments

Comments
 (0)