Last active
March 3, 2024 09:30
-
-
Save bbkane/4a916594753aeace83c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just unzip SDL2 zip file into CMAKE_SOURCE_DIR | |
# This doesn't work with VS2015 | |
cmake_minimum_required(VERSION 3.1) | |
project(sdl2test) | |
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") | |
#find_package(SDL2 REQUIRED) | |
#message(status $ENV{SDL2DIR}) | |
find_path(SDL2_INCLUDE_DIR SDL.h PATHS "${CMAKE_SOURCE_DIR}/SDL2-2.0.3/include") | |
find_library(SDL2_LIBRARY NAMES SDL2 PATHS "${CMAKE_SOURCE_DIR}/SDL2-2.0.3/lib/x86/" NO_DEFAULT_PATH) | |
find_library(SDL2MAIN_LIBRARY NAMES SDL2main PATHS "${CMAKE_SOURCE_DIR}/SDL2-2.0.3/lib/x86/" NO_DEFAULT_PATH) | |
add_executable(sdl2test sdl2test.cpp) | |
include_directories("${SDL2_INCLUDE_DIR}") | |
target_link_libraries(sdl2test ${SDL2_LIBRARY} ${SDL2MAIN_LIBRARY}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just unzip SDL2 zip file into CMAKE_SOURCE_DIR | |
# This doesn't work with VS2015 | |
cmake_minimum_required(VERSION 3.1) | |
project(SDL2Test) | |
add_executable(sdl2test Source/sdl2test.cpp) | |
set(SDL2_HOME "${CMAKE_SOURCE_DIR}/Dynamic-Libraries/SDL2-2.0.3") | |
find_path(SDL2_INCLUDE_DIR SDL.h PATHS "${SDL2_HOME}/include") | |
find_library(SDL2_LIBRARY NAMES SDL2 PATHS "${SDL2_HOME}/lib/x86/" NO_DEFAULT_PATH) | |
find_library(SDL2MAIN_LIBRARY NAMES SDL2main PATHS "${SDL2_HOME}/lib/x86/" NO_DEFAULT_PATH) | |
include_directories("${SDL2_INCLUDE_DIR}") | |
target_link_libraries(sdl2test ${SDL2_LIBRARY} ${SDL2MAIN_LIBRARY}) | |
if(MSVC) | |
set_target_properties(sdl2test PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/Game") | |
set_target_properties(sdl2test PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/Game") | |
#See notes... | |
file(COPY "Assets" DESTINATION ${PROJECT_BINARY_DIR}) | |
file(COPY "Assets" DESTINATION ${CMAKE_SOURCE_DIR}/Game) | |
file(GLOB X86_DLL_FILES | |
${SDL2_HOME}/lib/x86/*.dll | |
${CMAKE_SOURCE_DIR}/Dynamic-Libraries/SDL2_image-2.0.0/lib/x86/*.dll) | |
#message(@@@@@@@@@@@@ ${X86_DLL_FILES}%%%%%%%%%) | |
file(COPY ${X86_DLL_FILES} DESTINATION ${CMAKE_SOURCE_DIR}/Game) | |
endif() | |
# TODO: Include other dynamic library files | |
# TODO: Include header libraries | |
# TODO: maybe copy config folder? | |
# TODO: ensure it works with my final project | |
# TOD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment