Author Topic: The CMake build system  (Read 2772 times)

0 Members and 1 Guest are viewing this topic.

Offline m!m

  • 210
The CMake build system
The new build system based on CMake has just been merged into master. This means that there are a few changes to how a build is compiled. A description of some common tasks can be found in the GitHub wiki: https://github.com/scp-fs2open/fs2open.github.com/wiki/CMake

Before you do anything, make sure you have updated your git submodules, either by running git submodule update --init --recursive or by cloning the repository with the --recursive flag.

Changes on Windows:
Previously we maintained multiple project files for the individual Visual Studio versions. These are no longer needed and have been removed. Instead, CMake now generates these files. First, you need to download the latest version of CMake from the website I linked above. Then, follow the steps in the Readme for generating your project files. The generated files are standard Visual Studio files so you can just open them using the standard methods.

Changes on Linux:
There aren't a lot of conceptual changes here. Instead of running ./autogen.sh you now need to run cmake.

Changes on Mac:
Similarly to Windows, you will now need to generate your project files. The process is similar to the Windows workflow so just follow those instructions.

If you have any troubles or questions about the new setup, I would be happy to answer them here or on IRC.
« Last Edit: August 05, 2016, 02:30:09 am by m!m »

 

Offline Yarn

  • 210
Re: The CMake build system
I get an error message whenever I try to generate the project files:
Quote
Error in configuration process, project files may be invalid

Here's what gets logged to the bottom portion of the CMake window (errors are preceded by dashes):
Code: [Select]
The C compiler identification is MSVC 19.0.24210.0
The CXX compiler identification is MSVC 19.0.24210.0
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
--CMake Error at cmake/toolchain-msvc.cmake:2 (include):
--  include could not find load file:
--
--    EnableExtraCompilerWarnings
--Call Stack (most recent call first):
--  cmake/toolchain.cmake:11 (include)
--  CMakeLists.txt:118 (INCLUDE)


Doing configuration specific to visual studio...
--CMake Error at cmake/toolchain-msvc.cmake:26 (globally_enable_extra_compiler_warnings):
--  Unknown CMake command "globally_enable_extra_compiler_warnings".
--Call Stack (most recent call first):
--  cmake/toolchain.cmake:11 (include)
--  CMakeLists.txt:118 (INCLUDE)


Configuring incomplete, errors occurred!
See also "C:/Games/FreeSpace2/fs2_open/master_build/CMakeFiles/CMakeOutput.log".

In case it's useful, here's the CMakeCache.txt file that's generated:
Code: [Select]
# This is the CMakeCache file.
# For build in directory: c:/Games/FreeSpace2/fs2_open/master_build
# It was generated by CMake: C:/Program Files/CMake/bin/cmake.exe
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.

########################
# EXTERNAL cache entries
########################

//Available configurations
CMAKE_CONFIGURATION_TYPES:STRING=Debug;Release;FastDebug

//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING= /DWIN32 /D_WINDOWS /W3 /GR /EHsc

//Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1

//Flags used by the compiler during release builds for minimum
// size.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=/MD /O1 /Ob1 /DNDEBUG

//Flags used by the compiler during release builds.
CMAKE_CXX_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /DNDEBUG

//Flags used by the compiler during release builds with debug info.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=/MD /Zi /O2 /Ob1 /DNDEBUG

//Libraries linked by default with all C++ applications.
CMAKE_CXX_STANDARD_LIBRARIES:STRING=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib

//Flags used by the compiler during all build types.
CMAKE_C_FLAGS:STRING= /DWIN32 /D_WINDOWS /W3

//Flags used by the compiler during debug builds.
CMAKE_C_FLAGS_DEBUG:STRING=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1

//Flags used by the compiler during release builds for minimum
// size.
CMAKE_C_FLAGS_MINSIZEREL:STRING=/MD /O1 /Ob1 /DNDEBUG

//Flags used by the compiler during release builds.
CMAKE_C_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /DNDEBUG

//Flags used by the compiler during release builds with debug info.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=/MD /Zi /O2 /Ob1 /DNDEBUG

//Libraries linked by default with all C applications.
CMAKE_C_STANDARD_LIBRARIES:STRING=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib

//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING= /machine:X86

//Flags used by the linker during debug builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL

//Flags used by the linker during release minsize builds.
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO

//Flags used by the linker during release builds.
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO

//Flags used by the linker during Release with Debug Info builds.
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL

//Install path
CMAKE_INSTALL_PREFIX:FILEPATH=C:/Games/FreeSpace2

//Path to a program.
CMAKE_LINKER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/link.exe

//Flags used by the linker during the creation of modules.
CMAKE_MODULE_LINKER_FLAGS:STRING= /machine:X86

//Flags used by the linker during debug builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL

//Flags used by the linker during release minsize builds.
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO

//Flags used by the linker during release builds.
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO

//Flags used by the linker during Release with Debug Info builds.
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL

//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=FS2_Open

//RC compiler
CMAKE_RC_COMPILER:FILEPATH=rc

//Flags for Windows Resource Compiler.
CMAKE_RC_FLAGS:STRING=' /DWIN32 '

//Flags used by the linker during the creation of dll's.
CMAKE_SHARED_LINKER_FLAGS:STRING= /machine:X86

//Flags used by the linker during debug builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL

//Flags used by the linker during release minsize builds.
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO

//Flags used by the linker during release builds.
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO

//Flags used by the linker during Release with Debug Info builds.
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL

//If set, runtime paths are not added when installing shared libraries,
// but are added when building.
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO

//If set, runtime paths are not added when using shared libraries.
CMAKE_SKIP_RPATH:BOOL=NO

//Flags used by the linker during the creation of static libraries.
CMAKE_STATIC_LINKER_FLAGS:STRING= /machine:X86

//Flags used by the linker during debug builds.
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=

//Flags used by the linker during release minsize builds.
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=

//Flags used by the linker during release builds.
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=

//Flags used by the linker during Release with Debug Info builds.
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=

//If this value is on, makefiles will be generated without the
// .SILENT directive, and all commands will be echoed to the console
// during the make.  This is useful for debugging only. With Visual
// Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE

//Enable cotire, this speeds up builds but may cause issues while
// developing (default = OFF)
COTIRE_ENABLE:BOOL=OFF

//Executable output path
EXECUTABLE_OUTPUT_PATH:PATH=C:/Games/FreeSpace2/fs2_open/master_build/bin

//Value Computed by CMake
FS2_Open_BINARY_DIR:STATIC=C:/Games/FreeSpace2/fs2_open/master_build

//Value Computed by CMake
FS2_Open_SOURCE_DIR:STATIC=C:/Games/FreeSpace2/fs2_open/master

//Build FRED2 binary
FSO_BUILD_FRED2:BOOL=ON

//Build and use the included libraries istead of using the system
// headers and libraries
FSO_BUILD_INCLUDED_LIBS:BOOL=ON

//Build tools related to FSO
FSO_BUILD_TOOLS:BOOL=OFF

//Build wxFRED2 binary
FSO_BUILD_WXFRED2:BOOL=OFF

//Generate binaries in development mode, only use if you know what
// you're doing!
FSO_DEVELOPMENT_MODE:BOOL=OFF

//Determines if warnings in the build are considered fatal errors,
// primarily used for CI
FSO_FATAL_WARNINGS:BOOL=OFF

//The path of the FreeSpace directory you want to use. Please note
// that you will have to change CMAKE_INSTALL_PREFIX if you change
// this at some point.
FSO_FREESPACE_PATH:FILEPATH=C:/Games/FreeSpace2

//Install some debug files (currently only PDB files on windows)
FSO_INSTALL_DEBUG_FILES:BOOL=OFF

//Additional arguments passed to a generated executable when run
// with the generated build files.
FSO_RUN_ARGUMENTS:STRING=

//Use LuaJIT for Lua scripting, needs a working internet connection!
FSO_USE_LUAJIT:BOOL=OFF

//Download and build OpenAL Soft instead of using the system libraries
FSO_USE_OPENALSOFT:BOOL=OFF

//Use Windows specific text-to-speach libraries
FSO_USE_SPEECH:BOOL=ON

//Enable voice recognition support
FSO_USE_VOICEREC:BOOL=ON

//Library output path
LIBRARY_OUTPUT_PATH:PATH=C:/Games/FreeSpace2/fs2_open/master_build/bin

//Use the dynamically linked version of the runtime
MSVC_USE_RUNTIME_DLL:BOOL=OFF


########################
# INTERNAL cache entries
########################

//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=c:/Games/FreeSpace2/fs2_open/master_build
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=6
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=1
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=C:/Program Files/CMake/bin/cmake.exe
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=C:/Program Files/CMake/bin/cpack.exe
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=C:/Program Files/CMake/bin/ctest.exe
//ADVANCED property for variable: CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_STANDARD_LIBRARIES
CMAKE_CXX_STANDARD_LIBRARIES-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_STANDARD_LIBRARIES
CMAKE_C_STANDARD_LIBRARIES-ADVANCED:INTERNAL=1
//Executable file format
CMAKE_EXECUTABLE_FORMAT:INTERNAL=Unknown
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//Name of external makefile project generator.
CMAKE_EXTRA_GENERATOR:INTERNAL=
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Visual Studio 14 2015
//Name of generator platform.
CMAKE_GENERATOR_PLATFORM:INTERNAL=
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Source directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=C:/Games/FreeSpace2/fs2_open/master
//ADVANCED property for variable: CMAKE_LINKER
CMAKE_LINKER-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//number of local generators
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
//ADVANCED property for variable: CMAKE_RC_COMPILER
CMAKE_RC_COMPILER-ADVANCED:INTERNAL=1
CMAKE_RC_COMPILER_WORKS:INTERNAL=1
//ADVANCED property for variable: CMAKE_RC_FLAGS
CMAKE_RC_FLAGS-ADVANCED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=C:/Program Files/CMake/share/cmake-3.6
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SKIP_RPATH
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: COTIRE_ENABLE
COTIRE_ENABLE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: FSO_BUILD_INCLUDED_LIBS
FSO_BUILD_INCLUDED_LIBS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: FSO_DEVELOPMENT_MODE
FSO_DEVELOPMENT_MODE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: FSO_FATAL_WARNINGS
FSO_FATAL_WARNINGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: FSO_INSTALL_DEBUG_FILES
FSO_INSTALL_DEBUG_FILES-ADVANCED:INTERNAL=1
//ADVANCED property for variable: FSO_USE_LUAJIT
FSO_USE_LUAJIT-ADVANCED:INTERNAL=1
//ADVANCED property for variable: FSO_USE_OPENALSOFT
FSO_USE_OPENALSOFT-ADVANCED:INTERNAL=1
//ADVANCED property for variable: MSVC_USE_RUNTIME_DLL
MSVC_USE_RUNTIME_DLL-ADVANCED:INTERNAL=1
TARGET_COPY_DIRS:INTERNAL=
TARGET_COPY_FILES:INTERNAL=

I'm using CMake 3.6.1 64-bit, Git for Windows 2.9.2 64-bit, and Visual Studio Community 2015 Update 3. This happens even with a clean repository checkout.
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 

Offline m!m

  • 210
Re: The CMake build system
Before you do anything, make sure you have updated your git submodules, either by running git submodule update --init --recursive or by clong the repository with the --recursive flag.

 

Offline Yarn

  • 210
Re: The CMake build system
I honestly thought that the "submodules" were part of Git for Windows and that those had to be updated by installing the latest Git for Windows. Guess I was totally wrong.

For those of us using TortoiseGit, you can update the submodules without using Bash by doing the following:
  • Right-click the folder where you checked out the source code.
  • Select "TortoiseGit", then "Submodule Update...".
  • Make sure that all paths as well as the "Initialize submodules" and "Recursive" options are selected.
  • Click OK.
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 

Offline The E

  • He's Ebeneezer Goode
  • Global Moderator
  • 213
  • Nothing personal, just tech support.
    • Skype
    • Steam
    • Twitter
Re: The CMake build system
To explain what submodules are in git parlance: A submodule is a way to link to an external git repository to pull in data from there. If you have a project that links to a specific library, you can use submodules to pull the code you need, eliminating the need to maintain a copy of that code by yourself.
« Last Edit: July 27, 2016, 03:13:02 pm by The E »
**** every cause that ends in murder and children crying. ― Iain Banks
Join the fun at the HLP IRC channel. Get the latest spam and gossip as long as it's fresh!

 

Offline Yarn

  • 210
Re: The CMake build system
Is it possible to have the EXEs automatically be copied to the FS2 folder? The pre-CMake projects did this and I enjoyed the convenience. (In case you want to know, I left all settings at their defaults: CMAKE_INSTALL_PREFIX and FSO_FREESPACE_PATH are set to my FS2 folder, but EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH are not.)
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 

Offline m!m

  • 210
Re: The CMake build system
If you build the "INSTALL" target, the executables and DLLs will be copied to your FSO folder.

 

Offline Yarn

  • 210
Re: The CMake build system
I figured out how to make Visual Studio 2015 build the INSTALL target when F7 is pressed:
  • In Solution Explorer (typically found on the left), right-click "Solution 'FS2_Open'".
  • Click "Properties".
  • In the left pane, expand "Configuration Properties", then select "Configuration".
  • In the "Configuration" drop-down box at the top-left, select "Debug".
  • Make sure the "INSTALL" project's Build check box is checked.
  • Click Apply.
  • Repeat steps 4-6 with the FastDebug and Release configurations.
  • Click OK.

Is there a reason that the INSTALL target is not enabled by default?
« Last Edit: August 12, 2016, 01:10:09 pm by Yarn »
"Your fighter is running out of oil.  Please check under the hood and add more if necessary"
--strings.tbl, entry 177

"Freespace is very tired.  It is shutting down to get some rest."
--strings.tbl, entry 178

 

Offline m!m

  • 210
Re: The CMake build system
The reason is that a build of the entire project should not have any side effects outside the build directory. If you want to copy the files to the FSO directory you can just build the INSTALL project and everything else will be done automatically. If you just want to start the new executable directly, you don't have to copy it. Just use Ctrl+F5 and FSO will be started with the correct root directory.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: The CMake build system
Okay, I gave this a try but the builds are not being automatically moved to my FS2 folder at the end of the build process any more. Is this intentional or did I configure something incorrectly?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline m!m

  • 210
Re: The CMake build system
It's intentional, if you want to copy the executable to your FS2 folder you need to build the INSTALL target. For that you need to either set the FS2PATH environment variable or set the CMake variable CMAKE_INSTALL_PREFIX to your FS2 path.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: The CMake build system
Okay, here's the issue. I have Diaspora, TBP and FS2 which are obviously installed in different directories. I need to be able to run, debug and play all of them. In the past, I'd simply point the debugger at whichever executable was in the relevent folder.

What am I supposed to do now?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline m!m

  • 210
Re: The CMake build system
If you take a look at the Readme in the repository you would notice that you can set the FSO_FREESPACE_PATH CMake variable to set in which directory the executable is run. You can set that to the root of the desired TC and use that to debug that specific TC.
You can also set the working directory directly because I removed the code that would always change the current directory to the location of the executable.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: The CMake build system
Ah, okay so the latter should solve my issues.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline m!m

  • 210
Re: The CMake build system
The pull request 788 may cause an error upon configuration since the sdlmain setup was changed. If that happens, delete the cache and rerun the configuration in the CMake GUI. That should fix it.

 
Re: The CMake build system
Honestly I don't understand why cmake keeps this cache around that makes it impossible to update a lot of configuration without deleting it manually?
The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell.

 

Offline m!m

  • 210
Re: The CMake build system
Almost all configuration changes can be done without deleting the cache. This was just a very specific change that caused existing cache values to become invalid.

 
Re: The CMake build system
Oh, okay. I just still can't find any way of changing CFLAGS if I set them by exporting an environment variable.
The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell.

 

Offline m!m

  • 210
Re: The CMake build system
The current setup requires them to be set every time CMake runs the configure step or they will be overwritten by the default values. If that is not sufficient for you, you could submit a pull request with the required changes.

 
Re: The CMake build system
The current setup requires them to be set every time CMake runs the configure step or they will be overwritten by the default values. If that is not sufficient for you, you could submit a pull request with the required changes.

This is not true at all; once CMakeCache.txt is generated nothing I do short of deleting it (or the line in it that sets CFLAGS) can change them. This includes running cmake .. with CFLAGS unset.
The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell.