Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #129 from constcuriosity/fix-additional-source-roo…
Browse files Browse the repository at this point in the history
…t-paths-resolve

Resolve AdditionalSourceRootPaths before use
  • Loading branch information
belkiss committed Jul 16, 2021
2 parents 50d7f14 + 6932878 commit 754233b
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 60 deletions.
1 change: 1 addition & 0 deletions Sharpmake/Project.cs
Expand Up @@ -1820,6 +1820,7 @@ internal void Resolve(Builder builder, bool skipInvalidPath)
// Resolve full paths
_rootPath = Util.SimplifyPath(RootPath);
Util.ResolvePath(SharpmakeCsPath, ref _sourceRootPath);
Util.ResolvePath(SharpmakeCsPath, ref AdditionalSourceRootPaths);
Util.ResolvePath(SourceRootPath, ref SourceFiles);
Util.ResolvePath(SourceRootPath, ref SourceFilesExclude);
Util.ResolvePath(SourceRootPath, ref SourceFilesBlobExclude);
Expand Down
3 changes: 3 additions & 0 deletions samples/HelloXCode/HelloXCode.CommonProject.sharpmake.cs
Expand Up @@ -38,12 +38,15 @@ protected CommonProject()
IsTargetFileNameToLower = false;

SourceRootPath = @"[project.RootPath]\[project.Name]";
AdditionalSourceRootPaths.Add(Globals.ExternalDirectory);
}

[ConfigurePriority(ConfigurePriorities.All)]
[Configure]
public virtual void ConfigureAll(Configuration conf, CommonTarget target)
{
conf.IncludePaths.Add(Globals.ExternalDirectory);

conf.ProjectFileName = "[project.Name]_[target.Platform]";
if (target.DevEnv != DevEnv.xcode4ios)
conf.ProjectFileName += "_[target.DevEnv]";
Expand Down
1 change: 1 addition & 0 deletions samples/HelloXCode/HelloXCode.Main.sharpmake.cs
Expand Up @@ -36,6 +36,7 @@ public static class Globals
public static string RootDirectory;
public static string TmpDirectory { get { return Path.Combine(RootDirectory, "temp"); } }
public static string OutputDirectory { get { return Path.Combine(TmpDirectory, "bin"); } }
public static string ExternalDirectory { get { return Path.Combine(RootDirectory, @"..\external"); } }
}

public static class Main
Expand Down
17 changes: 2 additions & 15 deletions samples/HelloXCode/codebase/dll1/util_dll.cpp
Expand Up @@ -3,28 +3,15 @@

#include "src/util_static_lib1.h"
#include <iostream>
#include <external.h>

int UtilDll1::ComputeSum(const std::vector<int>& someInts)
{
int acc = 0;
for (int item : someInts)
acc += item;

#if _DEBUG
std::cout << "- Dll1 is built in Debug"
# if USES_FASTBUILD
" with FastBuild"
# endif
"!" << std::endl;
#endif

#if NDEBUG
std::cout << "- Dll1 is built in Release"
# if USES_FASTBUILD
" with FastBuild"
# endif
"!" << std::endl;
#endif
PrintBuildString("Dll1");

acc += static_lib1_utils::GetRandomPosition();

Expand Down
18 changes: 3 additions & 15 deletions samples/HelloXCode/codebase/exe/main.cpp
Expand Up @@ -3,25 +3,13 @@
#include "util_static_lib2.h"
#include "sub folder/useless_static_lib2.h"

#include <external.h>

int main(int, char**)
{
std::cout << "Hello XCode World, from " CREATION_DATE "!" << std::endl;

#if _DEBUG
std::cout << "- Exe is built in Debug"
# if USES_FASTBUILD
" with FastBuild"
# endif
"!" << std::endl;
#endif

#if NDEBUG
std::cout << "- Exe is built in Release"
# if USES_FASTBUILD
" with FastBuild"
# endif
"!" << std::endl;
#endif
PrintBuildString("Exe");

std::vector<int> someArray(5, 6);

Expand Down
17 changes: 2 additions & 15 deletions samples/HelloXCode/codebase/static lib2/util_static_lib2.cpp
@@ -1,5 +1,6 @@
#include "util_static_lib2.h"
#include <iostream>
#include <external.h>

Util2::Util2() = default;

Expand All @@ -9,21 +10,7 @@ Util2::~Util2()

void Util2::DoSomethingUseful() const
{
#if _DEBUG
std::cout << "- StaticLib2 is built in Debug"
# if USES_FASTBUILD
" with FastBuild"
# endif
"!" << std::endl;
#endif

#if NDEBUG
std::cout << "- StaticLib2 is built in Release"
# if USES_FASTBUILD
" with FastBuild"
# endif
"!" << std::endl;
#endif
PrintBuildString("StaticLib2");

return DoSomethingInternal("Yeah right...");
}
Expand Down
17 changes: 2 additions & 15 deletions samples/HelloXCode/codebase/static_lib1/src/util_static_lib1.cpp
@@ -1,26 +1,13 @@
#include "src/pch.h"
#include "util_static_lib1.h"
#include <ios>
#include <external.h>

namespace static_lib1_utils
{
std::streampos GetRandomPosition()
{
#if _DEBUG
std::cout << "- StaticLib1 is built in Debug"
# if USES_FASTBUILD
" with FastBuild"
# endif
"!" << std::endl;
#endif

#if NDEBUG
std::cout << "- StaticLib1 is built in Release"
# if USES_FASTBUILD
" with FastBuild"
# endif
"!" << std::endl;
#endif
PrintBuildString("StaticLib1");

return 1;
}
Expand Down
20 changes: 20 additions & 0 deletions samples/HelloXCode/external/external.cpp
@@ -0,0 +1,20 @@
#include "external.h"
#include <iostream>

void PrintBuildString(const char* binaryName)
{
#if _DEBUG
const char* configName = "Debug";
#elif NDEBUG
const char* configName = "Release";
#endif

std::cout << "- " <<
binaryName <<
" is built in " <<
configName <<
#if USES_FASTBUILD
" with FastBuild"
#endif
"!" << std::endl;
}
3 changes: 3 additions & 0 deletions samples/HelloXCode/external/external.h
@@ -0,0 +1,3 @@
#pragma once

void PrintBuildString(const char* binaryName);

0 comments on commit 754233b

Please sign in to comment.