Skip to content

Commit

Permalink
[build] SwigBinding: Compile on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cbentejac committed Feb 6, 2024
1 parent a5579cf commit ee75ce9
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 16 deletions.
19 changes: 10 additions & 9 deletions src/aliceVision/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,48 +85,49 @@ endif()
if(ALICEVISION_BUILD_SWIG_BINDING)
set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
set_property(SOURCE aliceVision.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE aliceVision.i PROPERTY SWIG_MODULE_NAME aliceVision)
set_property(SOURCE aliceVision.i PROPERTY SWIG_MODULE_NAME pyalicevision)

swig_add_library(aliceVision
swig_add_library(pyalicevision
TYPE MODULE
LANGUAGE python
SOURCES aliceVision.i
)

set_property(
TARGET aliceVision
TARGET pyalicevision
PROPERTY SWIG_COMPILE_OPTIONS -doxygen
)

target_include_directories(aliceVision
target_include_directories(pyalicevision
PRIVATE
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
set_property(
TARGET aliceVision
TARGET pyalicevision
PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON
)
set_property(
TARGET aliceVision
TARGET pyalicevision
PROPERTY COMPILE_OPTIONS -std=c++17
)

target_link_libraries(aliceVision
target_link_libraries(pyalicevision
PUBLIC
aliceVision_numeric
${Python3_LIBRARIES}
)
install(
TARGETS
aliceVision
pyalicevision
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/aliceVision.py
${CMAKE_CURRENT_BINARY_DIR}/pyalicevision.py
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/aliceVision.i
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

%module aliceVision
%module pyalicevision

%include <aliceVision/global.i>

Expand Down
1 change: 1 addition & 0 deletions src/aliceVision/camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
target_link_libraries(camera
PUBLIC
aliceVision_camera
${Python3_LIBRARIES}
)

install(
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/camera/Camera.i
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

%module (module="aliceVision") camera
%module (module="pyalicevision") camera

%include <aliceVision/camera/IntrinsicBase.i>

Expand Down
5 changes: 4 additions & 1 deletion src/aliceVision/global.i
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@

%template(IndexTSet) std::set<IndexT>;

%template(SizeTPair) std::pair<size_t, size_t>;
namespace std {
%template(SizeTPair) pair<size_t, size_t>;
}
%template(LongUintPair) std::pair<long unsigned int, long unsigned int>;

// As defined in aliceVision/types.hpp
%template(Pair) std::pair<IndexT, IndexT>;
Expand Down
1 change: 1 addition & 0 deletions src/aliceVision/hdr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
aliceVision_numeric
aliceVision_image
aliceVision_sfmData
${Python3_LIBRARIES}
)

install(
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/hdr/Hdr.i
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

%module (module="aliceVision") hdr
%module (module="pyalicevision") hdr

%include <aliceVision/hdr/Brackets.i>
1 change: 1 addition & 0 deletions src/aliceVision/sensorDB/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
target_link_libraries(sensorDB
PUBLIC
aliceVision_sensorDB
${Python3_LIBRARIES}
)

install(
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/sensorDB/SensorDB.i
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

%module (module="aliceVision") sensorDB
%module (module="pyalicevision") sensorDB

%include <aliceVision/sensorDB/Datasheet.i>

Expand Down
1 change: 1 addition & 0 deletions src/aliceVision/sfmData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
PUBLIC
aliceVision_sfmData
aliceVision_camera
${Python3_LIBRARIES}
)

install(
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/sfmData/SfMData.i
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

%module (module="aliceVision") sfmData
%module (module="pyalicevision") sfmData

%include <aliceVision/sfmData/CameraPose.i>
%include <aliceVision/sfmData/Constraint2D.i>
Expand Down
1 change: 1 addition & 0 deletions src/aliceVision/sfmDataIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
target_link_libraries(sfmDataIO
PUBLIC
aliceVision_sfmDataIO
${Python3_LIBRARIES}
)

install(
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/sfmDataIO/SfMDataIO.i
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

%module (module="aliceVision") sfmDataIO
%module (module="pyalicevision") sfmDataIO

%include <std_string.i>
%include <aliceVision/sfmDataIO/sfmDataIO.hpp>
Expand Down

0 comments on commit ee75ce9

Please sign in to comment.