Skip to content

Commit d9de0cd

Browse files
committed
small fixes
1 parent 0543e13 commit d9de0cd

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

CMakeLists.txt

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
cmake_minimum_required(VERSION 3.26)
1+
cmake_minimum_required(VERSION 3.14)
22

33
# Leon project
4+
set(LEON_VERSION 0.2.0)
5+
46
project(Leon
57
LANGUAGES C CXX
6-
VERSION 0.2.0
8+
VERSION ${LEON_VERSION}
79
HOMEPAGE_URL "https://ckdev.org/"
810
)
911

@@ -15,7 +17,7 @@ add_library(Leon INTERFACE)
1517

1618
target_include_directories(Leon INTERFACE "Include")
1719

18-
target_compile_definitions(Leon INTERFACE LEON_VERSION="${CMAKE_PROJECT_VERSION}")
20+
target_compile_definitions(Leon INTERFACE LEON_VERSION="${LEON_VERSION}")
1921

2022
# Compile Leon CLI app
2123
add_executable(Leon.CLI
@@ -85,8 +87,12 @@ else()
8587
endif()
8688

8789
# Compile and link luau
88-
set(LUAU_BUILD_TESTS OFF)
89-
add_subdirectory("ThirdParty/luau" EXCLUDE_FROM_ALL)
90+
if (NOT TARGET Luau.Compiler)
91+
set(LUAU_BUILD_CLI OFF)
92+
set(LUAU_BUILD_TESTS OFF)
93+
set(LUAU_BUILD_WEB OFF)
94+
add_subdirectory("ThirdParty/luau" EXCLUDE_FROM_ALL)
95+
endif()
9096

9197
target_link_libraries(Leon.CLI PRIVATE Luau.Compiler Luau.VM)
9298

Include/Leon/Leon.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626

2727
#define LEON __attribute__((annotate("@leon")))
2828
#define LEON_KV(key, value) __attribute__((annotate("@leonkv " #key " " #value)))
29+
#define LEON_V(value) __attribute__((annotate("@leonkv " #value " \"true\"")))
2930

3031
#else
3132

3233
#define LEON
3334
#define LEON_KV(...)
35+
#define LEON_V(...)
3436

3537
#endif

Source/Leon.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static StdPath GetStdPath(const std::string &src)
4747

4848
// TODO: I think this throws exceptions with non-ANSI characters with MSVC
4949
// I don't have a particularly convenient way to test that right now though.
50-
out.utf8 = out.path.u8string();
50+
out.utf8 = out.path.string();
5151
for (auto &i : out.utf8)
5252
if (i == '\\')
5353
i = '/';
@@ -318,7 +318,7 @@ int main(int argc, char **argv)
318318
for (auto &source : source_args)
319319
{
320320
// Get shorthand name
321-
std::string short_name = source.std.path.filename().u8string();
321+
std::string short_name = source.std.path.filename().string();
322322

323323
if (!source.rebuild)
324324
{
@@ -378,6 +378,7 @@ int main(int argc, char **argv)
378378
{
379379
case CXError_Failure:
380380
problem = "Failure";
381+
break;
381382
case CXError_Crashed:
382383
problem = "Crashed";
383384
break;
@@ -389,6 +390,7 @@ int main(int argc, char **argv)
389390
break;
390391
default:
391392
problem = std::to_string(ec);
393+
break;
392394
}
393395
throw std::runtime_error(problem + " wasn't caught by a diagnostic.");
394396
}
@@ -519,7 +521,7 @@ int main(int argc, char **argv)
519521
std::cerr << "========================================" << '\n';
520522
std::cerr << "Leon generator failed!" << '\n';
521523
std::cerr << "========================================" << '\n';
522-
std::cerr << e.what() << std::endl;
524+
std::cerr << "Error: " << e.what() << std::endl;
523525
return 1;
524526
}
525527

0 commit comments

Comments
 (0)