fixed merge conflicts
This commit is contained in:
parent
aaef83e122
commit
058f21b0fc
|
@ -81,15 +81,15 @@ function(assert_no_version_h target)
|
|||
if (DEFINED ENV{VERBOSE})
|
||||
add_custom_target("${target_name}"
|
||||
COMMAND "${CMAKE_COMMAND}" -DFILE="${CMAKE_SOURCE_DIR}/versions.h"
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/AssertFileDoesntExist.cmake"
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/AssertFileDoesntExist.cmake"
|
||||
COMMAND echo
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/AssertFileDoesntExist.cmake"
|
||||
-DFILE="${CMAKE_SOURCE_DIR}/versions.h"
|
||||
-DFILE="${CMAKE_SOURCE_DIR}/versions.h"
|
||||
COMMENT "Check old build system wasn't used in source dir")
|
||||
else()
|
||||
add_custom_target("${target_name}"
|
||||
COMMAND "${CMAKE_COMMAND}" -DFILE="${CMAKE_SOURCE_DIR}/versions.h"
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/AssertFileDoesntExist.cmake"
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/AssertFileDoesntExist.cmake"
|
||||
COMMENT "Check old build system wasn't used in source dir")
|
||||
endif()
|
||||
|
||||
|
@ -135,7 +135,7 @@ function(strip_debug_symbols target)
|
|||
if(is_exec AND NOT APPLE)
|
||||
add_custom_command(OUTPUT "${out_file}.debug"
|
||||
COMMAND objcopy --only-keep-debug $<TARGET_FILE:${target}> "${out_file}.debug" &&
|
||||
objcopy --add-gnu-debuglink="${out_file}.debug" ${out_file}
|
||||
objcopy --add-gnu-debuglink="${out_file}.debug" ${out_file}
|
||||
DEPENDS "${out_file}"
|
||||
COMMENT "Copy debug symbols to ${out_name}.debug")
|
||||
list(APPEND out_files "${out_file}.debug")
|
||||
|
@ -165,15 +165,10 @@ function(add_flow_target)
|
|||
set(actor_compiler_flags "")
|
||||
if(${src} MATCHES ".*\\.actor\\.(h|cpp)")
|
||||
list(APPEND actors ${src})
|
||||
list(APPEND actor_compiler_flags "--generate-probes")
|
||||
if(${src} MATCHES ".*\\.h")
|
||||
if (SUPPORT_DTRACE AND USE_LD STREQUAL "LLD")
|
||||
list(APPEND actor_compiler_flags "--generate-probes")
|
||||
endif()
|
||||
string(REPLACE ".actor.h" ".actor.g.h" generated ${src})
|
||||
else()
|
||||
if (SUPPORT_DTRACE)
|
||||
list(APPEND actor_compiler_flags "--generate-probes")
|
||||
endif()
|
||||
string(REPLACE ".actor.cpp" ".actor.g.cpp" generated ${src})
|
||||
endif()
|
||||
foreach(s IN LISTS AFT_DISABLE_ACTOR_WITHOUT_WAIT_WARNING)
|
||||
|
@ -186,29 +181,15 @@ function(add_flow_target)
|
|||
list(APPEND generated_files ${CMAKE_CURRENT_BINARY_DIR}/${generated})
|
||||
if(WIN32)
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${generated}"
|
||||
COMMAND $<TARGET_FILE:actorcompiler> "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${CMAKE_CURRENT_BINARY_DIR}/${generated}" ${actor_compiler_flags} ${actor_compiler_flags}
|
||||
COMMAND $<TARGET_FILE:actorcompiler> "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${CMAKE_CURRENT_BINARY_DIR}/${generated}" ${actor_compiler_flags}
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${src}" actorcompiler
|
||||
COMMENT "Compile actor: ${src}")
|
||||
else()
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${generated}"
|
||||
COMMAND ${MONO_EXECUTABLE} ${actor_exe} "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${CMAKE_CURRENT_BINARY_DIR}/${generated}" ${actor_compiler_flags} ${actor_compiler_flags} > /dev/null
|
||||
COMMAND ${MONO_EXECUTABLE} ${actor_exe} "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${CMAKE_CURRENT_BINARY_DIR}/${generated}" ${actor_compiler_flags} > /dev/null
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${src}" actorcompiler
|
||||
COMMENT "Compile actor: ${src}")
|
||||
endif()
|
||||
endforeach()
|
||||
list(APPEND sources ${generated})
|
||||
list(APPEND generated_files ${CMAKE_CURRENT_BINARY_DIR}/${generated})
|
||||
if(WIN32)
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${generated}"
|
||||
COMMAND $<TARGET_FILE:actorcompiler> "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${CMAKE_CURRENT_BINARY_DIR}/${generated}" ${actor_compiler_flags}
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${src}" actorcompiler
|
||||
COMMENT "Compile actor: ${src}")
|
||||
else()
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${generated}"
|
||||
COMMAND ${MONO_EXECUTABLE} ${actor_exe} "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${CMAKE_CURRENT_BINARY_DIR}/${generated}" ${actor_compiler_flags} > /dev/null
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${src}" actorcompiler
|
||||
COMMENT "Compile actor: ${src}")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND sources ${src})
|
||||
endif()
|
||||
|
|
|
@ -207,53 +207,6 @@ namespace actorcompiler
|
|||
}
|
||||
};
|
||||
|
||||
class ActorMap {
|
||||
public ActorMap(string actorMap) {
|
||||
var actors = actorMap.Split(';');
|
||||
uint counter = 0;
|
||||
foreach (var actor in actors) {
|
||||
dict.Add(actor, counter);
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
|
||||
public string generateCArray(string targetName) {
|
||||
var actors = this.Actors;
|
||||
for (int i = 0; i < actors.Length; ++i) {
|
||||
actors[i] = String.Format("\"{0}\"", actors[i]);
|
||||
}
|
||||
return String.Format("const char* {0}ActorMap = {{ {1} }};", targetName, String.Join(",", actors));
|
||||
}
|
||||
|
||||
public string[] Actors {
|
||||
get {
|
||||
string[] actors = new string[dict.Count];
|
||||
foreach (var actor in dict.Keys) {
|
||||
actors[dict[actor]] = actor;
|
||||
}
|
||||
return actors;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
|
||||
return String.Join(";", this.Actors);
|
||||
}
|
||||
Dictionary<string, uint> dict;
|
||||
|
||||
public uint this[string key] {
|
||||
get {
|
||||
if (dict.ContainsKey(key)) {
|
||||
return dict[key];
|
||||
} else {
|
||||
var res = Convert.ToUInt32(dict.Count);
|
||||
dict.Add(key, res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ActorParser
|
||||
{
|
||||
public bool LineNumbersEnabled = true;
|
||||
|
@ -262,14 +215,12 @@ namespace actorcompiler
|
|||
string sourceFile;
|
||||
ErrorMessagePolicy errorMessagePolicy;
|
||||
public bool generateProbes;
|
||||
public ActorMap actorMap;
|
||||
|
||||
public ActorParser(string text, string sourceFile, ErrorMessagePolicy errorMessagePolicy, bool generateProbes, ActorMap actorMap)
|
||||
public ActorParser(string text, string sourceFile, ErrorMessagePolicy errorMessagePolicy, bool generateProbes)
|
||||
{
|
||||
this.sourceFile = sourceFile;
|
||||
this.errorMessagePolicy = errorMessagePolicy;
|
||||
this.generateProbes = generateProbes;
|
||||
this.actorMap = actorMap;
|
||||
tokens = Tokenize(text).Select(t=>new Token{ Value=t }).ToArray();
|
||||
CountParens();
|
||||
//if (sourceFile.EndsWith(".h")) LineNumbersEnabled = false;
|
||||
|
|
|
@ -40,14 +40,10 @@ namespace actorcompiler
|
|||
Console.WriteLine("actorcompiler {0}", string.Join(" ", args));
|
||||
string input = args[0], output = args[1], outputtmp = args[1] + ".tmp";
|
||||
ErrorMessagePolicy errorMessagePolicy = new ErrorMessagePolicy();
|
||||
string actorMapArg = "--actor-map=";
|
||||
string actorMapFile = null;
|
||||
foreach (var arg in args) {
|
||||
if (arg.StartsWith("--")) {
|
||||
if (arg.Equals("--disable-actor-without-wait-warning")) {
|
||||
errorMessagePolicy.DisableActorWithoutWaitWarning = true;
|
||||
} else if (arg.StartsWith(actorMapArg)) {
|
||||
actorMapFile = arg.Substring(actorMapArg.Length);
|
||||
} else if (arg.Equals("--generate-probes")) {
|
||||
generateProbes = true;
|
||||
}
|
||||
|
@ -55,15 +51,9 @@ namespace actorcompiler
|
|||
}
|
||||
try
|
||||
{
|
||||
ActorMap actorMap;
|
||||
if (!actorMapFile.Equals("") && File.Exists(actorMapFile)) {
|
||||
actorMap = new ActorMap(File.ReadAllText(actorMapFile));
|
||||
} else {
|
||||
actorMap = new ActorMap("");
|
||||
}
|
||||
var inputData = File.ReadAllText(input);
|
||||
using (var outputStream = new StreamWriter(outputtmp))
|
||||
new ActorParser(inputData, input.Replace('\\', '/'), errorMessagePolicy, generateProbes, actorMap).Write(outputStream, output.Replace('\\', '/'));
|
||||
new ActorParser(inputData, input.Replace('\\', '/'), errorMessagePolicy, generateProbes).Write(outputStream, output.Replace('\\', '/'));
|
||||
if (File.Exists(output))
|
||||
{
|
||||
File.SetAttributes(output, FileAttributes.Normal);
|
||||
|
@ -71,9 +61,6 @@ namespace actorcompiler
|
|||
}
|
||||
File.Move(outputtmp, output);
|
||||
File.SetAttributes(output, FileAttributes.ReadOnly);
|
||||
if (!actorMapFile.Equals("")) {
|
||||
File.WriteAllText(actorMapFile, actorMap.ToString());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (actorcompiler.Error e)
|
||||
|
|
Loading…
Reference in New Issue