Skip to content

Commit

Permalink
swig issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Oct 9, 2024
1 parent d2a5267 commit fbcf74e
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 66 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/sub_buildWindows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ jobs:
shell: powershell
run: |
nuget install swigwintools -OutputDirectory "${{ env.builddir }}/Tools" -Version 4.2.0
nuget install python -Version 3.8 -OutputDirectory "${{ env.builddir }}/Tools"
- name: Configuring CMake
run: >
cmake -B"${{ env.builddir }}" .
Expand All @@ -120,6 +121,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release
-DSWIG_EXECUTABLE=${{ env.builddir }}swigwintools.4.2.0/tools/swigwin-4.2.0/swig.exe
-DSWIG_DIR=${{ env.builddir }}swigwintools.4.2.0/tools/swigwin-4.2.0
-DPython_ROOT_DIR${{ env.builddir }}python.3.8.0/tools
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Compiling sources
Expand Down
27 changes: 0 additions & 27 deletions CMakeSettings.json

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/SetupBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ macro(SetupBoost)
VERSION 1.86.0
URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.xz
URL_HASH SHA256=2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57
OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_INCLUDE_LIBRARIES system\\\;algorithm\\\;random\\\;filesystem\\\;regex\\\;thread\\\;chrono\\\;test\\\;date_time\\\;python\\\;numeric/conversion" # Note the escapes!
OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_ENABLE_PYTHON ON" "BOOST_INCLUDE_LIBRARIES system\\\;algorithm\\\;random\\\;filesystem\\\;regex\\\;thread\\\;chrono\\\;test\\\;date_time\\\;python\\\;numeric/conversion" # Note the escapes!
)
endif()
endmacro(SetupBoost)
56 changes: 27 additions & 29 deletions src/isimpa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ source_group( "" FILES ${ISIMPA_SOURCES} )

# Build auto-generated source files
# Find package for generation
FIND_PACKAGE(PythonInterp REQUIRED)
find_package(Python3 COMPONENTS Interpreter Development)

find_package(OpenGL)
include(FindPackageMessage)
Expand Down Expand Up @@ -480,8 +480,6 @@ GIT_REPOSITORY https://github.com/wxWidgets/wxWidgets
GIT_TAG v3.2.1
)

# Find package for buildingfind_package(Python3 COMPONENTS Interpreter Development)
FIND_PACKAGE(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; import sysconfig; print(list(sysconfig.get_paths().values()))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)

Expand Down Expand Up @@ -596,32 +594,32 @@ if(WIN32) # Check if we are on Windows
install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION . COMPONENT Runtime )
endif( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS )
# Try to fetch x64 version of python dll
get_filename_component(PYTHON_DLL_FILENAME "${PYTHON_LIBRARY}" NAME_WLE)

SET(CMAKE_FIND_LIBRARY_PREFIXES "")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")

find_library(
PYTHON_DLL
NAMES ${PYTHON_DLL_FILENAME}
PATHS ${PYTHON_ROOT_FOLDER}
NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
)
if(NOT EXISTS ${PYTHON_DLL})
MESSAGE(FATAL_ERROR "Python not found here ${PYTHON_DLL_FILENAME}.DLL")
else()
MESSAGE(STATUS "Python dll found here ${PYTHON_DLL}")
endif()

install(FILES ${PYTHON_DLL} DESTINATION .)

install(CODE "
set(INSTALL_DLL \"\${CMAKE_INSTALL_PREFIX}/${PYTHON_DLL_FILENAME}.DLL\")
file(SHA512 \${INSTALL_DLL} INSTALL_DLL_HASH)
MESSAGE(STATUS \"INSTALL_DLL_HASH \${INSTALL_DLL_HASH}\")
")
#get_filename_component(PYTHON_DLL_FILENAME "${PYTHON_LIBRARY}" NAME_WLE)

#SET(CMAKE_FIND_LIBRARY_PREFIXES "")
#SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")

#find_library(
# PYTHON_DLL
# NAMES ${PYTHON_DLL_FILENAME}
# PATHS ${PYTHON_ROOT_FOLDER}
# NO_DEFAULT_PATH
# NO_SYSTEM_ENVIRONMENT_PATH
# NO_CMAKE_SYSTEM_PATH
#)
#if(NOT EXISTS ${PYTHON_DLL})
# MESSAGE(FATAL_ERROR "Python not found here ${PYTHON_DLL_FILENAME}.DLL")
#else()
# MESSAGE(STATUS "Python dll found here ${PYTHON_DLL}")
#endif()

#install(FILES ${PYTHON_DLL} DESTINATION .)

#install(CODE "
#set(INSTALL_DLL \"\${CMAKE_INSTALL_PREFIX}/${PYTHON_DLL_FILENAME}.DLL\")
#file(SHA512 \${INSTALL_DLL} INSTALL_DLL_HASH)
#MESSAGE(STATUS \"INSTALL_DLL_HASH \${INSTALL_DLL_HASH}\")
#")
endif()

# Package creation instructions, NSIS under windows
Expand Down
2 changes: 2 additions & 0 deletions src/isimpa/GL/opengl_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include "first_header_include.hpp"

#ifdef _WINDOWS
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <windows.h>
#endif
#ifdef _UNIX
Expand Down
5 changes: 2 additions & 3 deletions src/lib_interface/input_output/ply/rply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,11 @@ p_ply ply_open_from_file(FILE *fp, p_ply_error_cb error_cb,
p_ply ply;
if (error_cb == NULL) error_cb = ply_error_cb;
assert(fp);
ply = ply_alloc();
if (!ply_type_check()) {
error_cb(ply, "Incompatible type system");
return NULL;
}
ply = ply_alloc();
if (!ply) {
error_cb(NULL, "Out of memory");
return NULL;
Expand Down Expand Up @@ -477,13 +477,12 @@ p_ply ply_create(const char *name, e_ply_storage_mode storage_mode,

p_ply ply_create_to_file(FILE *fp, e_ply_storage_mode storage_mode,
p_ply_error_cb error_cb, long idata, void *pdata) {
p_ply ply;
p_ply ply = ply_alloc();
assert(fp && storage_mode <= PLY_DEFAULT);
if (!ply_type_check()) {
error_cb(ply, "Incompatible type system");
return NULL;
}
ply = ply_alloc();
if (!ply) {
error_cb(NULL, "Out of memory");
return NULL;
Expand Down
21 changes: 15 additions & 6 deletions src/python_bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ include( InstallRequiredSystemLibraries )
#---------------------------------------#

# require swig > v3
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})

# Find package for building
FIND_PACKAGE(PythonLibs REQUIRED)
# Find package for testing
FIND_PACKAGE(PythonInterp REQUIRED)
find_package(SWIG REQUIRED)
include(UseSWIG)

if(${SWIG_VERSION} VERSION_GREATER_EQUAL 4)
list(APPEND CMAKE_SWIG_FLAGS "-doxygen")
endif()

if(UNIX AND NOT APPLE)
list(APPEND CMAKE_SWIG_FLAGS "-DSWIGWORDSIZE64")
endif()

# Find Python 3
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
list(APPEND CMAKE_SWIG_FLAGS "-py3" "-DPY3")


INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})

Expand Down

0 comments on commit fbcf74e

Please sign in to comment.