Skip to content

Commit

Permalink
Bugged version of pyind11, the building does not work for failure in …
Browse files Browse the repository at this point in the history
…reading jsoncons for city-pro_subnet. Essentially I have written a new function main_city_pro in main_city-pro.h that is the main so that I can wrap with pybind11
  • Loading branch information
albertoamaduzzi committed Jun 21, 2024
1 parent e9246a3 commit f5616f9
Show file tree
Hide file tree
Showing 8 changed files with 463,107 additions and 506 deletions.
22 changes: 20 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET})
set(VCPKG_TARGET_TRIPLET $ENV{VCPKG_DEFAULT_TRIPLET})
endif()

# If you are in windows environment (initial configuration for the project)
# If it is not installed, install vcpkg and set the important paths about it. (vpkg.cmake)

if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)
Expand All @@ -14,6 +17,7 @@ if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(VCPKG_MANIFEST_FEATURES)
message(STATUS "VCPKG_MANIFEST_FEATURES: ${VCPKG_MANIFEST_FEATURES}")
endif()
# Use the vcpkg toolchain file if it is defined
elseif(DEFINED CMAKE_TOOLCHAIN_FILE)
message(STATUS "Using toolchain: ${CMAKE_TOOLCHAIN_FILE}")
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg.cmake")
Expand Down Expand Up @@ -74,12 +78,22 @@ if(UNIX AND NOT APPLE)
endif()
find_library(LIBRT rt)
set(THREADS_PREFER_PTHREAD_FLAG ON)
# JSONCONS with ./vcpkg install jsoncons
set(CMAKE_PREFIX_PATH "$ENV{VCPKG_ROOT}/installed/")

find_package(Threads REQUIRED)
find_package(FLTK CONFIG REQUIRED)
find_package(Boost COMPONENTS filesystem REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(physycom-utils REQUIRED)
# JSONCONS with ./vcpkg install jsoncons
find_package(jsoncons CONFIG REQUIRED)
# PYBIND INSTALLATION VIA VCPKG
find_package(Python COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG REQUIRED)
#add_subdirectory($ENV{WORKSPACE}/pybind11 pybind11)


include_directories(${CMAKE_SOURCE_DIR}/source
${CMAKE_SOURCE_DIR}/source/ale)
Expand All @@ -104,6 +118,7 @@ add_library(city-pro_lib ${CMAKE_SOURCE_DIR}/source/carto.cpp
)

target_link_libraries(city-pro_lib
jsoncons::jsoncons
OpenGL::GL
OpenGL::GLU
fltk fltk_gl fltk_forms fltk_images
Expand All @@ -113,12 +128,12 @@ target_link_libraries(city-pro_lib
Eigen3::Eigen
Physycom::utils
)

add_executable(city-pro ${CMAKE_SOURCE_DIR}/source/main_city-pro.cpp)
target_link_libraries(city-pro city-pro_lib)

add_executable(city-pro_subnet ${CMAKE_SOURCE_DIR}/source/main_city-pro_subnet.cpp)
target_link_libraries(city-pro_subnet city-pro_lib)
target_link_libraries(city-pro_subnet
city-pro_lib)

set_property(TARGET city-pro_lib PROPERTY CXX_STANDARD 14)
set_property(TARGET city-pro PROPERTY CXX_STANDARD 14)
Expand All @@ -132,6 +147,9 @@ set_property(TARGET city-pro_subnet PROPERTY CXX_STANDARD 14)
# --start-with-test city-pro)
#set_tests_properties(my_app_valgrind_test PROPERTIES LABELS valgrind)# Add linking dependencies


pybind11_add_module(pycitypro ${CMAKE_CURRENT_LIST_DIR}/source/python_interface.cpp)

if(LIBRT)
target_link_libraries(city-pro ${LIBRT})
target_link_libraries(city-pro_subnet ${LIBRT})
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ In ```make_subnet``` is put by hand the maximum length for a poly extracted from
For own cartography the parameter needs to be changed.
##### COMMENT ON CPU USAGE
`city-pro` utilizes for input file of around 1 GB around 20 GB of RAM.
`Analysis_Paper.py` utilizes for the analysis in parallel of 6 days around 16 GB of RAM.
`Analysis_Paper.py` utilizes for the analysis in parallel of 9 days around 31 GB of RAM.

# GUIDLINES CONTRIBUTORS
#### Cpp
Expand Down Expand Up @@ -273,3 +273,11 @@ Input:
_fcm.csv


# EXPERIMENTAL PYBIND11
Add in ./vcpkg.json if not there, as values of `dependencies`:
`pybind11`,
`jsoncons`
Then:
`cd $WORKSPACE/vcpkg`
`./vcpkg install`

Loading

0 comments on commit f5616f9

Please sign in to comment.