Skip to content

Modernize the build system #1003

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

Open
wants to merge 6 commits into
base: pharo-10
Choose a base branch
from
Open
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
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ option(DEPENDENCIES_FORCE_BUILD "Force build libraries" OFF)
option(BUILD_WITH_GRAPHVIZ "Generate dependency graphs" ON)
option(VERSION_UPDATE_FROM_GIT "Extract version information from git tags. Default to true. Follow vX.Y.Z-suffix" TRUE)

option(INSTALL_C_SOURCE "Install the generated C source files to `pharo-vm'" OFF)

set(APPNAME "Pharo" CACHE STRING "VM Application name")
set(FLAVOUR "CoInterpreter" CACHE STRING "The kind of VM to generate. Possible values: StackVM, CoInterpreter")
Expand Down Expand Up @@ -105,6 +106,15 @@ endif()
#This needs to be at this point, after setting the toolchain configuration
project(PharoVM)

set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib" CACHE STRING "Install-time RPATH")

# Provide a default value for the installation prefix, while
# preserving any user-specified CMAKE_INSTALL_PREFIX.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE
"${CMAKE_CURRENT_BINARY_DIR}/build/dist")
endif()

include(cmake/versionExtraction.cmake)

set(BUILT_FROM "${PharoVM_VERSION_STRING_FULL} - Commit: ${PharoVM_VERSION_GIT_SHA} - Date: ${PharoVM_VERSION_GIT_COMMIT_DATE}")
Expand Down Expand Up @@ -407,7 +417,12 @@ message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS "Resource Compiler: ${CMAKE_RC_COMPILER}")

set(VM_FRONTEND_APPLICATION_TYPE)
include(cmake/${CMAKE_SYSTEM_NAME}.cmake)

if(UNIX AND NOT OSX AND NOT WIN)
include(cmake/Linux.cmake)
else() # WIN AND OSX
include(cmake/${CMAKE_SYSTEM_NAME}.cmake)
endif()

set(GENERATED_SOURCES ${VMSOURCEFILES})

Expand Down
2 changes: 0 additions & 2 deletions cmake/Darwin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ macro(add_third_party_dependencies_per_platform)
endmacro()

macro(configure_installables INSTALL_COMPONENT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/build/dist")

install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/libffi/install/lib/"
DESTINATION "${VM_EXECUTABLE_NAME}.app/Contents/MacOS/Plugins"
Expand Down
97 changes: 0 additions & 97 deletions cmake/FreeBSD.cmake

This file was deleted.

51 changes: 9 additions & 42 deletions cmake/Linux.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-rpath=.")
set(PHARO_BIN_LOCATION "default" CACHE STRING "The default location of the PHARO bin, used by the launch.sh.in")

if(${PHARO_BIN_LOCATION} STREQUAL "default")
set(PHARO_BIN_IN_ROOT "`/usr/bin/dirname \"\$0\"`/lib")
set(PHARO_BIN_IN_BIN "`/usr/bin/dirname \"\$0\"`/../lib")
else()
set(PHARO_BIN_IN_ROOT ${PHARO_BIN_LOCATION})
set(PHARO_BIN_IN_BIN ${PHARO_BIN_LOCATION})
endif()

function(add_platform_headers)
target_include_directories(${VM_LIBRARY_NAME}
PUBLIC
Expand Down Expand Up @@ -39,7 +28,6 @@ set(EXTRACTED_SOURCES
set(VM_FRONTEND_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/unixMain.c)


macro(add_third_party_dependencies_per_platform)
if(${FEATURE_LIB_GIT2})
include(cmake/importLibGit2.cmake)
Expand All @@ -58,42 +46,21 @@ macro(add_third_party_dependencies_per_platform)
endif()
endmacro()


macro(configure_installables INSTALL_COMPONENT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/build/dist")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packaging/linux/launch.sh.in
${CMAKE_CURRENT_BINARY_DIR}/build/packaging/linux/${VM_EXECUTABLE_NAME} @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packaging/linux/bin/launch.sh.in
${CMAKE_CURRENT_BINARY_DIR}/build/packaging/linux/bin/${VM_EXECUTABLE_NAME} @ONLY)


install(
DIRECTORY "${CMAKE_BINARY_DIR}/build/packaging/linux/"
DESTINATION "./"
USE_SOURCE_PERMISSIONS
COMPONENT ${INSTALL_COMPONENT})
TARGETS ${VM_EXECUTABLE_NAME}
COMPONENT ${INSTALL_COMPONENT})
install(
DIRECTORY "${CMAKE_BINARY_DIR}/build/vm/"
DESTINATION "lib"
USE_SOURCE_PERMISSIONS
COMPONENT ${INSTALL_COMPONENT})
install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/libffi/install/lib/"
DESTINATION "lib"
USE_SOURCE_PERMISSIONS
COMPONENT ${INSTALL_COMPONENT}
FILES_MATCHING PATTERN ${DYLIB_EXT})


install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/extracted/vm/include/unix/"
DESTINATION include/pharovm
COMPONENT include
FILES_MATCHING PATTERN *.h)
TARGETS ${VM_LIBRARY_NAME}
COMPONENT ${INSTALL_COMPONENT}
INCLUDES DESTINATION "include/pharovm")
install(
TARGETS ${VM_PLUGIN_TARGETS}
COMPONENT ${INSTALL_COMPONENT})
endmacro()

macro(add_required_libs_per_platform)
target_link_libraries(${VM_LIBRARY_NAME} dl)
target_link_libraries(${VM_LIBRARY_NAME} m)
target_link_libraries(${VM_LIBRARY_NAME} pthread)
endmacro()
endmacro()
97 changes: 0 additions & 97 deletions cmake/OpenBSD.cmake

This file was deleted.

2 changes: 0 additions & 2 deletions cmake/Windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ macro(add_third_party_dependencies_per_platform)
endmacro()

macro(configure_installables INSTALL_COMPONENT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/build/dist")

install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/vm/"
DESTINATION "./"
Expand Down
Loading