Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake Automatic Configuration #2111

Closed
wants to merge 2 commits into from

Conversation

kphillisjr
Copy link
Contributor

This is a rework for the ChakraCore automatic configuration. This is two patches that will allow many developers to quickly start developing using ChakraCore. I will be pushing a rework of the patches to the ChakraCore examples later, however the general process for this is as follows:

An example of how to use this is as follows...

# include Auto-Configure macro.
include("${CMAKE_SOURCE_DIR}/ChakraCore/ChakraAutoConfigure.cmake")
# Configure ChakraCore:
CHAKRACORE_AUTOCONFIGURE()
add_subdirectory(ChakraCore)
add_custom_target(CopyChakraHeaders ALL
	COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/include"
	COMMAND ${CMAKE_COMMAND} -E copy_if_different
		"${CMAKE_SOURCE_DIR}/ChakraCore/lib/Jsrt/ChakraCore.h"
		"${CMAKE_BINARY_DIR}/include"
	COMMAND ${CMAKE_COMMAND} -E copy_if_different
		"${CMAKE_SOURCE_DIR}/ChakraCore/lib/Jsrt/ChakraCommon.h"
		"${CMAKE_BINARY_DIR}/include"
	COMMAND ${CMAKE_COMMAND} -E copy_if_different
		"${CMAKE_SOURCE_DIR}/ChakraCore/lib/Jsrt/ChakraCommonWindows.h"
		"${CMAKE_BINARY_DIR}/include"
	COMMAND ${CMAKE_COMMAND} -E copy_if_different
		"${CMAKE_SOURCE_DIR}/ChakraCore/lib/Jsrt/ChakraDebug.h"
		"${CMAKE_BINARY_DIR}/include"
)
# enable C++11
add_executable(ChakraSample sample.cpp)
set_target_properties(ChakraSample PROPERTIES COMPILE_FLAGS "-std=c++11")
# link to ChakraCore.
target_link_libraries(ChakraSample ChakraCore)
# Make sure Chakra Core Headers are in a location that is easy to use.
add_dependencies(ChakraSample CopyChakraHeaders)
# Actually include the headers.
target_include_directories(ChakraSample PUBLIC "${CMAKE_BINARY_DIR}/include")

This file defines a single macro that attempts to autoconfigure chakracore.
The Shared Library for ChakraCore already contains all symbols needed. This
means that most applications will only need symbols that are exported by
libChakraCore.so or libChakraCore.dylib.
@msftclas
Copy link

Hi @kphillisjr, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@dilijev
Copy link
Contributor

dilijev commented Nov 30, 2016

/cc @obastemur

@kphillisjr
Copy link
Contributor Author

@dilijev and @obastemur, This does not include the major commit that resolves direct linking only to the ChakraCore shared library. The next commit provides a usable solution to issue #1811, but it breaks the ch utility in the process. This change is the following patch ( kphillisjr@75182f3 ), and to test this change on top of this pull request, run the following commands...

#Download and get the right ChakraCore Source Tree.
git clone https://github.com/kphillisjr/ChakraCore.git
cd ChakraCore
git checkout fix_issue_1811
cd ..

# Download and get the correct Chakra Samples tree.
git clone https://github.com/kphillisjr/Chakra-Samples.git
cd Chakra-Samples
git checkout samples_cmake_v3
ln -s ../ChakraCore .
# Use the build script... It's a copy of what is in ChakraCore anyways.
./build.sh
# This BuildLinux/Debug will contain ChakraHelloWorld  and ChakraOpenGLEngine 
# that link directly  to libChakraCore. Also both of these examples are
# functioning correctly.

@kphillisjr
Copy link
Contributor Author

/cc @liminzhu - This pull request will definitely effect the ChakraCore samples.

@obastemur
Copy link
Collaborator

#2575 (comment)

@obastemur obastemur closed this Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants