2023-05-01 16:24:56 +00:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
2023-05-21 20:32:50 +00:00
|
|
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
2023-08-02 18:23:35 +00:00
|
|
|
|
|
|
|
# Workaround for windows to prevent static linking of pthread
|
|
|
|
IF (WIN32)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
|
|
|
|
ENDIF()
|
2023-08-02 18:23:35 +00:00
|
|
|
if (UNIX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DCONFIG_BIGNUM")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -DCONFIG_BIGNUM")
|
|
|
|
endif (UNIX)
|
2023-08-02 18:23:35 +00:00
|
|
|
|
2023-05-21 20:32:50 +00:00
|
|
|
project(rayjs)
|
2023-05-01 16:24:56 +00:00
|
|
|
|
2023-05-04 15:00:22 +00:00
|
|
|
message("=== Configure raylib ===")
|
|
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/raylib EXCLUDE_FROM_ALL)
|
2023-05-02 19:33:02 +00:00
|
|
|
|
|
|
|
message("=== Configure QuickJS ===")
|
2023-05-01 16:24:56 +00:00
|
|
|
# add quickjs
|
|
|
|
set(quickjs_version 2021-03-27)
|
|
|
|
set(quickjs_sources_root ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/quickjs)
|
|
|
|
set(quickjs_sources
|
2023-08-02 18:23:35 +00:00
|
|
|
${quickjs_sources_root}/cutils.c
|
|
|
|
${quickjs_sources_root}/cutils.h
|
|
|
|
${quickjs_sources_root}/libbf.c
|
|
|
|
${quickjs_sources_root}/libbf.h
|
2023-05-01 16:24:56 +00:00
|
|
|
${quickjs_sources_root}/libregexp.c
|
2023-08-02 18:23:35 +00:00
|
|
|
${quickjs_sources_root}/libregexp.h
|
|
|
|
${quickjs_sources_root}/libunicode.h
|
2023-05-01 16:24:56 +00:00
|
|
|
${quickjs_sources_root}/libunicode.c
|
2023-08-02 18:23:35 +00:00
|
|
|
${quickjs_sources_root}/quickjs.h
|
|
|
|
${quickjs_sources_root}/quickjs.c
|
2023-05-01 16:24:56 +00:00
|
|
|
)
|
|
|
|
add_library(quickjs STATIC
|
|
|
|
${quickjs_sources}
|
|
|
|
)
|
|
|
|
target_compile_definitions(quickjs
|
|
|
|
PRIVATE
|
|
|
|
CONFIG_VERSION="${quickjs_version}"
|
|
|
|
)
|
|
|
|
target_include_directories(quickjs
|
|
|
|
PRIVATE
|
|
|
|
${quickjs_sources_root}
|
|
|
|
)
|
|
|
|
|
2023-06-15 13:32:20 +00:00
|
|
|
add_library(lightmapper INTERFACE)
|
|
|
|
target_include_directories(lightmapper INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/lightmapper)
|
|
|
|
|
2023-05-01 16:24:56 +00:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
2023-05-04 15:00:22 +00:00
|
|
|
file(GLOB files src/*.c)
|
2023-05-21 20:32:50 +00:00
|
|
|
#add_executable(${CMAKE_PROJECT_NAME} MACOSX_BUNDLE ${files})
|
2023-05-02 19:33:02 +00:00
|
|
|
add_executable(${CMAKE_PROJECT_NAME} ${files})
|
|
|
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE include)
|
|
|
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE src)
|
2023-06-02 06:03:36 +00:00
|
|
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE thirdparty/raygui/src)
|
2023-06-19 21:24:30 +00:00
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} quickjs raylib lightmapper)
|