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 86e0adc8d..4723ff1d7 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -15,241 +15,54 @@ set(GAME_HEADER config.hpp) source_group(game FILES ${GAME} ${GAME_HEADER}) -set(GAMEREND - mwrender/renderingmanager.cpp - mwrender/debugging.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/renderingmanager.hpp - mwrender/cell.hpp - mwrender/cellimp.hpp - mwrender/debugging.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 -) -set(GAMEINPUT_HEADER - mwinput/inputmanager.hpp) -source_group(apps\\openmw\\mwinput FILES ${GAMEINPUT} ${GAMEINPUT_HEADER}) +add_openmw_dir (mwinput + inputmanager + ) -set(GAMEGUI_HEADER - mwgui/layouts.hpp - mwgui/text_input.hpp - mwgui/widgets.hpp - mwgui/race.hpp - mwgui/class.hpp - mwgui/birth.hpp - mwgui/review.hpp - mwgui/window_manager.hpp - mwgui/console.hpp - mwgui/dialogue.hpp - mwgui/dialogue_history.hpp - mwgui/window_base.hpp - mwgui/stats_window.hpp - mwgui/messagebox.hpp -) -set(GAMEGUI - mwgui/window_manager.cpp - mwgui/layouts.cpp - mwgui/console.cpp - mwgui/text_input.cpp - mwgui/widgets.cpp - mwgui/race.cpp - mwgui/birth.cpp - mwgui/class.cpp - mwgui/review.cpp - mwgui/dialogue.cpp - mwgui/dialogue_history.cpp - mwgui/window_base.cpp - mwgui/stats_window.cpp - mwgui/messagebox.cpp -) -source_group(apps\\openmw\\mwgui FILES ${GAMEGUI_HEADER} ${GAMEGUI}) +add_openmw_dir (mwgui + layouts text_input widgets race class birth review window_manager console dialogue + dialogue_history window_base stats_window messagebox + ) -set(GAMEDIALOGUE_HEADER - mwdialogue/dialoguemanager.hpp - mwdialogue/journal.hpp - mwdialogue/journalentry.hpp - mwdialogue/quest.hpp - mwdialogue/topic.hpp -) -set(GAMEDIALOGUE - mwdialogue/dialoguemanager.cpp - mwdialogue/journal.cpp - mwdialogue/journalentry.cpp - mwdialogue/quest.cpp - mwdialogue/topic.cpp -) -source_group(apps\\openmw\\mwdialogue FILES ${GAMEDIALOGUE_HEADER} ${GAMEDIALOGUE}) +add_openmw_dir (mwdialogue + dialoguemanager journal journalentry quest topic + ) -set(GAMESCRIPT - mwscript/scriptmanager.cpp - mwscript/compilercontext.cpp - mwscript/interpretercontext.cpp - mwscript/cellextensions.cpp - mwscript/miscextensions.cpp - mwscript/guiextensions.cpp - mwscript/soundextensions.cpp - mwscript/skyextensions.cpp - mwscript/statsextensions.cpp - mwscript/containerextensions.cpp - mwscript/aiextensions.cpp - mwscript/controlextensions.cpp - mwscript/extensions.cpp - mwscript/globalscripts.cpp - mwscript/dialogueextensions.cpp +add_openmw_dir (mwscript + locals scriptmanager compilercontext interpretercontext cellextensions miscextensions + guiextensions soundextensions skyextensions statsextensions containerextensions + aiextensions controlextensions extensions globalscripts ref dialogueextensions ) -set(GAMESCRIPT_HEADER - mwscript/locals.hpp - mwscript/scriptmanager.hpp - mwscript/compilercontext.hpp - mwscript/interpretercontext.hpp - mwscript/cellextensions.hpp - mwscript/miscextensions.hpp - mwscript/guiextensions.hpp - mwscript/soundextensions.hpp - mwscript/skyextensions.hpp - mwscript/statsextensions.hpp - mwscript/containerextensions.hpp - mwscript/aiextensions.hpp - mwscript/controlextensions.hpp - mwscript/extensions.hpp - mwscript/globalscripts.hpp - mwscript/ref.hpp - mwscript/dialogueextensions.hpp - ) -source_group(apps\\openmw\\mwscript FILES ${GAMESCRIPT} ${GAMESCRIPT_HEADER}) -set(GAMESOUND - mwsound/soundmanager.cpp) -set(GAMESOUND_HEADER - mwsound/soundmanager.hpp) -source_group(apps\\openmw\\mwsound FILES ${GAMESOUND} ${GAMESOUND_HEADER}) +add_openmw_dir (mwsound + soundmanager + ) -set(GAMEWORLD - mwworld/world.cpp - mwworld/scene.cpp - mwworld/physicssystem.cpp - mwworld/globals.cpp - mwworld/class.cpp - mwworld/actionteleport.cpp - mwworld/actiontalk.cpp - mwworld/actiontake.cpp - mwworld/containerutil.cpp - mwworld/player.cpp - mwworld/cells.cpp - mwworld/localscripts.cpp +add_openmw_dir (mwworld + refdata world physicssystem scene environment globals class action nullaction actionteleport + containerstore actiontalk actiontake containerstore manualref containerutil player cellfunctors + cells localscripts ) -set(GAMEWORLD_HEADER - mwworld/refdata.hpp - mwworld/world.hpp - mwworld/physicssystem.hpp - mwworld/scene.hpp - mwworld/environment.hpp - mwworld/globals.hpp - mwworld/class.hpp - mwworld/action.hpp - mwworld/nullaction.hpp - mwworld/actionteleport.hpp - mwworld/containerstore.hpp - mwworld/actiontalk.hpp - mwworld/actiontake.hpp - mwworld/containerstore.hpp - mwworld/manualref.hpp - mwworld/containerutil.hpp - mwworld/player.hpp - mwworld/cellfunctors.hpp - mwworld/cells.hpp - mwworld/localscripts.hpp - ) -source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER}) -set(GAMECLASS - mwclass/classes.cpp - mwclass/activator.cpp - mwclass/creature.cpp - mwclass/npc.cpp - mwclass/weapon.cpp - mwclass/armor.cpp - mwclass/potion.cpp - mwclass/apparatus.cpp - mwclass/book.cpp - mwclass/clothing.cpp - mwclass/container.cpp - mwclass/door.cpp - mwclass/ingredient.cpp - mwclass/creaturelevlist.cpp - mwclass/itemlevlist.cpp - mwclass/light.cpp - mwclass/lockpick.cpp - mwclass/misc.cpp - mwclass/probe.cpp - mwclass/repair.cpp - mwclass/static.cpp +add_openmw_dir (mwclass + classes activator creature npc weapon armor potion apparatus book clothing container door + ingredient creaturelevlist itemlevlist light lockpick misc probe repair static ) -set(GAMECLASS_HEADER - mwclass/classes.hpp - mwclass/activator.hpp - mwclass/creature.hpp - mwclass/npc.hpp - mwclass/weapon.hpp - mwclass/armor.hpp - mwclass/potion.hpp - mwclass/apparatus.hpp - mwclass/book.hpp - mwclass/clothing.hpp - mwclass/container.hpp - mwclass/door.hpp - mwclass/ingredient.hpp - mwclass/creaturelevlist.hpp - mwclass/itemlevlist.hpp - mwclass/light.hpp - mwclass/lockpick.hpp - mwclass/misc.hpp - mwclass/probe.hpp - mwclass/repair.hpp - mwclass/static.hpp - mwclass/containerutil.hpp - ) -source_group(apps\\openmw\\mwclass FILES ${GAMECLASS} ${GAMECLASS_HEADER}) -set(GAMEMECHANICS - mwmechanics/mechanicsmanager.cpp - mwmechanics/magiceffects.cpp - ) -set(GAMEMECHANICS_HEADER - mwmechanics/mechanicsmanager.hpp - mwmechanics/stat.hpp - mwmechanics/creaturestats.hpp - mwmechanics/magiceffects.hpp - mwmechanics/movement.hpp - ) -source_group(apps\\openmw\\mwmechanics FILES ${GAMEMECHANICS} ${GAMEMECHANICS_HEADER}) - -set(OPENMW_CPP ${GAME} ${GAMEREND} ${GAMEINPUT} ${GAMESCRIPT} ${GAMESOUND} ${GAMEGUI} ${GAMEWORLD} - ${GAMECLASS} ${GAMEMECHANICS} ${GAMEDIALOGUE} - ) -set(OPENMW_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESCRIPT_HEADER} - ${GAMESOUND_HEADER} ${GAMEGUI_HEADER} ${GAMEWORLD_HEADER} ${GAMECLASS_HEADER} - ${GAMEMECHANICS_HEADER} ${GAMEDIALOG_HEADERUE} +add_openmw_dir (mwmechanics + mechanicsmanager stat creaturestats magiceffects movement ) # Main executable add_executable(openmw ${COMPONENTS} ${COMPONENTS_HEADER} ${OPENMW_LIBS} ${OPENMW_LIBS_HEADER} - ${OPENMW_CPP} ${OPENMW_HEADER} + ${OPENMW_FILES} + ${GAME} ${GAME_HEADER} ${APPLE_BUNDLE_RESOURCES} ) diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake new file mode 100644 index 000000000..8263763a2 --- /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)