Image class is just array of palette indices converted from the rgb data of any image by using euclidian distance between palette rgb and pixel rgb. Works well.
69 lines
2.2 KiB
CMake
69 lines
2.2 KiB
CMake
cmake_minimum_required(VERSION 3.27)
|
|
project(Pycron)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
# Adding Raylib
|
|
include(FetchContent)
|
|
set(FETCHCONTENT_QUIET FALSE)
|
|
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
|
|
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games
|
|
|
|
#raylib
|
|
FetchContent_Declare(
|
|
raylib
|
|
GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
|
|
GIT_TAG "master"
|
|
GIT_PROGRESS TRUE
|
|
)
|
|
|
|
FetchContent_MakeAvailable(raylib)
|
|
|
|
#json
|
|
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
|
|
FetchContent_MakeAvailable(json)
|
|
|
|
# Adding our source files
|
|
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/sources/*.c") # Define PROJECT_SOURCES as a list of all source files
|
|
set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/sources/") # Define PROJECT_INCLUDE to be the path to the include directory of the project
|
|
|
|
|
|
add_executable(Pycron src/main.cpp
|
|
src/Pycron.cpp
|
|
src/Pycron.h
|
|
src/Utilities.cpp
|
|
src/Utilities.h
|
|
src/Graphics/Graphics.cpp
|
|
src/Graphics/Graphics.h
|
|
src/StateManager.cpp
|
|
src/StateManager.h
|
|
src/State.h
|
|
src/States/GameState.cpp
|
|
src/States/GameState.h
|
|
src/Graphics/Font.cpp
|
|
src/Graphics/Font.h
|
|
src/States/EditorState.cpp
|
|
src/States/EditorState.h
|
|
src/Graphics/PycronImage.h
|
|
src/Graphics/PycronImage.cpp)
|
|
|
|
add_subdirectory(dependencies/pocketpy)
|
|
# Declaring our executable
|
|
target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES})
|
|
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE})
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE raylib nlohmann_json::nlohmann_json pocketpy)
|
|
|
|
|
|
# Setting ASSETS_PATH
|
|
target_compile_definitions(${PROJECT_NAME} PUBLIC ASSETS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/assets/") # Set the asset path macro to the absolute path on the dev machine
|
|
|
|
if(EMSCRIPTEN)
|
|
# exceptions must be enabled for emscripten
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fexceptions")
|
|
endif()
|
|
|
|
file(COPY ${CMAKE_SOURCE_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR})
|
|
file(COPY ${CMAKE_SOURCE_DIR}/python DESTINATION ${CMAKE_BINARY_DIR})
|
|
|
|
|