Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Use CMake build system (#15397)
Browse files Browse the repository at this point in the history
  • Loading branch information
ariya committed Dec 25, 2019
1 parent 10a3d93 commit e4a26a2
Show file tree
Hide file tree
Showing 16 changed files with 412 additions and 1,067 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,18 @@ bin/
*.class
build/
.gradle/

# CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
*_autogen

34 changes: 34 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.5.0)
project(phantomjs)

set (CMAKE_CXX_STANDARD 11)

find_package(Qt5 COMPONENTS Core Network WebKitWidgets REQUIRED)
find_package(Threads REQUIRED)

message("Using Qt version ${Qt5Core_VERSION}")
if (Qt5Core_VERSION VERSION_LESS 5.5.0)
message(FATAL_ERROR "This version of Qt is not supported. Please use Qt 5.5 or later")
endif()

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

file(GLOB_RECURSE PHANTOMJS_SOURCES src/*.cpp)
include_directories(src)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(THIRDPARTY_SOURCES src/mongoose/mongoose.c src/qcommandline/qcommandline.cpp src/linenoise/src/linenoise.c)
include_directories(src/linenoise/src)
include_directories(src/mongoose)
include_directories(src/qcommandline)

set(EXTRA_LIBS dl)

add_executable(${PROJECT_NAME} src/phantomjs.qrc src/ghostdriver/ghostdriver.qrc ${PHANTOMJS_SOURCES} ${THIRDPARTY_SOURCES})
target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBS} Qt5::Core Qt5::Network Qt5::WebKitWidgets Threads::Threads)
install(TARGETS ${PROJECT_NAME} DESTINATION bin)

add_custom_target(check COMMAND python test/run-tests.py -v)
46 changes: 46 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Installation Instructions
*************************

System requirements:

* C++ toolchain such as g++ 7 or later
* CMake version 3.5 or later
* Qt 5 toolkit
* Python 2.7 (to run the tests)


Installation on Linux
---------------------

On Debian/Ubuntu, the requirements can be fulfilled by installing these packages:

sudo apt install g++ cmake qt5-default libqt5webkit5-dev python

After unpacking the source tarball or cloning the repository:

./configure && make

Do a quick sanity check:

./bin/phantomjs --version

Run the test suite:

make check

Install it (may require sudo):

make install


Installation on Windows
-----------------------

To be written.


Installation on macOS
---------------------

To be written.

Loading

0 comments on commit e4a26a2

Please sign in to comment.