Skip to content

Commit eb50a9c

Browse files
Misc linux cleanup
Couple things: 1) Fix build break- need to ifdef out a reference to Profiler thunk 2) Clean up CMakeLists: - Seperate out C++ flags from C flags - Switch use of CHAKRA_RUNTIME_SOURCE_DIR to using a relative path to get ninja to work Add simple hello world test runner for Linux Incorporate code review feedback
1 parent 2c52a04 commit eb50a9c

7 files changed

Lines changed: 72 additions & 14 deletions

File tree

CMakeLists.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ if(CLR_CMAKE_PLATFORM_UNIX)
7171

7272
set(CMAKE_CXX_STANDARD 11)
7373

74-
add_compile_options(
75-
-fms-extensions
76-
-fdelayed-template-parsing
77-
-msse4.1
74+
set(c_warn_flags
75+
-Wno-implicit-function-declaration
76+
)
77+
78+
set(cxx_warn_flags
7879
-Wno-microsoft
7980
-Wno-unused-value
8081
-Wno-int-to-void-pointer-cast
@@ -96,6 +97,18 @@ if(CLR_CMAKE_PLATFORM_UNIX)
9697
-Wno-switch # switch values not handled
9798
-Wno-int-to-pointer-cast
9899
)
100+
101+
set(cxx_compile_flags
102+
-fdelayed-template-parsing
103+
)
104+
105+
add_compile_options(
106+
-fms-extensions
107+
-msse4.1
108+
"$<$<COMPILE_LANGUAGE:C>:${c_warn_flags}>"
109+
"$<$<COMPILE_LANGUAGE:CXX>:${cxx_warn_flags}>"
110+
"$<$<COMPILE_LANGUAGE:CXX>:${cxx_compile_flags}>"
111+
)
99112
endif(CLR_CMAKE_PLATFORM_UNIX)
100113

101114
if(CMAKE_BUILD_TYPE STREQUAL Debug)

bin/ChakraCore/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ target_include_directories (
3333
# icuuc: For the ICU (xplat-todo: Make this optional)
3434
#
3535
target_link_libraries(ChakraCore
36-
-Wl,-undefined,error
36+
-Wl,--no-undefined
3737
-Wl,--start-group
3838
-Wl,--whole-archive
3939
Chakra.Jsrt
@@ -70,4 +70,4 @@ target_link_libraries(ChakraCore
7070
add_custom_command(TARGET ChakraCore POST_BUILD
7171
COMMAND ${CMAKE_COMMAND} -E copy_if_different
7272
"${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.so"
73-
${CHAKRACORE_BINARY_DIR}/)
73+
${CHAKRACORE_BINARY_DIR}/)

lib/Runtime/Base/FunctionBody.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4848,7 +4848,11 @@ namespace Js
48484848
void FunctionBody::SetEntryToDeferParseForDebugger()
48494849
{
48504850
ProxyEntryPointInfo* defaultEntryPointInfo = this->GetDefaultEntryPointInfo();
4851-
if (defaultEntryPointInfo->jsMethod != DefaultDeferredParsingThunk && defaultEntryPointInfo->jsMethod != ProfileDeferredParsingThunk)
4851+
if (defaultEntryPointInfo->jsMethod != DefaultDeferredParsingThunk
4852+
#ifdef ENABLE_SCRIPT_PROFILING
4853+
&& defaultEntryPointInfo->jsMethod != ProfileDeferredParsingThunk
4854+
#endif
4855+
)
48524856
{
48534857
#ifdef ENABLE_SCRIPT_PROFILING
48544858
// Just change the thunk, the cleanup will be done once the function gets called.

lib/Runtime/Base/FunctionBody.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,10 +2998,12 @@ namespace Js
29982998
ULONG * line, LONG * col);
29992999
#endif
30003000

3001+
#ifdef ENABLE_SCRIPT_PROFILING
30013002
HRESULT RegisterFunction(BOOL fChangeMode, BOOL fOnlyCurrent = FALSE);
30023003
HRESULT ReportScriptCompiled();
30033004
HRESULT ReportFunctionCompiled();
30043005
void SetEntryToProfileMode();
3006+
#endif
30053007

30063008
void CheckAndRegisterFuncToDiag(ScriptContext *scriptContext);
30073009
void SetEntryToDeferParseForDebugger();

lib/Runtime/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
project(CHAKRA_RUNTIME)
22

33
include_directories(
4-
$(CHAKRA_RUNTIME_SOURCE_DIR)
5-
$(CHAKRA_RUNTIME_SOURCE_DIR)../Common
6-
$(CHAKRA_RUNTIME_SOURCE_DIR)../Backend
7-
$(CHAKRA_RUNTIME_SOURCE_DIR)../Parser
8-
$(CHAKRA_RUNTIME_SOURCE_DIR)/ByteCode
9-
$(CHAKRA_RUNTIME_SOURCE_DIR)/PlatformAgnostic
10-
$(CHAKRA_RUNTIME_SOURCE_DIR)/Math
4+
.
5+
../Common
6+
../Backend
7+
../Parser
8+
ByteCode
9+
PlatformAgnostic
10+
Math
1111
)
1212

1313
add_subdirectory (Base)

test/Basics/hello.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
function say(arg)
7+
{
8+
WScript.Echo(arg);
9+
}
10+
11+
say("hello world");
12+
say("PASS");

test/runtests.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#-------------------------------------------------------------------------------------------------------
2+
# Copyright (C) Microsoft. All rights reserved.
3+
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
#-------------------------------------------------------------------------------------------------------
5+
#
6+
# Eventual test running harness on *nix for ChakraCore
7+
# Today, it's simply there to make sure hello.js doesn't regress
8+
#
9+
10+
test_path=`dirname "$0"`
11+
ch_path="$test_path/../BuildLinux/ch"
12+
hello_path="$test_path/Basics/hello.js"
13+
14+
if [ ! -f $ch_path ]; then
15+
echo 'ch not found- exiting'
16+
exit 1
17+
fi
18+
19+
output=`$ch_path $hello_path 2>&1 | tail -n 1`
20+
21+
if [ ! $output == "PASS" ]; then
22+
echo "Hello world failed"
23+
exit 1
24+
fi
25+
26+
echo "Hello world passed"
27+
exit 0

0 commit comments

Comments
 (0)