Horde3D

Next-Generation Graphics Engine
It is currently 18.04.2024, 13:37

All times are UTC + 1 hour




Post new topic Reply to topic  [ 59 posts ]  Go to page Previous  1, 2, 3, 4  Next

Prefered Build System for Horde3D
Poll ended at 14.05.2008, 20:06
CMake 57%  57%  [ 4 ]
waf 14%  14%  [ 1 ]
Other 29%  29%  [ 2 ]
Total votes : 7
Author Message
PostPosted: 21.05.2008, 15:14 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
Volker wrote:
Finally I started with testing your CMake patch. Unfortunately I didn't get GNU patch to integrate it correctly so I had to apply it manually.

Can you send me the error message? Did you rename the folders before patching?


Top
 Profile  
Reply with quote  
PostPosted: 21.05.2008, 16:01 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Calling
Code:
patch -i cmake-r3.patch

from trunk directory results in
Quote:
patching file CMakeLists.txt
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


I have renamed the directories to remove the spaces as you suggested. But don't worry about that to much, since I suggest to include the CMake files
as well as the glfw package in the svn repository anyway. But first I want to make sure everything is working fine at least under windows and linux. Maybe I can also borrow a macintosh to test it on this platform too.


Top
 Profile  
Reply with quote  
PostPosted: 22.05.2008, 16:04 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
Codepoet wrote:

I have modified your CMake files to accept spaces in the directory names, and added preliminary Mac support.

Attachment:
cmake-r3-mac-b1.tgz [4.37 KiB]
Downloaded 535 times


It now builds fully on Mac, but it doesn't output properly packaged Mac binaries as yet. Hopefully those will happen in the next few days - as soon as I finish reading the last 2 years cmake mailing lists ;)

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 23.05.2008, 11:51 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
Volker: "patch -p1 -i cmake-r3.patch" should work.
glfw linker errors on win32:
My cmake files produce a static version of glfw. Then GLFW_DLL must not be defined when including glfw.h. Try to remove the defines in the samples before the glfw include directive.

swiftcoder: Your file with removed spaces does not work on Linux. cmake runs fine, but make fails claiming it can't find some files. I'd prefer to remove the spaces since other tools don't like them, too.


Top
 Profile  
Reply with quote  
PostPosted: 23.05.2008, 13:00 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
Codepoet wrote:
swiftcoder: Your file with removed spaces does not work on Linux. cmake runs fine, but make fails claiming it can't find some files. I'd prefer to remove the spaces since other tools don't like them, too.
Meh, and I even tested it on windows, --score for linux today. Double quoting doesn't work either?

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 23.05.2008, 13:30 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
I've tried a few things before removing the spaces from the directory names... But nothing worked. I assume it's a problem in the makefile generator of cmake.


Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 13:11 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
@Codepoet Thanks for the tip with the preprocessor flag. That was the solution.

So finally I got it working under windows too.

The only thing I'm not very satisfied with is the handling of the content directory. If I create a Visual Studio Solution based on CMake, the working directory when debugging the application from within Visual Studio is the directory that contains the .vcproj file. Unfortunately this does not match with the Horde3DUtils::loadResourcesFromDisk( "../Content" ); statement used in the samples. So I changed the samples to use a path generated from argv[0] and adjusted the CMake files to create the executables in the Binaries directory. Additionally I changed the subsystem of the samples under windows from Console to Windows. I will now check if this configuration is also working under linux.

Another problem may be the automatic creation of the egExtension.cpp
Using the method proposed by Codepoet forces the use of CMake. So we can't ship preconfigured files e.g. for Visual Studio. I'm wondering if this would be a problem.


Attachments:
File comment: Patch created with TortoiseSVN
cmake-r5.zip [4.15 KiB]
Downloaded 548 times
Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 15:45 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
I've had some problems with your patch. Got rejects for the samples and had to integrate manually. Now it's in my git repo, branch cmake with swiftcoders fixes. It compiles fine, even with cmake 2.4. But then it does not put the generated files into the Binary folder.
With 2.6 it puts them into the Binary folder, but I have to move all samples into a subfolder of "Binaries"... But that can be fixed with another path specification inside the source.

I'm using another solution for this problem in my Python projects. I'm using a command line argument "--content PATH" which can be given any number of times to add the paths to the content directories. That way I avoid messing with paths in my source code.
But then cmake must generate project files which pass this options string to the executables to allow easy debugging.


cmake dependency:
At least for "makefile" projects under Linux an installed version of cmake is necessary.


Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 16:04 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Hadn't time to check it with linux yet. But concerning the 2.4 version of CMake, this is true, since the CMAKE_LIBRARY_OUTPUT_DIRECTORY and CMAKE_RUNTIME_OUTPUT_DIRECTORY seem to be introduced with 2.6. In 2.4 I think they are called EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH.

Under Windows CMake added the configuration name automatically (although I couldn't figure out why) so the final binary was put into e.g. Binaries/Debug. That's why I thought it would be ok to set ../Content as content directory.

The problem with command line arguments is that you can't specify them easily in CMake. Command line parameters are stored in a special file of Visual Studio that can't be generated automatically by CMake.


Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 16:43 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
Add both paths or fix the visual studio target?


I found a problem:
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Horde3D/Binaries CACHE STRING "Where libraries go" FORCE)
should also be enabled for Linux. Just remove the IF(WIN32) / ENDIF(WIN32) part.


Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 16:58 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
I think we can avoid setting the library path anyway, since dlls seem to be treated as runtime.

So currently under Linux and CMake 2.4.7 I got a working solution with the following root CMakeLists.txt
Code:
cmake_minimum_required(VERSION 2.4)

# Avoid warning under CMake 2.6
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)   
  cmake_policy(SET CMP0003 NEW)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)

project(Horde3D)

# accumulate list of sources of extension modules
# this can not be done inside the Extensions folder since cmake can only pass variables to subdirectories, never upwards...
set(HORDE3D_EXTENSION_SOURCES)
set(HORDE3D_EXTENSION_INCLUDES)
set(HORDE3D_EXTENSION_INSTALLS)


# terrain extension (check egExtensions.cpp if it's activated)
option(HORDE3D_BUILD_TERRAIN "Build the terrain extension into Horde3D" ON)
if(HORDE3D_BUILD_TERRAIN)
   set(HORDE3D_EXTENSION_SOURCES
      ${HORDE3D_EXTENSION_SOURCES}
      ${Horde3D_SOURCE_DIR}/Extensions/Terrain/Source/terrain.cpp
      ${Horde3D_SOURCE_DIR}/Extensions/Terrain/Source/extension.cpp
      )
   set(HORDE3D_EXTENSION_INSTALLS
      ${HORDE3D_EXTENSION_INSTALLS}
      "installExtension(Horde3DTerrain::getExtensionName, Horde3DTerrain::initExtension, Horde3DTerrain::releaseExtension);\n"
      )
   set(HORDE3D_EXTENSION_INCLUDES
      ${HORDE3D_EXTENSION_INCLUDES}
      "#include \"Extensions/Terrain/Source/extension.h\"\n"
      )
endif(HORDE3D_BUILD_TERRAIN)

IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)   
  IF(WIN32)
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Horde3D/Binaries
     CACHE STRING "Where binaries and .dll files go" FORCE) 
  ELSE(WIN32)
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/${CMAKE_SYSTEM_NAME}
       CACHE STRING "Where binaries and .dll files go" FORCE)
  ENDIF(WIN32)
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)   
  IF(WIN32)
    SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Horde3D/Binaries
     CACHE STRING "Where binaries and .dll files go" FORCE) 
  ELSE(WIN32)
     SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/${CMAKE_SYSTEM_NAME}
     CACHE STRING "Where binaries and .dll files go" FORCE)   
  ENDIF(WIN32)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)

# create egExtensions.cpp
CONFIGURE_FILE(Horde3D/Source/Horde3DEngine/egExtensions_auto_include.h.in ${CMAKE_BINARY_DIR}/egExtensions_auto_include.h)
CONFIGURE_FILE(Horde3D/Source/Horde3DEngine/egExtensions_auto_install.h.in ${CMAKE_BINARY_DIR}/egExtensions_auto_install.h)

add_subdirectory(Horde3D)
add_subdirectory(Extensions)


Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 17:01 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
I have to add, that I suppose that CMake 2.6 does add the configuration. That's why I added the CMAKE_SYSTEM_NAME as a subdirectory in Binaries. I haven't checked yet if that's the reason for the additional Debug directory I got under Windows.


Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 17:16 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Just checked it under Linux with CMake 2.6: Here the configuration is not added, so it seems like this is a special "feature" of the Windows version of CMake

[edit] Updated the CMakeFiles.txt above


Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 17:57 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
This file works for me with cmake 2.4 and cmake 2.6 under Linux:
Code:
cmake_minimum_required(VERSION 2.4)
project(Horde3D)


# accumulate list of sources of extension modules
# this can not be done inside the Extensions folder since cmake can only pass variables to subdirectories, never upwards...
set(HORDE3D_EXTENSION_SOURCES)
set(HORDE3D_EXTENSION_INCLUDES)
set(HORDE3D_EXTENSION_INSTALLS)



# terrain extension (check egExtensions.cpp if it's activated)
option(HORDE3D_BUILD_TERRAIN "Build the terrain extension into Horde3D" ON)
if(HORDE3D_BUILD_TERRAIN)
   set(HORDE3D_EXTENSION_SOURCES
      ${HORDE3D_EXTENSION_SOURCES}
      ${Horde3D_SOURCE_DIR}/Extensions/Terrain/Source/terrain.cpp
      ${Horde3D_SOURCE_DIR}/Extensions/Terrain/Source/extension.cpp
      )
   set(HORDE3D_EXTENSION_INSTALLS
      ${HORDE3D_EXTENSION_INSTALLS}
      "installExtension(Horde3DTerrain::getExtensionName, Horde3DTerrain::initExtension, Horde3DTerrain::releaseExtension);\n"
      )
   set(HORDE3D_EXTENSION_INCLUDES
      ${HORDE3D_EXTENSION_INCLUDES}
      "#include \"Extensions/Terrain/Source/extension.h\"\n"
      )
endif(HORDE3D_BUILD_TERRAIN)


IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)
   IF(WIN32)
      SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Horde3D/Binaries
         CACHE STRING "Where binaries and .dll files go" FORCE)
   ELSE(WIN32)
      SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/${CMAKE_SYSTEM_NAME}
         CACHE STRING "Where binaries and .dll files go" FORCE)
   ENDIF(WIN32)
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)
   SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/${CMAKE_SYSTEM_NAME}
      CACHE STRING "Where binaries and .dll files go" FORCE)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)



# create egExtensions.cpp
CONFIGURE_FILE(Horde3D/Source/Horde3DEngine/egExtensions_auto_include.h.in ${CMAKE_BINARY_DIR}/egExtensions_auto_include.h)
CONFIGURE_FILE(Horde3D/Source/Horde3DEngine/egExtensions_auto_install.h.in ${CMAKE_BINARY_DIR}/egExtensions_auto_install.h)

add_subdirectory(Horde3D)
add_subdirectory(Extensions)


cmake 2.6 outputs the following warning message when doing "cmake ..":
Code:
CMake Warning (dev) at Horde3D/Samples/Chicago/CMakeLists.txt:9 (add_executable):
  Policy CMP0003 should be set before this line.  Add code such as

    if(COMMAND cmake_policy)
      cmake_policy(SET CMP0003 NEW)
    endif(COMMAND cmake_policy)

  as early as possible but after the most recent call to
  cmake_minimum_required or cmake_policy(VERSION).  This warning appears
  because target "Chicago" links to some libraries for which the linker must
  search:

    GL

  and other libraries with known full path:

    /home/fnoeding/programming/horde3d/build/Horde3D/Source/Horde3DEngine/libHorde3D.so
    /home/fnoeding/programming/horde3d/build/Horde3D/Source/Horde3DUtils/libHorde3DUtils.so
    /home/fnoeding/programming/horde3d/build/Horde3D/Dependencies/glfw/libglfw.a

  CMake is adding directories in the second list to the linker search path in
  case they are needed to find libraries from the first list (for backwards
  compatibility with CMake 2.4).  Set policy CMP0003 to OLD or NEW to enable
  or disable this behavior explicitly.  Run "cmake --help-policy CMP0003" for
  more information.
This warning is for project developers.  Use -Wno-dev to suppress it.


Probably we should put the .so and .dll files into Binaries/X, too. That does not happen at the moment.


Top
 Profile  
Reply with quote  
PostPosted: 27.05.2008, 18:05 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
The warning with CMake 2.6 can be avoided using the following statement:
Code:
# Avoid warning under CMake 2.6
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)   
  cmake_policy(SET CMP0003 NEW)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)


I already added it to the CMakeLists.txt I posted above.

The DLLs are already build into the same directory as the executables under CMake 2.6. So we only have to add the specific command for 2.4. Under Linux this seems not to be necessary. I'm not very familiar with the library loading under Linux. Maybe it has something to do with the RPATH settings.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 59 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 33 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group