Skip to content

Commit

Permalink
- fixed path issues when compiling for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jglanz committed May 31, 2019
1 parent 7eedc69 commit 9875d5e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/assets/cxxpods.cmake.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ include(CMakeFindDependencyMacro)
# endif()
set(CXXPODS_SYSTEM_TYPES "{{buildTypeNames}}" CACHE STRING "" FORCE)

string(TOLOWER "${CMAKE_SYSTEM_NAME}" CXXPODS_SYSTEM_NAME)
string(REPLACE "-" "_" CXXPODS_SYSTEM "${CMAKE_SYSTEM_PROCESSOR}-${CXXPODS_SYSTEM_NAME}")
if("${CXXPODS_SYSTEM}" STREQUAL "")
message(STATUS "Trying to detect CXXPODS_SYSTEM")
string(TOLOWER "${CMAKE_SYSTEM_NAME}" CXXPODS_SYSTEM_NAME)
string(REPLACE "-" "_" CXXPODS_SYSTEM "${CMAKE_SYSTEM_PROCESSOR}-${CXXPODS_SYSTEM_NAME}")
endif()


list(FIND CXXPODS_SYSTEM_TYPES ${CXXPODS_SYSTEM} CXXPODS_SYSTEM_TYPE_FOUND)
if(${CXXPODS_SYSTEM_TYPE_FOUND} EQUAL -1)
Expand Down
18 changes: 14 additions & 4 deletions src/project/DependencyBuilderCMake.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class DependencyBuilderCMake extends DependencyBuilder {
{},
cmakeFlags,
type.toCMakeOptions(this.project,this.dep.project)),
cmakeEnv =type.toScriptEnvironment(this.project,this.dep.project)
cmakeEnv = type.toScriptEnvironment(this.project,this.dep.project)


const
Expand Down Expand Up @@ -157,10 +157,16 @@ export default class DependencyBuilderCMake extends DependencyBuilder {

const
cmakeBuildType = cmakeOpts.get("CMAKE_BUILD_TYPE","Release"),
makeCmd = `${Paths.CMake} --build . ${!IsWindows ? `-- -j${Environment.CXXPODS_PROC_COUNT}` : ` -- /P:Configuration=${cmakeBuildType}`}`
makeCmd = `${Paths.CMake} --build . ${!IsWindows ? `-- -j${Environment.CXXPODS_PROC_COUNT}` : ` -- /P:Configuration=${cmakeBuildType}`}`,
cmakeEnv = this.buildConfig.type.toScriptEnvironment(this.project,this.dep.project)

log.info(`Making ${name}@${version} with: ${makeCmd}`)
if (sh.exec(makeCmd).code !== 0) {
if (sh.exec(makeCmd, {
env: {
...process.env,
...cmakeEnv
}
}).code !== 0) {
throw `Make failed`
}
sh.popd()
Expand All @@ -174,7 +180,11 @@ export default class DependencyBuilderCMake extends DependencyBuilder {
`${Paths.CMake} --build . --target INSTALL -- /P:Configuration=${cmakeBuildType}` :
`${Paths.Make} -j${Environment.CXXPODS_PROC_COUNT} install`
log.info(`Installing ${name}@${version} with: ${installCmd}`)
if (sh.exec(installCmd).code !== 0) {
if (sh.exec(installCmd, {
env: {
...process.env,
...cmakeEnv
}}).code !== 0) {
throw `Install failed`
}
sh.popd()
Expand Down
12 changes: 11 additions & 1 deletion src/project/Toolchain.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import File from '../util/File'
import File, {exists, isDirectory} from '../util/File'
import * as sh from "shelljs"
import * as Path from 'path'

Expand Down Expand Up @@ -152,6 +152,16 @@ export default class Toolchain {
SYSTEM: this.system
}

if (this.system === System.IOS) {
const xcodeResult = sh.exec("xcode-select --print-path")
Assert.ok(xcodeResult.code === 0, `Unable to determine xcode path: ${xcodeResult.stderr}/${xcodeResult.stdout}`)

const xcodeBinPath = `${xcodeResult.stdout.trim().replace("\n","")}/Toolchains/XcodeDefault.xctoolchain/usr/bin`
Assert.ok(isDirectory(xcodeBinPath), `Invalid xcode bin ${xcodeBinPath}`)

props.PATH = `${xcodeBinPath}:${process.env.PATH}`
}

if (!this.file)
return props

Expand Down

0 comments on commit 9875d5e

Please sign in to comment.