Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 18, 2024, 03:04:06 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Best cross-compilation setup?
Pages: 1 [2]
Print
Author Topic: Best cross-compilation setup?  (Read 1706 times)
deathgreps
Level 0
*


View Profile WWW
« Reply #20 on: July 16, 2016, 09:41:33 AM »

I tend to use a combination of a tool I wrote myself, native tools (Linux) and MSYS2 for Windows. The build system I wrote doesn't check for dependencies. Currently it's really only useful for creating Makefiles so for example you can have multiple descriptions for different operating systems and just generate Makefiles for them. You can find it here if you're interested: https://gitlab.com/0X1A/yabs.

If you have the Rust toolchain installed you can just install it with a 'cargo install yabs'. I should note though that this is 100% not tested on OS X or Windows. As I said I tend to just generate a Makefile for Windows. This is actually the first time I post this anywhere Who, Me?
Logged
oahda
Level 10
*****



View Profile
« Reply #21 on: July 17, 2016, 01:58:42 AM »

Quote from: Manual
aux_source_directory Find all source files in a directory.

aux_source_directory( )

Collects the names of all the source files in the specified directory and stores the list in the provided. This command is intended to be used by projects that use explicit template instantiation. Template instantiation files can be stored in a "Templates" subdirectory and collected automatically using this command to avoid manually listing all instantiations.

It is tempting to use this command to avoid writing the list of source files for a library or executable target. While this seems to work, there is no way for CMake to generate a build system that knows when a new source file has been added. Normally the generated build system knows when it needs to rerun CMake because the CMakeLists.txt file is modified to add a new source. When the source is just added to the directory without modifying this file, one would have to manually rerun CMake to generate a build system incorporating the new file.

OK, but what if I'm not using a build system like Buildbot which was suggested earlier? I'm not pr0^ (nor environmentally detrimental) enough to have computers running all the time to react every time my CMake files are updated anyway. So do I really need to care about this? I would invoke CMake manually every time I wanted to rebuild stuff anyway, which wouldn't be every time I add a file. So wouldn't I be better off, saving time, by using this command instead, in my use case?

EDIT:
Another question... Trying to figure out how to make CMake enforce a C++14 flag. But all suggestions I find are something like this:

Code:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")

But that's specific. I thought the point of CMake was to be underspecific so that stuff could be resolved for specific platforms/compilers/etc? Because for LLVM I want/need -std=gnu++14 instead. Does that mean I have to write a bunch of #ifdef-like things per platform in my CMakeLists anyway..?

EDIT 2:
Okay, seems it can be done in a generic way after all: https://cmake.org/cmake/help/v3.1/prop_tgt/CXX_STANDARD.html

Going to give it a try...

EDIT 3:
Nope, doesn't work. Xcode project just end up set to "compiler default", not the C++14 options.

EDIT 4:
... OK, it does work. It just doesn't show up in the project's build settings in Xcode. But if I add this, the project compiles. If I don't, it doesn't. Despite build settings looking no different. Okay then.
« Last Edit: July 17, 2016, 05:37:53 AM by Prinsessa » Logged

Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic