Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@captain0xff
Copy link
Contributor

This PR modifies the cmake files to allow building coin using add_subdirectory command of CMake. I have only tested this on my debian linux machine.

@tritao
Copy link
Contributor

tritao commented Apr 11, 2025

Just to add some context to this, we're doing this as part of a FreeCAD effort and would eventually like to include Coin as a submodule.

I have tested as working as well with:

cmake_minimum_required(VERSION 3.10)

project(coin3d-test)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_BUILD_TYPE Debug)

set(COIN_BUILD_EGL 0)
set(COIN_BUILD_GLX 1)
set(COIN_BUILD_EXAMPLES OFF)
set(COIN_BUILD_TESTS OFF)
add_subdirectory(coin)

add_executable(main
    coin/examples/glfw/glfw.cpp
)

target_include_directories(main PRIVATE
    ${CMAKE_BINARY_DIR}/coin/include
    coin/include
)

target_compile_options(main PRIVATE -Wall -pedantic)

target_link_libraries(main PRIVATE Coin glfw GL)

@VolkerEnderlein
Copy link
Member

Thanks for the PR it is highly appreciated. The broken Windows build is not related to your changes. It seems I need to do some adaptions (i.e. set a policy for FindBoost module) to make that work under Windows.

@captain0xff
Copy link
Contributor Author

captain0xff commented Apr 11, 2025

I am glad that you guys found the PR useful :)
I just wanted to include coin as a submodule in my SDL project but @tritao mentioned that this is something that FreeCAD also needs so I created the PR.

@VolkerEnderlein VolkerEnderlein merged commit 8243eaa into coin3d:master Apr 13, 2025
4 of 5 checks passed
@captain0xff captain0xff deleted the add-subdirectory-support branch April 13, 2025 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants