"Using Ogre in your App" cmake error

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
jwwalker
Goblin
Posts: 224
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 17
Contact:

"Using Ogre in your App" cmake error

Post by jwwalker »

I was trying to follow the instructions for Using Ogre in your App, in the section "Creating your application with 'EmptyProject' script", on macOS 11.6. I created a symbolic link EmptyProject/Dependencies/Ogre pointing to my Ogre repository. Then, with my working directory being EmptyProject, I ran the command:

Code: Select all

cmake -G Xcode .
The output was:
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode-beta5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode-beta5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMake/Dependencies/OGRE.cmake:148 (endmacro):
Flow control statements are not properly nested.
Call Stack (most recent call first):
CMakeLists.txt:19 (include)


-- Configuring incomplete, errors occurred!
See also "/Volumes/Work/non-repo-libraries/EmptyProject/CMakeFiles/CMakeOutput.log".
I can't make head or tails of CMakeOutput.log.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: "Using Ogre in your App" cmake error

Post by dark_sylinc »

Fixed. Thanks for the report!
jwwalker
Goblin
Posts: 224
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 17
Contact:

Re: "Using Ogre in your App" cmake error

Post by jwwalker »

OK, thanks. With that change, I then got a file not found error on EmptyProject/Dependencies/Ogre/build/include/OgreBuildSettings.h. Apparently the script is assuming that my build output is in a folder "build" in the Ogre repository, which is not where I put it. I addressed that by adding a symbolic link, "build", pointing to the actual build folder. Now I get this:
-- Detected DLL build of Ogre
-- Found SDL2: /usr/local/lib/libSDL2main.a;/usr/local/lib/libSDL2.dylib;-framework Cocoa
-- Found SDL2
-- Copying Hlms data files from Ogre repository
-- Copying Common data files from Ogre repository
-- Copying DLLs and generating Plugins.cfg for Debug
-- Copying DLLs and generating Plugins.cfg for Release
-- Copying DLLs and generating Plugins.cfg for RelWithDebInfo
-- Copying DLLs and generating Plugins.cfg for MinSizeRel
-- Generating /Volumes/Work/non-repo-libraries/EmptyProject/bin/Data/resources2.cfg from template
/Volumes/Work/non-repo-libraries/EmptyProject/CMake/Templates/Resources.cfg.in
-- Copying OgreSamplesCommon cpp and header files to
/Volumes/Work/non-repo-libraries/EmptyProject/include/OgreCommon
/Volumes/Work/non-repo-libraries/EmptyProject/src/OgreCommon/
-- Configuring done
CMake Error at CMakeLists.txt:53 (add_executable):
Cannot find source file:

./Data/Resources.cfg

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc


CMake Error at CMakeLists.txt:53 (add_executable):
No SOURCES given to target: EmptyProject


CMake Generate step failed. Build files cannot be regenerated correctly.
I don't see a Resources.cfg file in a Data folder anywhere.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: "Using Ogre in your App" cmake error

Post by dark_sylinc »

jwwalker wrote: Sat Sep 25, 2021 6:09 pm OK, thanks. With that change, I then got a file not found error on EmptyProject/Dependencies/Ogre/build/include/OgreBuildSettings.h. Apparently the script is assuming that my build output is in a folder "build" in the Ogre repository, which is not where I put it. I addressed that by adding a symbolic link, "build", pointing to the actual build folder. Now I get this:
That's by far the easiest solution. You can also explicitly set another build path using the OGRE_BINARIES CMake variable.
jwwalker wrote: Sat Sep 25, 2021 6:09 pmI don't see a Resources.cfg file in a Data folder anywhere.
I'm not right now near a macOS machine. Could you try this patch?

Code: Select all

diff --git a/Samples/2.0/Tutorials/EmptyProject/CMakeLists.txt b/Samples/2.0/Tutorials/EmptyProject/CMakeLists.txt
index 7089dff51e..8f0a062a75 100644
--- a/Samples/2.0/Tutorials/EmptyProject/CMakeLists.txt
+++ b/Samples/2.0/Tutorials/EmptyProject/CMakeLists.txt
@@ -47,7 +47,7 @@ add_recursive( ./include HEADERS )
 
 if( APPLE )
 	file( GLOB_RECURSE RESOURCES ./src/*.storyboard )
-	set( RESOURCES ${RESOURCES} ./Data/Resources.cfg ./bin/Data )
+	set( RESOURCES ${RESOURCES} ./Data/resources2.cfg ./bin/Data )
 endif()
 
 add_executable( ${PROJECT_NAME} WIN32 MACOSX_BUNDLE ${SOURCES} ${HEADERS} ${RESOURCES} )
The CMake script automatically generates resources2.cfg file and it is supposed to be included into the XCode project so that it is bundled with the app; alongside with anything that is dropped into the bin/Data folder.

If the sample complains that files couldn't be loaded because resources2.cfg couldn't be found then likely the patch should be this instead:

Code: Select all

diff --git a/Samples/2.0/Tutorials/EmptyProject/CMakeLists.txt b/Samples/2.0/Tutorials/EmptyProject/CMakeLists.txt
index 7089dff51e..8f0a062a75 100644
--- a/Samples/2.0/Tutorials/EmptyProject/CMakeLists.txt
+++ b/Samples/2.0/Tutorials/EmptyProject/CMakeLists.txt
@@ -47,7 +47,7 @@ add_recursive( ./include HEADERS )
 
 if( APPLE )
 	file( GLOB_RECURSE RESOURCES ./src/*.storyboard )
-	set( RESOURCES ${RESOURCES} ./Data/Resources.cfg ./bin/Data )
+	set( RESOURCES ${RESOURCES} ./bin/Data )
 endif()
 
 add_executable( ${PROJECT_NAME} WIN32 MACOSX_BUNDLE ${SOURCES} ${HEADERS} ${RESOURCES} )
jwwalker
Goblin
Posts: 224
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 17
Contact:

Re: "Using Ogre in your App" cmake error

Post by jwwalker »

With the first patch, it complains that it can't find ./Data/resources2.cfg. With the second patch, the error is
CMake Error: Target EmptyProject Info.plist template "/Volumes/Work/non-repo-libraries/EmptyProject/src/Info.plist" could not be found.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: "Using Ogre in your App" cmake error

Post by dark_sylinc »

Ah! There is no such file!!!

The one from Samples/2.0/Common/src/System/OSX/Resources/Info.plist should work. I should test EmptyProject on macOS to iron out these issues.

I am impressed by your patience and perseverance to get Ogre3D on macOS working reliably :oops: :oops: :wink:
jwwalker
Goblin
Posts: 224
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 17
Contact:

Re: "Using Ogre in your App" cmake error

Post by jwwalker »

dark_sylinc wrote: Sun Sep 26, 2021 2:13 am Ah! There is no such file!!!

The one from Samples/2.0/Common/src/System/OSX/Resources/Info.plist should work. I should test EmptyProject on macOS to iron out these issues.
The last attempt with cmake did get as far as creating an EmptyProject.xcodeproj file, so I tried adding that Info.plist. Attempting to build that project produces the error
EmptyProject/src/OgreCommon/System/iOS/Resources/Main.storyboard: error: iOS storyboards do not support target device type "mac".
That would be great if you could iron out these issues. :)
dark_sylinc wrote: Sun Sep 26, 2021 2:13 amI am impressed by your patience and perseverance to get Ogre3D on macOS working reliably :oops: :oops: :wink:
I need a new rendering engine for a Mac/Windows app that currently uses OpenGL. I spent months looking at Filament before deciding that its lighting options were too limited, so I hope I can make Ogre work.
Post Reply