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 5, 2024
1 parent a5579cf commit 22f53dc
Show file tree
Hide file tree
Showing 12 changed files with 24 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
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
6 changes: 4 additions & 2 deletions src/aliceVision/global.i
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
%}

%inline %{
typedef long unsigned int size_t;
//typedef long unsigned int size_t;
typedef uint32_t IndexT;
%}

Expand All @@ -37,7 +37,9 @@

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

%template(SizeTPair) std::pair<size_t, size_t>;
//%template(SizeTPair) std::pair<size_t, size_t>;
%template(LongUintPair) std::pair<long unsigned int, long unsigned int>;
%template(UintPair) std::pair<unsigned int, 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 22f53dc

Please sign in to comment.