diff --git a/README.md b/README.md index 8978538..7107068 100644 --- a/README.md +++ b/README.md @@ -67,14 +67,14 @@ must add the appropriate directory to the `Additional SDKs` setting: You also need to add the following linker options to the `Other Linker Flags` setting: -| Distribution | Language | Required | Ice Plugins | Optional Services | -| ------------ | ----------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------| ---------------------------------------------------------------------------- | -| Ice Touch 1.3 | Objective-C | `-ObjC`
`-lIceObjC-libc++`
`-lc++` | | `-lGlacier2ObjC-libc++`
`-lIceStormObjC-libc++`
`-lIceGridObjC-libc++` | -| Ice Touch 1.3 | C++ | `-lIce-libc++` | | `-lGlacier2-libc++`
`-lIceGrid-libc++`
`-lIceStorm-libc++` | -| Ice Touch 3.6 | Objective-C | `-ObjC`
`-lIceObjC`
`-lc++` | | `-lGlacier2ObjC`
`-lIceStormObjC`
`-lIceGridObjC` | -| Ice Touch 3.6 | C++ | `-lIce` | | `-lGlacier2`
`-lIceGrid`
`-lIceStorm` | -| Ice 3.7 | Objective-C | `-ObjC`
`-lIce`
`-lIceObjC`
`-lc++` | `-lIceDiscovery`
`-lIceIAP` `-lIceIAPObjC`
`-lIceLocatorDiscovery`
`-lIceSSL` `-lIceSSLObjC` | `-lGlacier2ObjC`
`-lIceGridObjC`
`-lIceStormObjC` | -| Ice 3.7 | C++ | `-lIce` | `-lIceDiscovery`
`-lIceIAP`
`-lIceLocatorDiscovery`
`-lIceSSL` | `-lGlacier2`
`-lIceGrid`
`-lIceStorm` | +| Distribution | Language | Required | Ice Plugins | Optional Services | +| ------------ | ----------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| Ice Touch 1.3 | Objective-C | `-ObjC`
`-lIceObjC-libc++`
`-lc++` | | `-lGlacier2ObjC-libc++`
`-lIceStormObjC-libc++`
`-lIceGridObjC-libc++` | +| Ice Touch 1.3 | C++ | `-lIce-libc++` | | `-lGlacier2-libc++`
`-lIceGrid-libc++`
`-lIceStorm-libc++` | +| Ice Touch 3.6 | Objective-C | `-ObjC`
`-lIceObjC`
`-lc++` | | `-lGlacier2ObjC`
`-lIceStormObjC`
`-lIceGridObjC` | +| Ice Touch 3.6 | C++ | `-lIce` | | `-lGlacier2`
`-lIceGrid`
`-lIceStorm` | +| Ice 3.7 | Objective-C | `-ObjC`
`-lIce`
`-lIceObjC`
`-lc++` | `-lIceDiscovery`
`-lIceIAP` `-lIceIAPObjC`
`-lIceLocatorDiscovery`
`-lIceSSL` `-lIceSSLObjC` | `-lGlacier2ObjC`
`-lIceGridObjC`
`-lIceStormObjC` | +| Ice 3.7 | C++ | `-lIce` | `-lIceDiscovery`
`-lIceIAP`
`-lIceLocatorDiscovery`
`-lIceSSL` | `-lGlacier2`
`-lIceGrid`
`-lIceStorm` | With Ice 3.7 (iOS and OS X) or Ice Touch (OS X only), you also need to add `-lbz2` and `-liconv`. @@ -95,6 +95,9 @@ To force your Slice files to be re-compiled you need to clean (⇧⌘K) your pro The builder automatically includes the Ice Slice files directory included with the Ice or Ice Touch SDK as well as the directory of the Slice file being compiled. +The output directory passed to the slice compiler is determined by comparing the paths of the given `Output files`. +Exactly two files must be set and both files must share the same base directory path. + [1]: https://github.com/zeroc-ice/ice-builder-xcode/tree/xcode7-plugin [2]: https://doc.zeroc.com/display/Ice/slice2cpp+Command-Line+Options [3]: https://doc.zeroc.com/display/Ice/slice2objc+Command-Line+Options diff --git a/icebuilder b/icebuilder index de814ba..99d1c6d 100755 --- a/icebuilder +++ b/icebuilder @@ -6,7 +6,7 @@ # ********************************************************************** set -eo pipefail -readonly ICE_BUILDER_XCODE_VERSION=3.0.0 +readonly ICE_BUILDER_XCODE_VERSION=3.0.1 calledFromXcode() { if [[ -z $XCODE_PRODUCT_BUILD_VERSION || -z $DERIVED_FILE_DIR || -z $INPUT_FILE_PATH ]]; then @@ -18,22 +18,52 @@ calledFromXcode() { # Run slice sliceCompiler. We always include Ice slice file directory as well as the INPUT_FILE_DIR. compileSliceFile() { logDebug "Compiling slice file: $INPUT_FILE_NAME" - set -x + set -x # print the executed slice compiler command $sliceCompiler -I"$INPUT_FILE_DIR" \ -I"$sliceDir" \ - --output-dir "$DERIVED_FILE_DIR" \ + --output-dir "$outputDir" \ "${sliceCompilerArguments[@]}" \ "$INPUT_FILE_PATH" } +# Output directory is detected by comparing the SCRIPT_OUTPUT_FILE_{0,1} variables. +# These are expected to the be the destination of the slice compiler generated header +# and source files. Both files must share the same base directory, as this is how we +# determine the output directory to pass to the slice compiler. +setOutputDir() { + if [ "$SCRIPT_OUTPUT_FILE_COUNT" -ne 2 ]; then + echo "Please specify a header and source output file." + return 1 + fi + + local -r outputFile0=${SCRIPT_OUTPUT_FILE_0} + logDebug "Output file 0: $outputFile0" + local -r outputFile1=${SCRIPT_OUTPUT_FILE_1} + logDebug "Output file 1: $outputFile1" + + local -r outputFileDir0=$(dirname "$outputFile0") + local -r outputFileDir1=$(dirname "$outputFile1") + + if [ "$outputFileDir0" != "$outputFileDir1" ]; then + echo "Output files must be in the same directory." + return 1 + fi + + outputDir="$outputFileDir0" +} + main() { if ! calledFromXcode; then logError "Ice Builder for Xcode must be executed from an Xcode environment." exit 0 fi + if ! setOutputDir; then + exit 1 + fi + if ! findIceSDK; then - logError "Unable to find an Ice SDK. An Ice SDK must be added to the list of 'Additional SDKs'." + logError "Unable to find an Ice or Ice Touch SDK. An Ice or Ice Touch SDK must be added to the list of 'Additional SDKs'." exit 1 fi @@ -104,7 +134,7 @@ versionGt() { } # -# Procress arguments and run slice compiler +# Process arguments and run slice compiler # logDebug "Ice Builder for Xcode version: $ICE_BUILDER_XCODE_VERSION"