diff --git a/.gitmodules b/.gitmodules index 414132795..d38299a6d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "src/tests/cbehave"] path = src/tests/cbehave url = https://github.com/cxong/cbehave.git +[submodule "src/cdogs/hqx"] + path = src/cdogs/hqx + url = https://github.com/cxong/hqx.git diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e6935ffcf..108dece3f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -96,22 +96,16 @@ include_directories(.) set(CDOGS_DATA_DIR "") set(CDOGS_CFG_DIR ".cdogs/") -IF(MSVC) - SET(SOURCE_DIRECTORY "${CMAKE_BINARY_DIR}") - SET(OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/cdogs-sdl") -ELSE() - SET(SOURCE_DIRECTORY "..") - SET(OUTPUT_DIRECTORY "../cdogs-sdl") -ENDIF() -# TODO: fix workaround due to path difference +SET(SOURCE_DIRECTORY "..") +SET(OUTPUT_DIRECTORY "../cdogs-sdl") +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "..") IF(UNIX) - SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "..") CONFIGURE_FILE(${SOURCE_DIRECTORY}/build/linux/cdogs-sdl.cmake ${SOURCE_DIRECTORY}/build/linux/cdogs-sdl) ENDIF() IF(WIN32) CONFIGURE_FILE(${SOURCE_DIRECTORY}/build/windows/cdogs.rc.cmake ${SOURCE_DIRECTORY}/build/windows/cdogs.rc) ENDIF() -CONFIGURE_FILE(cdogs/sys_config.h.cmake ${SOURCE_DIRECTORY}/src/cdogs/sys_config.h) +CONFIGURE_FILE(${SOURCE_DIRECTORY}/src/cdogs/sys_config.h.cmake ${SOURCE_DIRECTORY}/src/cdogs/sys_config.h) CONFIGURE_FILE(${SOURCE_DIRECTORY}/README.md.cmake ${SOURCE_DIRECTORY}/README.md) add_subdirectory(cdogs) @@ -194,7 +188,7 @@ SET(CPACK_PACKAGE_EXECUTABLES "..\\\\cdogs-sdl;C-Dogs SDL") IF(MSVC) SET(CPACK_GENERATOR NSIS) SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) - SET(CPACK_RESOURCE_FILE_LICENSE ${SOURCE_DIRECTORY}/doc/COPYING.GPL) + SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_DIRECTORY}/doc/COPYING.GPL) set(CPACK_PACKAGE_INSTALL_DIRECTORY "C-Dogs SDL") SET(CPACK_NSIS_MUI_ICON ${SOURCE_DIRECTORY}/cdogs-icon.ico) SET(CPACK_CREATE_DESKTOP_LINKS cdogs-sdl) @@ -214,3 +208,10 @@ SET(CDOGS_SDL_EDITOR_HEADERS charsed.h) add_executable(cdogs-sdl-editor ${CDOGS_SDL_EDITOR_SOURCES} ${CDOGS_SDL_EDITOR_HEADERS} ${CDOGS_SDL_EXTRA}) target_link_libraries(cdogs-sdl-editor cdogs json hqx ${SDL_LIBRARY} ${SDLMIXER_LIBRARY} ${EXTRA_LIBRARIES}) + +if(MSVC) + add_custom_command( + TARGET cdogs-sdl + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${SOURCE_DIRECTORY}/src/cdogs/hqx/hqx.dll ${SOURCE_DIRECTORY}) +endif() \ No newline at end of file diff --git a/src/cdogs/CMakeLists.txt b/src/cdogs/CMakeLists.txt index cd8796940..dd06ef577 100644 --- a/src/cdogs/CMakeLists.txt +++ b/src/cdogs/CMakeLists.txt @@ -1,5 +1,5 @@ -add_subdirectory(hqx) -include_directories(.) +add_subdirectory(hqx/src) +include_directories(hqx/src) set(CDOGS_SOURCES actors.c diff --git a/src/cdogs/blit.c b/src/cdogs/blit.c index 225a665f2..26e6c5fdd 100644 --- a/src/cdogs/blit.c +++ b/src/cdogs/blit.c @@ -53,7 +53,7 @@ #include #include -#include +#include #include #include "config.h" diff --git a/src/cdogs/grafx.c b/src/cdogs/grafx.c index a42f014c6..67490bdd1 100644 --- a/src/cdogs/grafx.c +++ b/src/cdogs/grafx.c @@ -53,7 +53,7 @@ #include #include -#include +#include #include #include diff --git a/src/cdogs/hqx b/src/cdogs/hqx new file mode 160000 index 000000000..ce5b2492d --- /dev/null +++ b/src/cdogs/hqx @@ -0,0 +1 @@ +Subproject commit ce5b2492dddac944be61ec7a5f801979140f13e1 diff --git a/src/cdogs/sys_config.h b/src/cdogs/sys_config.h deleted file mode 100644 index cf3a12454..000000000 --- a/src/cdogs/sys_config.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - C-Dogs SDL - A port of the legendary (and fun) action/arcade cdogs. - - Copyright (c) 2013, Cong Xu - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ -#ifndef __SYS_CONFIG -#define __SYS_CONFIG - -#define CDOGS_SDL_VERSION "v0.4.5" - -/* where to look for the cdogs data files */ -#define CDOGS_DATA_DIR "" - -#define CDOGS_CFG_DIR ".cdogs/" - -#define CDOGS_MUSIC_DIR "music" -#define CDOGS_GAME_MUSIC_DIR CDOGS_MUSIC_DIR "/game" -#define CDOGS_MENU_MUSIC_DIR CDOGS_MUSIC_DIR "/menu" - -#define CDOGS_CAMPAIGN_DIR "missions" -#define CDOGS_DOGFIGHT_DIR "dogfights" - -#define CDOGS_FILENAME_MAX 256 -#define CDOGS_PATH_MAX 4096 - -#endif