floooh / fips

High-level build system for distributed, multi-platform C/C++ projects.
MIT License
468 stars 82 forks source link

allow to use cross-platform SDKs in other filesystem locations #19

Closed floooh closed 9 years ago

floooh commented 9 years ago

Instead of setting up new, local SDKs it should be possible to point fips to an existing SDK install for emscripten, PNaCl and Android. Fips diag should then make sure that the SDKs have everything that fips expects.

Probably through a './fips set emscripten-location bla'...

ricejasonf commented 9 years ago

What if we could just make our own config and toolchain files? I was looking at the emscripten toolchain file, and it appears that that the whole thing could be a macro that could substitute emscripten's location in the filesystem. I'm trying to figure out how to do this because I also like to compile with both gcc and clang. I also already have emscripten/fastcomp on my system.

ricejasonf commented 9 years ago

I did this in emscripten.toolchain.cmake and it worked! :smiley:

    #get_filename_component(EMSCRIPTEN_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../${EMSC_EMSDK_DIRNAME}" ABSOLUTE)
    get_filename_component(EMSCRIPTEN_ROOT_PATH "/usr/local/src/emscripten" ABSOLUTE)
ricejasonf commented 9 years ago

oh i had to comment some stuff in mod/config.py as well

    # check if the target platform SDK is installed
    #if not check_sdk(fips_dir, cfg['platform']) :
    #    messages.append("platform sdk for '{}' not installed (see './fips help setup')".format(cfg['platform']))
    #    valid = False
floooh commented 9 years ago

You can already inject your own configs and toolchain files in projects and imports:

Custom config files must reside in a fips-configs subdirectory (e.g.: https://github.com/floooh/oryol/tree/master/fips-configs), and custom toolchain files need to reside in a fips-toolchains subdirectory. Both are searched in the following order: first in the current project, next in imported projects, and finally in the fips directory itself (there in different subdirectories: configs and cmake-toolchains).

For using a different toolchain file you need to create a custom config file, and set the cmake-toolchain attribute, like here: https://github.com/floooh/fips/blob/master/configs/emsc-make-debug.yml#L6

I haven't tested overriding the toolchains files very much though, might still have some bugs.

floooh commented 9 years ago

PS: I think with these 2 features (custom-configs and custom-toolchain-files) I guess the original bug is actually fixed, completely forgot about it ;)

ricejasonf commented 9 years ago

For host specific configs/toolchains, I would prefer to not place those in a project repo. I'm fine plopping them in the fips subdirectories, but the check_sdk explodes for platform emscripten because it checks for the compiler in a specific directory. Would an override in the config be acceptable? Something like this:

---
platform: emscripten
generator: Ninja
build_tool: ninja
build_type: Debug
cmake-toolchain: local-emscripten.toolchain.cmake
defines:
    FIPS_CUSTOM_SDK: 1
ricejasonf commented 9 years ago

... or is just using an arbitrary platform name feasible? I just noticed this from the README PSA: "cross-compile target platform names are no longer hardwired, fips projects can now add define their own cross-compile platforms"

ricejasonf commented 9 years ago

that appears to work.. please disregard :)