diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cd7034f..0a41a087 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,7 +249,6 @@ set(SOURCES src/gui/control/panel.cpp src/gui/control/scrollbar.cpp src/gui/gui.cpp - src/main.cpp src/net/client.cpp src/net/connection.cpp src/net/command.cpp @@ -318,53 +317,30 @@ set(SOURCES src/script/util.cpp src/script/variable.cpp) -add_executable(reone ${HEADERS} ${SOURCES}) - -target_compile_definitions(reone PRIVATE BOOST_BIND_GLOBAL_PLACEHOLDERS) -target_include_directories(reone SYSTEM PRIVATE ${Boost_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS} ${MAD_INCLUDE_DIR}) -target_link_libraries(reone PRIVATE ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY} GLEW::GLEW ${OPENGL_LIBRARIES} ${MAD_LIBRARY}) +add_library(libreone STATIC ${HEADERS} ${SOURCES}) +target_compile_definitions(libreone PUBLIC BOOST_BIND_NO_PLACEHOLDERS) +target_include_directories(libreone SYSTEM PUBLIC ${Boost_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS} ${MAD_INCLUDE_DIR}) +target_link_libraries(libreone PUBLIC ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY} GLEW::GLEW ${OPENGL_LIBRARIES} ${MAD_LIBRARY}) if(WIN32) - target_link_libraries(reone PRIVATE SDL2::SDL2 OpenAL::OpenAL) + target_link_libraries(libreone PUBLIC SDL2::SDL2 OpenAL::OpenAL) else() - target_link_libraries(reone PRIVATE ${SDL2_LIBRARIES} ${OpenAL_LIBRARIES} Threads::Threads) + target_link_libraries(libreone PUBLIC ${SDL2_LIBRARIES} ${OpenAL_LIBRARIES} Threads::Threads) endif() if(USE_EXTERNAL_GLM) - target_include_directories(reone PRIVATE ${CMAKE_SOURCE_DIR}/external/glm) + target_include_directories(libreone PUBLIC ${CMAKE_SOURCE_DIR}/external/glm) endif() +add_executable(reone ${HEADERS} src/main.cpp) +target_link_libraries(reone PRIVATE libreone) + if(BUILD_TOOLS) set(TOOLS_HEADERS - src/core/debug.h - src/core/log.h - src/core/pathutil.h - src/core/types.h - src/resource/2dafile.h - src/resource/binfile.h - src/resource/collection/biffile.h - src/resource/collection/erffile.h - src/resource/collection/keyfile.h - src/resource/collection/rimfile.h - src/resource/gfffile.h - src/resource/tlkfile.h - src/resource/util.h tools/program.h tools/tools.h) set(TOOLS_SOURCES - src/core/debug.cpp - src/core/log.cpp - src/core/pathutil.cpp - src/resource/2dafile.cpp - src/resource/binfile.cpp - src/resource/collection/biffile.cpp - src/resource/collection/erffile.cpp - src/resource/collection/keyfile.cpp - src/resource/collection/rimfile.cpp - src/resource/gfffile.cpp - src/resource/tlkfile.cpp - src/resource/util.cpp tools/main.cpp tools/2datool.cpp tools/biftool.cpp @@ -376,14 +352,6 @@ if(BUILD_TOOLS) tools/tlktool.cpp tools/tools.cpp) - add_executable(reone-tools ${TOOLS_HEADERS} ${TOOLS_SOURCES}) - - target_compile_definitions(reone-tools PRIVATE BOOST_BIND_GLOBAL_PLACEHOLDERS) - target_include_directories(reone-tools SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) - target_include_directories(reone-tools PRIVATE ${CMAKE_SOURCE_DIR}) - target_link_libraries(reone-tools PRIVATE ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY}) - - if(USE_EXTERNAL_GLM) - target_include_directories(reone-tools PRIVATE ${CMAKE_SOURCE_DIR}/external/glm) - endif() + add_executable(reone-tools ${HEADERS} ${TOOLS_HEADERS} ${TOOLS_SOURCES}) + target_link_libraries(reone-tools PRIVATE libreone) endif() diff --git a/tools/2datool.cpp b/tools/2datool.cpp index 49fba82a..0c9e75d2 100644 --- a/tools/2datool.cpp +++ b/tools/2datool.cpp @@ -19,7 +19,7 @@ #include -#include "src/resource/2dafile.h" +#include "../src/resource/2dafile.h" using namespace std; diff --git a/tools/biftool.cpp b/tools/biftool.cpp index 2dec3afd..e748b169 100644 --- a/tools/biftool.cpp +++ b/tools/biftool.cpp @@ -20,9 +20,9 @@ #include #include -#include "src/core/log.h" -#include "src/resource/collection/biffile.h" -#include "src/resource/util.h" +#include "../src/core/log.h" +#include "../src/resource/collection/biffile.h" +#include "../src/resource/util.h" using namespace std; diff --git a/tools/erftool.cpp b/tools/erftool.cpp index 6733c0a8..eae0f62b 100644 --- a/tools/erftool.cpp +++ b/tools/erftool.cpp @@ -19,9 +19,9 @@ #include -#include "src/core/log.h" -#include "src/resource/collection/erffile.h" -#include "src/resource/util.h" +#include "../src/core/log.h" +#include "../src/resource/collection/erffile.h" +#include "../src/resource/util.h" using namespace std; diff --git a/tools/gfftool.cpp b/tools/gfftool.cpp index 9499ba6a..e6de42df 100644 --- a/tools/gfftool.cpp +++ b/tools/gfftool.cpp @@ -22,7 +22,7 @@ #include -#include "src/resource/gfffile.h" +#include "../src/resource/gfffile.h" using namespace std; diff --git a/tools/keytool.cpp b/tools/keytool.cpp index 20fe1d9f..38dc96da 100644 --- a/tools/keytool.cpp +++ b/tools/keytool.cpp @@ -19,7 +19,7 @@ #include -#include "src/core/log.h" +#include "../src/core/log.h" using namespace reone::resource; diff --git a/tools/main.cpp b/tools/main.cpp index f2131660..a52d8610 100644 --- a/tools/main.cpp +++ b/tools/main.cpp @@ -17,8 +17,9 @@ #include +#include "../src/core/log.h" + #include "program.h" -#include "src/core/log.h" using namespace std; diff --git a/tools/program.cpp b/tools/program.cpp index 910903cd..9e40588b 100644 --- a/tools/program.cpp +++ b/tools/program.cpp @@ -22,7 +22,7 @@ #include #include -#include "src/core/pathutil.h" +#include "../src/core/pathutil.h" using namespace std; diff --git a/tools/rimtool.cpp b/tools/rimtool.cpp index be382cef..809e6702 100644 --- a/tools/rimtool.cpp +++ b/tools/rimtool.cpp @@ -19,9 +19,9 @@ #include -#include "src/core/log.h" -#include "src/resource/collection/rimfile.h" -#include "src/resource/util.h" +#include "../src/core/log.h" +#include "../src/resource/collection/rimfile.h" +#include "../src/resource/util.h" using namespace std; diff --git a/tools/tools.h b/tools/tools.h index b3286104..d9b4195b 100644 --- a/tools/tools.h +++ b/tools/tools.h @@ -24,7 +24,7 @@ #include #include -#include "src/resource/collection/keyfile.h" +#include "../src/resource/collection/keyfile.h" namespace reone {