Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ if(NOT CC_TARGET_OS_ANDROID)
endif()

add_subdirectory (ch)
add_subdirectory (ChakraCore)

if (NOT STATIC_LIBRARY)
add_subdirectory (ChakraCore)
endif()
170 changes: 59 additions & 111 deletions bin/ChakraCore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,55 +1,11 @@
if(BuildJIT)
set(chakra_backend_objects $<TARGET_OBJECTS:Chakra.Backend>)
endif()

if(CC_TARGETS_AMD64)
set(wasm_objects $<TARGET_OBJECTS:Chakra.WasmReader>)
set(wasm_includes ${CHAKRACORE_SOURCE_DIR}/lib/WasmReader)
endif()

add_library (ChakraCoreStatic STATIC
$<TARGET_OBJECTS:Chakra.Pal>
$<TARGET_OBJECTS:Chakra.Common.Core>
$<TARGET_OBJECTS:Chakra.Jsrt>
$<TARGET_OBJECTS:Chakra.Jsrt.Core>
${chakra_backend_objects}
$<TARGET_OBJECTS:Chakra.Common.Common>
$<TARGET_OBJECTS:Chakra.Common.Codex>
$<TARGET_OBJECTS:Chakra.Common.DataStructures>
$<TARGET_OBJECTS:Chakra.Common.Exceptions>
$<TARGET_OBJECTS:Chakra.Common.Memory>
$<TARGET_OBJECTS:Chakra.Common.Util>
$<TARGET_OBJECTS:Chakra.Runtime.Base>
$<TARGET_OBJECTS:Chakra.Runtime.ByteCode>
$<TARGET_OBJECTS:Chakra.Runtime.Debug>
$<TARGET_OBJECTS:Chakra.Runtime.Language>
$<TARGET_OBJECTS:Chakra.Runtime.Library>
$<TARGET_OBJECTS:Chakra.Runtime.Math>
$<TARGET_OBJECTS:Chakra.Runtime.Types>
$<TARGET_OBJECTS:Chakra.Runtime.PlatformAgnostic>
$<TARGET_OBJECTS:Chakra.Parser>
${wasm_objects}
add_library (ChakraCore SHARED
ChakraCoreShared.cpp
ConfigParserExternals.cpp
TestHooks.cpp
)

if(CC_TARGET_OS_OSX)
target_link_libraries(ChakraCoreStatic
"-framework CoreFoundation"
"-framework Security"
)
else()
if (NOT CC_TARGET_OS_ANDROID)
set(PTHREAD "pthread")
endif()

target_link_libraries(ChakraCoreStatic
${CC_LTO_ENABLED}
${PTHREAD}
"dl"
)
endif()

target_include_directories (
ChakraCoreStatic PUBLIC
ChakraCore PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CHAKRACORE_SOURCE_DIR}/lib/Backend
${CHAKRACORE_SOURCE_DIR}/lib/Common
Expand All @@ -60,74 +16,66 @@ target_include_directories (
${wasm_includes}
)

if (NOT STATIC_LIBRARY)
add_library (ChakraCore SHARED
ChakraCoreShared.cpp
ConfigParserExternals.cpp
TestHooks.cpp
)
#
# Link step for the ChakraCore shared library
#
# External libraries we link with are the following:
# pthread: For threading
# stdc++/gcc_s: C++ runtime code
# dl: For shared library loading related functions
#
if(CC_TARGET_OS_ANDROID OR CC_TARGET_OS_LINUX)
set(LINKER_START_GROUP
-fPIC
-Wl,--start-group
-Wl,--whole-archive
)

#
# Link step for the ChakraCore shared library
#
# External libraries we link with are the following:
# pthread: For threading
# stdc++/gcc_s: C++ runtime code
# dl: For shared library loading related functions
#
if(CC_TARGET_OS_ANDROID OR CC_TARGET_OS_LINUX)
set(LINKER_START_GROUP
-fPIC
-Wl,--start-group
-Wl,--whole-archive
)
set(LINKER_END_GROUP
-Wl,--no-whole-archive
-Wl,--end-group
-static-libstdc++
)
elseif(CC_TARGET_OS_OSX)
set(LINKER_START_GROUP -Wl,-force_load,)
endif()

set(LINKER_END_GROUP
-Wl,--no-whole-archive
-Wl,--end-group
-static-libstdc++
)
elseif(CC_TARGET_OS_OSX)
set(LINKER_START_GROUP -Wl,-force_load,)
endif()
# common link deps
set(lib_target "${lib_target}"
-Wl,-undefined,error
${LINKER_START_GROUP}
ChakraCoreStatic
${LINKER_END_GROUP}
pthread
dl
${ICULIB}
)

# common link deps
if(CC_TARGET_OS_ANDROID OR CC_TARGET_OS_LINUX)
set(lib_target "${lib_target}"
-Wl,-undefined,error
${LINKER_START_GROUP}
ChakraCoreStatic
${LINKER_END_GROUP}
pthread
dl
${ICULIB}
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libChakraCoreLib.version
# reduce link time memory usage
-Xlinker --no-keep-memory
)

if(CC_TARGET_OS_ANDROID OR CC_TARGET_OS_LINUX)
set(lib_target "${lib_target}"
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libChakraCoreLib.version
# reduce link time memory usage
-Xlinker --no-keep-memory
)
elseif(CC_TARGET_OS_OSX)
if(CC_TARGETS_X86)
set(lib_target "${lib_target} -arch i386")
elseif(CC_TARGETS_ARM)
set(lib_target "${lib_target} -arch arm")
endif()
elseif(CC_TARGET_OS_OSX)
if(CC_TARGETS_X86)
set(lib_target "${lib_target} -arch i386")
elseif(CC_TARGETS_ARM)
set(lib_target "${lib_target} -arch arm")
endif()
endif()

target_link_libraries (ChakraCore
${lib_target}
${CC_LTO_ENABLED}
)
target_link_libraries (ChakraCore
${lib_target}
${CC_LTO_ENABLED}
)

if(NOT CC_XCODE_PROJECT)
# Post build step to copy the built shared library
# to out/{BUILD_TYPE}/ (or whatever the CMakeBuildDir is)
add_custom_command(TARGET ChakraCore POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.${DYN_LIB_EXT}"
${CHAKRACORE_BINARY_DIR}/
)
endif()
if(NOT CC_XCODE_PROJECT)
# Post build step to copy the built shared library
# to out/{BUILD_TYPE}/ (or whatever the CMakeBuildDir is)
add_custom_command(TARGET ChakraCore POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.${DYN_LIB_EXT}"
${CHAKRACORE_BINARY_DIR}/
)
endif()
4 changes: 3 additions & 1 deletion bin/ch/WScriptJsrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,10 @@ bool WScriptJsrt::Initialize()
JsValueRef buildValue;
#ifdef _DEBUG
#define BUILD_TYPE_STRING_CH "Debug" // (O0)
#elif defined(ENABLE_DEBUG_CONFIG_OPTIONS)
#define BUILD_TYPE_STRING_CH "Test" // (O3 with debug config options)
#else
#define BUILD_TYPE_STRING_CH "Release" // consider Test is also Release build (O3)
#define BUILD_TYPE_STRING_CH "Release" // (O3)
#endif
IfJsrtErrorFail(ChakraRTInterface::JsCreateString(
BUILD_TYPE_STRING_CH, strlen(BUILD_TYPE_STRING_CH), &buildValue), false);
Expand Down
63 changes: 63 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,68 @@
add_compile_options(-fPIC)

if(BuildJIT)
set(chakra_backend_objects $<TARGET_OBJECTS:Chakra.Backend>)
endif()

if(CC_TARGETS_AMD64)
set(wasm_objects $<TARGET_OBJECTS:Chakra.WasmReader>)
set(wasm_includes ${CHAKRACORE_SOURCE_DIR}/lib/WasmReader)
endif()

add_library (ChakraCoreStatic STATIC
ChakraCoreStatic.cpp
$<TARGET_OBJECTS:Chakra.Pal>
$<TARGET_OBJECTS:Chakra.Common.Core>
$<TARGET_OBJECTS:Chakra.Jsrt>
$<TARGET_OBJECTS:Chakra.Jsrt.Core>
${chakra_backend_objects}
$<TARGET_OBJECTS:Chakra.Common.Common>
$<TARGET_OBJECTS:Chakra.Common.Codex>
$<TARGET_OBJECTS:Chakra.Common.DataStructures>
$<TARGET_OBJECTS:Chakra.Common.Exceptions>
$<TARGET_OBJECTS:Chakra.Common.Memory>
$<TARGET_OBJECTS:Chakra.Common.Util>
$<TARGET_OBJECTS:Chakra.Runtime.Base>
$<TARGET_OBJECTS:Chakra.Runtime.ByteCode>
$<TARGET_OBJECTS:Chakra.Runtime.Debug>
$<TARGET_OBJECTS:Chakra.Runtime.Language>
$<TARGET_OBJECTS:Chakra.Runtime.Library>
$<TARGET_OBJECTS:Chakra.Runtime.Math>
$<TARGET_OBJECTS:Chakra.Runtime.Types>
$<TARGET_OBJECTS:Chakra.Runtime.PlatformAgnostic>
$<TARGET_OBJECTS:Chakra.Parser>
${wasm_objects}
)

if(CC_TARGET_OS_OSX)
target_link_libraries(ChakraCoreStatic
"-framework CoreFoundation"
"-framework Security"
)
else()
if (NOT CC_TARGET_OS_ANDROID)
set(PTHREAD "pthread")
endif()

target_link_libraries(ChakraCoreStatic
${CC_LTO_ENABLED}
${PTHREAD}
"dl"
)
endif()

target_include_directories (
ChakraCoreStatic PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CHAKRACORE_SOURCE_DIR}/lib/Backend
${CHAKRACORE_SOURCE_DIR}/lib/Common
${CHAKRACORE_SOURCE_DIR}/lib/Runtime
${CHAKRACORE_SOURCE_DIR}/lib/Runtime/ByteCode
${CHAKRACORE_SOURCE_DIR}/lib/Parser
${CHAKRACORE_SOURCE_DIR}/lib/Jsrt
${wasm_includes}
)

if(BuildJIT)
add_subdirectory (Backend)
endif()
Expand Down
10 changes: 10 additions & 0 deletions lib/ChakraCoreStatic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

// dummy file for build system to make sure libChakraCoreStatic.a builds.
void EMPTY_FUNCTION()
{

}
11 changes: 0 additions & 11 deletions pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6636,17 +6636,6 @@ VOID
PALAPI
PAL_Reenter(PAL_Boundary boundary);

// This function needs to be called on a thread when it enters
// a region of code that depends on this instance of the PAL
// in the process, and it is unknown whether the current thread
// is already running in the PAL. Returns TRUE if and only if
// the thread was not running in the PAL previously. Does not
// modify LastError.
PALIMPORT
BOOL
PALAPI
PAL_ReenterForEH(VOID);

// This function needs to be called on a thread when it leaves
// a region of code that depends on this instance of the PAL
// in the process. Does not modify LastError.
Expand Down
1 change: 0 additions & 1 deletion pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ if(CC_TARGETS_AMD64 OR CC_TARGETS_X86)
if(CC_TARGET_OS_OSX)
set(PLATFORM_SOURCES ${PLATFORM_SOURCES}
arch/i386/activationhandlerwrapper.S
arch/i386/context.S
arch/i386/dispatchexceptionwrapper.S
)
endif()
Expand Down
36 changes: 0 additions & 36 deletions pal/src/arch/i386/context.S

This file was deleted.

12 changes: 0 additions & 12 deletions pal/src/include/pal/dbgmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ extern Volatile<BOOL> dbg_master_switch ;
#define ERROR_(x) TRACE
#define DBG_PRINTF(level, channel, bHeader) TRACE

#define CHECK_STACK_ALIGN

#define SET_DEFAULT_DEBUG_CHANNEL(x)
#define DBG_ENABLED(level, channel) (false)

Expand All @@ -272,23 +270,13 @@ extern Volatile<BOOL> dbg_master_switch ;
#define WARN_(x) \
DBG_PRINTF(DLI_WARN,DCI_##x,TRUE)

#if _DEBUG && defined(__APPLE__) && !defined(__i686__)
bool DBG_ShouldCheckStackAlignment();
#define CHECK_STACK_ALIGN if (DBG_ShouldCheckStackAlignment()) DBG_CheckStackAlignment()
#else
#define CHECK_STACK_ALIGN
#endif

#define ENTRY_EXTERNAL \
CHECK_STACK_ALIGN; \
DBG_PRINTF(DLI_ENTRY, defdbgchan,TRUE)

#define ENTRY \
CHECK_STACK_ALIGN; \
DBG_PRINTF(DLI_ENTRY, defdbgchan,TRUE)

#define ENTRY_(x) \
CHECK_STACK_ALIGN; \
DBG_PRINTF(DLI_ENTRY, DCI_##x,TRUE)

#define LOGEXIT \
Expand Down
Loading