From eaa5e39d906034b287a054b7587d5e4d08c6c729 Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Sun, 24 Dec 2023 00:42:30 -0700 Subject: Got it working on windows --- CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2f665e..e85c450 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.11) project(KillaFacsista VERSION 1.0) +find_package(raylib 3.0 REQUIRED) + set(C_STANDARD 99) set(C_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -11,6 +13,11 @@ if (EMSCRIPTEN) set(CMAKE_EXECUTABLE_SUFFIX ".html") # This line is used to set your executable to build with the emscripten html template so taht you can directly open it. endif () +if (WIN32) + # Hide the cmd in windows. + set(CMAKE_C_FLAGS "-Wl,-subsystem,windows") +endif (WIN32) + # Add source files. file(GLOB SRC_FILES src/*.c src/entities/*.c src/levels/*.c src/screens/*.c) @@ -21,10 +28,14 @@ if (${PLATFORM} MATCHES "Web") set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "--preload-file assets.rres") endif() -set(RAYLIB raylib) +set(RAYLIB_LIB raylib) target_include_directories(${PROJECT_NAME} PUBLIC include src) -target_link_libraries(${PROJECT_NAME} ${RAYLIB} m glfw) +target_link_libraries(${PROJECT_NAME} ${RAYLIB_LIB} m) + +if (WIN32) + target_link_libraries(${PROJECT_NAME} opengl32 gdi32 winmm) +endif (WIN32) file(COPY assets/assets.rres DESTINATION ${CMAKE_BINARY_DIR}) -- cgit v1.2.3