-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (48 loc) · 2.67 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
cmake_minimum_required(VERSION 3.0.0)
project(nimuh VERSION 1.0.6)
configure_file( config.h.in ${PROJECT_SOURCE_DIR}/src/config.h )
find_package(EXPAT REQUIRED)
find_package(SDL_mixer REQUIRED)
find_package(SDL REQUIRED)
find_package(SDL_image REQUIRED)
include_directories(src)
include_directories(${SDL_INCLUDE_DIR})
file(GLOB SOURCES "src/*.cpp")
IF (MINGW)
message(STATUS "Compiling for MINGW")
set(DIST "${PROJECT_SOURCE_DIR}/dist/nimuh-${nimuh_VERSION}/")
set(DATA_DIR "./data/")
add_executable(nimuh ${SOURCES} "data/nimuh.rc")
target_link_libraries(nimuh ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${EXPAT_LIBRARIES} ${SDL_MIXER_LIBRARIES} -lopengl32 -static -static-libgcc -static-libstdc++)
install(TARGETS nimuh DESTINATION ${DIST})
install(DIRECTORY data DESTINATION ${DIST})
install(FILES /mingw64/bin/SDL.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libSDL_mixer-1-2-0.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libjpeg-8.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libpng16-16.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libtiff-5.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/SDL_image.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libexpat-1.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libwebp-7.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libmad-0.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/zlib1.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/liblzma-5.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libogg-0.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libvorbis-0.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libvorbisenc-2.dll DESTINATION ${DIST})
install(FILES /mingw64/bin/libvorbisfile-3.dll DESTINATION ${DIST})
ELSE()
message(STATUS "Compiling for Linux")
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}/bin")
set(DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/nimuh/data")
set(APPLICATIONS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
find_package(OpenGL)
add_executable(nimuh ${SOURCES})
target_link_libraries(nimuh ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${OPENGL_LIBRARIES} ${EXPAT_LIBRARIES} ${SDL_MIXER_LIBRARIES})
install(TARGETS nimuh DESTINATION ${exec_prefix})
install(DIRECTORY data DESTINATION ${DATA_DIR}/../)
install(FILES "nimuh.desktop" DESTINATION "${APPLICATIONS_DIR}")
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake)
ENDIF (MINGW)
configure_file( config.h.in ${PROJECT_SOURCE_DIR}/src/config.h )