ShadesOfTime
Chieftain
- Joined
- May 3, 2012
- Messages
- 31
Instructions for setting up the build environment for RaR on Win10
update 2018-09-14
If you are here because you want to play the mod with the latest, unofficial changes, first have a look here:
https://forums.civfanatics.com/threads/latest-nightly-builds.636428/
If you are here because you want to compile yourself, read on ...
The steps for this tutorial were performed and tested on Windows 10 professional.
Step 1:
----------------
Download and extract the Microsoft Visual C++ Toolkit 2003 ...
... from here:
http://www.mediafire.com/file/iyfcfdd8eezh01m
You might need to install a 7z-extractor software to extract it. See here: https://www.7-zip.org/
Step 2:
----------------
Download and extract the appropriate WindowsSDK ...
...from here:
http://www.mediafire.com/file/ilulm07imz9alnd
Best is to put the folders of the extracted toolkit and the WindowsSDK in the same folder eg "RaR_build_tools/WindowsSDK" and "RaR_build_tools/MVC++Toolkit2003".
Step 3:
----------------
Download, mount and install the Visual Studio 2010 Express iso ...
... from here:
https://sourceforge.net/projects/beyond-the-sword-sdk/files/VS2010Express1.iso/download
- To mount the iso do rightClick>>Mount.
- In the mounted directory double click "Setup.hta".
- In the main setup menu click "Microsoft Visual Studio C++ Express"
- In the next dialog steps you don't need to select to install "Microsoft Silverlight" or "Microsoft SQL Server 2008 Service Pack 1 (x64).
Step 4:
----------------
Have a installed copy of Civilization IV:Colonization that includes the civ4col source code.
Users report that the Steam version of Civ4Col does not include the source code.
Step 5:
----------------
Download the RaR mod, source and project files
... from
https://sourceforge.net/p/religion-and-revolution-git/code/ci/develop-2_7_1/tree/
by clicking "Download Snapshot".
Note that there are several options what to download. On the left side you can chose between several branches and tags. Those translate to the state the mod is in. Eg tag "2.7" translates to the release version 2.7. To get the latest bugfixes and commits you would have to select branch "develop-2_7_1" (as of 2018-09-11).
Step 6:
----------------
Install the RaR mod by putting it into the mod folder of Civilization IV:Colonization.
On my installation this mod folder is "Documents\My Games\Sid Meier's Civilization IV Colonization\MODS".
Copying the folder "Religion_and_Revolution" there will make the mod available in-game (In game: MainMenu>>Advanced>>Load a mod>>Religion and Revolution).
Step 7:
----------------
Load the solution.
- Within the mods folder open the file "Project Files\RaR.sln". This will start Visual Studio and scan the whole project, which may take a while.
Step 8:
----------------
Configure the solution for compiling by providing the correct paths to makefile.
- The RaR solution is configured to use a method called "makefile" to put everything together and compile it.
- Makefile does not (always) like spaces in paths.
- The correct paths are provided to makefile by editing "Project Files\Makefile.settings". Which is created the first time the solution is loaded. It does not exist in the project folder prior to that.
- The paths are provided by assigning values to variables in "Makefile.settings".
- The variables which must be set in "Makefile.settings", are these:
-- CIV4_PATH ... The path to the folder "CvGameCoreDLL" within the installation folder of the game (not the mod).
-- TOOLKIT ... The path to the folder of the Microsoft Visual C++ Toolkit 2003.
-- PSDK ... The path to the folder of the WindowsSDK
-- CC, CPP ... Both need the path to the preprocessor, which can be found within the Microsoft Visual C++ Toolkit 2003.
-- LD ... The path to the linker, which also can be found within the Microsoft Visual C++ Toolkit 2003.
On my installation the contents of "Makefile.settings" look like this:
CIV4_PATH=C:\Program Files (x86)\2K Games\Firaxis Games\Sid Meier's Civilization IV Colonization\CvGameCoreDLL
BUILD_TOOLS=C:\Users\xxx\Documents\civ4col.rar.development\build_environment
TOOLKIT=$(BUILD_TOOLS)\Microsoft_Visual_C++_Toolkit_2003
PSDK=$(BUILD_TOOLS)\WindowsSDK
CC="$(TOOLKIT)\Bin\cl.exe"
CPP="$(TOOLKIT)\Bin\cl.exe"
LD="$(TOOLKIT)\Bin\link.exe"
This might be confusing at first glance, but is easy to understand if explained.
- CIV4_PATH=... Here the path to the folder "CvGameCoreDLL" is set. For reasons I don't know, makefile accepts this path with spaces in it. Luckily. In your installation this path most likely is exactly the same.
- BUILD_TOOLS=... Here an additional variable is used to store the path to the folder where both the Toolkit and the SDK reside.
- TOOLKIT=... and PSDK=... Here the variable BUILD_TOOLS is used to put together the paths for the variables TOOLKIT and PSDK.
- In all 3 of the above makefile does not accept spaces, so I had to rename the folders to not contain any.
- If I don't want to use the additional variable BUILD_TOOLS I could write the configuration like this also:
CIV4_PATH=C:\Program Files (x86)\2K Games\Firaxis Games\Sid Meier's Civilization IV Colonization\CvGameCoreDLL
TOOLKIT=C:\Users\xxx\Documents\civ4col.rar.development\build_environment\Microsoft_Visual_C++_Toolkit_2003
PSDK=C:\Users\xxx\Documents\civ4col.rar.development\build_environment\WindowsSDK
CC="$(TOOLKIT)\Bin\cl.exe"
CPP="$(TOOLKIT)\Bin\cl.exe"
LD="$(TOOLKIT)\Bin\link.exe"
- CC=..., CPP=... and LD=... Here the variable TOOLKIT is used to put together the paths to the preprocessor and the linker.
If you want to use the contents of this "Makefile.settings", you just need to provide the paths for CIV4_PATH, TOOLKIT and PSDK in any of the explained forms above (and remember the spaces).
Note that the contents of "Makefile" might change in future versions of the project. So "Makefile.settings" might need an adaption in the future too. But this should not happen unless absolutely necessary. Have a look of the first part of "Makefile". It is pretty self explaining and it should get clearer why the paths are needed and how everything comes together.
Step 9:
----------------
Compile! (Finally)
- In Visual Studio click Build>>Build Solution.
The whole project will be compiled now. When the compilation is a success (the output window says something like "... Build: 1 succeeded ... "), the compiled file will be copied to the neccessary places automatically (into the folders "Assets" and "2 city plot" of the mod).
You can start the game and load the freshly compiled mod now.
Additional notes for beginner modders:
----------------------------------------------------------------
If you want to make changes to the source code, always have a backup copy of the whole mod. If anything goes wrong you can just copy it over. If you want to get into modding hardcore you should sooner than later get accustomed to GIT and how it is used with the RaR project.
Thanks to
----------------
@devolution for this post: https://forums.civfanatics.com/thre...ild-environment-for-rar.632502/#post-15138038
@Nightinggale for advice
@Asaf for this thread: https://forums.civfanatics.com/threads/a-simple-guide-to-compiling-the-dll.405444/
update 2018-09-14
If you are here because you want to play the mod with the latest, unofficial changes, first have a look here:
https://forums.civfanatics.com/threads/latest-nightly-builds.636428/
If you are here because you want to compile yourself, read on ...
The steps for this tutorial were performed and tested on Windows 10 professional.
Step 1:
----------------
Download and extract the Microsoft Visual C++ Toolkit 2003 ...
Spoiler :
... from here:
http://www.mediafire.com/file/iyfcfdd8eezh01m
You might need to install a 7z-extractor software to extract it. See here: https://www.7-zip.org/
Step 2:
----------------
Download and extract the appropriate WindowsSDK ...
Spoiler :
...from here:
http://www.mediafire.com/file/ilulm07imz9alnd
Best is to put the folders of the extracted toolkit and the WindowsSDK in the same folder eg "RaR_build_tools/WindowsSDK" and "RaR_build_tools/MVC++Toolkit2003".
Step 3:
----------------
Download, mount and install the Visual Studio 2010 Express iso ...
Spoiler :
... from here:
https://sourceforge.net/projects/beyond-the-sword-sdk/files/VS2010Express1.iso/download
- To mount the iso do rightClick>>Mount.
- In the mounted directory double click "Setup.hta".
- In the main setup menu click "Microsoft Visual Studio C++ Express"
- In the next dialog steps you don't need to select to install "Microsoft Silverlight" or "Microsoft SQL Server 2008 Service Pack 1 (x64).
Step 4:
----------------
Have a installed copy of Civilization IV:Colonization that includes the civ4col source code.
Spoiler :
Users report that the Steam version of Civ4Col does not include the source code.
Step 5:
----------------
Download the RaR mod, source and project files
Spoiler :
... from
https://sourceforge.net/p/religion-and-revolution-git/code/ci/develop-2_7_1/tree/
by clicking "Download Snapshot".
Note that there are several options what to download. On the left side you can chose between several branches and tags. Those translate to the state the mod is in. Eg tag "2.7" translates to the release version 2.7. To get the latest bugfixes and commits you would have to select branch "develop-2_7_1" (as of 2018-09-11).
Step 6:
----------------
Install the RaR mod by putting it into the mod folder of Civilization IV:Colonization.
Spoiler :
On my installation this mod folder is "Documents\My Games\Sid Meier's Civilization IV Colonization\MODS".
Copying the folder "Religion_and_Revolution" there will make the mod available in-game (In game: MainMenu>>Advanced>>Load a mod>>Religion and Revolution).
Step 7:
----------------
Load the solution.
Spoiler :
- Within the mods folder open the file "Project Files\RaR.sln". This will start Visual Studio and scan the whole project, which may take a while.
Step 8:
----------------
Configure the solution for compiling by providing the correct paths to makefile.
Spoiler :
- The RaR solution is configured to use a method called "makefile" to put everything together and compile it.
- Makefile does not (always) like spaces in paths.
- The correct paths are provided to makefile by editing "Project Files\Makefile.settings". Which is created the first time the solution is loaded. It does not exist in the project folder prior to that.
- The paths are provided by assigning values to variables in "Makefile.settings".
- The variables which must be set in "Makefile.settings", are these:
-- CIV4_PATH ... The path to the folder "CvGameCoreDLL" within the installation folder of the game (not the mod).
-- TOOLKIT ... The path to the folder of the Microsoft Visual C++ Toolkit 2003.
-- PSDK ... The path to the folder of the WindowsSDK
-- CC, CPP ... Both need the path to the preprocessor, which can be found within the Microsoft Visual C++ Toolkit 2003.
-- LD ... The path to the linker, which also can be found within the Microsoft Visual C++ Toolkit 2003.
On my installation the contents of "Makefile.settings" look like this:
Spoiler :
CIV4_PATH=C:\Program Files (x86)\2K Games\Firaxis Games\Sid Meier's Civilization IV Colonization\CvGameCoreDLL
BUILD_TOOLS=C:\Users\xxx\Documents\civ4col.rar.development\build_environment
TOOLKIT=$(BUILD_TOOLS)\Microsoft_Visual_C++_Toolkit_2003
PSDK=$(BUILD_TOOLS)\WindowsSDK
CC="$(TOOLKIT)\Bin\cl.exe"
CPP="$(TOOLKIT)\Bin\cl.exe"
LD="$(TOOLKIT)\Bin\link.exe"
This might be confusing at first glance, but is easy to understand if explained.
- CIV4_PATH=... Here the path to the folder "CvGameCoreDLL" is set. For reasons I don't know, makefile accepts this path with spaces in it. Luckily. In your installation this path most likely is exactly the same.
- BUILD_TOOLS=... Here an additional variable is used to store the path to the folder where both the Toolkit and the SDK reside.
- TOOLKIT=... and PSDK=... Here the variable BUILD_TOOLS is used to put together the paths for the variables TOOLKIT and PSDK.
- In all 3 of the above makefile does not accept spaces, so I had to rename the folders to not contain any.
- If I don't want to use the additional variable BUILD_TOOLS I could write the configuration like this also:
Spoiler :
CIV4_PATH=C:\Program Files (x86)\2K Games\Firaxis Games\Sid Meier's Civilization IV Colonization\CvGameCoreDLL
TOOLKIT=C:\Users\xxx\Documents\civ4col.rar.development\build_environment\Microsoft_Visual_C++_Toolkit_2003
PSDK=C:\Users\xxx\Documents\civ4col.rar.development\build_environment\WindowsSDK
CC="$(TOOLKIT)\Bin\cl.exe"
CPP="$(TOOLKIT)\Bin\cl.exe"
LD="$(TOOLKIT)\Bin\link.exe"
- CC=..., CPP=... and LD=... Here the variable TOOLKIT is used to put together the paths to the preprocessor and the linker.
If you want to use the contents of this "Makefile.settings", you just need to provide the paths for CIV4_PATH, TOOLKIT and PSDK in any of the explained forms above (and remember the spaces).
Note that the contents of "Makefile" might change in future versions of the project. So "Makefile.settings" might need an adaption in the future too. But this should not happen unless absolutely necessary. Have a look of the first part of "Makefile". It is pretty self explaining and it should get clearer why the paths are needed and how everything comes together.
Step 9:
----------------
Compile! (Finally)
Spoiler :
- In Visual Studio click Build>>Build Solution.
The whole project will be compiled now. When the compilation is a success (the output window says something like "... Build: 1 succeeded ... "), the compiled file will be copied to the neccessary places automatically (into the folders "Assets" and "2 city plot" of the mod).
You can start the game and load the freshly compiled mod now.
Additional notes for beginner modders:
----------------------------------------------------------------
Spoiler :
If you want to make changes to the source code, always have a backup copy of the whole mod. If anything goes wrong you can just copy it over. If you want to get into modding hardcore you should sooner than later get accustomed to GIT and how it is used with the RaR project.
Thanks to
----------------
@devolution for this post: https://forums.civfanatics.com/thre...ild-environment-for-rar.632502/#post-15138038
@Nightinggale for advice
@Asaf for this thread: https://forums.civfanatics.com/threads/a-simple-guide-to-compiling-the-dll.405444/
Last edited: