From cb1373a4c7fab4123615274a1964a73f8a023ff8 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 6 Nov 2011 09:30:15 +0100 Subject: [PATCH] rewrote cmake scripts for components --- CMakeLists.txt | 165 +---------------------------------- apps/esmtool/CMakeLists.txt | 4 +- apps/launcher/CMakeLists.txt | 8 +- apps/openmw/CMakeLists.txt | 4 +- cmake/OpenMWMacros.cmake | 12 +++ components/CMakeLists.txt | 66 ++++++++++++++ 6 files changed, 87 insertions(+), 172 deletions(-) create mode 100644 components/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 2edd7ac5e..723d10b34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,168 +82,6 @@ ELSE() message (STATUS "OpenMW pre-built binaries not found. Using standard locations.") ENDIF() -# source directory: components -set(COMP_DIR ${CMAKE_SOURCE_DIR}/components) - -set(BSA - ${COMP_DIR}/bsa/bsa_archive.cpp - ${COMP_DIR}/bsa/bsa_file.cpp) -set(BSA_HEADER - ${COMP_DIR}/bsa/bsa_archive.hpp - ${COMP_DIR}/bsa/bsa_file.hpp) -source_group(components\\bsa FILES ${BSA} ${BSA_HEADER}) - -set(CFG - ${COMP_DIR}/cfg/configurationmanager.cpp - ) -set(CFG_HEADER - ${COMP_DIR}/cfg/configurationmanager.hpp - ) -source_group(components\\cfg FILES ${CFG} ${CFG_HEADER}) - -set(NIF - ${COMP_DIR}/nif/nif_file.cpp) -set(NIF_HEADER - ${COMP_DIR}/nif/controlled.hpp - ${COMP_DIR}/nif/effect.hpp - ${COMP_DIR}/nif/nif_types.hpp - ${COMP_DIR}/nif/record.hpp - ${COMP_DIR}/nif/controller.hpp - ${COMP_DIR}/nif/extra.hpp - ${COMP_DIR}/nif/node.hpp - ${COMP_DIR}/nif/record_ptr.hpp - ${COMP_DIR}/nif/data.hpp - ${COMP_DIR}/nif/nif_file.hpp - ${COMP_DIR}/nif/property.hpp) -source_group(components\\nif FILES ${NIF} ${NIF_HEADER}) - -set(NIFOGRE - ${COMP_DIR}/nifogre/ogre_nif_loader.cpp) -set(NIFOGRE_HEADER - ${COMP_DIR}/nifogre/ogre_nif_loader.hpp) -source_group(components\\nifogre FILES ${NIFOGRE} ${NIFOGRE_HEADER}) - -set(NIFBULLET - ${COMP_DIR}/nifbullet/bullet_nif_loader.cpp) -set(NIFBULLET_HEADER - ${COMP_DIR}/nifbullet/bullet_nif_loader.hpp) -source_group(components\\nifbullet FILES ${NIFBULLET} ${NIFBULLET_HEADER}) - -set(TO_UTF8 - ${COMP_DIR}/to_utf8/to_utf8.cpp) -set(TO_UTF8_HEADER - ${COMP_DIR}/to_utf8/to_utf8.hpp) -source_group(components\\to_utf8 FILES ${TO_UTF8} ${TO_UTF8_HEADER}) - -set(FILE_FINDER - ${COMP_DIR}/file_finder/search.cpp) -set(FILE_FINDER_HEADER - ${COMP_DIR}/file_finder/file_finder.hpp - ${COMP_DIR}/file_finder/filename_less.hpp - ${COMP_DIR}/file_finder/search.hpp) -source_group(components\\file_finder FILES ${FILE_FINDER} ${FILE_FINDER_HEADER}) - -set(ESM_STORE - ${COMP_DIR}/esm_store/store.cpp) -set(ESM_STORE_HEADER - ${COMP_DIR}/esm_store/cell_store.hpp - ${COMP_DIR}/esm_store/reclists.hpp - ${COMP_DIR}/esm_store/store.hpp) -source_group(components\\esm_store FILES ${ESM_STORE} ${ESM_STORE_HEADER}) - -file(GLOB ESM_HEADER ${COMP_DIR}/esm/*.hpp) -set(ESM - ${COMP_DIR}/esm/attr.cpp - ${COMP_DIR}/esm/esm_reader.cpp - ${COMP_DIR}/esm/loadland.cpp - ${COMP_DIR}/esm/loadacti.cpp - ${COMP_DIR}/esm/loadalch.cpp - ${COMP_DIR}/esm/loadappa.cpp - ${COMP_DIR}/esm/loadarmo.cpp - ${COMP_DIR}/esm/loadbody.cpp - ${COMP_DIR}/esm/loadbook.cpp - ${COMP_DIR}/esm/loadbsgn.cpp - ${COMP_DIR}/esm/loadcell.cpp - ${COMP_DIR}/esm/loadclas.cpp - ${COMP_DIR}/esm/loadclot.cpp - ${COMP_DIR}/esm/loadcont.cpp - ${COMP_DIR}/esm/loadcrea.cpp - ${COMP_DIR}/esm/loaddial.cpp - ${COMP_DIR}/esm/loaddoor.cpp - ${COMP_DIR}/esm/loadench.cpp - ${COMP_DIR}/esm/loadfact.cpp - ${COMP_DIR}/esm/loadglob.cpp - ${COMP_DIR}/esm/loadgmst.cpp - ${COMP_DIR}/esm/loadinfo.cpp - ${COMP_DIR}/esm/loadingr.cpp - ${COMP_DIR}/esm/loadlevlist.cpp - ${COMP_DIR}/esm/loadligh.cpp - ${COMP_DIR}/esm/loadlocks.cpp - ${COMP_DIR}/esm/loadltex.cpp - ${COMP_DIR}/esm/loadmgef.cpp - ${COMP_DIR}/esm/loadmisc.cpp - ${COMP_DIR}/esm/loadnpc.cpp - ${COMP_DIR}/esm/loadpgrd.cpp - ${COMP_DIR}/esm/loadrace.cpp - ${COMP_DIR}/esm/loadregn.cpp - ${COMP_DIR}/esm/loadscpt.cpp - ${COMP_DIR}/esm/loadskil.cpp - ${COMP_DIR}/esm/loadsndg.cpp - ${COMP_DIR}/esm/loadsoun.cpp - ${COMP_DIR}/esm/loadspel.cpp - ${COMP_DIR}/esm/loadsscr.cpp - ${COMP_DIR}/esm/loadstat.cpp - ${COMP_DIR}/esm/loadweap.cpp - -) -source_group(components\\esm FILES ${ESM_HEADER} ${ESM}) - -set(MISC - ${COMP_DIR}/misc/stringops.cpp - ) -set(MISC_HEADER - ${COMP_DIR}/misc/slice_array.hpp - ${COMP_DIR}/misc/stringops.hpp - ) -source_group(components\\misc FILES ${MISC} ${MISC_HEADER}) - -set(FILES - ${COMP_DIR}/files/linuxpath.cpp - ${COMP_DIR}/files/windowspath.cpp - ${COMP_DIR}/files/macospath.cpp - ${COMP_DIR}/files/multidircollection.cpp - ${COMP_DIR}/files/collections.cpp - ${COMP_DIR}/files/fileops.cpp - ) -set(FILES_HEADER - ${COMP_DIR}/files/linuxpath.hpp - ${COMP_DIR}/files/windowspath.hpp - ${COMP_DIR}/files/macospath.hpp - ${COMP_DIR}/files/path.hpp - ${COMP_DIR}/files/multidircollection.hpp - ${COMP_DIR}/files/collections.hpp - ${COMP_DIR}/files/fileops.hpp - ) -source_group(components\\files FILES ${FILES} ${FILES_HEADER}) - -file(GLOB COMPILER ${COMP_DIR}/compiler/*.cpp) -file(GLOB COMPILER_HEADER ${COMP_DIR}/compiler/*.hpp) -source_group(components\\compiler FILES ${COMPILER} ${COMPILER_HEADER}) - -file(GLOB INTERPRETER ${COMP_DIR}/interpreter/*.cpp) -file(GLOB INTERPRETER_HEADER ${COMP_DIR}/interpreter/*.hpp) -source_group(components\\interpreter FILES ${INTERPRETER} ${INTERPRETER_HEADER}) - -set(COMPONENTS ${BSA} ${NIF} ${NIFOGRE} ${ESM_STORE} ${MISC} ${TO_UTF8} - ${COMPILER} ${INTERPRETER} ${ESM} ${FILE_FINDER} ${NIFBULLET} ${FILES} - ${CFG} - ) -set(COMPONENTS_HEADER ${BSA_HEADER} ${NIF_HEADER} ${NIFOGRE_HEADER} ${ESM_STORE_HEADER} - ${ESM_HEADER} ${MISC_HEADER} ${COMPILER_HEADER} ${TO_UTF8_HEADER} - ${INTERPRETER_HEADER} ${FILE_FINDER_HEADER} ${NIFBULLET_HEADER} ${FILES_HEADER} - ${CFG_HEADER} - ) - # source directory: libs set(LIBDIR ${CMAKE_SOURCE_DIR}/libs) @@ -513,6 +351,9 @@ if(DPKG_PROGRAM) include(CPack) endif(DPKG_PROGRAM) +# Components +add_subdirectory (components) + # Apps and tools add_subdirectory( apps/openmw ) diff --git a/apps/esmtool/CMakeLists.txt b/apps/esmtool/CMakeLists.txt index 583f1fabd..f2ab7bce7 100644 --- a/apps/esmtool/CMakeLists.txt +++ b/apps/esmtool/CMakeLists.txt @@ -8,13 +8,11 @@ source_group(apps\\esmtool FILES ${ESMTOOL}) # Main executable add_executable(esmtool ${ESMTOOL} - ${MISC} ${MISC_HEADER} - ${TO_UTF8} - ${ESM} ) target_link_libraries(esmtool ${Boost_LIBRARIES} + components ) #if (APPLE) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index de8f0256c..a8ce0e553 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -50,11 +50,6 @@ include(${QT_USE_FILE}) # Main executable add_executable(omwlauncher ${LAUNCHER} - ${MISC} ${MISC_HEADER} - ${FILES} ${FILES_HEADER} - ${CFG} ${CFG_HEADER} - ${TO_UTF8} - ${ESM} ${RCC_SRCS} ${MOC_SRCS} ) @@ -64,6 +59,7 @@ target_link_libraries(omwlauncher ${OGRE_LIBRARIES} ${QT_LIBRARIES} ${PNG_LIBRARY} + components ) if(DPKG_PROGRAM) @@ -78,7 +74,7 @@ if (APPLE) else() configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.qss") - + configure_file(${CMAKE_SOURCE_DIR}/files/launcher.cfg "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.cfg") endif() diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 4723ff1d7..90b752264 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -59,13 +59,15 @@ add_openmw_dir (mwmechanics # Main executable add_executable(openmw - ${COMPONENTS} ${COMPONENTS_HEADER} ${OPENMW_LIBS} ${OPENMW_LIBS_HEADER} + ${CONPONENT_FILES} ${OPENMW_FILES} ${GAME} ${GAME_HEADER} ${APPLE_BUNDLE_RESOURCES} ) +target_link_libraries (openmw components) + # Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING # when we change the backend. include_directories(${SOUND_INPUT_INCLUDES} ${BULLET_INCLUDE_DIRS}) diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake index 4f363fb63..c40936691 100644 --- a/cmake/OpenMWMacros.cmake +++ b/cmake/OpenMWMacros.cmake @@ -10,3 +10,15 @@ endforeach (f) endforeach (u) source_group ("apps\\openmw\\${dir}" FILES ${files}) endmacro (add_openmw_dir) + +macro (add_component_dir dir) +set (files) +foreach (u ${ARGN}) +file (GLOB ALL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.*") +foreach (f ${ALL}) +list (APPEND files "${f}") +list (APPEND COMPONENT_FILES "${f}") +endforeach (f) +endforeach (u) +source_group ("components\\${dir}" FILES ${files}) +endmacro (add_component_dir) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt new file mode 100644 index 000000000..76e68dd89 --- /dev/null +++ b/components/CMakeLists.txt @@ -0,0 +1,66 @@ +project (Components) + +# source files + +add_component_dir (bsa + bsa_archive bsa_file + ) + +add_component_dir (cfg + configurationmanager + ) + +add_component_dir (nif + controlled effect nif_types record controller extra node record_ptr data nif_file property + ) + +add_component_dir (nifogre + ogre_nif_loader + ) + +add_component_dir (nifbullet + bullet_nif_loader + ) + +add_component_dir (to_utf8 + to_utf8 + ) + +add_component_dir (file_finder + file_finder filename_less search + ) + +add_component_dir (esm_store + cell_store reclists store + ) + +add_component_dir (esm + attr defs esm_reader loadacti loadalch loadappa loadarmo loadbody loadbook loadbsgn loadcell + loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst + loadinfo loadingr loadland loadlevlist loadligh loadlocks loadltex loadmgef loadmisc loadnpcc + loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat + loadweap records + ) + +add_component_dir (misc + slice_array stringops + ) + +add_component_dir (files + linuxpath windowspath macospath path multidircollection collections fileops + ) + +add_component_dir (compiler + context controlparser errorhandler exception exprparser extensions fileparser generator + lineparser literals locals output parser scanner scriptparser skipparser streamerrorhandler + stringparser tokenloc + ) + +add_component_dir (interpreter + context controlopcodes genericopcodes installopcodes interpreter localopcodes mathopcodes + miscopcodes opcodes runtime scriptopcodes spatialopcodes types + ) + +include_directories(${BULLET_INCLUDE_DIRS}) + +add_library (components STATIC ${COMPONENT_FILES})