Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: BUILD_DEPS does not include a BUILD_SWIG option #4298

Open
SYury opened this issue Jul 5, 2024 · 2 comments
Open

cmake: BUILD_DEPS does not include a BUILD_SWIG option #4298

SYury opened this issue Jul 5, 2024 · 2 comments
Assignees
Labels
Build: CMake CMake based build issue Feature Request Missing Feature/Wrapper Lang: Python Python wrapper issue

Comments

@SYury
Copy link

SYury commented Jul 5, 2024

What language and solver does this apply to?
CMake build

Describe the problem you are trying to solve.
I'm building OR-Tools Python package from source on an Ubuntu machine:

cmake -S. -Bbuild -DBUILD_DEPS:BOOL=ON -DBUILD_PYTHON=ON -DCMAKE_BUILD_TYPE=Release

I don't have the rights to install packages from apt, so I build the dependencies from source.

Everything is ok when I build the C++ library without Python, but when I build the Python package it fails with Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR). Apparently, BUILD_DEPS does not include SWIG.

Describe the solution you'd like
Fetch and build SWIG from source when both BUILD_DEPS and BUILD_PYTHON are on.

@lperron
Copy link
Collaborator

lperron commented Jul 5, 2024

Unsure.

There are other things you need to install anyway, python-dev for instance, that are not installed by default.

So I am not convinced this will enable sudo-less builds

@Mizux
Copy link
Collaborator

Mizux commented Jul 5, 2024

seems SWIG has a cmake based build
ref: https://github.com/swig/swig/blob/master/CMakeLists.txt

Need to add it to the todo list for 2042 or beyond ^^;

note: may need to try to add it to https://mizux.dev/python-native to fast iterate on the dev then bakcport to or-tools once ready

ps: BUILD_PYTHON set BUILD_DEPS to ON by default, so don't need to specify both ;)
aka by default we prefer to provide a standalone wrapper package (note: we also build every deps as statis lib to avoid to ship dozen of .so + windows don't support RUNPATH..)

or-tools/CMakeLists.txt

Lines 161 to 167 in 528badf

# By default all dependencies are NOT built (i.e. BUILD_DEPS=OFF),
# BUT if building any wrappers (Python, Java or .Net) then BUILD_DEPS=ON.
if(BUILD_PYTHON OR BUILD_JAVA OR BUILD_DOTNET)
option(BUILD_DEPS "Build all dependencies" ON)
else()
option(BUILD_DEPS "Build all dependencies" OFF)
endif()

also

or-tools/CMakeLists.txt

Lines 49 to 53 in 528badf

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel. (default: Release)"
FORCE)
endif()

@Mizux Mizux self-assigned this Jul 5, 2024
@Mizux Mizux added Feature Request Missing Feature/Wrapper Build: CMake CMake based build issue Lang: Python Python wrapper issue labels Jul 5, 2024
@Mizux Mizux changed the title BUILD_DEPS does not include SWIG cmake: BUILD_DEPS does not include a BUILD_SWIG option Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build: CMake CMake based build issue Feature Request Missing Feature/Wrapper Lang: Python Python wrapper issue
Projects
None yet
Development

No branches or pull requests

3 participants