<commit_before>cmake_minimum_required(VERSION 3.2)

find_program(NODE_EXECUTABLE
	NAMES node nodejs
)

list(APPEND CMAKE_MODULE_PATH
	cmake/Modules
	${CMAKE_CURRENT_LIST_DIR}/third_party/omr/cmake/modules/
)

project(base9
	LANGUAGES C CXX
	VERSION 0.1
)

include(OmrPlatform)

# Global Configuration

omr_platform_global_setup()

set(CMAKE_CXX_STANDARD 14)

set(CMAKE_EXPORT_COMPILE_COMMANDS true)

enable_testing()

# OMR Configuration

set(OMR_COMPILER   ON  CACHE INTERNAL "Enable the Compiler.")
set(OMR_JITBUILDER ON  CACHE INTERNAL "We use OMR's jitbuilder tool for the b9 JIT")
set(OMR_GC         ON CACHE INTERNAL "We don't use the GC in b9 (yet)")
set(OMR_FVTEST     OFF CACHE INTERNAL "Disable OMR's internal test suite, it's incompatible with b9")
set(OMR_WARNINGS_AS_ERRORS OFF CACHE INTERNAL "OMR doesn't compile cleanly on my laptop :p")

# Compile a b9-js *.src to C++
function(add_b9_src src)
	add_custom_command(
		OUTPUT
			"${src}.cpp"
		COMMAND
			${NODE_EXECUTABLE} "${CMAKE_SOURCE_DIR}/js_compiler/compile.js"
			"${CMAKE_CURRENT_SOURCE_DIR}/${src}.src"
			>"${src}.cpp"
		DEPENDS
			"${CMAKE_SOURCE_DIR}/js_compiler/compile.js"
			"${CMAKE_CURRENT_SOURCE_DIR}/${src}.src"
	)
endfunction(add_b9_src)

# Compile a b9-js *.src file to a module DLL
function(add_b9_module module)
	add_b9_src(${module})
	add_library(${module} SHARED "${module}.cpp")
	target_link_libraries("${module}" b9)
endfunction(add_b9_module)

# Add a b9 test program written in b9-js<commit_msg>Change .so and .dylib files to .b9mod<commit_after>cmake_minimum_required(VERSION 3.2)

find_program(NODE_EXECUTABLE
	NAMES node nodejs
)

list(APPEND CMAKE_MODULE_PATH
	cmake/Modules
	${CMAKE_CURRENT_LIST_DIR}/third_party/omr/cmake/modules/
)

project(base9
	LANGUAGES C CXX
	VERSION 0.1
)

include(OmrPlatform)

# Global Configuration

omr_platform_global_setup()

set(CMAKE_CXX_STANDARD 14)

set(CMAKE_EXPORT_COMPILE_COMMANDS true)

enable_testing()

# OMR Configuration

set(OMR_COMPILER   ON  CACHE INTERNAL "Enable the Compiler.")
set(OMR_JITBUILDER ON  CACHE INTERNAL "We use OMR's jitbuilder tool for the b9 JIT")
set(OMR_GC         ON CACHE INTERNAL "We don't use the GC in b9 (yet)")
set(OMR_FVTEST     OFF CACHE INTERNAL "Disable OMR's internal test suite, it's incompatible with b9")
set(OMR_WARNINGS_AS_ERRORS OFF CACHE INTERNAL "OMR doesn't compile cleanly on my laptop :p")

# Compile a b9-js *.src to C++
function(add_b9_src src)
	add_custom_command(
		OUTPUT
			"${src}.cpp"
		COMMAND
			${NODE_EXECUTABLE} "${CMAKE_SOURCE_DIR}/js_compiler/compile.js"
			"${CMAKE_CURRENT_SOURCE_DIR}/${src}.src"
			>"${src}.cpp"
		DEPENDS
			"${CMAKE_SOURCE_DIR}/js_compiler/compile.js"
			"${CMAKE_CURRENT_SOURCE_DIR}/${src}.src"
	)
endfunction(add_b9_src)

# Compile a b9-js *.src file to a module DLL
function(add_b9_module module)
	add_b9_src(${module})
	add_library(${module} SHARED "${module}.cpp")
	set_target_properties(${module}
    		PROPERTIES
      		PREFIX ""
      		DEBUG_POSTFIX ""
      		SUFFIX ".b9mod"
  	)
  	target_link_libraries("${module}" b9)
endfunction(add_b9_module)

# Add a b9 test program written in b9-js
{'fraction_non_alphanumeric': 0.10780550223928342, 'fraction_numerical': 0.013435700575815739, 'mean_word_length': 5.083657587548638, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1401816', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1207, 'n_words': 271}