diff --git a/CMakeLists.txt b/CMakeLists.txt index daf17ba3d..2edd7ac5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,12 @@ IF (APPLE) set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk") ENDIF (APPLE) +# Macros + +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) + +include (OpenMWMacros) + # Version set (OPENMW_VERSION_MAJOR 0) @@ -76,9 +82,6 @@ ELSE() message (STATUS "OpenMW pre-built binaries not found. Using standard locations.") ENDIF() -# Add path for CMake scripts -set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) - # source directory: components set(COMP_DIR ${CMAKE_SOURCE_DIR}/components) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 54abb948a..6874b3746 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -15,26 +15,9 @@ set(GAME_HEADER config.hpp) source_group(game FILES ${GAME} ${GAME_HEADER}) -set(GAMEREND - mwrender/rendering_manager.cpp - mwrender/mwscene.cpp - mwrender/cellimp.cpp - mwrender/interior.cpp - mwrender/exterior.cpp - mwrender/sky.cpp - mwrender/player.cpp +add_openmw_dir (mwrender + rendering_manager mwscene cellimp interior exterior sky player ) -set(GAMEREND_HEADER - mwrender/rendering_manager.hpp - mwrender/cell.hpp - mwrender/cellimp.hpp - mwrender/mwscene.hpp - mwrender/interior.hpp - mwrender/exterior.hpp - mwrender/sky.hpp - mwrender/player.hpp - ) -source_group(apps\\openmw\\mwrender FILES ${GAMEREND} ${GAMEREND_HEADER}) set(GAMEINPUT mwinput/inputmanager.cpp @@ -237,10 +220,10 @@ set(GAMEMECHANICS_HEADER ) source_group(apps\\openmw\\mwmechanics FILES ${GAMEMECHANICS} ${GAMEMECHANICS_HEADER}) -set(OPENMW_CPP ${GAME} ${GAMEREND} ${GAMEINPUT} ${GAMESCRIPT} ${GAMESOUND} ${GAMEGUI} ${GAMEWORLD} +set(OPENMW_CPP ${GAME} ${GAMEINPUT} ${GAMESCRIPT} ${GAMESOUND} ${GAMEGUI} ${GAMEWORLD} ${GAMECLASS} ${GAMEMECHANICS} ${GAMEDIALOGUE} ) -set(OPENMW_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESCRIPT_HEADER} +set(OPENMW_HEADER ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESCRIPT_HEADER} ${GAMESOUND_HEADER} ${GAMEGUI_HEADER} ${GAMEWORLD_HEADER} ${GAMECLASS_HEADER} ${GAMEMECHANICS_HEADER} ${GAMEDIALOG_HEADERUE} ) @@ -249,6 +232,7 @@ set(OPENMW_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESC add_executable(openmw ${COMPONENTS} ${COMPONENTS_HEADER} ${OPENMW_LIBS} ${OPENMW_LIBS_HEADER} + ${OPENMW_FILES} ${OPENMW_CPP} ${OPENMW_HEADER} ${APPLE_BUNDLE_RESOURCES} ) diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake new file mode 100644 index 000000000..9b4e2bd4e --- /dev/null +++ b/cmake/OpenMWMacros.cmake @@ -0,0 +1,9 @@ + +macro (add_openmw_dir dir) +set (files) +foreach (u ${ARGN}) +list (APPEND files "${dir}/${u}") +list (APPEND OPENMW_FILES "${dir}/${u}") +endforeach (u) +source_group (apps\\openmw\\${dir} FILES ${files}) +endmacro (add_openmw_dir)