浏览代码

CMake: update all CMakeLists to include actual sources and headers

This make it easier to use project with newer CMake and Qt Creator.
I decided against using GLOB since we don't rename files that much.
Arseniy Shestakov 8 年之前
父节点
当前提交
fb19a3a068

+ 18 - 5
AI/BattleAI/CMakeLists.txt

@@ -5,20 +5,33 @@ include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_D
 
 set(battleAI_SRCS
 		StdInc.cpp
+
+		AttackPossibility.cpp
 		BattleAI.cpp
-		StackWithBonuses.cpp
+		common.cpp
 		EnemyInfo.cpp
-		AttackPossibility.cpp
-		PotentialTargets.cpp
 		main.cpp
-		common.cpp
+		PotentialTargets.cpp
+		StackWithBonuses.cpp
 		ThreatMap.cpp
 )
 
+set(battleAI_HEADERS
+		StdInc.h
+
+		AttackPossibility.h
+		BattleAI.h
+		common.h
+		EnemyInfo.h
+		PotentialTargets.h
+		StackWithBonuses.h
+		ThreatMap.h
+)
+
 if (ANDROID) # android compiles ai libs into main lib directly, so we skip this library and just reuse sources list
 	return()
 endif()
-add_library(BattleAI SHARED ${battleAI_SRCS})
+add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
 target_link_libraries(BattleAI vcmi)
 
 set_target_properties(BattleAI PROPERTIES ${PCH_PROPERTIES})

+ 11 - 3
AI/EmptyAI/CMakeLists.txt

@@ -4,11 +4,19 @@ cmake_minimum_required(VERSION 2.6)
 include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
 
 set(emptyAI_SRCS
-    CEmptyAI.cpp
-    exp_funcs.cpp
+		StdInc.cpp
+
+		CEmptyAI.cpp
+		exp_funcs.cpp
+)
+
+set(emptyAI_HEADERS
+		StdInc.h
+
+		CEmptyAI.h
 )
 
-add_library(EmptyAI SHARED ${emptyAI_SRCS})
+add_library(EmptyAI SHARED ${emptyAI_SRCS} ${emptyAI_HEADERS})
 target_link_libraries(EmptyAI vcmi)
 
 if (NOT APPLE) # Already inside vcmiclient bundle

+ 9 - 2
AI/StupidAI/CMakeLists.txt

@@ -5,11 +5,18 @@ include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_D
 
 set(stupidAI_SRCS
 		StdInc.cpp
-		StupidAI.cpp
+
 		main.cpp
+		StupidAI.cpp
+)
+
+set(stupidAI_HEADERS
+		StdInc.h
+
+		StupidAI.h
 )
 
-add_library(StupidAI SHARED ${stupidAI_SRCS})
+add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
 target_link_libraries(StupidAI vcmi)
 
 set_target_properties(StupidAI PROPERTIES ${PCH_PROPERTIES})

+ 17 - 7
AI/VCAI/CMakeLists.txt

@@ -9,19 +9,29 @@ endif()
 include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
 
 set(VCAI_SRCS
-    StdInc.cpp
-    VCAI.cpp
-    Goals.cpp
-    AIUtility.cpp
-    main.cpp
-    Fuzzy.cpp
+		StdInc.cpp
+
+		AIUtility.cpp
+		Fuzzy.cpp
+		Goals.cpp
+		main.cpp
+		VCAI.cpp
+)
+
+set(VCAI_HEADERS
+		StdInc.h
+
+		AIUtility.h
+		Fuzzy.h
+		Goals.h
+		VCAI.h
 )
 
 if (ANDROID) # android compiles ai libs into main lib directly, so we skip this library and just reuse sources list
 	return()
 endif()
 
-add_library(VCAI SHARED ${VCAI_SRCS})
+add_library(VCAI SHARED ${VCAI_SRCS} ${VCAI_HEADERS})
 if (FL_FOUND)
 	target_link_libraries(VCAI ${FL_LIBRARIES} vcmi)
 else()

+ 57 - 6
client/CMakeLists.txt

@@ -9,9 +9,9 @@ set(client_SRCS
 		StdInc.cpp
 		../CCallback.cpp
 
-		battle/CBattleInterface.cpp
 		battle/CBattleAnimations.cpp
 		battle/CBattleInterfaceClasses.cpp
+		battle/CBattleInterface.cpp
 		battle/CCreatureAnimation.cpp
 
 		gui/CAnimation.cpp
@@ -40,9 +40,9 @@ set(client_SRCS
 		windows/CQuestLog.cpp
 		windows/CSpellWindow.cpp
 		windows/CTradeWindow.cpp
-		windows/CWindowObject
-		windows/InfoWindows.cpp
+		windows/CWindowObject.cpp
 		windows/GUIClasses.cpp
+		windows/InfoWindows.cpp
 
 		CBitmapHandler.cpp
 		CDefHandler.cpp
@@ -61,8 +61,59 @@ set(client_SRCS
 )
 
 set(client_HEADERS
+		StdInc.h
+
+		battle/CBattleAnimations.h
+		battle/CBattleInterfaceClasses.h
+		battle/CBattleInterface.h
+		battle/CCreatureAnimation.h
+
+		gui/CAnimation.h
+		gui/CCursorHandler.h
+		gui/CGuiHandler.h
+		gui/CIntObject.h
+		gui/Fonts.h
+		gui/Geometries.h
+		gui/SDL_Compat.h
+		gui/SDL_Extensions.h
 		gui/SDL_Pixels.h
-                gui/SDL_Compat.h
+
+		widgets/AdventureMapClasses.h
+		widgets/Buttons.h
+		widgets/CArtifactHolder.h
+		widgets/CComponent.h
+		widgets/CGarrisonInt.h
+		widgets/Images.h
+		widgets/MiscWidgets.h
+		widgets/ObjectLists.h
+		widgets/TextControls.h
+		windows/CAdvmapInterface.h
+		windows/CCastleInterface.h
+		windows/CCreatureWindow.h
+		windows/CHeroWindow.h
+		windows/CKingdomInterface.h
+		windows/CQuestLog.h
+		windows/CSpellWindow.h
+		windows/CTradeWindow.h
+		windows/CWindowObject.h
+		windows/GUIClasses.h
+		windows/InfoWindows.h
+
+		CBitmapHandler.h
+		CDefHandler.h
+		CGameInfo.h
+		Client.h
+		CMessage.h
+		CMT.h
+		CMusicHandler.h
+		CPlayerInterface.h
+		CPreGame.h
+		CVideoHandler.h
+		Graphics.h
+		mapHandler.h
+		resource.h
+		SDLMain.h
+		SDLRWwrapper.h
 )
 
 if(ANDROID) # android needs client/server to be libraries, not executables, so we can't reuse the build part of this script
@@ -121,9 +172,9 @@ if(APPLE)
 
 	add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${MakeVCMIBundle})
 elseif(WIN32)
-	add_executable(vcmiclient ${client_SRCS} VCMI_client.rc)
+	add_executable(vcmiclient ${client_SRCS} ${client_HEADERS} VCMI_client.rc)
 else()
-	add_executable(vcmiclient ${client_SRCS})
+	add_executable(vcmiclient ${client_SRCS} ${client_HEADERS})
 endif()
 
 if(WIN32)

+ 2 - 0
lib/CAndroidVMHelper.cpp

@@ -9,6 +9,7 @@
  */
 #include "CAndroidVMHelper.h"
 
+#ifdef VCMI_ANDROID
 static JavaVM * vmCache = nullptr;
 
 /// cached java classloader so that we can find our classes from other threads
@@ -103,3 +104,4 @@ extern "C" JNIEXPORT void JNICALL Java_eu_vcmi_vcmi_NativeMethods_initClassloade
 	vcmiClassLoader = (jclass) env->NewGlobalRef(env->CallObjectMethod(anyVCMIClass, getClassLoaderMethod));
 	vcmiFindClassMethod = env->GetMethodID(classLoaderClass, "findClass", "(Ljava/lang/String;)Ljava/lang/Class;");
 }
+#endif

+ 3 - 0
lib/CAndroidVMHelper.h

@@ -9,6 +9,7 @@
  */
 #pragma once
 
+#ifdef VCMI_ANDROID
 #include <jni.h>
 #include <string>
 
@@ -39,3 +40,5 @@ public:
 
 	static constexpr const char * NATIVE_METHODS_DEFAULT_CLASS = "eu/vcmi/vcmi/NativeMethods";
 };
+
+#endif

+ 170 - 63
lib/CMakeLists.txt

@@ -8,21 +8,38 @@ set(lib_SRCS
 		StdInc.cpp
 		${CMAKE_BINARY_DIR}/Version.cpp
 
+		battle/AccessibilityInfo.cpp
+		battle/BattleAction.cpp
+		battle/BattleAttackInfo.cpp
+		battle/BattleHex.cpp
+		battle/BattleInfo.cpp
+		battle/CBattleInfoCallback.cpp
+		battle/CBattleInfoEssentials.cpp
+		battle/CCallbackBase.cpp
+		battle/CObstacleInstance.cpp
+		battle/CPlayerBattleCallback.cpp
+		battle/ReachabilityInfo.cpp
+		battle/SideInBattle.cpp
+		battle/SiegeInfo.cpp
+
 		filesystem/AdapterLoaders.cpp
+		filesystem/CArchiveLoader.cpp
+		filesystem/CBinaryReader.cpp
 		filesystem/CCompressedStream.cpp
+		filesystem/CFileInputStream.cpp
 		filesystem/CFilesystemLoader.cpp
-		filesystem/CArchiveLoader.cpp
 		filesystem/CMemoryBuffer.cpp
 		filesystem/CMemoryStream.cpp
-		filesystem/CBinaryReader.cpp
-		filesystem/CFileInputStream.cpp
 		filesystem/CZipLoader.cpp
 		filesystem/CZipSaver.cpp
 		filesystem/FileInfo.cpp
-		filesystem/Filesystem.cpp
 		filesystem/FileStream.cpp
-		filesystem/ResourceID.cpp
+		filesystem/Filesystem.cpp
 		filesystem/MinizipExtensions.cpp
+		filesystem/ResourceID.cpp
+
+		logging/CBasicLogConfigurator.cpp
+		logging/CLogger.cpp
 
 		mapObjects/CArmedInstance.cpp
 		mapObjects/CBank.cpp
@@ -40,9 +57,6 @@ set(lib_SRCS
 		mapObjects/MiscObjects.cpp
 		mapObjects/ObjectTemplate.cpp
 
-		logging/CBasicLogConfigurator.cpp
-		logging/CLogger.cpp
-
 		mapping/CCampaignHandler.cpp
 		mapping/CDrawRoadsOperation.cpp
 		mapping/CMap.cpp
@@ -52,14 +66,23 @@ set(lib_SRCS
 		mapping/MapFormatH3M.cpp
 		mapping/MapFormatJson.cpp
 
+		registerTypes/RegisterTypes.cpp
+		registerTypes/TypesClientPacks1.cpp
+		registerTypes/TypesClientPacks2.cpp
+		registerTypes/TypesMapObjects1.cpp
+		registerTypes/TypesMapObjects2.cpp
+		registerTypes/TypesMapObjects3.cpp
+		registerTypes/TypesPregamePacks.cpp
+		registerTypes/TypesServerPacks.cpp
+
 		rmg/CMapGenerator.cpp
 		rmg/CMapGenOptions.cpp
 		rmg/CRmgTemplate.cpp
-		rmg/CRmgTemplateZone.cpp
 		rmg/CRmgTemplateStorage.cpp
+		rmg/CRmgTemplateZone.cpp
 		rmg/CZoneGraphGenerator.cpp
 		rmg/CZonePlacer.cpp
- 
+
 		serializer/BinaryDeserializer.cpp
 		serializer/BinarySerializer.cpp
 		serializer/CLoadIntegrityValidator.cpp
@@ -67,28 +90,19 @@ set(lib_SRCS
 		serializer/Connection.cpp
 		serializer/CSerializer.cpp
 		serializer/CTypeList.cpp
+		serializer/JsonDeserializer.cpp
+		serializer/JsonSerializeFormat.cpp
+		serializer/JsonSerializer.cpp
 
-		spells/CSpellHandler.cpp
-		spells/ISpellMechanics.cpp
 		spells/AdventureSpellMechanics.cpp
 		spells/BattleSpellMechanics.cpp
-		spells/CreatureSpellMechanics.cpp
 		spells/CDefaultSpellMechanics.cpp
+		spells/CreatureSpellMechanics.cpp
+		spells/CSpellHandler.cpp
+		spells/ISpellMechanics.cpp
 		spells/ViewSpellInt.cpp
 
-		battle/BattleAction.cpp
-		battle/BattleHex.cpp
-		battle/BattleInfo.cpp
-		battle/AccessibilityInfo.cpp
-		battle/BattleAttackInfo.cpp
-		battle/CBattleInfoCallback.cpp
-		battle/CBattleInfoEssentials.cpp
-		battle/CCallbackBase.cpp
-		battle/CPlayerBattleCallback.cpp
-		battle/ReachabilityInfo.cpp
-		SiegeInfo.cpp
-		SideInBattle.cpp
-		CStack.cpp
+		CAndroidVMHelper.cpp
 		CArtHandler.cpp
 		CBonusTypeHandler.cpp
 		CBuildingHandler.cpp
@@ -96,87 +110,180 @@ set(lib_SRCS
 		CConsoleHandler.cpp
 		CCreatureHandler.cpp
 		CCreatureSet.cpp
+		CGameInfoCallback.cpp
 		CGameInterface.cpp
+		CGameState.cpp
 		CGeneralTextHandler.cpp
 		CHeroHandler.cpp
 		CModHandler.cpp
-		battle/CObstacleInstance.cpp
+		CPathfinder.cpp
 		CRandomGenerator.cpp
-
+		CStack.cpp
 		CThreadHelper.cpp
 		CTownHandler.cpp
 		GameConstants.cpp
 		HeroBonus.cpp
+		IGameCallback.cpp
+		IHandlerBase.cpp
 		JsonDetail.cpp
 		JsonNode.cpp
 		LogicalExpression.cpp
+		NetPacksLib.cpp
 		ResourceSet.cpp
-		VCMI_Lib.cpp
 		VCMIDirs.cpp
-		IHandlerBase.cpp
-
-		IGameCallback.cpp
-		CGameInfoCallback.cpp
-		CPathfinder.cpp
-		CGameState.cpp
-		NetPacksLib.cpp
-
-		serializer/JsonSerializer.cpp
-		serializer/JsonDeserializer.cpp
-		serializer/JsonSerializeFormat.cpp
-
-		registerTypes/RegisterTypes.cpp
-		registerTypes/TypesClientPacks1.cpp
-		registerTypes/TypesClientPacks2.cpp
-		registerTypes/TypesMapObjects1.cpp
-		registerTypes/TypesMapObjects2.cpp
-		registerTypes/TypesMapObjects3.cpp
-		registerTypes/TypesPregamePacks.cpp
-		registerTypes/TypesServerPacks.cpp
-		
-		${VCMILIB_ADDITIONAL_SOURCES}
+		VCMI_Lib.cpp
 )
 
 set(lib_HEADERS
+		StdInc.h
 		../Global.h
 
+		battle/AccessibilityInfo.h
+		battle/BattleAction.h
+		battle/BattleAttackInfo.h
+		battle/BattleHex.h
+		battle/BattleInfo.h
+		battle/CBattleInfoCallback.h
+		battle/CBattleInfoEssentials.h
+		battle/CCallbackBase.h
+		battle/CObstacleInstance.h
+		battle/CPlayerBattleCallback.h
+		battle/ReachabilityInfo.h
+		battle/SideInBattle.h
+		battle/SiegeInfo.h
+
+		filesystem/AdapterLoaders.h
+		filesystem/CArchiveLoader.h
+		filesystem/CBinaryReader.h
+		filesystem/CCompressedStream.h
+		filesystem/CFileInputStream.h
+		filesystem/CFilesystemLoader.h
+		filesystem/CInputOutputStream.h
 		filesystem/CInputStream.h
-		filesystem/ISimpleResourceLoader.h
-		filesystem/CStream.h
+		filesystem/CMemoryBuffer.h
+		filesystem/CMemoryStream.h
 		filesystem/COutputStream.h
-		filesystem/CInputOutputStream.h
+		filesystem/CStream.h
+		filesystem/CZipLoader.h
+		filesystem/CZipSaver.h
+		filesystem/FileInfo.h
+		filesystem/FileStream.h
+		filesystem/Filesystem.h
+		filesystem/ISimpleResourceLoader.h
+		filesystem/MinizipExtensions.h
+		filesystem/ResourceID.h
 
+		logging/CBasicLogConfigurator.h
+		logging/CLogger.h
+
+		mapObjects/CArmedInstance.h
+		mapObjects/CBank.h
+		mapObjects/CGHeroInstance.h
+		mapObjects/CGMarket.h
+		mapObjects/CGPandoraBox.h
+		mapObjects/CGTownInstance.h
+		mapObjects/CObjectClassesHandler.h
+		mapObjects/CObjectHandler.h
+		mapObjects/CommonConstructors.h
+		mapObjects/CQuest.h
+		mapObjects/CRewardableConstructor.h
+		mapObjects/CRewardableObject.h
+		mapObjects/JsonRandom.h
+		mapObjects/MapObjects.h
+		mapObjects/MiscObjects.h
+		mapObjects/ObjectTemplate.h
+
+		mapping/CCampaignHandler.h
+		mapping/CDrawRoadsOperation.h
+		mapping/CMapDefines.h
+		mapping/CMapEditManager.h
+		mapping/CMap.h
+		mapping/CMapInfo.h
+		mapping/CMapService.h
+		mapping/MapFormatH3M.h
+		mapping/MapFormatJson.h
+
+		registerTypes/RegisterTypes.h
+
+		rmg/CMapGenerator.h
+		rmg/CMapGenOptions.h
+		rmg/CRmgTemplate.h
+		rmg/CRmgTemplateStorage.h
+		rmg/CRmgTemplateZone.h
+		rmg/CZoneGraphGenerator.h
+		rmg/CZonePlacer.h
 		rmg/float3.h
 
+		serializer/BinaryDeserializer.h
+		serializer/BinarySerializer.h
+		serializer/CLoadIntegrityValidator.h
+		serializer/CMemorySerializer.h
+		serializer/Connection.h
+		serializer/CSerializer.h
+		serializer/CTypeList.h
+		serializer/JsonDeserializer.h
+		serializer/JsonSerializeFormat.h
+		serializer/JsonSerializer.h
+
+		spells/AdventureSpellMechanics.h
+		spells/BattleSpellMechanics.h
+		spells/CDefaultSpellMechanics.h
+		spells/CreatureSpellMechanics.h
+		spells/CSpellHandler.h
+		spells/ISpellMechanics.h
 		spells/Magic.h
 		spells/SpellMechanics.h
+		spells/ViewSpellInt.h
 
-		mapObjects/MapObjects.h
-		mapping/CMapDefines.h
-
-		CSoundBase.h
 		AI_Base.h
+		CAndroidVMHelper.h
+		CArtHandler.h
+		CBonusTypeHandler.h
+		CBuildingHandler.h
+		CConfigHandler.h
+		CConsoleHandler.h
+		CCreatureHandler.h
+		CCreatureSet.h
+		CGameInfoCallback.h
+		CGameInterface.h
+		CGameStateFwd.h
+		CGameState.h
+		CGeneralTextHandler.h
+		CHeroHandler.h
+		CModHandler.h
 		CondSh.h
 		ConstTransitivePtr.h
-		CBonusTypeHandler.h
+		CPathfinder.h
+		CPlayerState.h
+		CRandomGenerator.h
 		CScriptingModule.h
+		CSoundBase.h
+		CStack.h
 		CStopWatch.h
+		CThreadHelper.h
+		CTownHandler.h
 		FunctionList.h
 		GameConstants.h
+		HeroBonus.h
 		IBonusTypeHandler.h
-		StringConstants.h
+		IGameCallback.h
 		IGameEventsReceiver.h
+		IHandlerBase.h
 		int3.h
-		CGameStateFwd.h
-		CPlayerState.h
 		Interprocess.h
-		NetPacks.h
+		JsonDetail.h
+		JsonNode.h
+		LogicalExpression.h
 		NetPacksBase.h
+		NetPacks.h
+		ResourceSet.h
 		ScopeGuard.h
 		StartInfo.h
+		StringConstants.h
 		UnlockGuard.h
 		VCMIDirs.h
 		vcmi_endian.h
+		VCMI_Lib.h
 )
 
 add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS})

+ 10 - 2
server/CMakeLists.txt

@@ -6,17 +6,25 @@ include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
 
 set(server_SRCS
 		StdInc.cpp
+
 		CGameHandler.cpp
-		CVCMIServer.cpp
 		CQuery.cpp
+		CVCMIServer.cpp
 		NetPacksServer.cpp
 )
 
+set(server_HEADERS
+		StdInc.h
+
+		CGameHandler.h
+		CQuery.h
+		CVCMIServer.h
+)
 if(ANDROID) # android needs client/server to be libraries, not executables, so we can't reuse the build part of this script
 	return()
 endif()
 
-add_executable(vcmiserver ${server_SRCS})
+add_executable(vcmiserver ${server_SRCS} ${server_HEADERS})
 
 target_link_libraries(vcmiserver vcmi ${Boost_LIBRARIES} ${SYSTEM_LIBS})
 

+ 16 - 7
test/CMakeLists.txt

@@ -5,15 +5,24 @@ include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CM
 include_directories(${Boost_INCLUDE_DIRS})
 
 set(test_SRCS
-    StdInc.cpp
-    Battlefield.cpp
-    CVcmiTestConfig.cpp
-    CMapEditManagerTest.cpp
-    MapComparer.cpp
-    CMapFormatTest.cpp
+		StdInc.cpp
+
+		Battlefield.cpp
+		CMapEditManagerTest.cpp
+		CMapFormatTest.cpp
+		CMemoryBufferTest.cpp
+		CVcmiTestConfig.cpp
+		MapComparer.cpp
+)
+
+set(test_HEADERS
+		StdInc.h
+
+		CVcmiTestConfig.h
+		MapComparer.h
 )
 
-add_executable(vcmitest ${test_SRCS})
+add_executable(vcmitest ${test_SRCS} ${test_HEADERS})
 target_link_libraries(vcmitest vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB})
 add_test(vcmitest vcmitest)