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 documentation, install for iOS app #87

Open
ArMouReR opened this issue Oct 4, 2021 · 4 comments
Open

cmake documentation, install for iOS app #87

ArMouReR opened this issue Oct 4, 2021 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed triaged Issues that have been triaged

Comments

@ArMouReR
Copy link

ArMouReR commented Oct 4, 2021

Hi,

I am missing any documentation how to compile to static/dynamic lib to use inside iOS app.

I have tried to compile in the usual way, e.g.:

git clone https://github.com/microsoft/glTF-SDK.git
cd glTF-SDK/Build/
cmake ..
cmake --build . --target install

It worked, but install was done in: glTF-SDK/Built/Out/macOS/RelWithDebInfo/GLTFSDK/libGLTFSDK.a

How can I configure cmake to install it into /usr/local/include/ in order to use later in Xcode inside iPhone app ?

@kokuda
Copy link
Member

kokuda commented Oct 4, 2021

Take a look at the macinit.ps1 and macbuild.ps1 PowerShell scripts for the commands needed to build for iOS.

@ArMouReR
Copy link
Author

ArMouReR commented Oct 4, 2021

@kokuda Thanks for pointing out, tried to run init, it stopped with the following error:

CMake Error at Build/CMake/Modules/GLTFPlatform.cmake:88 (target_link_libraries):
  The keyword signature for target_link_libraries has already been used with
  the target "GLTFSDK.Test".  All uses of target_link_libraries with a target
  must be either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * GLTFSDK.Test/CMakeLists.txt:37 (target_link_libraries)

Call Stack (most recent call first):
  GLTFSDK.Test/CMakeLists.txt:46 (AddGLTFIOSAppProperties)


-- Configuring incomplete, errors occurred!

Then started the build script and got the following:

xcodebuild: error: 'GLTFSDK.xcodeproj' does not exist.
Attempting to build package from 'GLTFSDK.macOS.CPP.nuspec'.
WARNING: NU5125: The 'licenseUrl' element will be deprecated. Consider using the 'license' element instead.
WARNING: NU5048: The 'PackageIconUrl'/'iconUrl' element is deprecated. Consider using the 'PackageIcon'/'icon' element instead. Learn more at https://aka.ms/deprecateIconUrl
Successfully created package '/Users/admin/dev/ios/lib/glTF-SDK/Built/Out/NuGet/Microsoft.glTF.macOS.CPP.0.0.0.nupkg'.
Attempting to build package from 'GLTFSDK.iOS.CPP.nuspec'.
Could not find a part of the path '/Users/admin/dev/ios/lib/glTF-SDK/Built/Out/iOS/Debug/GLTFSDK'.

So, what is the general flow ?
All I need is to use it inside iOS app (C++ part), so in my understanding I need an inc folder with all the headers and .a lib that I can add as custom framework in Xcode.

What is the fastest route to get there ?
Any hints are really appreciated.

BTW, what about prebuild nuget package ? I don't think that I need the latest version and existing package may work for me...

@kokuda
Copy link
Member

kokuda commented Oct 4, 2021

Unfortunately, it has been a long time since I ran a mac or iOS build and don't recall the details. I just remembered that those scripts existed (I think I wrote them, but that was over 3 years ago and don't remember much) and thought they would help. You could try dissecting the commands within those scripts and run just the ones you need for iOS.

Take a look at GenerateProjectsIOS() in macinit.ps1 for how to build the xcode project. I don't know if it still works but it might help. I believe that once the xcode project is generated you can build the library using xcode.

@bghgary
Copy link
Contributor

bghgary commented Dec 7, 2023

Dupe or at least related: #70

@bghgary bghgary added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers triaged Issues that have been triaged labels Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed triaged Issues that have been triaged
Projects
None yet
Development

No branches or pull requests

3 participants