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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
- added lines and code coloration in the error context
- added documentation about the compiler implementation
- added documentation about the virtual machine
- ArkScript now supports LTO if the compiler can do it
- this is disabled in GCC 8 as [this causes a runtime crash](https://github.com/ArkScript-lang/Ark/pull/385#issuecomment-1163597951) due to an ABI breakage

### Changed
- fixed underline bug in the error context
Expand Down
23 changes: 22 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.9)

project(ark CXX)

Expand All @@ -7,6 +7,21 @@ set(ARK_VERSION_MAJOR 3)
set(ARK_VERSION_MINOR 2)
set(ARK_VERSION_PATCH 0)

include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported)

function(enable_ipo target_name)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND (CMAKE_CXX_COMPILER_VERSION MATCHES "^8\..+"))
message(WARNING "LTO/IPO supported but not enabled to prevent https://github.com/ArkScript-lang/Ark/pull/385#issuecomment-1163597951")
else()
message(STATUS "LTO/IPO enabled")
set_target_properties(
${target_name}
PROPERTIES
INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
endfunction()

# Uses GNU Install directory variables
include(GNUInstallDirs)

Expand Down Expand Up @@ -36,6 +51,8 @@ set_target_properties(
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF)

enable_ipo(ArkReactor)

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR APPLE)
target_compile_options(ArkReactor
PUBLIC
Expand Down Expand Up @@ -108,6 +125,7 @@ if (UNIX OR LINUX)
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
target_link_libraries(ArkReactor PUBLIC stdc++fs)
endif()

find_package(Threads)
target_link_libraries(ArkReactor PRIVATE ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
endif()
Expand Down Expand Up @@ -233,6 +251,9 @@ if (ARK_BUILD_EXE)
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF)

enable_ipo(ark)
enable_ipo(arkscript)

# Installs the arkscript executable.
install(TARGETS arkscript
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Expand Down